var oP=t=>{throw TypeError(t)};var JE=(t,e,n)=>e.has(t)||oP("Cannot "+n);var lt=(t,e,n)=>(JE(t,e,"read from private field"),n?n.call(t):e.get(t)),Bn=(t,e,n)=>e.has(t)?oP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),bn=(t,e,n,r)=>(JE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),br=(t,e,n)=>(JE(t,e,"access private method"),n);var h4=(t,e,n,r)=>({set _(i){bn(t,e,i,n)},get _(){return lt(t,e,r)}});function BQ(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 Oy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var eA={exports:{}},l_={};/**
 * @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 aP;function HQ(){if(aP)return l_;aP=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 l_.Fragment=e,l_.jsx=n,l_.jsxs=n,l_}var lP;function VQ(){return lP||(lP=1,eA.exports=HQ()),eA.exports}var d=VQ(),tA={exports:{}},Cr={};/**
 * @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 cP;function GQ(){if(cP)return Cr;cP=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"),f=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),m=Symbol.iterator;function x(z){return z===null||typeof z!="object"?null:(z=m&&z[m]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,S={};function M(z,Y,j){this.props=z,this.context=Y,this.refs=S,this.updater=j||b}M.prototype.isReactComponent={},M.prototype.setState=function(z,Y){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,Y,"setState")},M.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function C(){}C.prototype=M.prototype;function A(z,Y,j){this.props=z,this.context=Y,this.refs=S,this.updater=j||b}var N=A.prototype=new C;N.constructor=A,_(N,M.prototype),N.isPureReactComponent=!0;var P=Array.isArray;function k(){}var O={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function L(z,Y,j){var le=j.ref;return{$$typeof:t,type:z,key:Y,ref:le!==void 0?le:null,props:j}}function B(z,Y){return L(z.type,Y,z.props)}function V(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function W(z){var Y={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(j){return Y[j]})}var G=/\/+/g;function ee(z,Y){return typeof z=="object"&&z!==null&&z.key!=null?W(""+z.key):Y.toString(36)}function H(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(k,k):(z.status="pending",z.then(function(Y){z.status==="pending"&&(z.status="fulfilled",z.value=Y)},function(Y){z.status==="pending"&&(z.status="rejected",z.reason=Y)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function q(z,Y,j,le,ce){var X=typeof z;(X==="undefined"||X==="boolean")&&(z=null);var ie=!1;if(z===null)ie=!0;else switch(X){case"bigint":case"string":case"number":ie=!0;break;case"object":switch(z.$$typeof){case t:case e:ie=!0;break;case f:return ie=z._init,q(ie(z._payload),Y,j,le,ce)}}if(ie)return ce=ce(z),ie=le===""?"."+ee(z,0):le,P(ce)?(j="",ie!=null&&(j=ie.replace(G,"$&/")+"/"),q(ce,Y,j,"",function(ue){return ue})):ce!=null&&(V(ce)&&(ce=B(ce,j+(ce.key==null||z&&z.key===ce.key?"":(""+ce.key).replace(G,"$&/")+"/")+ie)),Y.push(ce)),1;ie=0;var fe=le===""?".":le+":";if(P(z))for(var Q=0;Q<z.length;Q++)le=z[Q],X=fe+ee(le,Q),ie+=q(le,Y,j,X,ce);else if(Q=x(z),typeof Q=="function")for(z=Q.call(z),Q=0;!(le=z.next()).done;)le=le.value,X=fe+ee(le,Q++),ie+=q(le,Y,j,X,ce);else if(X==="object"){if(typeof z.then=="function")return q(H(z),Y,j,le,ce);throw Y=String(z),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return ie}function J(z,Y,j){if(z==null)return z;var le=[],ce=0;return q(z,le,"","",function(X){return Y.call(j,X,ce++)}),le}function K(z){if(z._status===-1){var Y=z._result;Y=Y(),Y.then(function(j){(z._status===0||z._status===-1)&&(z._status=1,z._result=j)},function(j){(z._status===0||z._status===-1)&&(z._status=2,z._result=j)}),z._status===-1&&(z._status=0,z._result=Y)}if(z._status===1)return z._result.default;throw z._result}var ne=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},U={map:J,forEach:function(z,Y,j){J(z,function(){Y.apply(this,arguments)},j)},count:function(z){var Y=0;return J(z,function(){Y++}),Y},toArray:function(z){return J(z,function(Y){return Y})||[]},only:function(z){if(!V(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Cr.Activity=p,Cr.Children=U,Cr.Component=M,Cr.Fragment=n,Cr.Profiler=i,Cr.PureComponent=A,Cr.StrictMode=r,Cr.Suspense=l,Cr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Cr.__COMPILER_RUNTIME={__proto__:null,c:function(z){return O.H.useMemoCache(z)}},Cr.cache=function(z){return function(){return z.apply(null,arguments)}},Cr.cacheSignal=function(){return null},Cr.cloneElement=function(z,Y,j){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var le=_({},z.props),ce=z.key;if(Y!=null)for(X in Y.key!==void 0&&(ce=""+Y.key),Y)!R.call(Y,X)||X==="key"||X==="__self"||X==="__source"||X==="ref"&&Y.ref===void 0||(le[X]=Y[X]);var X=arguments.length-2;if(X===1)le.children=j;else if(1<X){for(var ie=Array(X),fe=0;fe<X;fe++)ie[fe]=arguments[fe+2];le.children=ie}return L(z.type,ce,le)},Cr.createContext=function(z){return z={$$typeof:o,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:s,_context:z},z},Cr.createElement=function(z,Y,j){var le,ce={},X=null;if(Y!=null)for(le in Y.key!==void 0&&(X=""+Y.key),Y)R.call(Y,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(ce[le]=Y[le]);var ie=arguments.length-2;if(ie===1)ce.children=j;else if(1<ie){for(var fe=Array(ie),Q=0;Q<ie;Q++)fe[Q]=arguments[Q+2];ce.children=fe}if(z&&z.defaultProps)for(le in ie=z.defaultProps,ie)ce[le]===void 0&&(ce[le]=ie[le]);return L(z,X,ce)},Cr.createRef=function(){return{current:null}},Cr.forwardRef=function(z){return{$$typeof:a,render:z}},Cr.isValidElement=V,Cr.lazy=function(z){return{$$typeof:f,_payload:{_status:-1,_result:z},_init:K}},Cr.memo=function(z,Y){return{$$typeof:c,type:z,compare:Y===void 0?null:Y}},Cr.startTransition=function(z){var Y=O.T,j={};O.T=j;try{var le=z(),ce=O.S;ce!==null&&ce(j,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(k,ne)}catch(X){ne(X)}finally{Y!==null&&j.types!==null&&(Y.types=j.types),O.T=Y}},Cr.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Cr.use=function(z){return O.H.use(z)},Cr.useActionState=function(z,Y,j){return O.H.useActionState(z,Y,j)},Cr.useCallback=function(z,Y){return O.H.useCallback(z,Y)},Cr.useContext=function(z){return O.H.useContext(z)},Cr.useDebugValue=function(){},Cr.useDeferredValue=function(z,Y){return O.H.useDeferredValue(z,Y)},Cr.useEffect=function(z,Y){return O.H.useEffect(z,Y)},Cr.useEffectEvent=function(z){return O.H.useEffectEvent(z)},Cr.useId=function(){return O.H.useId()},Cr.useImperativeHandle=function(z,Y,j){return O.H.useImperativeHandle(z,Y,j)},Cr.useInsertionEffect=function(z,Y){return O.H.useInsertionEffect(z,Y)},Cr.useLayoutEffect=function(z,Y){return O.H.useLayoutEffect(z,Y)},Cr.useMemo=function(z,Y){return O.H.useMemo(z,Y)},Cr.useOptimistic=function(z,Y){return O.H.useOptimistic(z,Y)},Cr.useReducer=function(z,Y,j){return O.H.useReducer(z,Y,j)},Cr.useRef=function(z){return O.H.useRef(z)},Cr.useState=function(z){return O.H.useState(z)},Cr.useSyncExternalStore=function(z,Y,j){return O.H.useSyncExternalStore(z,Y,j)},Cr.useTransition=function(){return O.H.useTransition()},Cr.version="19.2.1",Cr}var uP;function mw(){return uP||(uP=1,tA.exports=GQ()),tA.exports}var w=mw();const ni=Oy(w),uU=BQ({__proto__:null,default:ni},[w]);var nA={exports:{}},c_={},rA={exports:{}},iA={};/**
 * @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 dP;function WQ(){return dP||(dP=1,(function(t){function e(q,J){var K=q.length;q.push(J);e:for(;0<K;){var ne=K-1>>>1,U=q[ne];if(0<i(U,J))q[ne]=J,q[K]=U,K=ne;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var J=q[0],K=q.pop();if(K!==J){q[0]=K;e:for(var ne=0,U=q.length,z=U>>>1;ne<z;){var Y=2*(ne+1)-1,j=q[Y],le=Y+1,ce=q[le];if(0>i(j,K))le<U&&0>i(ce,j)?(q[ne]=ce,q[le]=K,ne=le):(q[ne]=j,q[Y]=K,ne=Y);else if(le<U&&0>i(ce,K))q[ne]=ce,q[le]=K,ne=le;else break e}}return J}function i(q,J){var K=q.sortIndex-J.sortIndex;return K!==0?K:q.id-J.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=[],f=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(q){for(var J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=q)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(q){if(_=!1,N(q),!b)if(n(l)!==null)b=!0,k||(k=!0,W());else{var J=n(c);J!==null&&H(P,J.startTime-q)}}var k=!1,O=-1,R=5,L=-1;function B(){return S?!0:!(t.unstable_now()-L<R)}function V(){if(S=!1,k){var q=t.unstable_now();L=q;var J=!0;try{e:{b=!1,_&&(_=!1,C(O),O=-1),x=!0;var K=m;try{t:{for(N(q),p=n(l);p!==null&&!(p.expirationTime>q&&B());){var ne=p.callback;if(typeof ne=="function"){p.callback=null,m=p.priorityLevel;var U=ne(p.expirationTime<=q);if(q=t.unstable_now(),typeof U=="function"){p.callback=U,N(q),J=!0;break t}p===n(l)&&r(l),N(q)}else r(l);p=n(l)}if(p!==null)J=!0;else{var z=n(c);z!==null&&H(P,z.startTime-q),J=!1}}break e}finally{p=null,m=K,x=!1}J=void 0}}finally{J?W():k=!1}}}var W;if(typeof A=="function")W=function(){A(V)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,ee=G.port2;G.port1.onmessage=V,W=function(){ee.postMessage(null)}}else W=function(){M(V,0)};function H(q,J){O=M(function(){q(t.unstable_now())},J)}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(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(q){switch(m){case 1:case 2:case 3:var J=3;break;default:J=m}var K=m;m=J;try{return q()}finally{m=K}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(q,J){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=m;m=q;try{return J()}finally{m=K}},t.unstable_scheduleCallback=function(q,J,K){var ne=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?ne+K:ne):K=ne,q){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,q={id:f++,callback:J,priorityLevel:q,startTime:K,expirationTime:U,sortIndex:-1},K>ne?(q.sortIndex=K,e(c,q),n(l)===null&&q===n(c)&&(_?(C(O),O=-1):_=!0,H(P,K-ne))):(q.sortIndex=U,e(l,q),b||x||(b=!0,k||(k=!0,W()))),q},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(q){var J=m;return function(){var K=m;m=J;try{return q.apply(this,arguments)}finally{m=K}}}})(iA)),iA}var fP;function dU(){return fP||(fP=1,rA.exports=WQ()),rA.exports}var sA={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 hP;function $Q(){if(hP)return dl;hP=1;var t=mw();function e(l){var c="https://react.dev/errors/"+l;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)c+="&args[]="+encodeURIComponent(arguments[f])}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,f){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:f}}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 f=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,f)},dl.flushSync=function(l){var c=o.T,f=r.p;try{if(o.T=null,r.p=2,l)return l()}finally{o.T=c,r.p=f,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 f=c.as,p=a(f,c.crossOrigin),m=typeof c.integrity=="string"?c.integrity:void 0,x=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;f==="style"?r.d.S(l,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:p,integrity:m,fetchPriority:x}):f==="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 f=a(c.as,c.crossOrigin);r.d.M(l,{crossOrigin:f,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 f=c.as,p=a(f,c.crossOrigin);r.d.L(l,f,{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 f=a(c.as,c.crossOrigin);r.d.m(l,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:f,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,f){return o.H.useFormState(l,c,f)},dl.useFormStatus=function(){return o.H.useHostTransitionStatus()},dl.version="19.2.1",dl}var pP;function fU(){if(pP)return sA.exports;pP=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(),sA.exports=$Q(),sA.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 mP;function qQ(){if(mP)return c_;mP=1;var t=dU(),e=mw(),n=fU();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 F=I.alternate;if(F===null){if(T=I.return,T!==null){y=T;continue}break}if(I.child===F.child){for(F=I.child;F;){if(F===y)return l(I),u;if(F===T)return l(I),h;F=F.sibling}throw Error(r(188))}if(y.return!==T.return)y=I,T=F;else{for(var me=!1,je=I.child;je;){if(je===y){me=!0,y=I,T=F;break}if(je===T){me=!0,T=I,y=F;break}je=je.sibling}if(!me){for(je=F.child;je;){if(je===y){me=!0,y=F,T=I;break}if(je===T){me=!0,T=F,y=I;break}je=je.sibling}if(!me)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 f(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u;for(u=u.child;u!==null;){if(h=f(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"),P=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function W(u){return u===null||typeof u!="object"?null:(u=V&&u[V]||u["@@iterator"],typeof u=="function"?u:null)}var G=Symbol.for("react.client.reference");function ee(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===G?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 P:return"Suspense";case k:return"SuspenseList";case L:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case b:return"Portal";case A:return u.displayName||"Context";case C:return(u._context.displayName||"Context")+".Consumer";case N:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case O:return h=u.displayName||null,h!==null?h:ee(u.type)||"Memo";case R:h=u._payload,u=u._init;try{return ee(u(h))}catch{}}return null}var H=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},ne=[],U=-1;function z(u){return{current:u}}function Y(u){0>U||(u.current=ne[U],ne[U]=null,U--)}function j(u,h){U++,ne[U]=u.current,u.current=h}var le=z(null),ce=z(null),X=z(null),ie=z(null);function fe(u,h){switch(j(X,h),j(ce,u),j(le,null),h.nodeType){case 9:case 11:u=(u=h.documentElement)&&(u=u.namespaceURI)?N9(u):0;break;default:if(u=h.tagName,h=h.namespaceURI)h=N9(h),u=k9(h,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}Y(le),j(le,u)}function Q(){Y(le),Y(ce),Y(X)}function ue(u){u.memoizedState!==null&&j(ie,u);var h=le.current,y=k9(h,u.type);h!==y&&(j(ce,u),j(le,y))}function he(u){ce.current===u&&(Y(le),Y(ce)),ie.current===u&&(Y(ie),i_._currentValue=K)}var se,Ce;function de(u){if(se===void 0)try{throw Error()}catch(y){var h=y.stack.trim().match(/\n( *(at )?)/);se=h&&h[1]||"",Ce=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+se+u+Ce}var Me=!1;function Te(u,h){if(!u||Me)return"";Me=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var T={DetermineComponentFrameRoot:function(){try{if(h){var Zt=function(){throw Error()};if(Object.defineProperty(Zt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Zt,[])}catch(zt){var kt=zt}Reflect.construct(u,[],Zt)}else{try{Zt.call()}catch(zt){kt=zt}u.call(Zt.prototype)}}else{try{throw Error()}catch(zt){kt=zt}(Zt=u())&&typeof Zt.catch=="function"&&Zt.catch(function(){})}}catch(zt){if(zt&&kt&&typeof zt.stack=="string")return[zt.stack,kt.stack]}return[null,null]}};T.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var I=Object.getOwnPropertyDescriptor(T.DetermineComponentFrameRoot,"name");I&&I.configurable&&Object.defineProperty(T.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var F=T.DetermineComponentFrameRoot(),me=F[0],je=F[1];if(me&&je){var at=me.split(`
`),Et=je.split(`
`);for(I=T=0;T<at.length&&!at[T].includes("DetermineComponentFrameRoot");)T++;for(;I<Et.length&&!Et[I].includes("DetermineComponentFrameRoot");)I++;if(T===at.length||I===Et.length)for(T=at.length-1,I=Et.length-1;1<=T&&0<=I&&at[T]!==Et[I];)I--;for(;1<=T&&0<=I;T--,I--)if(at[T]!==Et[I]){if(T!==1||I!==1)do if(T--,I--,0>I||at[T]!==Et[I]){var Wt=`
`+at[T].replace(" at new "," at ");return u.displayName&&Wt.includes("<anonymous>")&&(Wt=Wt.replace("<anonymous>",u.displayName)),Wt}while(1<=T&&0<=I);break}}}finally{Me=!1,Error.prepareStackTrace=y}return(y=u?u.displayName||u.name:"")?de(y):""}function Pe(u,h){switch(u.tag){case 26:case 27:case 5:return de(u.type);case 16:return de("Lazy");case 13:return u.child!==h&&h!==null?de("Suspense Fallback"):de("Suspense");case 19:return de("SuspenseList");case 0:case 15:return Te(u.type,!1);case 11:return Te(u.type.render,!1);case 1:return Te(u.type,!0);case 31:return de("Activity");default:return""}}function oe(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 Ve=Object.prototype.hasOwnProperty,He=t.unstable_scheduleCallback,ze=t.unstable_cancelCallback,Ge=t.unstable_shouldYield,ae=t.unstable_requestPaint,Z=t.unstable_now,ge=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,_e=t.unstable_UserBlockingPriority,ve=t.unstable_NormalPriority,Ue=t.unstable_LowPriority,Se=t.unstable_IdlePriority,ke=t.log,qe=t.unstable_setDisableYieldValue,Je=null,nt=null;function tt(u){if(typeof ke=="function"&&qe(u),nt&&typeof nt.setStrictMode=="function")try{nt.setStrictMode(Je,u)}catch{}}var be=Math.clz32?Math.clz32:Ee,Le=Math.log,Ze=Math.LN2;function Ee(u){return u>>>=0,u===0?32:31-(Le(u)/Ze|0)|0}var Ye=256,it=262144,mt=4194304;function ft(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 Qe(u,h,y){var T=u.pendingLanes;if(T===0)return 0;var I=0,F=u.suspendedLanes,me=u.pingedLanes;u=u.warmLanes;var je=T&134217727;return je!==0?(T=je&~F,T!==0?I=ft(T):(me&=je,me!==0?I=ft(me):y||(y=je&~u,y!==0&&(I=ft(y))))):(je=T&~F,je!==0?I=ft(je):me!==0?I=ft(me):y||(y=T&~u,y!==0&&(I=ft(y)))),I===0?0:h!==0&&h!==I&&(h&F)===0&&(F=I&-I,y=h&-h,F>=y||F===32&&(y&4194048)!==0)?h:I}function Ae(u,h){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&h)===0}function Xe(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 Re(){var u=mt;return mt<<=1,(mt&62914560)===0&&(mt=4194304),u}function Be(u){for(var h=[],y=0;31>y;y++)h.push(u);return h}function ot(u,h){u.pendingLanes|=h,h!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function dt(u,h,y,T,I,F){var me=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 je=u.entanglements,at=u.expirationTimes,Et=u.hiddenUpdates;for(y=me&~y;0<y;){var Wt=31-be(y),Zt=1<<Wt;je[Wt]=0,at[Wt]=-1;var kt=Et[Wt];if(kt!==null)for(Et[Wt]=null,Wt=0;Wt<kt.length;Wt++){var zt=kt[Wt];zt!==null&&(zt.lane&=-536870913)}y&=~Zt}T!==0&&Nt(u,T,0),F!==0&&I===0&&u.tag!==0&&(u.suspendedLanes|=F&~(me&~h))}function Nt(u,h,y){u.pendingLanes|=h,u.suspendedLanes&=~h;var T=31-be(h);u.entangledLanes|=h,u.entanglements[T]=u.entanglements[T]|1073741824|y&261930}function Dt(u,h){var y=u.entangledLanes|=h;for(u=u.entanglements;y;){var T=31-be(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 rn(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Ut(){var u=J.p;return u!==0?u:(u=window.event,u===void 0?32:J9(u.type))}function Ft(u,h){var y=J.p;try{return J.p=u,h()}finally{J.p=y}}var Bt=Math.random().toString(36).slice(2),Kt="__reactFiber$"+Bt,dn="__reactProps$"+Bt,Rt="__reactContainer$"+Bt,Pt="__reactEvents$"+Bt,Lt="__reactListeners$"+Bt,ln="__reactHandles$"+Bt,It="__reactResources$"+Bt,Oe="__reactMarker$"+Bt;function gt(u){delete u[Kt],delete u[dn],delete u[Pt],delete u[Lt],delete u[ln]}function _t(u){var h=u[Kt];if(h)return h;for(var y=u.parentNode;y;){if(h=y[Rt]||y[Kt]){if(y=h.alternate,h.child!==null||y!==null&&y.child!==null)for(u=j9(u);u!==null;){if(y=u[Kt])return y;u=j9(u)}return h}u=y,y=u.parentNode}return null}function Vt(u){if(u=u[Kt]||u[Rt]){var h=u.tag;if(h===5||h===6||h===13||h===31||h===26||h===27||h===3)return u}return null}function vn(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u.stateNode;throw Error(r(33))}function ye(u){var h=u[It];return h||(h=u[It]={hoistableStyles:new Map,hoistableScripts:new Map}),h}function et(u){u[Oe]=!0}var xt=new Set,vt={};function ut(u,h){qt(u,h),qt(u+"Capture",h)}function qt(u,h){for(vt[u]=h,u=0;u<h.length;u++)xt.add(h[u])}var en=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]*$"),Qt={},Gt={};function hn(u){return Ve.call(Gt,u)?!0:Ve.call(Qt,u)?!1:en.test(u)?Gt[u]=!0:(Qt[u]=!0,!1)}function Sn(u,h,y){if(hn(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 Nn(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 nn(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 vr(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,F=T.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(me){y=""+me,F.call(this,me)}}),Object.defineProperty(u,h,{enumerable:T.enumerable}),{getValue:function(){return y},setValue:function(me){y=""+me},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Yn(u){if(!u._valueTracker){var h=vr(u)?"checked":"value";u._valueTracker=sr(u,h,""+u[h])}}function fr(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var y=h.getValue(),T="";return u&&(T=vr(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 ls=/[\n"\\]/g;function jn(u){return u.replace(ls,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function ys(u,h,y,T,I,F,me,je){u.name="",me!=null&&typeof me!="function"&&typeof me!="symbol"&&typeof me!="boolean"?u.type=me:u.removeAttribute("type"),h!=null?me==="number"?(h===0&&u.value===""||u.value!=h)&&(u.value=""+Gn(h)):u.value!==""+Gn(h)&&(u.value=""+Gn(h)):me!=="submit"&&me!=="reset"||u.removeAttribute("value"),h!=null?Li(u,me,Gn(h)):y!=null?Li(u,me,Gn(y)):T!=null&&u.removeAttribute("value"),I==null&&F!=null&&(u.defaultChecked=!!F),I!=null&&(u.checked=I&&typeof I!="function"&&typeof I!="symbol"),je!=null&&typeof je!="function"&&typeof je!="symbol"&&typeof je!="boolean"?u.name=""+Gn(je):u.removeAttribute("name")}function Ps(u,h,y,T,I,F,me,je){if(F!=null&&typeof F!="function"&&typeof F!="symbol"&&typeof F!="boolean"&&(u.type=F),h!=null||y!=null){if(!(F!=="submit"&&F!=="reset"||h!=null)){Yn(u);return}y=y!=null?""+Gn(y):"",h=h!=null?""+Gn(h):y,je||h===u.value||(u.value=h),u.defaultValue=h}T=T??I,T=typeof T!="function"&&typeof T!="symbol"&&!!T,u.checked=je?u.checked:!!T,u.defaultChecked=!!T,me!=null&&typeof me!="function"&&typeof me!="symbol"&&typeof me!="boolean"&&(u.name=me),Yn(u)}function Li(u,h,y){h==="number"&&un(u.ownerDocument)===u||u.defaultValue===""+y||(u.defaultValue=""+y)}function bs(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 Sr(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(H(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),Yn(u)}function Is(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 ta(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&&ta(u,I,T)}else for(var F in h)h.hasOwnProperty(F)&&ta(u,F,h[F])}function Ra(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 tc=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"]]),Tl=/^[\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 Tl.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function Os(){}var nc=null;function Qa(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Da=null,Pa=null;function Vc(u){var h=Vt(u);if(h&&(u=h.stateNode)){var y=u[dn]||null;e:switch(u=h.stateNode,h.type){case"input":if(ys(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="'+jn(""+h)+'"][type="radio"]'),h=0;h<y.length;h++){var T=y[h];if(T!==u&&T.form===u.form){var I=T[dn]||null;if(!I)throw Error(r(90));ys(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&&fr(T)}break e;case"textarea":Sr(u,y.value,y.defaultValue);break e;case"select":h=y.value,h!=null&&bs(u,!!y.multiple,h,!1)}}}var Gc=!1;function rc(u,h,y){if(Gc)return u(h,y);Gc=!0;try{var T=u(h);return T}finally{if(Gc=!1,(Da!==null||Pa!==null)&&(Qc(),Da&&(h=Da,u=Pa,Pa=Da=null,Vc(h),u)))for(h=0;h<u.length;h++)Vc(u[h])}}function na(u,h){var y=u.stateNode;if(y===null)return null;var T=y[dn]||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 ho=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jo=!1;if(ho)try{var Cl={};Object.defineProperty(Cl,"passive",{get:function(){jo=!0}}),window.addEventListener("test",Cl,Cl),window.removeEventListener("test",Cl,Cl)}catch{jo=!1}var _s=null,Ja=null,el=null;function Wc(){if(el)return el;var u,h=Ja,y=h.length,T,I="value"in _s?_s.value:_s.textContent,F=I.length;for(u=0;u<y&&h[u]===I[u];u++);var me=y-u;for(T=1;T<=me&&h[y-T]===I[F-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 ra(){return!1}function wr(u){function h(y,T,I,F,me){this._reactName=y,this._targetInst=I,this.type=T,this.nativeEvent=F,this.target=me,this.currentTarget=null;for(var je in u)u.hasOwnProperty(je)&&(y=u[je],this[je]=y?y(F):F[je]);return this.isDefaultPrevented=(F.defaultPrevented!=null?F.defaultPrevented:F.returnValue===!1)?Wr:ra,this.isPropagationStopped=ra,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 wi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zi=wr(wi),Kr=p({},wi,{view:0,detail:0}),Ia=wr(Kr),El,ic,To,gi=p({},Kr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jp,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!==To&&(To&&u.type==="mousemove"?(El=u.screenX-To.screenX,ic=u.screenY-To.screenY):ic=El=0,To=u),El)},movementY:function(u){return"movementY"in u?u.movementY:ic}}),Eh=wr(gi),yd=p({},gi,{dataTransfer:0}),bd=wr(yd),df=p({},Kr,{relatedTarget:0}),ba=wr(df),qi=p({},wi,{animationName:0,elapsedTime:0,pseudoElement:0}),Ys=wr(qi),Ss=p({},wi,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),Al=wr(Ss),Co=p({},wi,{data:0}),Lp=wr(Co),Ah={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},V0={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"},ff={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _d(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=ff[u])?!!h[u]:!1}function jp(){return _d}var zp=p({},Kr,{key:function(u){if(u.key){var h=Ah[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"?V0[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jp,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}}),Sd=wr(zp),sc=p({},gi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),oc=wr(sc),wd=p({},Kr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jp}),G0=wr(wd),Fp=p({},wi,{propertyName:0,elapsedTime:0,pseudoElement:0}),W0=wr(Fp),Ks=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}),$0=wr(Ks),q0=p({},wi,{newState:0,oldState:0}),X0=wr(q0),Y0=[9,13,27,32],Cu=ho&&"CompositionEvent"in window,Md=null;ho&&"documentMode"in document&&(Md=document.documentMode);var Up=ho&&"TextEvent"in window&&!Md,Bp=ho&&(!Cu||Md&&8<Md&&11>=Md),K0=" ",ac=!1;function Td(u,h){switch(u){case"keyup":return Y0.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ls(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Eu=!1;function ws(u,h){switch(u){case"compositionend":return Ls(h);case"keypress":return h.which!==32?null:(ac=!0,K0);case"textInput":return u=h.data,u===K0&&ac?null:u;default:return null}}function Hp(u,h){if(Eu)return u==="compositionend"||!Cu&&Td(u,h)?(u=Wc(),el=Ja=_s=null,Eu=!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 Bp&&h.locale!=="ko"?null:h.data;default:return null}}var Nh={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 Cd(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!Nh[u.type]:h==="textarea"}function Vp(u,h,y,T){Da?Pa?Pa.push(T):Pa=[T]:Da=T,h=Q3(h,"onChange"),0<h.length&&(y=new zi("onChange","change",null,y,T),u.push({event:y,listeners:h}))}var Au=null,$c=null;function xe(u){w9(u,0)}function De(u){var h=vn(u);if(fr(h))return u}function $e(u,h){if(u==="change")return h}var Ke=!1;if(ho){var ht;if(ho){var Tt="oninput"in document;if(!Tt){var Xt=document.createElement("div");Xt.setAttribute("oninput","return;"),Tt=typeof Xt.oninput=="function"}ht=Tt}else ht=!1;Ke=ht&&(!document.documentMode||9<document.documentMode)}function Jt(){Au&&(Au.detachEvent("onpropertychange",cn),$c=Au=null)}function cn(u){if(u.propertyName==="value"&&De($c)){var h=[];Vp(h,$c,u,Qa(u)),rc(xe,h)}}function Cn(u,h,y){u==="focusin"?(Jt(),Au=h,$c=y,Au.attachEvent("onpropertychange",cn)):u==="focusout"&&Jt()}function An(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return De($c)}function Pn(u,h){if(u==="click")return De(h)}function ar(u,h){if(u==="input"||u==="change")return De(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 xr(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(!Ve.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 Ln(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 Qn(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?Qn(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 js(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=ho&&"documentMode"in document&&11>=document.documentMode,ci=null,cs=null,zs=null,ia=!1;function zo(u,h,y){var T=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;ia||ci==null||ci!==un(T)||(T=ci,"selectionStart"in T&&js(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}),zs&&xr(zs,T)||(zs=T,T=Q3(cs,"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 Zs={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")},Fo={},Oa={};ho&&(Oa=document.createElement("div").style,"AnimationEvent"in window||(delete Zs.animationend.animation,delete Zs.animationiteration.animation,delete Zs.animationstart.animation),"TransitionEvent"in window||delete Zs.transitionend.transition);function po(u){if(Fo[u])return Fo[u];if(!Zs[u])return u;var h=Zs[u],y;for(y in h)if(h.hasOwnProperty(y)&&y in Oa)return Fo[u]=h[y];return u}var mo=po("animationend"),Eo=po("animationiteration"),qc=po("animationstart"),Uo=po("transitionrun"),$x=po("transitionstart"),t3=po("transitioncancel"),ob=po("transitionend"),lc=new Map,Z0="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(" ");Z0.push("scrollEnd");function cc(u,h){lc.set(u,h),ut(h,[u])}var Q0=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)},uc=[],Ed=0,Bo=0;function J0(){for(var u=Ed,h=Bo=Ed=0;h<u;){var y=uc[h];uc[h++]=null;var T=uc[h];uc[h++]=null;var I=uc[h];uc[h++]=null;var F=uc[h];if(uc[h++]=null,T!==null&&I!==null){var me=T.pending;me===null?I.next=I:(I.next=me.next,me.next=I),T.pending=I}F!==0&&hf(y,I,F)}}function Ho(u,h,y,T){uc[Ed++]=u,uc[Ed++]=h,uc[Ed++]=y,uc[Ed++]=T,Bo|=T,u.lanes|=T,u=u.alternate,u!==null&&(u.lanes|=T)}function qx(u,h,y,T){return Ho(u,h,y,T),dc(u)}function La(u,h){return Ho(u,null,null,h),dc(u)}function hf(u,h,y){u.lanes|=y;var T=u.alternate;T!==null&&(T.lanes|=y);for(var I=!1,F=u.return;F!==null;)F.childLanes|=y,T=F.alternate,T!==null&&(T.childLanes|=y),F.tag===22&&(u=F.stateNode,u===null||u._visibility&1||(I=!0)),u=F,F=F.return;return u.tag===3?(F=u.stateNode,I&&h!==null&&(I=31-be(y),u=F.hiddenUpdates,T=u[I],T===null?u[I]=[h]:T.push(h),h.lane=y|536870912),F):null}function dc(u){if(50<Df)throw Df=0,Xh=null,Error(r(185));for(var h=u.return;h!==null;)u=h,h=u.return;return u.tag===3?u.stateNode:null}var pf={};function ab(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 Ms(u,h,y,T){return new ab(u,h,y,T)}function Xx(u){return u=u.prototype,!(!u||!u.isReactComponent)}function tl(u,h){var y=u.alternate;return y===null?(y=Ms(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 Gp(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 Nu(u,h,y,T,I,F){var me=0;if(T=u,typeof u=="function")Xx(u)&&(me=1);else if(typeof u=="string")me=NQ(u,y,le.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case L:return u=Ms(31,y,h,I),u.elementType=L,u.lanes=F,u;case _:return mf(y.children,I,F,h);case S:me=8,I|=24;break;case M:return u=Ms(12,y,h,I|2),u.elementType=M,u.lanes=F,u;case P:return u=Ms(13,y,h,I),u.elementType=P,u.lanes=F,u;case k:return u=Ms(19,y,h,I),u.elementType=k,u.lanes=F,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case A:me=10;break e;case C:me=9;break e;case N:me=11;break e;case O:me=14;break e;case R:me=16,T=null;break e}me=29,y=Error(r(130,u===null?"null":typeof u,"")),T=null}return h=Ms(me,y,h,I),h.elementType=u,h.type=T,h.lanes=F,h}function mf(u,h,y,T){return u=Ms(7,u,T,h),u.lanes=y,u}function Yx(u,h,y){return u=Ms(6,u,null,h),u.lanes=y,u}function Wp(u){var h=Ms(18,null,null,0);return h.stateNode=u,h}function Kx(u,h,y){return h=Ms(4,u.children!==null?u.children:[],u.key,h),h.lanes=y,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}var eg=new WeakMap;function Nl(u,h){if(typeof u=="object"&&u!==null){var y=eg.get(u);return y!==void 0?y:(h={value:u,source:h,stack:oe(h)},eg.set(u,h),h)}return{value:u,source:h,stack:oe(h)}}var gf=[],xf=0,$p=null,qp=0,nl=[],us=0,Ad=null,Ts=1,Xc="";function ku(u,h){gf[xf++]=qp,gf[xf++]=$p,$p=u,qp=h}function n3(u,h,y){nl[us++]=Ts,nl[us++]=Xc,nl[us++]=Ad,Ad=u;var T=Ts;u=Xc;var I=32-be(T)-1;T&=~(1<<I),y+=1;var F=32-be(h)+I;if(30<F){var me=I-I%5;F=(T&(1<<me)-1).toString(32),T>>=me,I-=me,Ts=1<<32-be(h)+I|y<<I|T,Xc=F+u}else Ts=1<<F|y<<I|T,Xc=u}function Ru(u){u.return!==null&&(ku(u,1),n3(u,1,0))}function Zx(u){for(;u===$p;)$p=gf[--xf],gf[xf]=null,qp=gf[--xf],gf[xf]=null;for(;u===Ad;)Ad=nl[--us],nl[us]=null,Xc=nl[--us],nl[us]=null,Ts=nl[--us],nl[us]=null}function Qx(u,h){nl[us++]=Ts,nl[us++]=Xc,nl[us++]=Ad,Ts=h.id,Xc=h.overflow,Ad=u}var Fs=null,Xi=null,Zr=!1,Nd=null,kl=!1,Xp=Error(r(519));function Du(u){var h=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Pu(Nl(h,u)),Xp}function r3(u){var h=u.stateNode,y=u.type,T=u.memoizedProps;switch(h[Kt]=u,h[dn]=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<Mc.length;y++)ti(Mc[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),Ps(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||E9(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=Os),h=!0):h=!1,h||Du(u,!0)}function i3(u){for(Fs=u.return;Fs;)switch(Fs.tag){case 5:case 31:case 13:kl=!1;return;case 27:case 3:kl=!0;return;default:Fs=Fs.return}}function Yp(u){if(u!==Fs)return!1;if(!Zr)return i3(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")||zE(u.type,u.memoizedProps)),y=!y),y&&Xi&&Du(u),i3(u),h===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Xi=L9(u)}else if(h===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Xi=L9(u)}else h===27?(h=Xi,mm(u.type)?(u=VE,VE=null,Xi=u):Xi=h):Xi=Fs?qu(u.stateNode.nextSibling):null;return!0}function vf(){Xi=Fs=null,Zr=!1}function Jx(){var u=Nd;return u!==null&&(Bs===null?Bs=u:Bs.push.apply(Bs,u),Nd=null),u}function Pu(u){Nd===null?Nd=[u]:Nd.push(u)}var Kp=z(null),yf=null,Iu=null;function kd(u,h,y){j(Kp,h._currentValue),h._currentValue=y}function Ou(u){u._currentValue=Kp.current,Y(Kp)}function ev(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 tv(u,h,y,T){var I=u.child;for(I!==null&&(I.return=u);I!==null;){var F=I.dependencies;if(F!==null){var me=I.child;F=F.firstContext;e:for(;F!==null;){var je=F;F=I;for(var at=0;at<h.length;at++)if(je.context===h[at]){F.lanes|=y,je=F.alternate,je!==null&&(je.lanes|=y),ev(F.return,y,u),T||(me=null);break e}F=je.next}}else if(I.tag===18){if(me=I.return,me===null)throw Error(r(341));me.lanes|=y,F=me.alternate,F!==null&&(F.lanes|=y),ev(me,y,u),me=null}else me=I.child;if(me!==null)me.return=I;else for(me=I;me!==null;){if(me===u){me=null;break}if(I=me.sibling,I!==null){I.return=me.return,me=I;break}me=me.return}I=me}}function Lu(u,h,y,T){u=null;for(var I=h,F=!1;I!==null;){if(!F){if((I.flags&524288)!==0)F=!0;else if((I.flags&262144)!==0)break}if(I.tag===10){var me=I.alternate;if(me===null)throw Error(r(387));if(me=me.memoizedProps,me!==null){var je=I.type;lr(I.pendingProps.value,me.value)||(u!==null?u.push(je):u=[je])}}else if(I===ie.current){if(me=I.alternate,me===null)throw Error(r(387));me.memoizedState.memoizedState!==I.memoizedState.memoizedState&&(u!==null?u.push(i_):u=[i_])}I=I.return}u!==null&&tv(h,u,y,T),h.flags|=262144}function tg(u){for(u=u.firstContext;u!==null;){if(!lr(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function bf(u){yf=u,Iu=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function cr(u){return s3(yf,u)}function Zp(u,h){return yf===null&&bf(u),s3(u,h)}function s3(u,h){var y=h._currentValue;if(h={context:h,memoizedValue:y,next:null},Iu===null){if(u===null)throw Error(r(308));Iu=h,u.dependencies={lanes:0,firstContext:h},u.flags|=524288}else Iu=Iu.next=h;return y}var o3=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()})}},wE=t.unstable_scheduleCallback,ME=t.unstable_NormalPriority,go={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lb(){return{controller:new o3,data:new Map,refCount:0}}function kh(u){u.refCount--,u.refCount===0&&wE(ME,function(){u.controller.abort()})}var Rl=null,nv=0,Rd=0,fc=null;function cb(u,h){if(Rl===null){var y=Rl=[];nv=0,Rd=Ot(),fc={status:"pending",value:void 0,then:function(T){y.push(T)}}}return nv++,h.then(ub,ub),h}function ub(){if(--nv===0&&Rl!==null){fc!==null&&(fc.status="fulfilled");var u=Rl;Rl=null,Rd=0,fc=null;for(var h=0;h<u.length;h++)(0,u[h])()}}function db(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 a3=q.S;q.S=function(u,h){Qb=Z(),typeof h=="object"&&h!==null&&typeof h.then=="function"&&cb(u,h),a3!==null&&a3(u,h)};var _f=z(null);function rv(){var u=_f.current;return u!==null?u:mr.pooledCache}function ng(u,h){h===null?j(_f,_f.current):j(_f,h.pool)}function fb(){var u=rv();return u===null?null:{parent:go._currentValue,pool:u}}var Rh=Error(r(460)),rg=Error(r(474)),Dr=Error(r(542)),iv={then:function(){}};function rl(u){return u=u.status,u==="fulfilled"||u==="rejected"}function sv(u,h,y){switch(y=u[y],y===void 0?u.push(h):y!==h&&(h.then(Os,Os),h=y),h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,Ih(u),u;default:if(typeof h.status=="string")h.then(Os,Os);else{if(u=mr,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,Ih(u),u}throw ju=h,Rh}}function Dh(u){try{var h=u._init;return h(u._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(ju=y,Rh):y}}var ju=null;function Ph(){if(ju===null)throw Error(r(459));var u=ju;return ju=null,u}function Ih(u){if(u===Rh||u===Dr)throw Error(r(483))}var Oh=null,Lh=0;function ig(u){var h=Lh;return Lh+=1,Oh===null&&(Oh=[]),sv(Oh,u,h)}function hc(u,h){h=h.props.ref,u.ref=h!==void 0?h:null}function Qp(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 ov(u){function h(wt,pt){if(u){var Ct=wt.deletions;Ct===null?(wt.deletions=[pt],wt.flags|=16):Ct.push(pt)}}function y(wt,pt){if(!u)return null;for(;pt!==null;)h(wt,pt),pt=pt.sibling;return null}function T(wt){for(var pt=new Map;wt!==null;)wt.key!==null?pt.set(wt.key,wt):pt.set(wt.index,wt),wt=wt.sibling;return pt}function I(wt,pt){return wt=tl(wt,pt),wt.index=0,wt.sibling=null,wt}function F(wt,pt,Ct){return wt.index=Ct,u?(Ct=wt.alternate,Ct!==null?(Ct=Ct.index,Ct<pt?(wt.flags|=67108866,pt):Ct):(wt.flags|=67108866,pt)):(wt.flags|=1048576,pt)}function me(wt){return u&&wt.alternate===null&&(wt.flags|=67108866),wt}function je(wt,pt,Ct,Yt){return pt===null||pt.tag!==6?(pt=Yx(Ct,wt.mode,Yt),pt.return=wt,pt):(pt=I(pt,Ct),pt.return=wt,pt)}function at(wt,pt,Ct,Yt){var Zn=Ct.type;return Zn===_?Wt(wt,pt,Ct.props.children,Yt,Ct.key):pt!==null&&(pt.elementType===Zn||typeof Zn=="object"&&Zn!==null&&Zn.$$typeof===R&&Dh(Zn)===pt.type)?(pt=I(pt,Ct.props),hc(pt,Ct),pt.return=wt,pt):(pt=Nu(Ct.type,Ct.key,Ct.props,null,wt.mode,Yt),hc(pt,Ct),pt.return=wt,pt)}function Et(wt,pt,Ct,Yt){return pt===null||pt.tag!==4||pt.stateNode.containerInfo!==Ct.containerInfo||pt.stateNode.implementation!==Ct.implementation?(pt=Kx(Ct,wt.mode,Yt),pt.return=wt,pt):(pt=I(pt,Ct.children||[]),pt.return=wt,pt)}function Wt(wt,pt,Ct,Yt,Zn){return pt===null||pt.tag!==7?(pt=mf(Ct,wt.mode,Yt,Zn),pt.return=wt,pt):(pt=I(pt,Ct),pt.return=wt,pt)}function Zt(wt,pt,Ct){if(typeof pt=="string"&&pt!==""||typeof pt=="number"||typeof pt=="bigint")return pt=Yx(""+pt,wt.mode,Ct),pt.return=wt,pt;if(typeof pt=="object"&&pt!==null){switch(pt.$$typeof){case x:return Ct=Nu(pt.type,pt.key,pt.props,null,wt.mode,Ct),hc(Ct,pt),Ct.return=wt,Ct;case b:return pt=Kx(pt,wt.mode,Ct),pt.return=wt,pt;case R:return pt=Dh(pt),Zt(wt,pt,Ct)}if(H(pt)||W(pt))return pt=mf(pt,wt.mode,Ct,null),pt.return=wt,pt;if(typeof pt.then=="function")return Zt(wt,ig(pt),Ct);if(pt.$$typeof===A)return Zt(wt,Zp(wt,pt),Ct);Qp(wt,pt)}return null}function kt(wt,pt,Ct,Yt){var Zn=pt!==null?pt.key:null;if(typeof Ct=="string"&&Ct!==""||typeof Ct=="number"||typeof Ct=="bigint")return Zn!==null?null:je(wt,pt,""+Ct,Yt);if(typeof Ct=="object"&&Ct!==null){switch(Ct.$$typeof){case x:return Ct.key===Zn?at(wt,pt,Ct,Yt):null;case b:return Ct.key===Zn?Et(wt,pt,Ct,Yt):null;case R:return Ct=Dh(Ct),kt(wt,pt,Ct,Yt)}if(H(Ct)||W(Ct))return Zn!==null?null:Wt(wt,pt,Ct,Yt,null);if(typeof Ct.then=="function")return kt(wt,pt,ig(Ct),Yt);if(Ct.$$typeof===A)return kt(wt,pt,Zp(wt,Ct),Yt);Qp(wt,Ct)}return null}function zt(wt,pt,Ct,Yt,Zn){if(typeof Yt=="string"&&Yt!==""||typeof Yt=="number"||typeof Yt=="bigint")return wt=wt.get(Ct)||null,je(pt,wt,""+Yt,Zn);if(typeof Yt=="object"&&Yt!==null){switch(Yt.$$typeof){case x:return wt=wt.get(Yt.key===null?Ct:Yt.key)||null,at(pt,wt,Yt,Zn);case b:return wt=wt.get(Yt.key===null?Ct:Yt.key)||null,Et(pt,wt,Yt,Zn);case R:return Yt=Dh(Yt),zt(wt,pt,Ct,Yt,Zn)}if(H(Yt)||W(Yt))return wt=wt.get(Ct)||null,Wt(pt,wt,Yt,Zn,null);if(typeof Yt.then=="function")return zt(wt,pt,Ct,ig(Yt),Zn);if(Yt.$$typeof===A)return zt(wt,pt,Ct,Zp(pt,Yt),Zn);Qp(pt,Yt)}return null}function zn(wt,pt,Ct,Yt){for(var Zn=null,Mi=null,Hn=pt,zr=pt=0,oi=null;Hn!==null&&zr<Ct.length;zr++){Hn.index>zr?(oi=Hn,Hn=null):oi=Hn.sibling;var Ti=kt(wt,Hn,Ct[zr],Yt);if(Ti===null){Hn===null&&(Hn=oi);break}u&&Hn&&Ti.alternate===null&&h(wt,Hn),pt=F(Ti,pt,zr),Mi===null?Zn=Ti:Mi.sibling=Ti,Mi=Ti,Hn=oi}if(zr===Ct.length)return y(wt,Hn),Zr&&ku(wt,zr),Zn;if(Hn===null){for(;zr<Ct.length;zr++)Hn=Zt(wt,Ct[zr],Yt),Hn!==null&&(pt=F(Hn,pt,zr),Mi===null?Zn=Hn:Mi.sibling=Hn,Mi=Hn);return Zr&&ku(wt,zr),Zn}for(Hn=T(Hn);zr<Ct.length;zr++)oi=zt(Hn,wt,zr,Ct[zr],Yt),oi!==null&&(u&&oi.alternate!==null&&Hn.delete(oi.key===null?zr:oi.key),pt=F(oi,pt,zr),Mi===null?Zn=oi:Mi.sibling=oi,Mi=oi);return u&&Hn.forEach(function(bm){return h(wt,bm)}),Zr&&ku(wt,zr),Zn}function or(wt,pt,Ct,Yt){if(Ct==null)throw Error(r(151));for(var Zn=null,Mi=null,Hn=pt,zr=pt=0,oi=null,Ti=Ct.next();Hn!==null&&!Ti.done;zr++,Ti=Ct.next()){Hn.index>zr?(oi=Hn,Hn=null):oi=Hn.sibling;var bm=kt(wt,Hn,Ti.value,Yt);if(bm===null){Hn===null&&(Hn=oi);break}u&&Hn&&bm.alternate===null&&h(wt,Hn),pt=F(bm,pt,zr),Mi===null?Zn=bm:Mi.sibling=bm,Mi=bm,Hn=oi}if(Ti.done)return y(wt,Hn),Zr&&ku(wt,zr),Zn;if(Hn===null){for(;!Ti.done;zr++,Ti=Ct.next())Ti=Zt(wt,Ti.value,Yt),Ti!==null&&(pt=F(Ti,pt,zr),Mi===null?Zn=Ti:Mi.sibling=Ti,Mi=Ti);return Zr&&ku(wt,zr),Zn}for(Hn=T(Hn);!Ti.done;zr++,Ti=Ct.next())Ti=zt(Hn,wt,zr,Ti.value,Yt),Ti!==null&&(u&&Ti.alternate!==null&&Hn.delete(Ti.key===null?zr:Ti.key),pt=F(Ti,pt,zr),Mi===null?Zn=Ti:Mi.sibling=Ti,Mi=Ti);return u&&Hn.forEach(function(UQ){return h(wt,UQ)}),Zr&&ku(wt,zr),Zn}function Zi(wt,pt,Ct,Yt){if(typeof Ct=="object"&&Ct!==null&&Ct.type===_&&Ct.key===null&&(Ct=Ct.props.children),typeof Ct=="object"&&Ct!==null){switch(Ct.$$typeof){case x:e:{for(var Zn=Ct.key;pt!==null;){if(pt.key===Zn){if(Zn=Ct.type,Zn===_){if(pt.tag===7){y(wt,pt.sibling),Yt=I(pt,Ct.props.children),Yt.return=wt,wt=Yt;break e}}else if(pt.elementType===Zn||typeof Zn=="object"&&Zn!==null&&Zn.$$typeof===R&&Dh(Zn)===pt.type){y(wt,pt.sibling),Yt=I(pt,Ct.props),hc(Yt,Ct),Yt.return=wt,wt=Yt;break e}y(wt,pt);break}else h(wt,pt);pt=pt.sibling}Ct.type===_?(Yt=mf(Ct.props.children,wt.mode,Yt,Ct.key),Yt.return=wt,wt=Yt):(Yt=Nu(Ct.type,Ct.key,Ct.props,null,wt.mode,Yt),hc(Yt,Ct),Yt.return=wt,wt=Yt)}return me(wt);case b:e:{for(Zn=Ct.key;pt!==null;){if(pt.key===Zn)if(pt.tag===4&&pt.stateNode.containerInfo===Ct.containerInfo&&pt.stateNode.implementation===Ct.implementation){y(wt,pt.sibling),Yt=I(pt,Ct.children||[]),Yt.return=wt,wt=Yt;break e}else{y(wt,pt);break}else h(wt,pt);pt=pt.sibling}Yt=Kx(Ct,wt.mode,Yt),Yt.return=wt,wt=Yt}return me(wt);case R:return Ct=Dh(Ct),Zi(wt,pt,Ct,Yt)}if(H(Ct))return zn(wt,pt,Ct,Yt);if(W(Ct)){if(Zn=W(Ct),typeof Zn!="function")throw Error(r(150));return Ct=Zn.call(Ct),or(wt,pt,Ct,Yt)}if(typeof Ct.then=="function")return Zi(wt,pt,ig(Ct),Yt);if(Ct.$$typeof===A)return Zi(wt,pt,Zp(wt,Ct),Yt);Qp(wt,Ct)}return typeof Ct=="string"&&Ct!==""||typeof Ct=="number"||typeof Ct=="bigint"?(Ct=""+Ct,pt!==null&&pt.tag===6?(y(wt,pt.sibling),Yt=I(pt,Ct),Yt.return=wt,wt=Yt):(y(wt,pt),Yt=Yx(Ct,wt.mode,Yt),Yt.return=wt,wt=Yt),me(wt)):y(wt,pt)}return function(wt,pt,Ct,Yt){try{Lh=0;var Zn=Zi(wt,pt,Ct,Yt);return Oh=null,Zn}catch(Hn){if(Hn===Rh||Hn===Dr)throw Hn;var Mi=Ms(29,Hn,null,wt.mode);return Mi.lanes=Yt,Mi.return=wt,Mi}finally{}}}var Dd=ov(!0),av=ov(!1),ja=!1;function sg(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hb(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 Sf(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=dc(u),hf(u,null,y),h}return Ho(u,T,h,y),dc(u)}function wf(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,Dt(u,y)}}function Kn(u,h){var y=u.updateQueue,T=u.alternate;if(T!==null&&(T=T.updateQueue,y===T)){var I=null,F=null;if(y=y.firstBaseUpdate,y!==null){do{var me={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};F===null?I=F=me:F=F.next=me,y=y.next}while(y!==null);F===null?I=F=h:F=F.next=h}else I=F=h;y={baseState:T.baseState,firstBaseUpdate:I,lastBaseUpdate:F,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 pb=!1;function og(){if(pb){var u=fc;if(u!==null)throw u}}function Jp(u,h,y,T){pb=!1;var I=u.updateQueue;ja=!1;var F=I.firstBaseUpdate,me=I.lastBaseUpdate,je=I.shared.pending;if(je!==null){I.shared.pending=null;var at=je,Et=at.next;at.next=null,me===null?F=Et:me.next=Et,me=at;var Wt=u.alternate;Wt!==null&&(Wt=Wt.updateQueue,je=Wt.lastBaseUpdate,je!==me&&(je===null?Wt.firstBaseUpdate=Et:je.next=Et,Wt.lastBaseUpdate=at))}if(F!==null){var Zt=I.baseState;me=0,Wt=Et=at=null,je=F;do{var kt=je.lane&-536870913,zt=kt!==je.lane;if(zt?(Nr&kt)===kt:(T&kt)===kt){kt!==0&&kt===Rd&&(pb=!0),Wt!==null&&(Wt=Wt.next={lane:0,tag:je.tag,payload:je.payload,callback:null,next:null});e:{var zn=u,or=je;kt=h;var Zi=y;switch(or.tag){case 1:if(zn=or.payload,typeof zn=="function"){Zt=zn.call(Zi,Zt,kt);break e}Zt=zn;break e;case 3:zn.flags=zn.flags&-65537|128;case 0:if(zn=or.payload,kt=typeof zn=="function"?zn.call(Zi,Zt,kt):zn,kt==null)break e;Zt=p({},Zt,kt);break e;case 2:ja=!0}}kt=je.callback,kt!==null&&(u.flags|=64,zt&&(u.flags|=8192),zt=I.callbacks,zt===null?I.callbacks=[kt]:zt.push(kt))}else zt={lane:kt,tag:je.tag,payload:je.payload,callback:je.callback,next:null},Wt===null?(Et=Wt=zt,at=Zt):Wt=Wt.next=zt,me|=kt;if(je=je.next,je===null){if(je=I.shared.pending,je===null)break;zt=je,je=zt.next,zt.next=null,I.lastBaseUpdate=zt,I.shared.pending=null}}while(!0);Wt===null&&(at=Zt),I.baseState=at,I.firstBaseUpdate=Et,I.lastBaseUpdate=Wt,F===null&&(I.shared.lanes=0),Gu|=me,u.lanes=me,u.memoizedState=Zt}}function em(u,h){if(typeof u!="function")throw Error(r(191,u));u.call(h)}function l3(u,h){var y=u.callbacks;if(y!==null)for(u.callbacks=null,u=0;u<y.length;u++)em(y[u],h)}var tm=z(null),lv=z(0);function c3(u,h){u=Ol,j(lv,u),j(tm,h),Ol=u|h.baseLanes}function mb(){j(lv,Ol),j(tm,tm.current)}function ag(){Ol=lv.current,Y(tm),Y(lv)}var il=z(null),za=null;function Id(u){var h=u.alternate;j(Qr,Qr.current&1),j(il,u),za===null&&(h===null||tm.current!==null||h.memoizedState!==null)&&(za=u)}function gb(u){j(Qr,Qr.current),j(il,u),za===null&&(za=u)}function u3(u){u.tag===22?(j(Qr,Qr.current),j(il,u),za===null&&(za=u)):sl()}function sl(){j(Qr,Qr.current),j(il,il.current)}function Qs(u){Y(il),za===u&&(za=null),Y(Qr)}var Qr=z(0);function Dl(u){for(var h=u;h!==null;){if(h.tag===13){var y=h.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||BE(y)||HE(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 ds=0,Mr=null,Fi=null,$r=null,pc=!1,nm=!1,jh=!1,cv=0,lg=0,rm=null,xb=0;function Cs(){throw Error(r(321))}function vb(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 uv(u,h,y,T,I,F){return ds=F,Mr=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,q.H=u===null||u.memoizedState===null?H3:zb,jh=!1,F=y(T,I),jh=!1,nm&&(F=zh(h,y,T,I)),d3(u),F}function d3(u){q.H=im;var h=Fi!==null&&Fi.next!==null;if(ds=0,$r=Fi=Mr=null,pc=!1,lg=0,rm=null,h)throw Error(r(300));u===null||xo||(u=u.dependencies,u!==null&&tg(u)&&(xo=!0))}function zh(u,h,y,T){Mr=u;var I=0;do{if(nm&&(rm=null),lg=0,nm=!1,25<=I)throw Error(r(301));if(I+=1,$r=Fi=null,u.updateQueue!=null){var F=u.updateQueue;F.lastEffect=null,F.events=null,F.stores=null,F.memoCache!=null&&(F.memoCache.index=0)}q.H=mc,F=h(y,T)}while(nm);return F}function Fh(){var u=q.H,h=u.useState()[0];return h=typeof h.then=="function"?cg(h):h,u=u.useState()[0],(Fi!==null?Fi.memoizedState:null)!==u&&(Mr.flags|=1024),h}function yb(){var u=cv!==0;return cv=0,u}function bb(u,h,y){h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~y}function _b(u){if(pc){for(u=u.memoizedState;u!==null;){var h=u.queue;h!==null&&(h.pending=null),u=u.next}pc=!1}ds=0,$r=Fi=Mr=null,nm=!1,lg=cv=0,rm=null}function Ao(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $r===null?Mr.memoizedState=$r=u:$r=$r.next=u,$r}function Js(){if(Fi===null){var u=Mr.alternate;u=u!==null?u.memoizedState:null}else u=Fi.next;var h=$r===null?Mr.memoizedState:$r.next;if(h!==null)$r=h,Fi=u;else{if(u===null)throw Mr.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?Mr.memoizedState=$r=u:$r=$r.next=u}return $r}function dv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function cg(u){var h=lg;return lg+=1,rm===null&&(rm=[]),u=sv(rm,u,h),h=Mr,($r===null?h.memoizedState:$r.next)===null&&(h=h.alternate,q.H=h===null||h.memoizedState===null?H3:zb),u}function Mf(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return cg(u);if(u.$$typeof===A)return cr(u)}throw Error(r(438,String(u)))}function Sb(u){var h=null,y=Mr.updateQueue;if(y!==null&&(h=y.memoCache),h==null){var T=Mr.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=dv(),Mr.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]=B;return h.index++,y}function Od(u,h){return typeof h=="function"?h(u):h}function fv(u){var h=Js();return wb(h,Fi,u)}function wb(u,h,y){var T=u.queue;if(T===null)throw Error(r(311));T.lastRenderedReducer=y;var I=u.baseQueue,F=T.pending;if(F!==null){if(I!==null){var me=I.next;I.next=F.next,F.next=me}h.baseQueue=I=F,T.pending=null}if(F=u.baseState,I===null)u.memoizedState=F;else{h=I.next;var je=me=null,at=null,Et=h,Wt=!1;do{var Zt=Et.lane&-536870913;if(Zt!==Et.lane?(Nr&Zt)===Zt:(ds&Zt)===Zt){var kt=Et.revertLane;if(kt===0)at!==null&&(at=at.next={lane:0,revertLane:0,gesture:null,action:Et.action,hasEagerState:Et.hasEagerState,eagerState:Et.eagerState,next:null}),Zt===Rd&&(Wt=!0);else if((ds&kt)===kt){Et=Et.next,kt===Rd&&(Wt=!0);continue}else Zt={lane:0,revertLane:Et.revertLane,gesture:null,action:Et.action,hasEagerState:Et.hasEagerState,eagerState:Et.eagerState,next:null},at===null?(je=at=Zt,me=F):at=at.next=Zt,Mr.lanes|=kt,Gu|=kt;Zt=Et.action,jh&&y(F,Zt),F=Et.hasEagerState?Et.eagerState:y(F,Zt)}else kt={lane:Zt,revertLane:Et.revertLane,gesture:Et.gesture,action:Et.action,hasEagerState:Et.hasEagerState,eagerState:Et.eagerState,next:null},at===null?(je=at=kt,me=F):at=at.next=kt,Mr.lanes|=Zt,Gu|=Zt;Et=Et.next}while(Et!==null&&Et!==h);if(at===null?me=F:at.next=je,!lr(F,u.memoizedState)&&(xo=!0,Wt&&(y=fc,y!==null)))throw y;u.memoizedState=F,u.baseState=me,u.baseQueue=at,T.lastRenderedState=F}return I===null&&(T.lanes=0),[u.memoizedState,T.dispatch]}function Mb(u){var h=Js(),y=h.queue;if(y===null)throw Error(r(311));y.lastRenderedReducer=u;var T=y.dispatch,I=y.pending,F=h.memoizedState;if(I!==null){y.pending=null;var me=I=I.next;do F=u(F,me.action),me=me.next;while(me!==I);lr(F,h.memoizedState)||(xo=!0),h.memoizedState=F,h.baseQueue===null&&(h.baseState=F),y.lastRenderedState=F}return[F,T]}function f3(u,h,y){var T=Mr,I=Js(),F=Zr;if(F){if(y===void 0)throw Error(r(407));y=y()}else y=h();var me=!lr((Fi||I).memoizedState,y);if(me&&(I.memoizedState=y,xo=!0),I=I.queue,Db(m3.bind(null,T,I,u),[u]),I.getSnapshot!==h||me||$r!==null&&$r.memoizedState.tag&1){if(T.flags|=2048,Tf(9,{destroy:void 0},p3.bind(null,T,I,y,h),null),mr===null)throw Error(r(349));F||(ds&127)!==0||h3(T,h,y)}return y}function h3(u,h,y){u.flags|=16384,u={getSnapshot:h,value:y},h=Mr.updateQueue,h===null?(h=dv(),Mr.updateQueue=h,h.stores=[u]):(y=h.stores,y===null?h.stores=[u]:y.push(u))}function p3(u,h,y,T){h.value=y,h.getSnapshot=T,g3(h)&&x3(u)}function m3(u,h,y){return y(function(){g3(h)&&x3(u)})}function g3(u){var h=u.getSnapshot;u=u.value;try{var y=h();return!lr(u,y)}catch{return!0}}function x3(u){var h=La(u,2);h!==null&&Ir(h,u,2)}function Tb(u){var h=Ao();if(typeof u=="function"){var y=u;if(u=y(),jh){tt(!0);try{y()}finally{tt(!1)}}}return h.memoizedState=h.baseState=u,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Od,lastRenderedState:u},h}function Cb(u,h,y,T){return u.baseState=y,wb(u,Fi,typeof T=="function"?T:Od)}function TE(u,h,y,T,I){if(gv(u))throw Error(r(485));if(u=h.action,u!==null){var F={payload:I,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(me){F.listeners.push(me)}};q.T!==null?y(!0):F.isTransition=!1,T(F),y=h.pending,y===null?(F.next=h.pending=F,v3(h,F)):(F.next=y.next,h.pending=y.next=F)}}function v3(u,h){var y=h.action,T=h.payload,I=u.state;if(h.isTransition){var F=q.T,me={};q.T=me;try{var je=y(I,T),at=q.S;at!==null&&at(me,je),y3(u,h,je)}catch(Et){Eb(u,h,Et)}finally{F!==null&&me.types!==null&&(F.types=me.types),q.T=F}}else try{F=y(I,T),y3(u,h,F)}catch(Et){Eb(u,h,Et)}}function y3(u,h,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(T){b3(u,h,T)},function(T){return Eb(u,h,T)}):b3(u,h,y)}function b3(u,h,y){h.status="fulfilled",h.value=y,_3(h),u.state=y,h=u.pending,h!==null&&(y=h.next,y===h?u.pending=null:(y=y.next,h.next=y,v3(u,y)))}function Eb(u,h,y){var T=u.pending;if(u.pending=null,T!==null){T=T.next;do h.status="rejected",h.reason=y,_3(h),h=h.next;while(h!==T)}u.action=null}function _3(u){u=u.listeners;for(var h=0;h<u.length;h++)(0,u[h])()}function Ab(u,h){return h}function Nb(u,h){if(Zr){var y=mr.formState;if(y!==null){e:{var T=Mr;if(Zr){if(Xi){t:{for(var I=Xi,F=kl;I.nodeType!==8;){if(!F){I=null;break t}if(I=qu(I.nextSibling),I===null){I=null;break t}}F=I.data,I=F==="F!"||F==="F"?I:null}if(I){Xi=qu(I.nextSibling),T=I.data==="F!";break e}}Du(T)}T=!1}T&&(h=y[0])}}return y=Ao(),y.memoizedState=y.baseState=h,T={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ab,lastRenderedState:h},y.queue=T,y=F3.bind(null,Mr,T),T.dispatch=y,T=Tb(!1),F=jb.bind(null,Mr,!1,T.queue),T=Ao(),I={state:h,dispatch:null,action:u,pending:null},T.queue=I,y=TE.bind(null,Mr,I,F,y),I.dispatch=y,T.memoizedState=u,[h,y,!1]}function S3(u){var h=Js();return kb(h,Fi,u)}function kb(u,h,y){if(h=wb(u,h,Ab)[0],u=fv(Od)[0],typeof h=="object"&&h!==null&&typeof h.then=="function")try{var T=cg(h)}catch(me){throw me===Rh?Dr:me}else T=h;h=Js();var I=h.queue,F=I.dispatch;return y!==h.memoizedState&&(Mr.flags|=2048,Tf(9,{destroy:void 0},w3.bind(null,I,y),null)),[T,F,u]}function w3(u,h){u.action=h}function Rb(u){var h=Js(),y=Fi;if(y!==null)return kb(h,y,u);Js(),h=h.memoizedState,y=Js();var T=y.queue.dispatch;return y.memoizedState=u,[h,T,!1]}function Tf(u,h,y,T){return u={tag:u,create:y,deps:T,inst:h,next:null},h=Mr.updateQueue,h===null&&(h=dv(),Mr.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 hv(){return Js().memoizedState}function pv(u,h,y,T){var I=Ao();Mr.flags|=u,I.memoizedState=Tf(1|h,{destroy:void 0},y,T===void 0?null:T)}function mv(u,h,y,T){var I=Js();T=T===void 0?null:T;var F=I.memoizedState.inst;Fi!==null&&T!==null&&vb(T,Fi.memoizedState.deps)?I.memoizedState=Tf(h,F,y,T):(Mr.flags|=u,I.memoizedState=Tf(1|h,F,y,T))}function M3(u,h){pv(8390656,8,u,h)}function Db(u,h){mv(2048,8,u,h)}function T3(u){Mr.flags|=4;var h=Mr.updateQueue;if(h===null)h=dv(),Mr.updateQueue=h,h.events=[u];else{var y=h.events;y===null?h.events=[u]:y.push(u)}}function C3(u){var h=Js().memoizedState;return T3({ref:h,nextImpl:u}),function(){if((Vn&2)!==0)throw Error(r(440));return h.impl.apply(void 0,arguments)}}function E3(u,h){return mv(4,2,u,h)}function A3(u,h){return mv(4,4,u,h)}function N3(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 k3(u,h,y){y=y!=null?y.concat([u]):null,mv(4,4,N3.bind(null,h,u),y)}function Pb(){}function R3(u,h){var y=Js();h=h===void 0?null:h;var T=y.memoizedState;return h!==null&&vb(h,T[1])?T[0]:(y.memoizedState=[u,h],u)}function D3(u,h){var y=Js();h=h===void 0?null:h;var T=y.memoizedState;if(h!==null&&vb(h,T[1]))return T[0];if(T=u(),jh){tt(!0);try{u()}finally{tt(!1)}}return y.memoizedState=[T,h],T}function Ib(u,h,y){return y===void 0||(ds&1073741824)!==0&&(Nr&261930)===0?u.memoizedState=h:(u.memoizedState=y,u=Br(),Mr.lanes|=u,Gu|=u,y)}function P3(u,h,y,T){return lr(y,h)?y:tm.current!==null?(u=Ib(u,y,T),lr(u,h)||(xo=!0),u):(ds&42)===0||(ds&1073741824)!==0&&(Nr&261930)===0?(xo=!0,u.memoizedState=y):(u=Br(),Mr.lanes|=u,Gu|=u,h)}function I3(u,h,y,T,I){var F=J.p;J.p=F!==0&&8>F?F:8;var me=q.T,je={};q.T=je,jb(u,!1,h,y);try{var at=I(),Et=q.S;if(Et!==null&&Et(je,at),at!==null&&typeof at=="object"&&typeof at.then=="function"){var Wt=db(at,T);ug(u,h,Wt,jl(u))}else ug(u,h,T,jl(u))}catch(Zt){ug(u,h,{then:function(){},status:"rejected",reason:Zt},jl())}finally{J.p=F,me!==null&&je.types!==null&&(me.types=je.types),q.T=me}}function CE(){}function Ob(u,h,y,T){if(u.tag!==5)throw Error(r(476));var I=O3(u).queue;I3(u,I,h,K,y===null?CE:function(){return L3(u),y(T)})}function O3(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:Od,lastRenderedState:K},next:null};var y={};return h.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Od,lastRenderedState:y},next:null},u.memoizedState=h,u=u.alternate,u!==null&&(u.memoizedState=h),h}function L3(u){var h=O3(u);h.next===null&&(h=u.alternate.memoizedState),ug(u,h.next.queue,{},jl())}function Lb(){return cr(i_)}function j3(){return Js().memoizedState}function z3(){return Js().memoizedState}function EE(u){for(var h=u.return;h!==null;){switch(h.tag){case 24:case 3:var y=jl();u=Pd(y);var T=Sf(h,u,y);T!==null&&(Ir(T,h,y),wf(T,h,y)),h={cache:lb()},u.payload=h;return}h=h.return}}function AE(u,h,y){var T=jl();y={lane:T,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},gv(u)?U3(h,y):(y=qx(u,h,y,T),y!==null&&(Ir(y,u,T),B3(y,h,T)))}function F3(u,h,y){var T=jl();ug(u,h,y,T)}function ug(u,h,y,T){var I={lane:T,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(gv(u))U3(h,I);else{var F=u.alternate;if(u.lanes===0&&(F===null||F.lanes===0)&&(F=h.lastRenderedReducer,F!==null))try{var me=h.lastRenderedState,je=F(me,y);if(I.hasEagerState=!0,I.eagerState=je,lr(je,me))return Ho(u,h,I,0),mr===null&&J0(),!1}catch{}finally{}if(y=qx(u,h,I,T),y!==null)return Ir(y,u,T),B3(y,h,T),!0}return!1}function jb(u,h,y,T){if(T={lane:2,revertLane:Ot(),gesture:null,action:T,hasEagerState:!1,eagerState:null,next:null},gv(u)){if(h)throw Error(r(479))}else h=qx(u,y,T,2),h!==null&&Ir(h,u,2)}function gv(u){var h=u.alternate;return u===Mr||h!==null&&h===Mr}function U3(u,h){nm=pc=!0;var y=u.pending;y===null?h.next=h:(h.next=y.next,y.next=h),u.pending=h}function B3(u,h,y){if((y&4194048)!==0){var T=h.lanes;T&=u.pendingLanes,y|=T,h.lanes=y,Dt(u,y)}}var im={readContext:cr,use:Mf,useCallback:Cs,useContext:Cs,useEffect:Cs,useImperativeHandle:Cs,useLayoutEffect:Cs,useInsertionEffect:Cs,useMemo:Cs,useReducer:Cs,useRef:Cs,useState:Cs,useDebugValue:Cs,useDeferredValue:Cs,useTransition:Cs,useSyncExternalStore:Cs,useId:Cs,useHostTransitionStatus:Cs,useFormState:Cs,useActionState:Cs,useOptimistic:Cs,useMemoCache:Cs,useCacheRefresh:Cs};im.useEffectEvent=Cs;var H3={readContext:cr,use:Mf,useCallback:function(u,h){return Ao().memoizedState=[u,h===void 0?null:h],u},useContext:cr,useEffect:M3,useImperativeHandle:function(u,h,y){y=y!=null?y.concat([u]):null,pv(4194308,4,N3.bind(null,h,u),y)},useLayoutEffect:function(u,h){return pv(4194308,4,u,h)},useInsertionEffect:function(u,h){pv(4,2,u,h)},useMemo:function(u,h){var y=Ao();h=h===void 0?null:h;var T=u();if(jh){tt(!0);try{u()}finally{tt(!1)}}return y.memoizedState=[T,h],T},useReducer:function(u,h,y){var T=Ao();if(y!==void 0){var I=y(h);if(jh){tt(!0);try{y(h)}finally{tt(!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=AE.bind(null,Mr,u),[T.memoizedState,u]},useRef:function(u){var h=Ao();return u={current:u},h.memoizedState=u},useState:function(u){u=Tb(u);var h=u.queue,y=F3.bind(null,Mr,h);return h.dispatch=y,[u.memoizedState,y]},useDebugValue:Pb,useDeferredValue:function(u,h){var y=Ao();return Ib(y,u,h)},useTransition:function(){var u=Tb(!1);return u=I3.bind(null,Mr,u.queue,!0,!1),Ao().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,h,y){var T=Mr,I=Ao();if(Zr){if(y===void 0)throw Error(r(407));y=y()}else{if(y=h(),mr===null)throw Error(r(349));(Nr&127)!==0||h3(T,h,y)}I.memoizedState=y;var F={value:y,getSnapshot:h};return I.queue=F,M3(m3.bind(null,T,F,u),[u]),T.flags|=2048,Tf(9,{destroy:void 0},p3.bind(null,T,F,y,h),null),y},useId:function(){var u=Ao(),h=mr.identifierPrefix;if(Zr){var y=Xc,T=Ts;y=(T&~(1<<32-be(T)-1)).toString(32)+y,h="_"+h+"R_"+y,y=cv++,0<y&&(h+="H"+y.toString(32)),h+="_"}else y=xb++,h="_"+h+"r_"+y.toString(32)+"_";return u.memoizedState=h},useHostTransitionStatus:Lb,useFormState:Nb,useActionState:Nb,useOptimistic:function(u){var h=Ao();h.memoizedState=h.baseState=u;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=y,h=jb.bind(null,Mr,!0,y),y.dispatch=h,[u,h]},useMemoCache:Sb,useCacheRefresh:function(){return Ao().memoizedState=EE.bind(null,Mr)},useEffectEvent:function(u){var h=Ao(),y={impl:u};return h.memoizedState=y,function(){if((Vn&2)!==0)throw Error(r(440));return y.impl.apply(void 0,arguments)}}},zb={readContext:cr,use:Mf,useCallback:R3,useContext:cr,useEffect:Db,useImperativeHandle:k3,useInsertionEffect:E3,useLayoutEffect:A3,useMemo:D3,useReducer:fv,useRef:hv,useState:function(){return fv(Od)},useDebugValue:Pb,useDeferredValue:function(u,h){var y=Js();return P3(y,Fi.memoizedState,u,h)},useTransition:function(){var u=fv(Od)[0],h=Js().memoizedState;return[typeof u=="boolean"?u:cg(u),h]},useSyncExternalStore:f3,useId:j3,useHostTransitionStatus:Lb,useFormState:S3,useActionState:S3,useOptimistic:function(u,h){var y=Js();return Cb(y,Fi,u,h)},useMemoCache:Sb,useCacheRefresh:z3};zb.useEffectEvent=C3;var mc={readContext:cr,use:Mf,useCallback:R3,useContext:cr,useEffect:Db,useImperativeHandle:k3,useInsertionEffect:E3,useLayoutEffect:A3,useMemo:D3,useReducer:Mb,useRef:hv,useState:function(){return Mb(Od)},useDebugValue:Pb,useDeferredValue:function(u,h){var y=Js();return Fi===null?Ib(y,u,h):P3(y,Fi.memoizedState,u,h)},useTransition:function(){var u=Mb(Od)[0],h=Js().memoizedState;return[typeof u=="boolean"?u:cg(u),h]},useSyncExternalStore:f3,useId:j3,useHostTransitionStatus:Lb,useFormState:Rb,useActionState:Rb,useOptimistic:function(u,h){var y=Js();return Fi!==null?Cb(y,Fi,u,h):(y.baseState=u,[u,y.queue.dispatch])},useMemoCache:Sb,useCacheRefresh:z3};mc.useEffectEvent=C3;function xv(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 dg={enqueueSetState:function(u,h,y){u=u._reactInternals;var T=jl(),I=Pd(T);I.payload=h,y!=null&&(I.callback=y),h=Sf(u,I,T),h!==null&&(Ir(h,u,T),wf(h,u,T))},enqueueReplaceState:function(u,h,y){u=u._reactInternals;var T=jl(),I=Pd(T);I.tag=1,I.payload=h,y!=null&&(I.callback=y),h=Sf(u,I,T),h!==null&&(Ir(h,u,T),wf(h,u,T))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var y=jl(),T=Pd(y);T.tag=2,h!=null&&(T.callback=h),h=Sf(u,T,y),h!==null&&(Ir(h,u,y),wf(h,u,y))}};function Fb(u,h,y,T,I,F,me){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(T,F,me):h.prototype&&h.prototype.isPureReactComponent?!xr(y,T)||!xr(I,F):!0}function Ub(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&&dg.enqueueReplaceState(h,h.state,null)}function Cf(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 V3(u){Q0(u)}function Bb(u){console.error(u)}function Hb(u){Q0(u)}function vv(u,h){try{var y=u.onUncaughtError;y(h.value,{componentStack:h.stack})}catch(T){setTimeout(function(){throw T})}}function G3(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 Vb(u,h,y){return y=Pd(y),y.tag=3,y.payload={element:null},y.callback=function(){vv(u,h)},y}function Gb(u){return u=Pd(u),u.tag=3,u}function W3(u,h,y,T){var I=y.type.getDerivedStateFromError;if(typeof I=="function"){var F=T.value;u.payload=function(){return I(F)},u.callback=function(){G3(h,y,T)}}var me=y.stateNode;me!==null&&typeof me.componentDidCatch=="function"&&(u.callback=function(){G3(h,y,T),typeof I!="function"&&(no===null?no=new Set([this]):no.add(this));var je=T.stack;this.componentDidCatch(T.value,{componentStack:je!==null?je:""})})}function No(u,h,y,T,I){if(y.flags|=32768,T!==null&&typeof T=="object"&&typeof T.then=="function"){if(h=y.alternate,h!==null&&Lu(h,y,I,!0),y=il.current,y!==null){switch(y.tag){case 31:case 13:return za===null?dm():y.alternate===null&&Es===0&&(Es=3),y.flags&=-257,y.flags|=65536,y.lanes=I,T===iv?y.flags|=16384:(h=y.updateQueue,h===null?y.updateQueue=new Set([T]):h.add(T),wg(u,T,I)),!1;case 22:return y.flags|=65536,T===iv?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)),wg(u,T,I)),!1}throw Error(r(435,y.tag))}return wg(u,T,I),dm(),!1}if(Zr)return h=il.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=I,T!==Xp&&(u=Error(r(422),{cause:T}),Pu(Nl(u,y)))):(T!==Xp&&(h=Error(r(423),{cause:T}),Pu(Nl(h,y))),u=u.current.alternate,u.flags|=65536,I&=-I,u.lanes|=I,T=Nl(T,y),I=Vb(u.stateNode,T,I),Kn(u,I),Es!==4&&(Es=2)),!1;var F=Error(r(520),{cause:T});if(F=Nl(F,y),qh===null?qh=[F]:qh.push(F),Es!==4&&(Es=2),h===null)return!0;T=Nl(T,y),y=h;do{switch(y.tag){case 3:return y.flags|=65536,u=I&-I,y.lanes|=u,u=Vb(y.stateNode,T,u),Kn(y,u),!1;case 1:if(h=y.type,F=y.stateNode,(y.flags&128)===0&&(typeof h.getDerivedStateFromError=="function"||F!==null&&typeof F.componentDidCatch=="function"&&(no===null||!no.has(F))))return y.flags|=65536,I&=-I,y.lanes|=I,I=Gb(I),W3(I,u,y,T),Kn(y,I),!1}y=y.return}while(y!==null);return!1}var yv=Error(r(461)),xo=!1;function Vo(u,h,y,T){h.child=u===null?av(h,null,y,T):Dd(h,u.child,y,T)}function Wb(u,h,y,T,I){y=y.render;var F=h.ref;if("ref"in T){var me={};for(var je in T)je!=="ref"&&(me[je]=T[je])}else me=T;return bf(h),T=uv(u,h,y,me,F,I),je=yb(),u!==null&&!xo?(bb(u,h,I),eo(u,h,I)):(Zr&&je&&Ru(h),h.flags|=1,Vo(u,h,T,I),h.child)}function Uh(u,h,y,T,I){if(u===null){var F=y.type;return typeof F=="function"&&!Xx(F)&&F.defaultProps===void 0&&y.compare===null?(h.tag=15,h.type=F,bv(u,h,F,T,I)):(u=Nu(y.type,null,T,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(F=u.child,!Cv(u,I)){var me=F.memoizedProps;if(y=y.compare,y=y!==null?y:xr,y(me,T)&&u.ref===h.ref)return eo(u,h,I)}return h.flags|=1,u=tl(F,T),u.ref=h.ref,u.return=h,h.child=u}function bv(u,h,y,T,I){if(u!==null){var F=u.memoizedProps;if(xr(F,T)&&u.ref===h.ref)if(xo=!1,h.pendingProps=T=F,Cv(u,I))(u.flags&131072)!==0&&(xo=!0);else return h.lanes=u.lanes,eo(u,h,I)}return sm(u,h,y,T,I)}function Bh(u,h,y,T){var I=T.children,F=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(F=F!==null?F.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&~F}else T=0,h.child=null;return ol(u,h,F,y,T)}if((y&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},u!==null&&ng(h,F!==null?F.cachePool:null),F!==null?c3(h,F):mb(),u3(h);else return T=h.lanes=536870912,ol(u,h,F!==null?F.baseLanes|y:y,y,T)}else F!==null?(ng(h,F.cachePool),c3(h,F),sl(),h.memoizedState=null):(u!==null&&ng(h,null),mb(),sl());return Vo(u,h,I,y),h.child}function zu(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 F=rv();return F=F===null?null:{parent:go._currentValue,pool:F},h.memoizedState={baseLanes:y,cachePool:F},u!==null&&ng(h,null),mb(),u3(h),u!==null&&Lu(u,h,T,!0),h.childLanes=I,null}function _v(u,h){return h=Tv({mode:h.mode,children:h.children},u.mode),h.ref=u.ref,u.child=h,h.return=u,h}function $3(u,h,y){return Dd(h,u.child,null,y),u=_v(h,h.pendingProps),u.flags|=2,Qs(h),h.memoizedState=null,u}function Sv(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=_v(h,T),h.lanes=536870912,zu(null,u);if(gb(h),(u=Xi)?(u=O9(u,kl),u=u!==null&&u.data==="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:Ad!==null?{id:Ts,overflow:Xc}:null,retryLane:536870912,hydrationErrors:null},y=Wp(u),y.return=h,h.child=y,Fs=h,Xi=null)):u=null,u===null)throw Du(h);return h.lanes=536870912,null}return _v(h,T)}var F=u.memoizedState;if(F!==null){var me=F.dehydrated;if(gb(h),I)if(h.flags&256)h.flags&=-257,h=$3(u,h,y);else if(h.memoizedState!==null)h.child=u.child,h.flags|=128,h=null;else throw Error(r(558));else if(xo||Lu(u,h,y,!1),I=(y&u.childLanes)!==0,xo||I){if(T=mr,T!==null&&(me=St(T,y),me!==0&&me!==F.retryLane))throw F.retryLane=me,La(u,me),Ir(T,u,me),yv;dm(),h=$3(u,h,y)}else u=F.treeContext,Xi=qu(me.nextSibling),Fs=h,Zr=!0,Nd=null,kl=!1,u!==null&&Qx(h,u),h=_v(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 Hh(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 sm(u,h,y,T,I){return bf(h),y=uv(u,h,y,T,void 0,I),T=yb(),u!==null&&!xo?(bb(u,h,I),eo(u,h,I)):(Zr&&T&&Ru(h),h.flags|=1,Vo(u,h,y,I),h.child)}function fg(u,h,y,T,I,F){return bf(h),h.updateQueue=null,y=zh(h,T,y,I),d3(u),T=yb(),u!==null&&!xo?(bb(u,h,F),eo(u,h,F)):(Zr&&T&&Ru(h),h.flags|=1,Vo(u,h,y,F),h.child)}function wv(u,h,y,T,I){if(bf(h),h.stateNode===null){var F=pf,me=y.contextType;typeof me=="object"&&me!==null&&(F=cr(me)),F=new y(T,F),h.memoizedState=F.state!==null&&F.state!==void 0?F.state:null,F.updater=dg,h.stateNode=F,F._reactInternals=h,F=h.stateNode,F.props=T,F.state=h.memoizedState,F.refs={},sg(h),me=y.contextType,F.context=typeof me=="object"&&me!==null?cr(me):pf,F.state=h.memoizedState,me=y.getDerivedStateFromProps,typeof me=="function"&&(xv(h,y,me,T),F.state=h.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof F.getSnapshotBeforeUpdate=="function"||typeof F.UNSAFE_componentWillMount!="function"&&typeof F.componentWillMount!="function"||(me=F.state,typeof F.componentWillMount=="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount=="function"&&F.UNSAFE_componentWillMount(),me!==F.state&&dg.enqueueReplaceState(F,F.state,null),Jp(h,T,F,I),og(),F.state=h.memoizedState),typeof F.componentDidMount=="function"&&(h.flags|=4194308),T=!0}else if(u===null){F=h.stateNode;var je=h.memoizedProps,at=Cf(y,je);F.props=at;var Et=F.context,Wt=y.contextType;me=pf,typeof Wt=="object"&&Wt!==null&&(me=cr(Wt));var Zt=y.getDerivedStateFromProps;Wt=typeof Zt=="function"||typeof F.getSnapshotBeforeUpdate=="function",je=h.pendingProps!==je,Wt||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(je||Et!==me)&&Ub(h,F,T,me),ja=!1;var kt=h.memoizedState;F.state=kt,Jp(h,T,F,I),og(),Et=h.memoizedState,je||kt!==Et||ja?(typeof Zt=="function"&&(xv(h,y,Zt,T),Et=h.memoizedState),(at=ja||Fb(h,y,at,T,kt,Et,me))?(Wt||typeof F.UNSAFE_componentWillMount!="function"&&typeof F.componentWillMount!="function"||(typeof F.componentWillMount=="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount=="function"&&F.UNSAFE_componentWillMount()),typeof F.componentDidMount=="function"&&(h.flags|=4194308)):(typeof F.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=T,h.memoizedState=Et),F.props=T,F.state=Et,F.context=me,T=at):(typeof F.componentDidMount=="function"&&(h.flags|=4194308),T=!1)}else{F=h.stateNode,hb(u,h),me=h.memoizedProps,Wt=Cf(y,me),F.props=Wt,Zt=h.pendingProps,kt=F.context,Et=y.contextType,at=pf,typeof Et=="object"&&Et!==null&&(at=cr(Et)),je=y.getDerivedStateFromProps,(Et=typeof je=="function"||typeof F.getSnapshotBeforeUpdate=="function")||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(me!==Zt||kt!==at)&&Ub(h,F,T,at),ja=!1,kt=h.memoizedState,F.state=kt,Jp(h,T,F,I),og();var zt=h.memoizedState;me!==Zt||kt!==zt||ja||u!==null&&u.dependencies!==null&&tg(u.dependencies)?(typeof je=="function"&&(xv(h,y,je,T),zt=h.memoizedState),(Wt=ja||Fb(h,y,Wt,T,kt,zt,at)||u!==null&&u.dependencies!==null&&tg(u.dependencies))?(Et||typeof F.UNSAFE_componentWillUpdate!="function"&&typeof F.componentWillUpdate!="function"||(typeof F.componentWillUpdate=="function"&&F.componentWillUpdate(T,zt,at),typeof F.UNSAFE_componentWillUpdate=="function"&&F.UNSAFE_componentWillUpdate(T,zt,at)),typeof F.componentDidUpdate=="function"&&(h.flags|=4),typeof F.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof F.componentDidUpdate!="function"||me===u.memoizedProps&&kt===u.memoizedState||(h.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||me===u.memoizedProps&&kt===u.memoizedState||(h.flags|=1024),h.memoizedProps=T,h.memoizedState=zt),F.props=T,F.state=zt,F.context=at,T=Wt):(typeof F.componentDidUpdate!="function"||me===u.memoizedProps&&kt===u.memoizedState||(h.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||me===u.memoizedProps&&kt===u.memoizedState||(h.flags|=1024),T=!1)}return F=T,Hh(u,h),T=(h.flags&128)!==0,F||T?(F=h.stateNode,y=T&&typeof y.getDerivedStateFromError!="function"?null:F.render(),h.flags|=1,u!==null&&T?(h.child=Dd(h,u.child,null,I),h.child=Dd(h,null,y,I)):Vo(u,h,y,I),h.memoizedState=F.state,u=h.child):u=eo(u,h,I),u}function q3(u,h,y,T){return vf(),h.flags|=256,Vo(u,h,y,T),h.child}var $b={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _a(u){return{baseLanes:u,cachePool:fb()}}function Mv(u,h,y){return u=u!==null?u.childLanes&~y:0,h&&(u|=Ba),u}function X3(u,h,y){var T=h.pendingProps,I=!1,F=(h.flags&128)!==0,me;if((me=F)||(me=u!==null&&u.memoizedState===null?!1:(Qr.current&2)!==0),me&&(I=!0,h.flags&=-129),me=(h.flags&32)!==0,h.flags&=-33,u===null){if(Zr){if(I?Id(h):sl(),(u=Xi)?(u=O9(u,kl),u=u!==null&&u.data!=="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:Ad!==null?{id:Ts,overflow:Xc}:null,retryLane:536870912,hydrationErrors:null},y=Wp(u),y.return=h,h.child=y,Fs=h,Xi=null)):u=null,u===null)throw Du(h);return HE(u)?h.lanes=32:h.lanes=536870912,null}var je=T.children;return T=T.fallback,I?(sl(),I=h.mode,je=Tv({mode:"hidden",children:je},I),T=mf(T,I,y,null),je.return=h,T.return=h,je.sibling=T,h.child=je,T=h.child,T.memoizedState=_a(y),T.childLanes=Mv(u,me,y),h.memoizedState=$b,zu(null,T)):(Id(h),hg(h,je))}var at=u.memoizedState;if(at!==null&&(je=at.dehydrated,je!==null)){if(F)h.flags&256?(Id(h),h.flags&=-257,h=qb(u,h,y)):h.memoizedState!==null?(sl(),h.child=u.child,h.flags|=128,h=null):(sl(),je=T.fallback,I=h.mode,T=Tv({mode:"visible",children:T.children},I),je=mf(je,I,y,null),je.flags|=2,T.return=h,je.return=h,T.sibling=je,h.child=T,Dd(h,u.child,null,y),T=h.child,T.memoizedState=_a(y),T.childLanes=Mv(u,me,y),h.memoizedState=$b,h=zu(null,T));else if(Id(h),HE(je)){if(me=je.nextSibling&&je.nextSibling.dataset,me)var Et=me.dgst;me=Et,T=Error(r(419)),T.stack="",T.digest=me,Pu({value:T,source:null,stack:null}),h=qb(u,h,y)}else if(xo||Lu(u,h,y,!1),me=(y&u.childLanes)!==0,xo||me){if(me=mr,me!==null&&(T=St(me,y),T!==0&&T!==at.retryLane))throw at.retryLane=T,La(u,T),Ir(me,u,T),yv;BE(je)||dm(),h=qb(u,h,y)}else BE(je)?(h.flags|=192,h.child=u.child,h=null):(u=at.treeContext,Xi=qu(je.nextSibling),Fs=h,Zr=!0,Nd=null,kl=!1,u!==null&&Qx(h,u),h=hg(h,T.children),h.flags|=4096);return h}return I?(sl(),je=T.fallback,I=h.mode,at=u.child,Et=at.sibling,T=tl(at,{mode:"hidden",children:T.children}),T.subtreeFlags=at.subtreeFlags&65011712,Et!==null?je=tl(Et,je):(je=mf(je,I,y,null),je.flags|=2),je.return=h,T.return=h,T.sibling=je,h.child=T,zu(null,T),T=h.child,je=u.child.memoizedState,je===null?je=_a(y):(I=je.cachePool,I!==null?(at=go._currentValue,I=I.parent!==at?{parent:at,pool:at}:I):I=fb(),je={baseLanes:je.baseLanes|y,cachePool:I}),T.memoizedState=je,T.childLanes=Mv(u,me,y),h.memoizedState=$b,zu(u.child,T)):(Id(h),y=u.child,u=y.sibling,y=tl(y,{mode:"visible",children:T.children}),y.return=h,y.sibling=null,u!==null&&(me=h.deletions,me===null?(h.deletions=[u],h.flags|=16):me.push(u)),h.child=y,h.memoizedState=null,y)}function hg(u,h){return h=Tv({mode:"visible",children:h},u.mode),h.return=u,u.child=h}function Tv(u,h){return u=Ms(22,u,null,h),u.lanes=0,u}function qb(u,h,y){return Dd(h,u.child,null,y),u=hg(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function Y3(u,h,y){u.lanes|=h;var T=u.alternate;T!==null&&(T.lanes|=h),ev(u.return,h,y)}function Vh(u,h,y,T,I,F){var me=u.memoizedState;me===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:T,tail:y,tailMode:I,treeForkCount:F}:(me.isBackwards=h,me.rendering=null,me.renderingStartTime=0,me.last=T,me.tail=y,me.tailMode=I,me.treeForkCount=F)}function al(u,h,y){var T=h.pendingProps,I=T.revealOrder,F=T.tail;T=T.children;var me=Qr.current,je=(me&2)!==0;if(je?(me=me&1|2,h.flags|=128):me&=1,j(Qr,me),Vo(u,h,T,y),T=Zr?qp:0,!je&&u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&Y3(u,y,h);else if(u.tag===19)Y3(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&&Dl(u)===null&&(I=y),y=y.sibling;y=I,y===null?(I=h.child,h.child=null):(I=y.sibling,y.sibling=null),Vh(h,!1,I,y,F,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&&Dl(u)===null){h.child=I;break}u=I.sibling,I.sibling=y,y=I,I=u}Vh(h,!0,y,null,F,T);break;case"together":Vh(h,!1,null,null,void 0,T);break;default:h.memoizedState=null}return h.child}function eo(u,h,y){if(u!==null&&(h.dependencies=u.dependencies),Gu|=h.lanes,(y&h.childLanes)===0)if(u!==null){if(Lu(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 Cv(u,h){return(u.lanes&h)!==0?!0:(u=u.dependencies,!!(u!==null&&tg(u)))}function NE(u,h,y){switch(h.tag){case 3:fe(h,h.stateNode.containerInfo),kd(h,go,u.memoizedState.cache),vf();break;case 27:case 5:ue(h);break;case 4:fe(h,h.stateNode.containerInfo);break;case 10:kd(h,h.type,h.memoizedProps.value);break;case 31:if(h.memoizedState!==null)return h.flags|=128,gb(h),null;break;case 13:var T=h.memoizedState;if(T!==null)return T.dehydrated!==null?(Id(h),h.flags|=128,null):(y&h.child.childLanes)!==0?X3(u,h,y):(Id(h),u=eo(u,h,y),u!==null?u.sibling:null);Id(h);break;case 19:var I=(u.flags&128)!==0;if(T=(y&h.childLanes)!==0,T||(Lu(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,Bh(u,h,y,h.pendingProps);case 24:kd(h,go,u.memoizedState.cache)}return eo(u,h,y)}function Ev(u,h,y){if(u!==null)if(u.memoizedProps!==h.pendingProps)xo=!0;else{if(!Cv(u,y)&&(h.flags&128)===0)return xo=!1,NE(u,h,y);xo=(u.flags&131072)!==0}else xo=!1,Zr&&(h.flags&1048576)!==0&&n3(h,qp,h.index);switch(h.lanes=0,h.tag){case 16:e:{var T=h.pendingProps;if(u=Dh(h.elementType),h.type=u,typeof u=="function")Xx(u)?(T=Cf(u,T),h.tag=1,h=wv(null,h,u,T,y)):(h.tag=0,h=sm(null,h,u,T,y));else{if(u!=null){var I=u.$$typeof;if(I===N){h.tag=11,h=Wb(null,h,u,T,y);break e}else if(I===O){h.tag=14,h=Uh(null,h,u,T,y);break e}}throw h=ee(u)||u,Error(r(306,h,""))}}return h;case 0:return sm(u,h,h.type,h.pendingProps,y);case 1:return T=h.type,I=Cf(T,h.pendingProps),wv(u,h,T,I,y);case 3:e:{if(fe(h,h.stateNode.containerInfo),u===null)throw Error(r(387));T=h.pendingProps;var F=h.memoizedState;I=F.element,hb(u,h),Jp(h,T,null,y);var me=h.memoizedState;if(T=me.cache,kd(h,go,T),T!==F.cache&&tv(h,[go],y,!0),og(),T=me.element,F.isDehydrated)if(F={element:T,isDehydrated:!1,cache:me.cache},h.updateQueue.baseState=F,h.memoizedState=F,h.flags&256){h=q3(u,h,T,y);break e}else if(T!==I){I=Nl(Error(r(424)),h),Pu(I),h=q3(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=qu(u.firstChild),Fs=h,Zr=!0,Nd=null,kl=!0,y=av(h,null,T,y),h.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(vf(),T===I){h=eo(u,h,y);break e}Vo(u,h,T,y)}h=h.child}return h;case 26:return Hh(u,h),u===null?(y=B9(h.type,null,h.pendingProps,null))?h.memoizedState=y:Zr||(y=h.type,u=h.pendingProps,T=J3(X.current).createElement(y),T[Kt]=h,T[dn]=u,Va(T,y,u),et(T),h.stateNode=T):h.memoizedState=B9(h.type,u.memoizedProps,h.pendingProps,u.memoizedState),null;case 27:return ue(h),u===null&&Zr&&(T=h.stateNode=z9(h.type,h.pendingProps,X.current),Fs=h,kl=!0,I=Xi,mm(h.type)?(VE=I,Xi=qu(T.firstChild)):Xi=I),Vo(u,h,h.pendingProps.children,y),Hh(u,h),u===null&&(h.flags|=4194304),h.child;case 5:return u===null&&Zr&&((I=T=Xi)&&(T=gQ(T,h.type,h.pendingProps,kl),T!==null?(h.stateNode=T,Fs=h,Xi=qu(T.firstChild),kl=!1,I=!0):I=!1),I||Du(h)),ue(h),I=h.type,F=h.pendingProps,me=u!==null?u.memoizedProps:null,T=F.children,zE(I,F)?T=null:me!==null&&zE(I,me)&&(h.flags|=32),h.memoizedState!==null&&(I=uv(u,h,Fh,null,null,y),i_._currentValue=I),Hh(u,h),Vo(u,h,T,y),h.child;case 6:return u===null&&Zr&&((u=y=Xi)&&(y=xQ(y,h.pendingProps,kl),y!==null?(h.stateNode=y,Fs=h,Xi=null,u=!0):u=!1),u||Du(h)),null;case 13:return X3(u,h,y);case 4:return fe(h,h.stateNode.containerInfo),T=h.pendingProps,u===null?h.child=Dd(h,null,T,y):Vo(u,h,T,y),h.child;case 11:return Wb(u,h,h.type,h.pendingProps,y);case 7:return Vo(u,h,h.pendingProps,y),h.child;case 8:return Vo(u,h,h.pendingProps.children,y),h.child;case 12:return Vo(u,h,h.pendingProps.children,y),h.child;case 10:return T=h.pendingProps,kd(h,h.type,T.value),Vo(u,h,T.children,y),h.child;case 9:return I=h.type._context,T=h.pendingProps.children,bf(h),I=cr(I),T=T(I),h.flags|=1,Vo(u,h,T,y),h.child;case 14:return Uh(u,h,h.type,h.pendingProps,y);case 15:return bv(u,h,h.type,h.pendingProps,y);case 19:return al(u,h,y);case 31:return Sv(u,h,y);case 22:return Bh(u,h,y,h.pendingProps);case 24:return bf(h),T=cr(go),u===null?(I=rv(),I===null&&(I=mr,F=lb(),I.pooledCache=F,F.refCount++,F!==null&&(I.pooledCacheLanes|=y),I=F),h.memoizedState={parent:T,cache:I},sg(h),kd(h,go,I)):((u.lanes&y)!==0&&(hb(u,h),Jp(h,null,null,y),og()),I=u.memoizedState,F=h.memoizedState,I.parent!==T?(I={parent:T,cache:T},h.memoizedState=I,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=I),kd(h,go,T)):(T=F.cache,kd(h,go,T),T!==I.cache&&tv(h,[go],y,!0))),Vo(u,h,h.pendingProps.children,y),h.child;case 29:throw h.pendingProps}throw Error(r(156,h.tag))}function Fu(u){u.flags|=4}function pg(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(Ns())u.flags|=8192;else throw ju=iv,rg}else u.flags&=-16777217}function Xb(u,h){if(h.type!=="stylesheet"||(h.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!$9(h))if(Ns())u.flags|=8192;else throw ju=iv,rg}function Ld(u,h){h!==null&&(u.flags|=4),u.flags&16384&&(h=u.tag!==22?Re():536870912,u.lanes|=h,es|=h)}function Uu(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 mg(u,h,y){var T=h.pendingProps;switch(Zx(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),Ou(go),Q(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(u===null||u.child===null)&&(Yp(h)?Fu(h):u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Jx())),Ui(h),null;case 26:var I=h.type,F=h.memoizedState;return u===null?(Fu(h),F!==null?(Ui(h),Xb(h,F)):(Ui(h),pg(h,I,null,T,y))):F?F!==u.memoizedState?(Fu(h),Ui(h),Xb(h,F)):(Ui(h),h.flags&=-16777217):(u=u.memoizedProps,u!==T&&Fu(h),Ui(h),pg(h,I,u,T,y)),null;case 27:if(he(h),y=X.current,I=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==T&&Fu(h);else{if(!T){if(h.stateNode===null)throw Error(r(166));return Ui(h),null}u=le.current,Yp(h)?r3(h):(u=z9(I,T,y),h.stateNode=u,Fu(h))}return Ui(h),null;case 5:if(he(h),I=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==T&&Fu(h);else{if(!T){if(h.stateNode===null)throw Error(r(166));return Ui(h),null}if(F=le.current,Yp(h))r3(h);else{var me=J3(X.current);switch(F){case 1:F=me.createElementNS("http://www.w3.org/2000/svg",I);break;case 2:F=me.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;default:switch(I){case"svg":F=me.createElementNS("http://www.w3.org/2000/svg",I);break;case"math":F=me.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;case"script":F=me.createElement("div"),F.innerHTML="<script><\/script>",F=F.removeChild(F.firstChild);break;case"select":F=typeof T.is=="string"?me.createElement("select",{is:T.is}):me.createElement("select"),T.multiple?F.multiple=!0:T.size&&(F.size=T.size);break;default:F=typeof T.is=="string"?me.createElement(I,{is:T.is}):me.createElement(I)}}F[Kt]=h,F[dn]=T;e:for(me=h.child;me!==null;){if(me.tag===5||me.tag===6)F.appendChild(me.stateNode);else if(me.tag!==4&&me.tag!==27&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===h)break e;for(;me.sibling===null;){if(me.return===null||me.return===h)break e;me=me.return}me.sibling.return=me.return,me=me.sibling}h.stateNode=F;e:switch(Va(F,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&&Fu(h)}}return Ui(h),pg(h,h.type,u===null?null:u.memoizedProps,h.pendingProps,y),null;case 6:if(u&&h.stateNode!=null)u.memoizedProps!==T&&Fu(h);else{if(typeof T!="string"&&h.stateNode===null)throw Error(r(166));if(u=X.current,Yp(h)){if(u=h.stateNode,y=h.memoizedProps,T=null,I=Fs,I!==null)switch(I.tag){case 27:case 5:T=I.memoizedProps}u[Kt]=h,u=!!(u.nodeValue===y||T!==null&&T.suppressHydrationWarning===!0||E9(u.nodeValue,y)),u||Du(h,!0)}else u=J3(u).createTextNode(T),u[Kt]=h,h.stateNode=u}return Ui(h),null;case 31:if(y=h.memoizedState,u===null||u.memoizedState!==null){if(T=Yp(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[Kt]=h}else vf(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Ui(h),u=!1}else y=Jx(),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=Yp(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[Kt]=h}else vf(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Ui(h),I=!1}else I=Jx(),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),F=null,T.memoizedState!==null&&T.memoizedState.cachePool!==null&&(F=T.memoizedState.cachePool.pool),F!==I&&(T.flags|=2048)),y!==u&&y&&(h.child.flags|=8192),Ld(h,h.updateQueue),Ui(h),null);case 4:return Q(),u===null&&PE(h.stateNode.containerInfo),Ui(h),null;case 10:return Ou(h.type),Ui(h),null;case 19:if(Y(Qr),T=h.memoizedState,T===null)return Ui(h),null;if(I=(h.flags&128)!==0,F=T.rendering,F===null)if(I)Uu(T,!1);else{if(Es!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if(F=Dl(u),F!==null){for(h.flags|=128,Uu(T,!1),u=F.updateQueue,h.updateQueue=u,Ld(h,u),h.subtreeFlags=0,u=y,y=h.child;y!==null;)Gp(y,u),y=y.sibling;return j(Qr,Qr.current&1|2),Zr&&ku(h,T.treeForkCount),h.child}u=u.sibling}T.tail!==null&&Z()>to&&(h.flags|=128,I=!0,Uu(T,!1),h.lanes=4194304)}else{if(!I)if(u=Dl(F),u!==null){if(h.flags|=128,I=!0,u=u.updateQueue,h.updateQueue=u,Ld(h,u),Uu(T,!0),T.tail===null&&T.tailMode==="hidden"&&!F.alternate&&!Zr)return Ui(h),null}else 2*Z()-T.renderingStartTime>to&&y!==536870912&&(h.flags|=128,I=!0,Uu(T,!1),h.lanes=4194304);T.isBackwards?(F.sibling=h.child,h.child=F):(u=T.last,u!==null?u.sibling=F:h.child=F,T.last=F)}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&&ku(h,T.treeForkCount),u):(Ui(h),null);case 22:case 23:return Qs(h),ag(),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&&Ld(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&&Y(_f),null;case 24:return y=null,u!==null&&(y=u.memoizedState.cache),h.memoizedState.cache!==y&&(h.flags|=2048),Ou(go),Ui(h),null;case 25:return null;case 30:return null}throw Error(r(156,h.tag))}function gc(u,h){switch(Zx(h),h.tag){case 1:return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return Ou(go),Q(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 26:case 27:case 5:return he(h),null;case 31:if(h.memoizedState!==null){if(Qs(h),h.alternate===null)throw Error(r(340));vf()}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));vf()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return Y(Qr),null;case 4:return Q(),null;case 10:return Ou(h.type),null;case 22:case 23:return Qs(h),ag(),u!==null&&Y(_f),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 24:return Ou(go),null;case 25:return null;default:return null}}function Pl(u,h){switch(Zx(h),h.tag){case 3:Ou(go),Q();break;case 26:case 27:case 5:he(h);break;case 4:Q();break;case 31:h.memoizedState!==null&&Qs(h);break;case 13:Qs(h);break;case 19:Y(Qr);break;case 10:Ou(h.type);break;case 22:case 23:Qs(h),ag(),u!==null&&Y(_f);break;case 24:Ou(go)}}function xc(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 F=y.create,me=y.inst;T=F(),me.destroy=T}y=y.next}while(y!==I)}}catch(je){ui(h,h.return,je)}}function sa(u,h,y){try{var T=h.updateQueue,I=T!==null?T.lastEffect:null;if(I!==null){var F=I.next;T=F;do{if((T.tag&u)===u){var me=T.inst,je=me.destroy;if(je!==void 0){me.destroy=void 0,I=h;var at=y,Et=je;try{Et()}catch(Wt){ui(I,at,Wt)}}}T=T.next}while(T!==F)}}catch(Wt){ui(h,h.return,Wt)}}function Yc(u){var h=u.updateQueue;if(h!==null){var y=u.stateNode;try{l3(h,y)}catch(T){ui(u,u.return,T)}}}function Go(u,h,y){y.props=Cf(u.type,u.memoizedProps),y.state=u.memoizedState;try{y.componentWillUnmount()}catch(T){ui(u,h,T)}}function jd(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 oa(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 gg(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 ko(u,h,y){try{var T=u.stateNode;uQ(T,u.type,y,h),T[dn]=h}catch(I){ui(u,u.return,I)}}function fs(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&mm(u.type)||u.tag===4}function qr(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||fs(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&&mm(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 Bu(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=Os));else if(T!==4&&(T===27&&mm(u.type)&&(y=u.stateNode,h=null),u=u.child,u!==null))for(Bu(u,h,y),u=u.sibling;u!==null;)Bu(u,h,y),u=u.sibling}function Fa(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&&mm(u.type)&&(y=u.stateNode),u=u.child,u!==null))for(Fa(u,h,y),u=u.sibling;u!==null;)Fa(u,h,y),u=u.sibling}function Av(u){var h=u.stateNode,y=u.memoizedProps;try{for(var T=u.type,I=h.attributes;I.length;)h.removeAttributeNode(I[0]);Va(h,T,y),h[Kt]=u,h[dn]=y}catch(F){ui(u,u.return,F)}}var vc=!1,Yi=!1,Kc=!1,K3=typeof WeakSet=="function"?WeakSet:Set,Wo=null;function kE(u,h){if(u=u.containerInfo,LE=o4,u=Ji(u),js(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,F=T.focusNode;T=T.focusOffset;try{y.nodeType,F.nodeType}catch{y=null;break e}var me=0,je=-1,at=-1,Et=0,Wt=0,Zt=u,kt=null;t:for(;;){for(var zt;Zt!==y||I!==0&&Zt.nodeType!==3||(je=me+I),Zt!==F||T!==0&&Zt.nodeType!==3||(at=me+T),Zt.nodeType===3&&(me+=Zt.nodeValue.length),(zt=Zt.firstChild)!==null;)kt=Zt,Zt=zt;for(;;){if(Zt===u)break t;if(kt===y&&++Et===I&&(je=me),kt===F&&++Wt===T&&(at=me),(zt=Zt.nextSibling)!==null)break;Zt=kt,kt=Zt.parentNode}Zt=zt}y=je===-1||at===-1?null:{start:je,end:at}}else y=null}y=y||{start:0,end:0}}else y=null;for(jE={focusedElem:u,selectionRange:y},o4=!1,Wo=h;Wo!==null;)if(h=Wo,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,Wo=u;else for(;Wo!==null;){switch(h=Wo,F=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&&F!==null){u=void 0,y=h,I=F.memoizedProps,F=F.memoizedState,T=y.stateNode;try{var zn=Cf(y.type,I);u=T.getSnapshotBeforeUpdate(zn,F),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)UE(u);else if(y===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":UE(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,Wo=u;break}Wo=h.return}}function hs(u,h,y){var T=y.flags;switch(y.tag){case 0:case 11:case 15:_c(u,y),T&4&&xc(5,y);break;case 1:if(_c(u,y),T&4)if(u=y.stateNode,h===null)try{u.componentDidMount()}catch(me){ui(y,y.return,me)}else{var I=Cf(y.type,h.memoizedProps);h=h.memoizedState;try{u.componentDidUpdate(I,h,u.__reactInternalSnapshotBeforeUpdate)}catch(me){ui(y,y.return,me)}}T&64&&Yc(y),T&512&&jd(y,y.return);break;case 3:if(_c(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{l3(u,h)}catch(me){ui(y,y.return,me)}}break;case 27:h===null&&T&4&&Av(y);case 26:case 5:_c(u,y),h===null&&T&4&&gg(y),T&512&&jd(y,y.return);break;case 12:_c(u,y);break;case 31:_c(u,y),T&4&&Ef(u,y);break;case 13:_c(u,y),T&4&&om(u,y),T&64&&(u=y.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(y=E.bind(null,y),vQ(u,y))));break;case 22:if(T=y.memoizedState!==null||vc,!T){h=h!==null&&h.memoizedState!==null||Yi,I=vc;var F=Yi;vc=T,(Yi=h)&&!F?Ua(u,y,(y.subtreeFlags&8772)!==0):_c(u,y),vc=I,Yi=F}break;case 30:break;default:_c(u,y)}}function xg(u){var h=u.alternate;h!==null&&(u.alternate=null,xg(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&gt(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 yc(u,h,y){for(y=y.child;y!==null;)Nv(u,h,y),y=y.sibling}function Nv(u,h,y){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(Je,y)}catch{}switch(y.tag){case 26:Yi||oa(y,h),yc(u,h,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:Yi||oa(y,h);var T=Ai,I=Sa;mm(y.type)&&(Ai=y.stateNode,Sa=!1),yc(u,h,y),t_(y.stateNode),Ai=T,Sa=I;break;case 5:Yi||oa(y,h);case 6:if(T=Ai,I=Sa,Ai=null,yc(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(F){ui(y,h,F)}else try{Ai.removeChild(y.stateNode)}catch(F){ui(y,h,F)}break;case 18:Ai!==null&&(Sa?(u=Ai,P9(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,y.stateNode),jv(u)):P9(Ai,y.stateNode));break;case 4:T=Ai,I=Sa,Ai=y.stateNode.containerInfo,Sa=!0,yc(u,h,y),Ai=T,Sa=I;break;case 0:case 11:case 14:case 15:sa(2,y,h),Yi||sa(4,y,h),yc(u,h,y);break;case 1:Yi||(oa(y,h),T=y.stateNode,typeof T.componentWillUnmount=="function"&&Go(y,h,T)),yc(u,h,y);break;case 21:yc(u,h,y);break;case 22:Yi=(T=Yi)||y.memoizedState!==null,yc(u,h,y),Yi=T;break;default:yc(u,h,y)}}function Ef(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{jv(u)}catch(y){ui(h,h.return,y)}}}function om(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{jv(u)}catch(y){ui(h,h.return,y)}}function Yb(u){switch(u.tag){case 31:case 13:case 19:var h=u.stateNode;return h===null&&(h=u.stateNode=new K3),h;case 22:return u=u.stateNode,h=u._retryCache,h===null&&(h=u._retryCache=new K3),h;default:throw Error(r(435,u.tag))}}function zd(u,h){var y=Yb(u);h.forEach(function(T){if(!y.has(T)){y.add(T);var I=D.bind(null,u,T);T.then(I,I)}})}function Ro(u,h){var y=h.deletions;if(y!==null)for(var T=0;T<y.length;T++){var I=y[T],F=u,me=h,je=me;e:for(;je!==null;){switch(je.tag){case 27:if(mm(je.type)){Ai=je.stateNode,Sa=!1;break e}break;case 5:Ai=je.stateNode,Sa=!1;break e;case 3:case 4:Ai=je.stateNode.containerInfo,Sa=!0;break e}je=je.return}if(Ai===null)throw Error(r(160));Nv(F,me,I),Ai=null,Sa=!1,F=I.alternate,F!==null&&(F.return=null),I.return=null}if(h.subtreeFlags&13886)for(h=h.child;h!==null;)Af(h,u),h=h.sibling}var bc=null;function Af(u,h){var y=u.alternate,T=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Ro(h,u),Do(u),T&4&&(sa(3,u,u.return),xc(3,u),sa(5,u,u.return));break;case 1:Ro(h,u),Do(u),T&512&&(Yi||y===null||oa(y,y.return)),T&64&&vc&&(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=bc;if(Ro(h,u),Do(u),T&512&&(Yi||y===null||oa(y,y.return)),T&4){var F=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":F=I.getElementsByTagName("title")[0],(!F||F[Oe]||F[Kt]||F.namespaceURI==="http://www.w3.org/2000/svg"||F.hasAttribute("itemprop"))&&(F=I.createElement(T),I.head.insertBefore(F,I.querySelector("head > title"))),Va(F,T,y),F[Kt]=u,et(F),T=F;break e;case"link":var me=G9("link","href",I).get(T+(y.href||""));if(me){for(var je=0;je<me.length;je++)if(F=me[je],F.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&F.getAttribute("rel")===(y.rel==null?null:y.rel)&&F.getAttribute("title")===(y.title==null?null:y.title)&&F.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){me.splice(je,1);break t}}F=I.createElement(T),Va(F,T,y),I.head.appendChild(F);break;case"meta":if(me=G9("meta","content",I).get(T+(y.content||""))){for(je=0;je<me.length;je++)if(F=me[je],F.getAttribute("content")===(y.content==null?null:""+y.content)&&F.getAttribute("name")===(y.name==null?null:y.name)&&F.getAttribute("property")===(y.property==null?null:y.property)&&F.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&F.getAttribute("charset")===(y.charSet==null?null:y.charSet)){me.splice(je,1);break t}}F=I.createElement(T),Va(F,T,y),I.head.appendChild(F);break;default:throw Error(r(468,T))}F[Kt]=u,et(F),T=F}u.stateNode=T}else W9(I,u.type,u.stateNode);else u.stateNode=V9(I,T,u.memoizedProps);else F!==T?(F===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):F.count--,T===null?W9(I,u.type,u.stateNode):V9(I,T,u.memoizedProps)):T===null&&u.stateNode!==null&&ko(u,u.memoizedProps,y.memoizedProps)}break;case 27:Ro(h,u),Do(u),T&512&&(Yi||y===null||oa(y,y.return)),y!==null&&T&4&&ko(u,u.memoizedProps,y.memoizedProps);break;case 5:if(Ro(h,u),Do(u),T&512&&(Yi||y===null||oa(y,y.return)),u.flags&32){I=u.stateNode;try{Is(I,"")}catch(zn){ui(u,u.return,zn)}}T&4&&u.stateNode!=null&&(I=u.memoizedProps,ko(u,I,y!==null?y.memoizedProps:I)),T&1024&&(Kc=!0);break;case 6:if(Ro(h,u),Do(u),T&4){if(u.stateNode===null)throw Error(r(162));T=u.memoizedProps,y=u.stateNode;try{y.nodeValue=T}catch(zn){ui(u,u.return,zn)}}break;case 3:if(n4=null,I=bc,bc=e4(h.containerInfo),Ro(h,u),bc=I,Do(u),T&4&&y!==null&&y.memoizedState.isDehydrated)try{jv(h.containerInfo)}catch(zn){ui(u,u.return,zn)}Kc&&(Kc=!1,kv(u));break;case 4:T=bc,bc=e4(u.stateNode.containerInfo),Ro(h,u),Do(u),bc=T;break;case 12:Ro(h,u),Do(u);break;case 31:Ro(h,u),Do(u),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,zd(u,T)));break;case 13:Ro(h,u),Do(u),u.child.flags&8192&&u.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(am=Z()),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,zd(u,T)));break;case 22:I=u.memoizedState!==null;var at=y!==null&&y.memoizedState!==null,Et=vc,Wt=Yi;if(vc=Et||I,Yi=Wt||at,Ro(h,u),Yi=Wt,vc=Et,Do(u),T&8192)e:for(h=u.stateNode,h._visibility=I?h._visibility&-2:h._visibility|1,I&&(y===null||at||vc||Yi||Hu(u)),y=null,h=u;;){if(h.tag===5||h.tag===26){if(y===null){at=y=h;try{if(F=at.stateNode,I)me=F.style,typeof me.setProperty=="function"?me.setProperty("display","none","important"):me.display="none";else{je=at.stateNode;var Zt=at.memoizedProps.style,kt=Zt!=null&&Zt.hasOwnProperty("display")?Zt.display:null;je.style.display=kt==null||typeof kt=="boolean"?"":(""+kt).trim()}}catch(zn){ui(at,at.return,zn)}}}else if(h.tag===6){if(y===null){at=h;try{at.stateNode.nodeValue=I?"":at.memoizedProps}catch(zn){ui(at,at.return,zn)}}}else if(h.tag===18){if(y===null){at=h;try{var zt=at.stateNode;I?I9(zt,!0):I9(at.stateNode,!1)}catch(zn){ui(at,at.return,zn)}}}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,zd(u,y))));break;case 19:Ro(h,u),Do(u),T&4&&(T=u.updateQueue,T!==null&&(u.updateQueue=null,zd(u,T)));break;case 30:break;case 21:break;default:Ro(h,u),Do(u)}}function Do(u){var h=u.flags;if(h&2){try{for(var y,T=u.return;T!==null;){if(fs(T)){y=T;break}T=T.return}if(y==null)throw Error(r(160));switch(y.tag){case 27:var I=y.stateNode,F=qr(u);Fa(u,F,I);break;case 5:var me=y.stateNode;y.flags&32&&(Is(me,""),y.flags&=-33);var je=qr(u);Fa(u,je,me);break;case 3:case 4:var at=y.stateNode.containerInfo,Et=qr(u);Bu(u,Et,at);break;default:throw Error(r(161))}}catch(Wt){ui(u,u.return,Wt)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function kv(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var h=u;kv(h),h.tag===5&&h.flags&1024&&h.stateNode.reset(),u=u.sibling}}function _c(u,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)hs(u,h.alternate,h),h=h.sibling}function Hu(u){for(u=u.child;u!==null;){var h=u;switch(h.tag){case 0:case 11:case 14:case 15:sa(4,h,h.return),Hu(h);break;case 1:oa(h,h.return);var y=h.stateNode;typeof y.componentWillUnmount=="function"&&Go(h,h.return,y),Hu(h);break;case 27:t_(h.stateNode);case 26:case 5:oa(h,h.return),Hu(h);break;case 22:h.memoizedState===null&&Hu(h);break;case 30:Hu(h);break;default:Hu(h)}u=u.sibling}}function Ua(u,h,y){for(y=y&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var T=h.alternate,I=u,F=h,me=F.flags;switch(F.tag){case 0:case 11:case 15:Ua(I,F,y),xc(4,F);break;case 1:if(Ua(I,F,y),T=F,I=T.stateNode,typeof I.componentDidMount=="function")try{I.componentDidMount()}catch(Et){ui(T,T.return,Et)}if(T=F,I=T.updateQueue,I!==null){var je=T.stateNode;try{var at=I.shared.hiddenCallbacks;if(at!==null)for(I.shared.hiddenCallbacks=null,I=0;I<at.length;I++)em(at[I],je)}catch(Et){ui(T,T.return,Et)}}y&&me&64&&Yc(F),jd(F,F.return);break;case 27:Av(F);case 26:case 5:Ua(I,F,y),y&&T===null&&me&4&&gg(F),jd(F,F.return);break;case 12:Ua(I,F,y);break;case 31:Ua(I,F,y),y&&me&4&&Ef(I,F);break;case 13:Ua(I,F,y),y&&me&4&&om(I,F);break;case 22:F.memoizedState===null&&Ua(I,F,y),jd(F,F.return);break;case 30:break;default:Ua(I,F,y)}h=h.sibling}}function Nf(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&&kh(y))}function Gh(u,h){u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&kh(u))}function aa(u,h,y,T){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)Kb(u,h,y,T),h=h.sibling}function Kb(u,h,y,T){var I=h.flags;switch(h.tag){case 0:case 11:case 15:aa(u,h,y,T),I&2048&&xc(9,h);break;case 1:aa(u,h,y,T);break;case 3:aa(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&&kh(u)));break;case 12:if(I&2048){aa(u,h,y,T),u=h.stateNode;try{var F=h.memoizedProps,me=F.id,je=F.onPostCommit;typeof je=="function"&&je(me,h.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(at){ui(h,h.return,at)}}else aa(u,h,y,T);break;case 31:aa(u,h,y,T);break;case 13:aa(u,h,y,T);break;case 23:break;case 22:F=h.stateNode,me=h.alternate,h.memoizedState!==null?F._visibility&2?aa(u,h,y,T):Vu(u,h):F._visibility&2?aa(u,h,y,T):(F._visibility|=2,la(u,h,y,T,(h.subtreeFlags&10256)!==0||!1)),I&2048&&Nf(me,h);break;case 24:aa(u,h,y,T),I&2048&&Gh(h.alternate,h);break;default:aa(u,h,y,T)}}function la(u,h,y,T,I){for(I=I&&((h.subtreeFlags&10256)!==0||!1),h=h.child;h!==null;){var F=u,me=h,je=y,at=T,Et=me.flags;switch(me.tag){case 0:case 11:case 15:la(F,me,je,at,I),xc(8,me);break;case 23:break;case 22:var Wt=me.stateNode;me.memoizedState!==null?Wt._visibility&2?la(F,me,je,at,I):Vu(F,me):(Wt._visibility|=2,la(F,me,je,at,I)),I&&Et&2048&&Nf(me.alternate,me);break;case 24:la(F,me,je,at,I),I&&Et&2048&&Gh(me.alternate,me);break;default:la(F,me,je,at,I)}h=h.sibling}}function Vu(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:Vu(y,T),I&2048&&Nf(T.alternate,T);break;case 24:Vu(y,T),I&2048&&Gh(T.alternate,T);break;default:Vu(y,T)}h=h.sibling}}var Wh=8192;function Il(u,h,y){if(u.subtreeFlags&Wh)for(u=u.child;u!==null;)Rv(u,h,y),u=u.sibling}function Rv(u,h,y){switch(u.tag){case 26:Il(u,h,y),u.flags&Wh&&u.memoizedState!==null&&kQ(y,bc,u.memoizedState,u.memoizedProps);break;case 5:Il(u,h,y);break;case 3:case 4:var T=bc;bc=e4(u.stateNode.containerInfo),Il(u,h,y),bc=T;break;case 22:u.memoizedState===null&&(T=u.alternate,T!==null&&T.memoizedState!==null?(T=Wh,Wh=16777216,Il(u,h,y),Wh=T):Il(u,h,y));break;default:Il(u,h,y)}}function $h(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 kf(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];Wo=T,Us(T,u)}$h(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:kf(u),u.flags&2048&&sa(9,u,u.return);break;case 3:kf(u);break;case 12:kf(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)):kf(u);break;default:kf(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];Wo=T,Us(T,u)}$h(u)}for(u=u.child;u!==null;){switch(h=u,h.tag){case 0:case 11:case 15:sa(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 Us(u,h){for(;Wo!==null;){var y=Wo;switch(y.tag){case 0:case 11:case 15:sa(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:kh(y.memoizedState.cache)}if(T=y.child,T!==null)T.return=y,Wo=T;else e:for(y=u;Wo!==null;){T=Wo;var I=T.sibling,F=T.return;if(xg(T),T===y){Wo=null;break e}if(I!==null){I.return=F,Wo=I;break e}Wo=F}}}var Fd={getCacheForType:function(u){var h=cr(go),y=h.data.get(u);return y===void 0&&(y=u(),h.data.set(u,y)),y},cacheSignal:function(){return cr(go).controller.signal}},Tr=typeof WeakMap=="function"?WeakMap:Map,Vn=0,mr=null,Pr=null,Nr=0,ei=0,wa=null,Sc=!1,Zc=!1,Zb=!1,Ol=0,Es=0,Gu=0,Rf=0,vg=0,Ba=0,es=0,qh=null,Bs=null,Hs=!1,am=0,Qb=0,to=1/0,As=null,no=null,Ni=0,Ll=null,lm=null,wc=0,cm=0,um=null,yg=null,Df=0,Xh=null;function jl(){return(Vn&2)!==0&&Nr!==0?Nr&-Nr:q.T!==null?Ot():Ut()}function Br(){if(Ba===0)if((Nr&536870912)===0||Zr){var u=it;it<<=1,(it&3932160)===0&&(it=262144),Ba=u}else Ba=536870912;return u=il.current,u!==null&&(u.flags|=32),Ba}function Ir(u,h,y){(u===mr&&(ei===2||ei===9)||u.cancelPendingCommit!==null)&&(If(u,0),vo(u,Nr,Ba,!1)),ot(u,y),((Vn&2)===0||u!==mr)&&(u===mr&&((Vn&2)===0&&(Rf|=y),Es===4&&vo(u,Nr,Ba,!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||Ae(u,h),I=T?bg(u,h):Ha(u,h,!0),F=T;do{if(I===0){Zc&&!T&&vo(u,h,0,!1);break}else{if(y=u.current.alternate,F&&!ki(y)){I=Ha(u,h,!1),F=!1;continue}if(I===2){if(F=h,u.errorRecoveryDisabledLanes&F)var me=0;else me=u.pendingLanes&-536870913,me=me!==0?me:me&536870912?536870912:0;if(me!==0){h=me;e:{var je=u;I=qh;var at=je.current.memoizedState.isDehydrated;if(at&&(If(je,me).flags|=256),me=Ha(je,me,!1),me!==2){if(Zb&&!at){je.errorRecoveryDisabledLanes|=F,Rf|=F,I=4;break e}F=Bs,Bs=I,F!==null&&(Bs===null?Bs=F:Bs.push.apply(Bs,F))}I=me}if(F=!1,I!==2)continue}}if(I===1){If(u,0),vo(u,h,0,!0);break}e:{switch(T=u,F=I,F){case 0:case 1:throw Error(r(345));case 4:if((h&4194048)!==h)break;case 6:vo(T,h,Ba,!Sc);break e;case 2:Bs=null;break;case 3:case 5:break;default:throw Error(r(329))}if((h&62914560)===h&&(I=am+300-Z(),10<I)){if(vo(T,h,Ba,!Sc),Qe(T,0,!0)!==0)break e;wc=h,T.timeoutHandle=R9(Xr.bind(null,T,y,Bs,As,Hs,h,Ba,Rf,es,Sc,F,"Throttled",-0,0),I);break e}Xr(T,y,Bs,As,Hs,h,Ba,Rf,es,Sc,F,null,-0,0)}}break}while(!0);on(u)}function Xr(u,h,y,T,I,F,me,je,at,Et,Wt,Zt,kt,zt){if(u.timeoutHandle=-1,Zt=h.subtreeFlags,Zt&8192||(Zt&16785408)===16785408){Zt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Os},Rv(h,F,Zt);var zn=(F&62914560)===F?am-Z():(F&4194048)===F?Qb-Z():0;if(zn=RQ(Zt,zn),zn!==null){wc=F,u.cancelPendingCommit=zn(Bd.bind(null,u,h,F,y,T,I,me,je,at,Wt,Zt,null,kt,zt)),vo(u,F,me,!Et);return}}Bd(u,h,F,y,T,I,me,je,at)}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],F=I.getSnapshot;I=I.value;try{if(!lr(F(),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 vo(u,h,y,T){h&=~vg,h&=~Rf,u.suspendedLanes|=h,u.pingedLanes&=~h,T&&(u.warmLanes|=h),T=u.expirationTimes;for(var I=h;0<I;){var F=31-be(I),me=1<<F;T[F]=-1,I&=~me}y!==0&&Nt(u,y,h)}function Qc(){return(Vn&6)===0?(Rn(0),!1):!0}function Pf(){if(Pr!==null){if(ei===0)var u=Pr.return;else u=Pr,Iu=yf=null,_b(u),Oh=null,Lh=0,u=Pr;for(;u!==null;)Pl(u.alternate,u),u=u.return;Pr=null}}function If(u,h){var y=u.timeoutHandle;y!==-1&&(u.timeoutHandle=-1,hQ(y)),y=u.cancelPendingCommit,y!==null&&(u.cancelPendingCommit=null,y()),wc=0,Pf(),mr=u,Pr=y=tl(u.current,null),Nr=h,ei=0,wa=null,Sc=!1,Zc=Ae(u,h),Zb=!1,es=Ba=vg=Rf=Gu=Es=0,Bs=qh=null,Hs=!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-be(T),F=1<<I;h|=u[I],T&=~F}return Ol=h,J0(),y}function Wu(u,h){Mr=null,q.H=im,h===Rh||h===Dr?(h=Ph(),ei=3):h===rg?(h=Ph(),ei=4):ei=h===yv?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,wa=h,Pr===null&&(Es=1,vv(u,Nl(h,u.current)))}function Ns(){var u=il.current;return u===null?!0:(Nr&4194048)===Nr?za===null:(Nr&62914560)===Nr||(Nr&536870912)!==0?u===za:!1}function Ud(){var u=q.H;return q.H=im,u===null?im:u}function Of(){var u=q.A;return q.A=Fd,u}function dm(){Es=4,Sc||(Nr&4194048)!==Nr&&il.current!==null||(Zc=!0),(Gu&134217727)===0&&(Rf&134217727)===0||mr===null||vo(mr,Nr,Ba,!1)}function Ha(u,h,y){var T=Vn;Vn|=2;var I=Ud(),F=Of();(mr!==u||Nr!==h)&&(As=null,If(u,h)),h=!1;var me=Es;e:do try{if(ei!==0&&Pr!==null){var je=Pr,at=wa;switch(ei){case 8:Pf(),me=6;break e;case 3:case 2:case 9:case 6:il.current===null&&(h=!0);var Et=ei;if(ei=0,wa=null,Yh(u,je,at,Et),y&&Zc){me=0;break e}break;default:Et=ei,ei=0,wa=null,Yh(u,je,at,Et)}}fm(),me=Es;break}catch(Wt){Wu(u,Wt)}while(!0);return h&&u.shellSuspendCounter++,Iu=yf=null,Vn=T,q.H=I,q.A=F,Pr===null&&(mr=null,Nr=0,J0()),me}function fm(){for(;Pr!==null;)Dv(Pr)}function bg(u,h){var y=Vn;Vn|=2;var T=Ud(),I=Of();mr!==u||Nr!==h?(As=null,to=Z()+500,If(u,h)):Zc=Ae(u,h);e:do try{if(ei!==0&&Pr!==null){h=Pr;var F=wa;t:switch(ei){case 1:ei=0,wa=null,Yh(u,h,F,1);break;case 2:case 9:if(rl(F)){ei=0,wa=null,_g(h);break}h=function(){ei!==2&&ei!==9||mr!==u||(ei=7),on(u)},F.then(h,h);break e;case 3:ei=7;break e;case 4:ei=5;break e;case 7:rl(F)?(ei=0,wa=null,_g(h)):(ei=0,wa=null,Yh(u,h,F,7));break;case 5:var me=null;switch(Pr.tag){case 26:me=Pr.memoizedState;case 5:case 27:var je=Pr;if(me?$9(me):je.stateNode.complete){ei=0,wa=null;var at=je.sibling;if(at!==null)Pr=at;else{var Et=je.return;Et!==null?(Pr=Et,Lf(Et)):Pr=null}break t}}ei=0,wa=null,Yh(u,h,F,5);break;case 6:ei=0,wa=null,Yh(u,h,F,6);break;case 8:Pf(),Es=6;break e;default:throw Error(r(462))}}ul();break}catch(Wt){Wu(u,Wt)}while(!0);return Iu=yf=null,q.H=T,q.A=I,Vn=y,Pr!==null?0:(mr=null,Nr=0,J0(),Es)}function ul(){for(;Pr!==null&&!Ge();)Dv(Pr)}function Dv(u){var h=Ev(u.alternate,u,Ol);u.memoizedProps=u.pendingProps,h===null?Lf(u):Pr=h}function _g(u){var h=u,y=h.alternate;switch(h.tag){case 15:case 0:h=fg(y,h,h.pendingProps,h.type,void 0,Nr);break;case 11:h=fg(y,h,h.pendingProps,h.type.render,h.ref,Nr);break;case 5:_b(h);default:Pl(y,h),h=Pr=Gp(h,Ol),h=Ev(y,h,Ol)}u.memoizedProps=u.pendingProps,h===null?Lf(u):Pr=h}function Yh(u,h,y,T){Iu=yf=null,_b(h),Oh=null,Lh=0;var I=h.return;try{if(No(u,I,h,y,Nr)){Es=1,vv(u,Nl(y,u.current)),Pr=null;return}}catch(F){if(I!==null)throw Pr=I,F;Es=1,vv(u,Nl(y,u.current)),Pr=null;return}h.flags&32768?(Zr||T===1?u=!0:Zc||(Nr&536870912)!==0?u=!1:(Sc=u=!0,(T===2||T===9||T===3||T===6)&&(T=il.current,T!==null&&T.tag===13&&(T.flags|=16384))),Sg(h,u)):Lf(h)}function Lf(u){var h=u;do{if((h.flags&32768)!==0){Sg(h,Sc);return}u=h.return;var y=mg(h.alternate,h,Ol);if(y!==null){Pr=y;return}if(h=h.sibling,h!==null){Pr=h;return}Pr=h=u}while(h!==null);Es===0&&(Es=5)}function Sg(u,h){do{var y=gc(u.alternate,u);if(y!==null){y.flags&=32767,Pr=y;return}if(y=u.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!h&&(u=u.sibling,u!==null)){Pr=u;return}Pr=u=y}while(u!==null);Es=6,Pr=null}function Bd(u,h,y,T,I,F,me,je,at){u.cancelPendingCommit=null;do hm();while(Ni!==0);if((Vn&6)!==0)throw Error(r(327));if(h!==null){if(h===u.current)throw Error(r(177));if(F=h.lanes|h.childLanes,F|=Bo,dt(u,y,F,me,je,at),u===mr&&(Pr=mr=null,Nr=0),lm=h,Ll=u,wc=y,cm=F,um=I,yg=T,(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,$(ve,function(){return Pv(),null})):(u.callbackNode=null,u.callbackPriority=0),T=(h.flags&13878)!==0,(h.subtreeFlags&13878)!==0||T){T=q.T,q.T=null,I=J.p,J.p=2,me=Vn,Vn|=4;try{kE(u,h,y)}finally{Vn=me,J.p=I,q.T=T}}Ni=1,yo(),Hd(),Kh()}}function yo(){if(Ni===1){Ni=0;var u=Ll,h=lm,y=(h.flags&13878)!==0;if((h.subtreeFlags&13878)!==0||y){y=q.T,q.T=null;var T=J.p;J.p=2;var I=Vn;Vn|=4;try{Af(h,u);var F=jE,me=Ji(u.containerInfo),je=F.focusedElem,at=F.selectionRange;if(me!==je&&je&&je.ownerDocument&&Qn(je.ownerDocument.documentElement,je)){if(at!==null&&js(je)){var Et=at.start,Wt=at.end;if(Wt===void 0&&(Wt=Et),"selectionStart"in je)je.selectionStart=Et,je.selectionEnd=Math.min(Wt,je.value.length);else{var Zt=je.ownerDocument||document,kt=Zt&&Zt.defaultView||window;if(kt.getSelection){var zt=kt.getSelection(),zn=je.textContent.length,or=Math.min(at.start,zn),Zi=at.end===void 0?or:Math.min(at.end,zn);!zt.extend&&or>Zi&&(me=Zi,Zi=or,or=me);var wt=Ln(je,or),pt=Ln(je,Zi);if(wt&&pt&&(zt.rangeCount!==1||zt.anchorNode!==wt.node||zt.anchorOffset!==wt.offset||zt.focusNode!==pt.node||zt.focusOffset!==pt.offset)){var Ct=Zt.createRange();Ct.setStart(wt.node,wt.offset),zt.removeAllRanges(),or>Zi?(zt.addRange(Ct),zt.extend(pt.node,pt.offset)):(Ct.setEnd(pt.node,pt.offset),zt.addRange(Ct))}}}}for(Zt=[],zt=je;zt=zt.parentNode;)zt.nodeType===1&&Zt.push({element:zt,left:zt.scrollLeft,top:zt.scrollTop});for(typeof je.focus=="function"&&je.focus(),je=0;je<Zt.length;je++){var Yt=Zt[je];Yt.element.scrollLeft=Yt.left,Yt.element.scrollTop=Yt.top}}o4=!!LE,jE=LE=null}finally{Vn=I,J.p=T,q.T=y}}u.current=h,Ni=2}}function Hd(){if(Ni===2){Ni=0;var u=Ll,h=lm,y=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||y){y=q.T,q.T=null;var T=J.p;J.p=2;var I=Vn;Vn|=4;try{hs(u,h.alternate,h)}finally{Vn=I,J.p=T,q.T=y}}Ni=3}}function Kh(){if(Ni===4||Ni===3){Ni=0,ae();var u=Ll,h=lm,y=wc,T=yg;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?Ni=5:(Ni=0,lm=Ll=null,$u(u,u.pendingLanes));var I=u.pendingLanes;if(I===0&&(no=null),rn(y),h=h.stateNode,nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(Je,h,void 0,(h.current.flags&128)===128)}catch{}if(T!==null){h=q.T,I=J.p,J.p=2,q.T=null;try{for(var F=u.onRecoverableError,me=0;me<T.length;me++){var je=T[me];F(je.value,{componentStack:je.stack})}}finally{q.T=h,J.p=I}}(wc&3)!==0&&hm(),on(u),I=u.pendingLanes,(y&261930)!==0&&(I&42)!==0?u===Xh?Df++:(Df=0,Xh=u):Df=0,Rn(0)}}function $u(u,h){(u.pooledCacheLanes&=h)===0&&(h=u.pooledCache,h!=null&&(u.pooledCache=null,kh(h)))}function hm(){return yo(),Hd(),Kh(),Pv()}function Pv(){if(Ni!==5)return!1;var u=Ll,h=cm;cm=0;var y=rn(wc),T=q.T,I=J.p;try{J.p=32>y?32:y,q.T=null,y=um,um=null;var F=Ll,me=wc;if(Ni=0,lm=Ll=null,wc=0,(Vn&6)!==0)throw Error(r(331));var je=Vn;if(Vn|=4,ll(F.current),Kb(F,F.current,me,y),Vn=je,Rn(0,!1),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(Je,F)}catch{}return!0}finally{J.p=I,q.T=T,$u(u,h)}}function Jb(u,h,y){h=Nl(y,h),h=Vb(u.stateNode,h,2),u=Sf(u,h,2),u!==null&&(ot(u,2),on(u))}function ui(u,h,y){if(u.tag===3)Jb(u,u,y);else for(;h!==null;){if(h.tag===3){Jb(h,u,y);break}else if(h.tag===1){var T=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof T.componentDidCatch=="function"&&(no===null||!no.has(T))){u=Nl(y,u),y=Gb(2),T=Sf(h,y,2),T!==null&&(W3(y,T,h,u),ot(T,2),on(T));break}}h=h.return}}function wg(u,h,y){var T=u.pingCache;if(T===null){T=u.pingCache=new Tr;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)||(Zb=!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,mr===u&&(Nr&y)===y&&(Es===4||Es===3&&(Nr&62914560)===Nr&&300>Z()-am?(Vn&2)===0&&If(u,0):vg|=y,es===Nr&&(es=0)),on(u)}function v(u,h){h===0&&(h=Re()),u=La(u,h),u!==null&&(ot(u,h),on(u))}function E(u){var h=u.memoizedState,y=0;h!==null&&(y=h.retryLane),v(u,y)}function D(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 $(u,h){return He(u,h)}var re=null,Ie=null,ct=!1,jt=!1,tn=!1,yn=0;function on(u){u!==Ie&&u.next===null&&(Ie===null?re=Ie=u:Ie=Ie.next=u),jt=!0,ct||(ct=!0,Mt())}function Rn(u,h){if(!tn&&jt){tn=!0;do for(var y=!1,T=re;T!==null;){if(u!==0){var I=T.pendingLanes;if(I===0)var F=0;else{var me=T.suspendedLanes,je=T.pingedLanes;F=(1<<31-be(42|u)+1)-1,F&=I&~(me&~je),F=F&201326741?F&201326741|1:F?F|2:0}F!==0&&(y=!0,At(T,F))}else F=Nr,F=Qe(T,T===mr?F:0,T.cancelPendingCommit!==null||T.timeoutHandle!==-1),(F&3)===0||Ae(T,F)||(y=!0,At(T,F));T=T.next}while(y);tn=!1}}function yr(){ro()}function ro(){jt=ct=!1;var u=0;yn!==0&&fQ()&&(u=yn);for(var h=Z(),y=null,T=re;T!==null;){var I=T.next,F=pm(T,h);F===0?(T.next=null,y===null?re=I:y.next=I,I===null&&(Ie=y)):(y=T,(u!==0||(F&3)!==0)&&(jt=!0)),T=I}Ni!==0&&Ni!==5||Rn(u),yn!==0&&(yn=0)}function pm(u,h){for(var y=u.suspendedLanes,T=u.pingedLanes,I=u.expirationTimes,F=u.pendingLanes&-62914561;0<F;){var me=31-be(F),je=1<<me,at=I[me];at===-1?((je&y)===0||(je&T)!==0)&&(I[me]=Xe(je,h)):at<=h&&(u.expiredLanes|=je),F&=~je}if(h=mr,y=Nr,y=Qe(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&&ze(T),u.callbackNode=null,u.callbackPriority=0;if((y&3)===0||Ae(u,y)){if(h=y&-y,h===u.callbackPriority)return h;switch(T!==null&&ze(T),rn(y)){case 2:case 8:y=_e;break;case 32:y=ve;break;case 268435456:y=Se;break;default:y=ve}return T=jf.bind(null,u),y=He(y,T),u.callbackPriority=h,u.callbackNode=y,h}return T!==null&&T!==null&&ze(T),u.callbackPriority=2,u.callbackNode=null,2}function jf(u,h){if(Ni!==0&&Ni!==5)return u.callbackNode=null,u.callbackPriority=0,null;var y=u.callbackNode;if(hm()&&u.callbackNode!==y)return null;var T=Nr;return T=Qe(u,u===mr?T:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),T===0?null:(Hr(u,T,h),pm(u,Z()),u.callbackNode!=null&&u.callbackNode===y?jf.bind(null,u):null)}function At(u,h){if(hm())return null;Hr(u,h,!0)}function Mt(){pQ(function(){(Vn&6)!==0?He(we,yr):ro()})}function Ot(){if(yn===0){var u=Rd;u===0&&(u=Ye,Ye<<=1,(Ye&261888)===0&&(Ye=256)),yn=u}return yn}function gn(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:ya(""+u)}function Jn(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 ks(u,h,y,T,I){if(h==="submit"&&y&&y.stateNode===I){var F=gn((I[dn]||null).action),me=T.submitter;me&&(h=(h=me[dn]||null)?gn(h.formAction):me.getAttribute("formAction"),h!==null&&(F=h,me=null));var je=new zi("action","action",null,T,I);u.push({event:je,listeners:[{instance:null,listener:function(){if(T.defaultPrevented){if(yn!==0){var at=me?Jn(I,me):new FormData(I);Ob(y,{pending:!0,data:at,method:I.method,action:F},null,at)}}else typeof F=="function"&&(je.preventDefault(),at=me?Jn(I,me):new FormData(I),Ob(y,{pending:!0,data:at,method:I.method,action:F},F,at))},currentTarget:I}]})}}for(var nr=0;nr<Z0.length;nr++){var si=Z0[nr],$o=si.toLowerCase(),mi=si[0].toUpperCase()+si.slice(1);cc($o,"on"+mi)}cc(mo,"onAnimationEnd"),cc(Eo,"onAnimationIteration"),cc(qc,"onAnimationStart"),cc("dblclick","onDoubleClick"),cc("focusin","onFocus"),cc("focusout","onBlur"),cc(Uo,"onTransitionRun"),cc($x,"onTransitionStart"),cc(t3,"onTransitionCancel"),cc(ob,"onTransitionEnd"),qt("onMouseEnter",["mouseout","mouseover"]),qt("onMouseLeave",["mouseout","mouseover"]),qt("onPointerEnter",["pointerout","pointerover"]),qt("onPointerLeave",["pointerout","pointerover"]),ut("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ut("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ut("onBeforeInput",["compositionend","keypress","textInput","paste"]),ut("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ut("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ut("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mc="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(" "),RE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Mc));function w9(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 F=void 0;if(h)for(var me=T.length-1;0<=me;me--){var je=T[me],at=je.instance,Et=je.currentTarget;if(je=je.listener,at!==F&&I.isPropagationStopped())break e;F=je,I.currentTarget=Et;try{F(I)}catch(Wt){Q0(Wt)}I.currentTarget=null,F=at}else for(me=0;me<T.length;me++){if(je=T[me],at=je.instance,Et=je.currentTarget,je=je.listener,at!==F&&I.isPropagationStopped())break e;F=je,I.currentTarget=Et;try{F(I)}catch(Wt){Q0(Wt)}I.currentTarget=null,F=at}}}}function ti(u,h){var y=h[Pt];y===void 0&&(y=h[Pt]=new Set);var T=u+"__bubble";y.has(T)||(M9(h,u,2,!1),y.add(T))}function DE(u,h,y){var T=0;h&&(T|=4),M9(y,u,T,h)}var Z3="_reactListening"+Math.random().toString(36).slice(2);function PE(u){if(!u[Z3]){u[Z3]=!0,xt.forEach(function(y){y!=="selectionchange"&&(RE.has(y)||DE(y,!1,u),DE(y,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[Z3]||(h[Z3]=!0,DE("selectionchange",!1,h))}}function M9(u,h,y,T){switch(J9(h)){case 2:var I=IQ;break;case 8:I=OQ;break;default:I=XE}y=I.bind(null,h,y,u),I=void 0,!jo||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 IE(u,h,y,T,I){var F=T;if((h&1)===0&&(h&2)===0&&T!==null)e:for(;;){if(T===null)return;var me=T.tag;if(me===3||me===4){var je=T.stateNode.containerInfo;if(je===I)break;if(me===4)for(me=T.return;me!==null;){var at=me.tag;if((at===3||at===4)&&me.stateNode.containerInfo===I)return;me=me.return}for(;je!==null;){if(me=_t(je),me===null)return;if(at=me.tag,at===5||at===6||at===26||at===27){T=F=me;continue e}je=je.parentNode}}T=T.return}rc(function(){var Et=F,Wt=Qa(y),Zt=[];e:{var kt=lc.get(u);if(kt!==void 0){var zt=zi,zn=u;switch(u){case"keypress":if(ii(y)===0)break e;case"keydown":case"keyup":zt=Sd;break;case"focusin":zn="focus",zt=ba;break;case"focusout":zn="blur",zt=ba;break;case"beforeblur":case"afterblur":zt=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":zt=Eh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":zt=bd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":zt=G0;break;case mo:case Eo:case qc:zt=Ys;break;case ob:zt=W0;break;case"scroll":case"scrollend":zt=Ia;break;case"wheel":zt=$0;break;case"copy":case"cut":case"paste":zt=Al;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":zt=oc;break;case"toggle":case"beforetoggle":zt=X0}var or=(h&4)!==0,Zi=!or&&(u==="scroll"||u==="scrollend"),wt=or?kt!==null?kt+"Capture":null:kt;or=[];for(var pt=Et,Ct;pt!==null;){var Yt=pt;if(Ct=Yt.stateNode,Yt=Yt.tag,Yt!==5&&Yt!==26&&Yt!==27||Ct===null||wt===null||(Yt=na(pt,wt),Yt!=null&&or.push(e_(pt,Yt,Ct))),Zi)break;pt=pt.return}0<or.length&&(kt=new zt(kt,zn,null,y,Wt),Zt.push({event:kt,listeners:or}))}}if((h&7)===0){e:{if(kt=u==="mouseover"||u==="pointerover",zt=u==="mouseout"||u==="pointerout",kt&&y!==nc&&(zn=y.relatedTarget||y.fromElement)&&(_t(zn)||zn[Rt]))break e;if((zt||kt)&&(kt=Wt.window===Wt?Wt:(kt=Wt.ownerDocument)?kt.defaultView||kt.parentWindow:window,zt?(zn=y.relatedTarget||y.toElement,zt=Et,zn=zn?_t(zn):null,zn!==null&&(Zi=s(zn),or=zn.tag,zn!==Zi||or!==5&&or!==27&&or!==6)&&(zn=null)):(zt=null,zn=Et),zt!==zn)){if(or=Eh,Yt="onMouseLeave",wt="onMouseEnter",pt="mouse",(u==="pointerout"||u==="pointerover")&&(or=oc,Yt="onPointerLeave",wt="onPointerEnter",pt="pointer"),Zi=zt==null?kt:vn(zt),Ct=zn==null?kt:vn(zn),kt=new or(Yt,pt+"leave",zt,y,Wt),kt.target=Zi,kt.relatedTarget=Ct,Yt=null,_t(Wt)===Et&&(or=new or(wt,pt+"enter",zn,y,Wt),or.target=Ct,or.relatedTarget=Zi,Yt=or),Zi=Yt,zt&&zn)t:{for(or=aQ,wt=zt,pt=zn,Ct=0,Yt=wt;Yt;Yt=or(Yt))Ct++;Yt=0;for(var Zn=pt;Zn;Zn=or(Zn))Yt++;for(;0<Ct-Yt;)wt=or(wt),Ct--;for(;0<Yt-Ct;)pt=or(pt),Yt--;for(;Ct--;){if(wt===pt||pt!==null&&wt===pt.alternate){or=wt;break t}wt=or(wt),pt=or(pt)}or=null}else or=null;zt!==null&&T9(Zt,kt,zt,or,!1),zn!==null&&Zi!==null&&T9(Zt,Zi,zn,or,!0)}}e:{if(kt=Et?vn(Et):window,zt=kt.nodeName&&kt.nodeName.toLowerCase(),zt==="select"||zt==="input"&&kt.type==="file")var Mi=$e;else if(Cd(kt))if(Ke)Mi=ar;else{Mi=An;var Hn=Cn}else zt=kt.nodeName,!zt||zt.toLowerCase()!=="input"||kt.type!=="checkbox"&&kt.type!=="radio"?Et&&Ra(Et.elementType)&&(Mi=$e):Mi=Pn;if(Mi&&(Mi=Mi(u,Et))){Vp(Zt,Mi,y,Wt);break e}Hn&&Hn(u,kt,Et),u==="focusout"&&Et&&kt.type==="number"&&Et.memoizedProps.value!=null&&Li(kt,"number",kt.value)}switch(Hn=Et?vn(Et):window,u){case"focusin":(Cd(Hn)||Hn.contentEditable==="true")&&(ci=Hn,cs=Et,zs=null);break;case"focusout":zs=cs=ci=null;break;case"mousedown":ia=!0;break;case"contextmenu":case"mouseup":case"dragend":ia=!1,zo(Zt,y,Wt);break;case"selectionchange":if(xi)break;case"keydown":case"keyup":zo(Zt,y,Wt)}var zr;if(Cu)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 Eu?Td(u,y)&&(oi="onCompositionEnd"):u==="keydown"&&y.keyCode===229&&(oi="onCompositionStart");oi&&(Bp&&y.locale!=="ko"&&(Eu||oi!=="onCompositionStart"?oi==="onCompositionEnd"&&Eu&&(zr=Wc()):(_s=Wt,Ja="value"in _s?_s.value:_s.textContent,Eu=!0)),Hn=Q3(Et,oi),0<Hn.length&&(oi=new Lp(oi,u,null,y,Wt),Zt.push({event:oi,listeners:Hn}),zr?oi.data=zr:(zr=Ls(y),zr!==null&&(oi.data=zr)))),(zr=Up?ws(u,y):Hp(u,y))&&(oi=Q3(Et,"onBeforeInput"),0<oi.length&&(Hn=new Lp("onBeforeInput","beforeinput",null,y,Wt),Zt.push({event:Hn,listeners:oi}),Hn.data=zr)),ks(Zt,u,Et,y,Wt)}w9(Zt,h)})}function e_(u,h,y){return{instance:u,listener:h,currentTarget:y}}function Q3(u,h){for(var y=h+"Capture",T=[];u!==null;){var I=u,F=I.stateNode;if(I=I.tag,I!==5&&I!==26&&I!==27||F===null||(I=na(u,y),I!=null&&T.unshift(e_(u,I,F)),I=na(u,h),I!=null&&T.push(e_(u,I,F))),u.tag===3)return T;u=u.return}return[]}function aQ(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function T9(u,h,y,T,I){for(var F=h._reactName,me=[];y!==null&&y!==T;){var je=y,at=je.alternate,Et=je.stateNode;if(je=je.tag,at!==null&&at===T)break;je!==5&&je!==26&&je!==27||Et===null||(at=Et,I?(Et=na(y,F),Et!=null&&me.unshift(e_(y,Et,at))):I||(Et=na(y,F),Et!=null&&me.push(e_(y,Et,at)))),y=y.return}me.length!==0&&u.push({event:h,listeners:me})}var lQ=/\r\n?/g,cQ=/\u0000|\uFFFD/g;function C9(u){return(typeof u=="string"?u:""+u).replace(lQ,`
`).replace(cQ,"")}function E9(u,h){return h=C9(h),C9(u)===h}function Ki(u,h,y,T,I,F){switch(y){case"children":typeof T=="string"?h==="body"||h==="textarea"&&T===""||Is(u,T):(typeof T=="number"||typeof T=="bigint")&&h!=="body"&&Is(u,""+T);break;case"className":Nn(u,"class",T);break;case"tabIndex":Nn(u,"tabindex",T);break;case"dir":case"role":case"viewBox":case"width":case"height":Nn(u,y,T);break;case"style":va(u,T,F);break;case"data":if(h!=="object"){Nn(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 F=="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=Os);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),Sn(u,"popover",T);break;case"xlinkActuate":nn(u,"http://www.w3.org/1999/xlink","xlink:actuate",T);break;case"xlinkArcrole":nn(u,"http://www.w3.org/1999/xlink","xlink:arcrole",T);break;case"xlinkRole":nn(u,"http://www.w3.org/1999/xlink","xlink:role",T);break;case"xlinkShow":nn(u,"http://www.w3.org/1999/xlink","xlink:show",T);break;case"xlinkTitle":nn(u,"http://www.w3.org/1999/xlink","xlink:title",T);break;case"xlinkType":nn(u,"http://www.w3.org/1999/xlink","xlink:type",T);break;case"xmlBase":nn(u,"http://www.w3.org/XML/1998/namespace","xml:base",T);break;case"xmlLang":nn(u,"http://www.w3.org/XML/1998/namespace","xml:lang",T);break;case"xmlSpace":nn(u,"http://www.w3.org/XML/1998/namespace","xml:space",T);break;case"is":Sn(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=tc.get(y)||y,Sn(u,y,T))}}function OE(u,h,y,T,I,F){switch(y){case"style":va(u,T,F);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"?Is(u,T):(typeof T=="number"||typeof T=="bigint")&&Is(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=Os);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!vt.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(I=y.endsWith("Capture"),h=y.slice(2,I?y.length-7:void 0),F=u[dn]||null,F=F!=null?F[y]:null,typeof F=="function"&&u.removeEventListener(h,F,I),typeof T=="function")){typeof F!="function"&&F!==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,""):Sn(u,y,T)}}}function Va(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,F;for(F in y)if(y.hasOwnProperty(F)){var me=y[F];if(me!=null)switch(F){case"src":T=!0;break;case"srcSet":I=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,h));default:Ki(u,h,F,me,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 je=F=me=I=null,at=null,Et=null;for(T in y)if(y.hasOwnProperty(T)){var Wt=y[T];if(Wt!=null)switch(T){case"name":I=Wt;break;case"type":me=Wt;break;case"checked":at=Wt;break;case"defaultChecked":Et=Wt;break;case"value":F=Wt;break;case"defaultValue":je=Wt;break;case"children":case"dangerouslySetInnerHTML":if(Wt!=null)throw Error(r(137,h));break;default:Ki(u,h,T,Wt,y,null)}}Ps(u,F,je,at,Et,me,I,!1);return;case"select":ti("invalid",u),T=me=F=null;for(I in y)if(y.hasOwnProperty(I)&&(je=y[I],je!=null))switch(I){case"value":F=je;break;case"defaultValue":me=je;break;case"multiple":T=je;default:Ki(u,h,I,je,y,null)}h=F,y=me,u.multiple=!!T,h!=null?bs(u,!!T,h,!1):y!=null&&bs(u,!!T,y,!0);return;case"textarea":ti("invalid",u),F=I=T=null;for(me in y)if(y.hasOwnProperty(me)&&(je=y[me],je!=null))switch(me){case"value":T=je;break;case"defaultValue":I=je;break;case"children":F=je;break;case"dangerouslySetInnerHTML":if(je!=null)throw Error(r(91));break;default:Ki(u,h,me,je,y,null)}pi(u,T,I,F);return;case"option":for(at in y)if(y.hasOwnProperty(at)&&(T=y[at],T!=null))switch(at){case"selected":u.selected=T&&typeof T!="function"&&typeof T!="symbol";break;default:Ki(u,h,at,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<Mc.length;T++)ti(Mc[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(Et in y)if(y.hasOwnProperty(Et)&&(T=y[Et],T!=null))switch(Et){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,h));default:Ki(u,h,Et,T,y,null)}return;default:if(Ra(h)){for(Wt in y)y.hasOwnProperty(Wt)&&(T=y[Wt],T!==void 0&&OE(u,h,Wt,T,y,void 0));return}}for(je in y)y.hasOwnProperty(je)&&(T=y[je],T!=null&&Ki(u,h,je,T,y,null))}function uQ(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,F=null,me=null,je=null,at=null,Et=null,Wt=null;for(zt in y){var Zt=y[zt];if(y.hasOwnProperty(zt)&&Zt!=null)switch(zt){case"checked":break;case"value":break;case"defaultValue":at=Zt;default:T.hasOwnProperty(zt)||Ki(u,h,zt,null,T,Zt)}}for(var kt in T){var zt=T[kt];if(Zt=y[kt],T.hasOwnProperty(kt)&&(zt!=null||Zt!=null))switch(kt){case"type":F=zt;break;case"name":I=zt;break;case"checked":Et=zt;break;case"defaultChecked":Wt=zt;break;case"value":me=zt;break;case"defaultValue":je=zt;break;case"children":case"dangerouslySetInnerHTML":if(zt!=null)throw Error(r(137,h));break;default:zt!==Zt&&Ki(u,h,kt,zt,T,Zt)}}ys(u,me,je,at,Et,Wt,F,I);return;case"select":zt=me=je=kt=null;for(F in y)if(at=y[F],y.hasOwnProperty(F)&&at!=null)switch(F){case"value":break;case"multiple":zt=at;default:T.hasOwnProperty(F)||Ki(u,h,F,null,T,at)}for(I in T)if(F=T[I],at=y[I],T.hasOwnProperty(I)&&(F!=null||at!=null))switch(I){case"value":kt=F;break;case"defaultValue":je=F;break;case"multiple":me=F;default:F!==at&&Ki(u,h,I,F,T,at)}h=je,y=me,T=zt,kt!=null?bs(u,!!y,kt,!1):!!T!=!!y&&(h!=null?bs(u,!!y,h,!0):bs(u,!!y,y?[]:"",!1));return;case"textarea":zt=kt=null;for(je in y)if(I=y[je],y.hasOwnProperty(je)&&I!=null&&!T.hasOwnProperty(je))switch(je){case"value":break;case"children":break;default:Ki(u,h,je,null,T,I)}for(me in T)if(I=T[me],F=y[me],T.hasOwnProperty(me)&&(I!=null||F!=null))switch(me){case"value":kt=I;break;case"defaultValue":zt=I;break;case"children":break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(r(91));break;default:I!==F&&Ki(u,h,me,I,T,F)}Sr(u,kt,zt);return;case"option":for(var zn in y)if(kt=y[zn],y.hasOwnProperty(zn)&&kt!=null&&!T.hasOwnProperty(zn))switch(zn){case"selected":u.selected=!1;break;default:Ki(u,h,zn,null,T,kt)}for(at in T)if(kt=T[at],zt=y[at],T.hasOwnProperty(at)&&kt!==zt&&(kt!=null||zt!=null))switch(at){case"selected":u.selected=kt&&typeof kt!="function"&&typeof kt!="symbol";break;default:Ki(u,h,at,kt,T,zt)}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)kt=y[or],y.hasOwnProperty(or)&&kt!=null&&!T.hasOwnProperty(or)&&Ki(u,h,or,null,T,kt);for(Et in T)if(kt=T[Et],zt=y[Et],T.hasOwnProperty(Et)&&kt!==zt&&(kt!=null||zt!=null))switch(Et){case"children":case"dangerouslySetInnerHTML":if(kt!=null)throw Error(r(137,h));break;default:Ki(u,h,Et,kt,T,zt)}return;default:if(Ra(h)){for(var Zi in y)kt=y[Zi],y.hasOwnProperty(Zi)&&kt!==void 0&&!T.hasOwnProperty(Zi)&&OE(u,h,Zi,void 0,T,kt);for(Wt in T)kt=T[Wt],zt=y[Wt],!T.hasOwnProperty(Wt)||kt===zt||kt===void 0&&zt===void 0||OE(u,h,Wt,kt,T,zt);return}}for(var wt in y)kt=y[wt],y.hasOwnProperty(wt)&&kt!=null&&!T.hasOwnProperty(wt)&&Ki(u,h,wt,null,T,kt);for(Zt in T)kt=T[Zt],zt=y[Zt],!T.hasOwnProperty(Zt)||kt===zt||kt==null&&zt==null||Ki(u,h,Zt,kt,T,zt)}function A9(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dQ(){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],F=I.transferSize,me=I.initiatorType,je=I.duration;if(F&&je&&A9(me)){for(me=0,je=I.responseEnd,T+=1;T<y.length;T++){var at=y[T],Et=at.startTime;if(Et>je)break;var Wt=at.transferSize,Zt=at.initiatorType;Wt&&A9(Zt)&&(at=at.responseEnd,me+=Wt*(at<je?1:(je-Et)/(at-Et)))}if(--T,h+=8*(F+me)/(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 LE=null,jE=null;function J3(u){return u.nodeType===9?u:u.ownerDocument}function N9(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 k9(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 zE(u,h){return u==="textarea"||u==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.children=="bigint"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var FE=null;function fQ(){var u=window.event;return u&&u.type==="popstate"?u===FE?!1:(FE=u,!0):(FE=null,!1)}var R9=typeof setTimeout=="function"?setTimeout:void 0,hQ=typeof clearTimeout=="function"?clearTimeout:void 0,D9=typeof Promise=="function"?Promise:void 0,pQ=typeof queueMicrotask=="function"?queueMicrotask:typeof D9<"u"?function(u){return D9.resolve(null).then(u).catch(mQ)}:R9;function mQ(u){setTimeout(function(){throw u})}function mm(u){return u==="head"}function P9(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),jv(h);return}T--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")T++;else if(y==="html")t_(u.ownerDocument.documentElement);else if(y==="head"){y=u.ownerDocument.head,t_(y);for(var F=y.firstChild;F;){var me=F.nextSibling,je=F.nodeName;F[Oe]||je==="SCRIPT"||je==="STYLE"||je==="LINK"&&F.rel.toLowerCase()==="stylesheet"||y.removeChild(F),F=me}}else y==="body"&&t_(u.ownerDocument.body);y=I}while(y);jv(h)}function I9(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 UE(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":UE(y),gt(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}u.removeChild(y)}}function gQ(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[Oe])switch(h){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(F=u.getAttribute("rel"),F==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(F!==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(F=u.getAttribute("src"),(F!==(I.src==null?null:I.src)||u.getAttribute("type")!==(I.type==null?null:I.type)||u.getAttribute("crossorigin")!==(I.crossOrigin==null?null:I.crossOrigin))&&F&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(h==="input"&&u.type==="hidden"){var F=I.name==null?null:""+I.name;if(I.type==="hidden"&&u.getAttribute("name")===F)return u}else return u;if(u=qu(u.nextSibling),u===null)break}return null}function xQ(u,h,y){if(h==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!y||(u=qu(u.nextSibling),u===null))return null;return u}function O9(u,h){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!h||(u=qu(u.nextSibling),u===null))return null;return u}function BE(u){return u.data==="$?"||u.data==="$~"}function HE(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function vQ(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 qu(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 VE=null;function L9(u){u=u.nextSibling;for(var h=0;u;){if(u.nodeType===8){var y=u.data;if(y==="/$"||y==="/&"){if(h===0)return qu(u.nextSibling);h--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||h++}u=u.nextSibling}return null}function j9(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 z9(u,h,y){switch(h=J3(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 t_(u){for(var h=u.attributes;h.length;)u.removeAttributeNode(h[0]);gt(u)}var Xu=new Map,F9=new Set;function e4(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Zh=J.d;J.d={f:yQ,r:bQ,D:_Q,C:SQ,L:wQ,m:MQ,X:CQ,S:TQ,M:EQ};function yQ(){var u=Zh.f(),h=Qc();return u||h}function bQ(u){var h=Vt(u);h!==null&&h.tag===5&&h.type==="form"?L3(h):Zh.r(u)}var Iv=typeof document>"u"?null:document;function U9(u,h,y){var T=Iv;if(T&&typeof h=="string"&&h){var I=jn(h);I='link[rel="'+u+'"][href="'+I+'"]',typeof y=="string"&&(I+='[crossorigin="'+y+'"]'),F9.has(I)||(F9.add(I),u={rel:u,crossOrigin:y,href:h},T.querySelector(I)===null&&(h=T.createElement("link"),Va(h,"link",u),et(h),T.head.appendChild(h)))}}function _Q(u){Zh.D(u),U9("dns-prefetch",u,null)}function SQ(u,h){Zh.C(u,h),U9("preconnect",u,h)}function wQ(u,h,y){Zh.L(u,h,y);var T=Iv;if(T&&u&&h){var I='link[rel="preload"][as="'+jn(h)+'"]';h==="image"&&y&&y.imageSrcSet?(I+='[imagesrcset="'+jn(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(I+='[imagesizes="'+jn(y.imageSizes)+'"]')):I+='[href="'+jn(u)+'"]';var F=I;switch(h){case"style":F=Ov(u);break;case"script":F=Lv(u)}Xu.has(F)||(u=p({rel:"preload",href:h==="image"&&y&&y.imageSrcSet?void 0:u,as:h},y),Xu.set(F,u),T.querySelector(I)!==null||h==="style"&&T.querySelector(n_(F))||h==="script"&&T.querySelector(r_(F))||(h=T.createElement("link"),Va(h,"link",u),et(h),T.head.appendChild(h)))}}function MQ(u,h){Zh.m(u,h);var y=Iv;if(y&&u){var T=h&&typeof h.as=="string"?h.as:"script",I='link[rel="modulepreload"][as="'+jn(T)+'"][href="'+jn(u)+'"]',F=I;switch(T){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":F=Lv(u)}if(!Xu.has(F)&&(u=p({rel:"modulepreload",href:u},h),Xu.set(F,u),y.querySelector(I)===null)){switch(T){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(r_(F)))return}T=y.createElement("link"),Va(T,"link",u),et(T),y.head.appendChild(T)}}}function TQ(u,h,y){Zh.S(u,h,y);var T=Iv;if(T&&u){var I=ye(T).hoistableStyles,F=Ov(u);h=h||"default";var me=I.get(F);if(!me){var je={loading:0,preload:null};if(me=T.querySelector(n_(F)))je.loading=5;else{u=p({rel:"stylesheet",href:u,"data-precedence":h},y),(y=Xu.get(F))&&GE(u,y);var at=me=T.createElement("link");et(at),Va(at,"link",u),at._p=new Promise(function(Et,Wt){at.onload=Et,at.onerror=Wt}),at.addEventListener("load",function(){je.loading|=1}),at.addEventListener("error",function(){je.loading|=2}),je.loading|=4,t4(me,h,T)}me={type:"stylesheet",instance:me,count:1,state:je},I.set(F,me)}}}function CQ(u,h){Zh.X(u,h);var y=Iv;if(y&&u){var T=ye(y).hoistableScripts,I=Lv(u),F=T.get(I);F||(F=y.querySelector(r_(I)),F||(u=p({src:u,async:!0},h),(h=Xu.get(I))&&WE(u,h),F=y.createElement("script"),et(F),Va(F,"link",u),y.head.appendChild(F)),F={type:"script",instance:F,count:1,state:null},T.set(I,F))}}function EQ(u,h){Zh.M(u,h);var y=Iv;if(y&&u){var T=ye(y).hoistableScripts,I=Lv(u),F=T.get(I);F||(F=y.querySelector(r_(I)),F||(u=p({src:u,async:!0,type:"module"},h),(h=Xu.get(I))&&WE(u,h),F=y.createElement("script"),et(F),Va(F,"link",u),y.head.appendChild(F)),F={type:"script",instance:F,count:1,state:null},T.set(I,F))}}function B9(u,h,y,T){var I=(I=X.current)?e4(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=Ov(y.href),y=ye(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=Ov(y.href);var F=ye(I).hoistableStyles,me=F.get(u);if(me||(I=I.ownerDocument||I,me={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},F.set(u,me),(F=I.querySelector(n_(u)))&&!F._p&&(me.instance=F,me.state.loading=5),Xu.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},Xu.set(u,y),F||AQ(I,u,y,me.state))),h&&T===null)throw Error(r(528,""));return me}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=Lv(y),y=ye(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 Ov(u){return'href="'+jn(u)+'"'}function n_(u){return'link[rel="stylesheet"]['+u+"]"}function H9(u){return p({},u,{"data-precedence":u.precedence,precedence:null})}function AQ(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}),Va(h,"link",y),et(h),u.head.appendChild(h))}function Lv(u){return'[src="'+jn(u)+'"]'}function r_(u){return"script[async]"+u}function V9(u,h,y){if(h.count++,h.instance===null)switch(h.type){case"style":var T=u.querySelector('style[data-href~="'+jn(y.href)+'"]');if(T)return h.instance=T,et(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"),et(T),Va(T,"style",I),t4(T,y.precedence,u),h.instance=T;case"stylesheet":I=Ov(y.href);var F=u.querySelector(n_(I));if(F)return h.state.loading|=4,h.instance=F,et(F),F;T=H9(y),(I=Xu.get(I))&&GE(T,I),F=(u.ownerDocument||u).createElement("link"),et(F);var me=F;return me._p=new Promise(function(je,at){me.onload=je,me.onerror=at}),Va(F,"link",T),h.state.loading|=4,t4(F,y.precedence,u),h.instance=F;case"script":return F=Lv(y.src),(I=u.querySelector(r_(F)))?(h.instance=I,et(I),I):(T=y,(I=Xu.get(F))&&(T=p({},y),WE(T,I)),u=u.ownerDocument||u,I=u.createElement("script"),et(I),Va(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,t4(T,y.precedence,u));return h.instance}function t4(u,h,y){for(var T=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),I=T.length?T[T.length-1]:null,F=I,me=0;me<T.length;me++){var je=T[me];if(je.dataset.precedence===h)F=je;else if(F!==I)break}F?F.parentNode.insertBefore(u,F.nextSibling):(h=y.nodeType===9?y.head:y,h.insertBefore(u,h.firstChild))}function GE(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.title==null&&(u.title=h.title)}function WE(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.integrity==null&&(u.integrity=h.integrity)}var n4=null;function G9(u,h,y){if(n4===null){var T=new Map,I=n4=new Map;I.set(y,T)}else I=n4,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 F=y[I];if(!(F[Oe]||F[Kt]||u==="link"&&F.getAttribute("rel")==="stylesheet")&&F.namespaceURI!=="http://www.w3.org/2000/svg"){var me=F.getAttribute(h)||"";me=u+me;var je=T.get(me);je?je.push(F):T.set(me,[F])}}return T}function W9(u,h,y){u=u.ownerDocument||u,u.head.insertBefore(y,h==="title"?u.querySelector("head > title"):null)}function NQ(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 $9(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function kQ(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=Ov(T.href),F=h.querySelector(n_(I));if(F){h=F._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(u.count++,u=r4.bind(u),h.then(u,u)),y.state.loading|=4,y.instance=F,et(F);return}F=h.ownerDocument||h,T=H9(T),(I=Xu.get(I))&&GE(T,I),F=F.createElement("link"),et(F);var me=F;me._p=new Promise(function(je,at){me.onload=je,me.onerror=at}),Va(F,"link",T),y.instance=F}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(y,h),(h=y.state.preload)&&(y.state.loading&3)===0&&(u.count++,y=r4.bind(u),h.addEventListener("load",y),h.addEventListener("error",y))}}var $E=0;function RQ(u,h){return u.stylesheets&&u.count===0&&s4(u,u.stylesheets),0<u.count||0<u.imgCount?function(y){var T=setTimeout(function(){if(u.stylesheets&&s4(u,u.stylesheets),u.unsuspend){var F=u.unsuspend;u.unsuspend=null,F()}},6e4+h);0<u.imgBytes&&$E===0&&($E=62500*dQ());var I=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&s4(u,u.stylesheets),u.unsuspend)){var F=u.unsuspend;u.unsuspend=null,F()}},(u.imgBytes>$E?50:800)+h);return u.unsuspend=y,function(){u.unsuspend=null,clearTimeout(T),clearTimeout(I)}}:null}function r4(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)s4(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var i4=null;function s4(u,h){u.stylesheets=null,u.unsuspend!==null&&(u.count++,i4=new Map,h.forEach(DQ,u),i4=null,r4.call(u))}function DQ(u,h){if(!(h.state.loading&4)){var y=i4.get(u);if(y)var T=y.get(null);else{y=new Map,i4.set(u,y);for(var I=u.querySelectorAll("link[data-precedence],style[data-precedence]"),F=0;F<I.length;F++){var me=I[F];(me.nodeName==="LINK"||me.getAttribute("media")!=="not all")&&(y.set(me.dataset.precedence,me),T=me)}T&&y.set(null,T)}I=h.instance,me=I.getAttribute("data-precedence"),F=y.get(me)||T,F===T&&y.set(null,I),y.set(me,I),this.count++,T=r4.bind(this),I.addEventListener("load",T),I.addEventListener("error",T),F?F.parentNode.insertBefore(I,F.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(I,u.firstChild)),h.state.loading|=4}}var i_={$$typeof:A,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function PQ(u,h,y,T,I,F,me,je,at){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=Be(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Be(0),this.hiddenUpdates=Be(null),this.identifierPrefix=T,this.onUncaughtError=I,this.onCaughtError=F,this.onRecoverableError=me,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=at,this.incompleteTransitions=new Map}function q9(u,h,y,T,I,F,me,je,at,Et,Wt,Zt){return u=new PQ(u,h,y,me,at,Et,Wt,Zt,je),h=1,F===!0&&(h|=24),F=Ms(3,null,null,h),u.current=F,F.stateNode=u,h=lb(),h.refCount++,u.pooledCache=h,h.refCount++,F.memoizedState={element:T,isDehydrated:y,cache:h},sg(F),u}function X9(u){return u?(u=pf,u):pf}function Y9(u,h,y,T,I,F){I=X9(I),T.context===null?T.context=I:T.pendingContext=I,T=Pd(h),T.payload={element:y},F=F===void 0?null:F,F!==null&&(T.callback=F),y=Sf(u,T,h),y!==null&&(Ir(y,u,h),wf(y,u,h))}function K9(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var y=u.retryLane;u.retryLane=y!==0&&y<h?y:h}}function qE(u,h){K9(u,h),(u=u.alternate)&&K9(u,h)}function Z9(u){if(u.tag===13||u.tag===31){var h=La(u,67108864);h!==null&&Ir(h,u,67108864),qE(u,67108864)}}function Q9(u){if(u.tag===13||u.tag===31){var h=jl();h=Ht(h);var y=La(u,h);y!==null&&Ir(y,u,h),qE(u,h)}}var o4=!0;function IQ(u,h,y,T){var I=q.T;q.T=null;var F=J.p;try{J.p=2,XE(u,h,y,T)}finally{J.p=F,q.T=I}}function OQ(u,h,y,T){var I=q.T;q.T=null;var F=J.p;try{J.p=8,XE(u,h,y,T)}finally{J.p=F,q.T=I}}function XE(u,h,y,T){if(o4){var I=YE(T);if(I===null)IE(u,h,T,a4,y),eP(u,T);else if(jQ(I,u,h,y,T))T.stopPropagation();else if(eP(u,T),h&4&&-1<LQ.indexOf(u)){for(;I!==null;){var F=Vt(I);if(F!==null)switch(F.tag){case 3:if(F=F.stateNode,F.current.memoizedState.isDehydrated){var me=ft(F.pendingLanes);if(me!==0){var je=F;for(je.pendingLanes|=2,je.entangledLanes|=2;me;){var at=1<<31-be(me);je.entanglements[1]|=at,me&=~at}on(F),(Vn&6)===0&&(to=Z()+500,Rn(0))}}break;case 31:case 13:je=La(F,2),je!==null&&Ir(je,F,2),Qc(),qE(F,2)}if(F=YE(T),F===null&&IE(u,h,T,a4,y),F===I)break;I=F}I!==null&&T.stopPropagation()}else IE(u,h,T,null,y)}}function YE(u){return u=Qa(u),KE(u)}var a4=null;function KE(u){if(a4=null,u=_t(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 a4=u,null}function J9(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(ge()){case we:return 2;case _e:return 8;case ve:case Ue:return 32;case Se:return 268435456;default:return 32}default:return 32}}var ZE=!1,gm=null,xm=null,vm=null,s_=new Map,o_=new Map,ym=[],LQ="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 eP(u,h){switch(u){case"focusin":case"focusout":gm=null;break;case"dragenter":case"dragleave":xm=null;break;case"mouseover":case"mouseout":vm=null;break;case"pointerover":case"pointerout":s_.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":o_.delete(h.pointerId)}}function a_(u,h,y,T,I,F){return u===null||u.nativeEvent!==F?(u={blockedOn:h,domEventName:y,eventSystemFlags:T,nativeEvent:F,targetContainers:[I]},h!==null&&(h=Vt(h),h!==null&&Z9(h)),u):(u.eventSystemFlags|=T,h=u.targetContainers,I!==null&&h.indexOf(I)===-1&&h.push(I),u)}function jQ(u,h,y,T,I){switch(h){case"focusin":return gm=a_(gm,u,h,y,T,I),!0;case"dragenter":return xm=a_(xm,u,h,y,T,I),!0;case"mouseover":return vm=a_(vm,u,h,y,T,I),!0;case"pointerover":var F=I.pointerId;return s_.set(F,a_(s_.get(F)||null,u,h,y,T,I)),!0;case"gotpointercapture":return F=I.pointerId,o_.set(F,a_(o_.get(F)||null,u,h,y,T,I)),!0}return!1}function tP(u){var h=_t(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,Ft(u.priority,function(){Q9(y)});return}}else if(h===31){if(h=a(y),h!==null){u.blockedOn=h,Ft(u.priority,function(){Q9(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 l4(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var y=YE(u.nativeEvent);if(y===null){y=u.nativeEvent;var T=new y.constructor(y.type,y);nc=T,y.target.dispatchEvent(T),nc=null}else return h=Vt(y),h!==null&&Z9(h),u.blockedOn=y,!1;h.shift()}return!0}function nP(u,h,y){l4(u)&&y.delete(h)}function zQ(){ZE=!1,gm!==null&&l4(gm)&&(gm=null),xm!==null&&l4(xm)&&(xm=null),vm!==null&&l4(vm)&&(vm=null),s_.forEach(nP),o_.forEach(nP)}function c4(u,h){u.blockedOn===h&&(u.blockedOn=null,ZE||(ZE=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,zQ)))}var u4=null;function rP(u){u4!==u&&(u4=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){u4===u&&(u4=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(KE(T||y)===null)continue;break}var F=Vt(y);F!==null&&(u.splice(h,3),h-=3,Ob(F,{pending:!0,data:I,method:y.method,action:T},T,I))}}))}function jv(u){function h(at){return c4(at,u)}gm!==null&&c4(gm,u),xm!==null&&c4(xm,u),vm!==null&&c4(vm,u),s_.forEach(h),o_.forEach(h);for(var y=0;y<ym.length;y++){var T=ym[y];T.blockedOn===u&&(T.blockedOn=null)}for(;0<ym.length&&(y=ym[0],y.blockedOn===null);)tP(y),y.blockedOn===null&&ym.shift();if(y=(u.ownerDocument||u).$$reactFormReplay,y!=null)for(T=0;T<y.length;T+=3){var I=y[T],F=y[T+1],me=I[dn]||null;if(typeof F=="function")me||rP(y);else if(me){var je=null;if(F&&F.hasAttribute("formAction")){if(I=F,me=F[dn]||null)je=me.formAction;else if(KE(I)!==null)continue}else je=me.action;typeof je=="function"?y[T+1]=je:(y.splice(T,3),T-=3),rP(y)}}}function iP(){function u(F){F.canIntercept&&F.info==="react-transition"&&F.intercept({handler:function(){return new Promise(function(me){return I=me})},focusReset:"manual",scroll:"manual"})}function h(){I!==null&&(I(),I=null),T||setTimeout(y,20)}function y(){if(!T&&!navigation.transition){var F=navigation.currentEntry;F&&F.url!=null&&navigation.navigate(F.url,{state:F.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 QE(u){this._internalRoot=u}d4.prototype.render=QE.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(r(409));var y=h.current,T=jl();Y9(y,T,u,h,null,null)},d4.prototype.unmount=QE.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;Y9(u.current,2,null,u,null,null),Qc(),h[Rt]=null}};function d4(u){this._internalRoot=u}d4.prototype.unstable_scheduleHydration=function(u){if(u){var h=Ut();u={blockedOn:null,target:u,priority:h};for(var y=0;y<ym.length&&h!==0&&h<ym[y].priority;y++);ym.splice(y,0,u),y===0&&tP(u)}};var sP=e.version;if(sP!=="19.2.1")throw Error(r(527,sP,"19.2.1"));J.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?f(u):null,u=u===null?null:u.stateNode,u};var FQ={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var f4=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!f4.isDisabled&&f4.supportsFiber)try{Je=f4.inject(FQ),nt=f4}catch{}}return c_.createRoot=function(u,h){if(!i(u))throw Error(r(299));var y=!1,T="",I=V3,F=Bb,me=Hb;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&&(F=h.onCaughtError),h.onRecoverableError!==void 0&&(me=h.onRecoverableError)),h=q9(u,1,!1,null,null,y,T,null,I,F,me,iP),u[Rt]=h.current,PE(u),new QE(h)},c_.hydrateRoot=function(u,h,y){if(!i(u))throw Error(r(299));var T=!1,I="",F=V3,me=Bb,je=Hb,at=null;return y!=null&&(y.unstable_strictMode===!0&&(T=!0),y.identifierPrefix!==void 0&&(I=y.identifierPrefix),y.onUncaughtError!==void 0&&(F=y.onUncaughtError),y.onCaughtError!==void 0&&(me=y.onCaughtError),y.onRecoverableError!==void 0&&(je=y.onRecoverableError),y.formState!==void 0&&(at=y.formState)),h=q9(u,1,!0,h,y??null,T,I,at,F,me,je,iP),h.context=X9(null),y=h.current,T=jl(),T=Ht(T),I=Pd(T),I.callback=null,Sf(y,I,T),y=T,h.current.lanes=y,ot(h,y),on(h),u[Rt]=h.current,PE(u),new d4(h)},c_.version="19.2.1",c_}var gP;function XQ(){if(gP)return nA.exports;gP=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(),nA.exports=qQ(),nA.exports}var hU=XQ();/**
 * react-router v7.13.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var xP="popstate";function vP(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function YQ(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:_S(i)}return ZQ(e,n,null,t)}function co(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function rf(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function KQ(){return Math.random().toString(36).substring(2,10)}function yP(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"?Ly(e):e,state:n,key:e&&e.key||r||KQ(),unstable_mask:i}}function _S({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 Ly(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 ZQ(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",l=null,c=f();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function f(){return(o.state||{idx:null}).idx}function p(){a="POP";let S=f(),M=S==null?null:S-c;c=S,l&&l({action:a,location:_.location,delta:M})}function m(S,M){a="PUSH";let C=vP(S)?S:jN(_.location,S,M);c=f()+1;let A=yP(C,c),N=_.createHref(C.unstable_mask||C);try{o.pushState(A,"",N)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;i.location.assign(N)}s&&l&&l({action:a,location:_.location,delta:1})}function x(S,M){a="REPLACE";let C=vP(S)?S:jN(_.location,S,M);c=f();let A=yP(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(xP,p),l=S,()=>{i.removeEventListener(xP,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),co(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:_S(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function pU(t,e,n="/"){return JQ(t,e,n,!1)}function JQ(t,e,n,r){let i=typeof e=="string"?Ly(e):e,s=bp(i.pathname||"/",n);if(s==null)return null;let o=mU(t);eJ(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=dJ(s);a=cJ(o[l],c,r)}return a}function mU(t,e=[],n=[],r="",i=!1){let s=(o,a,l=i,c)=>{let f={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&l)return;co(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let p=ah([r,f.relativePath]),m=n.concat(f);o.children&&o.children.length>0&&(co(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),mU(o.children,e,m,p,l)),!(o.path==null&&!o.index)&&e.push({path:p,score:aJ(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 gU(o.path))s(o,a,!0,c)}),e}function gU(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=gU(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 eJ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:lJ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var tJ=/^:[\w-]+$/,nJ=3,rJ=2,iJ=1,sJ=10,oJ=-2,bP=t=>t==="*";function aJ(t,e){let n=t.split("/"),r=n.length;return n.some(bP)&&(r+=oJ),e&&(r+=rJ),n.filter(i=>!bP(i)).reduce((i,s)=>i+(tJ.test(s)?nJ:s===""?iJ:sJ),r)}function lJ(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 cJ(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,f=s==="/"?e:e.slice(s.length)||"/",p=v2({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},f),m=l.route;if(!p&&c&&n&&!r[r.length-1].route.index&&(p=v2({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},f)),!p)return null;Object.assign(i,p.params),o.push({params:i,pathname:ah([s,p.pathname]),pathnameBase:mJ(ah([s,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(s=ah([s,p.pathnameBase]))}return o}function v2(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=uJ(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:f,isOptional:p},m)=>{if(f==="*"){let b=a[m]||"";o=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const x=a[m];return p&&!x?c[f]=void 0:c[f]=(x||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function uJ(t,e=!1,n=!0){rf(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,f)=>{if(r.push({paramName:a,isOptional:l!=null}),l){let p=f.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 dJ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return rf(!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 bp(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 fJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function hJ(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Ly(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=_P(n.substring(1),"/"):s=_P(n,e)):s=e,{pathname:s,search:gJ(r),hash:xJ(i)}}function _P(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 oA(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 pJ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function xU(t){let e=pJ(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function r7(t,e,n,r=!1){let i;typeof t=="string"?i=Ly(t):(i={...t},co(!i.pathname||!i.pathname.includes("?"),oA("?","pathname","search",i)),co(!i.pathname||!i.pathname.includes("#"),oA("#","pathname","hash",i)),co(!i.search||!i.search.includes("#"),oA("#","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=hJ(i,a),c=o&&o!=="/"&&o.endsWith("/"),f=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||f)&&(l.pathname+="/"),l}var ah=t=>t.join("/").replace(/\/\/+/g,"/"),mJ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),gJ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,xJ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,vJ=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 yJ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function bJ(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var vU=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yU(t,e){let n=t;if(typeof n!="string"||!fJ.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(vU)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=bp(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{rf(!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 bU=["POST","PUT","PATCH","DELETE"];new Set(bU);var _J=["GET",...bU];new Set(_J);var jy=w.createContext(null);jy.displayName="DataRouter";var dT=w.createContext(null);dT.displayName="DataRouterState";var SJ=w.createContext(!1),_U=w.createContext({isTransitioning:!1});_U.displayName="ViewTransition";var wJ=w.createContext(new Map);wJ.displayName="Fetchers";var MJ=w.createContext(null);MJ.displayName="Await";var gd=w.createContext(null);gd.displayName="Navigation";var gw=w.createContext(null);gw.displayName="Location";var Np=w.createContext({outlet:null,matches:[],isDataRoute:!1});Np.displayName="Route";var i7=w.createContext(null);i7.displayName="RouteError";var SU="REACT_ROUTER_ERROR",TJ="REDIRECT",CJ="ROUTE_ERROR_RESPONSE";function EJ(t){if(t.startsWith(`${SU}:${TJ}:{`))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 AJ(t){if(t.startsWith(`${SU}:${CJ}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new vJ(e.status,e.statusText,e.data)}catch{}}function NJ(t,{relative:e}={}){co(xw(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(gd),{hash:i,pathname:s,search:o}=vw(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:ah([n,s])),r.createHref({pathname:a,search:o,hash:i})}function xw(){return w.useContext(gw)!=null}function vh(){return co(xw(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(gw).location}var wU="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function MU(t){w.useContext(gd).static||w.useLayoutEffect(t)}function fT(){let{isDataRoute:t}=w.useContext(Np);return t?HJ():kJ()}function kJ(){co(xw(),"useNavigate() may be used only in the context of a <Router> component.");let t=w.useContext(jy),{basename:e,navigator:n}=w.useContext(gd),{matches:r}=w.useContext(Np),{pathname:i}=vh(),s=JSON.stringify(xU(r)),o=w.useRef(!1);return MU(()=>{o.current=!0}),w.useCallback((l,c={})=>{if(rf(o.current,wU),!o.current)return;if(typeof l=="number"){n.go(l);return}let f=r7(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:ah([e,f.pathname])),(c.replace?n.replace:n.push)(f,c.state,c)},[e,n,s,i,t])}w.createContext(null);function vw(t,{relative:e}={}){let{matches:n}=w.useContext(Np),{pathname:r}=vh(),i=JSON.stringify(xU(n));return w.useMemo(()=>r7(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function RJ(t,e){return TU(t,e)}function TU(t,e,n){var S;co(xw(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext(gd),{matches:i}=w.useContext(Np),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||"";EU(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 f=vh(),p;if(e){let M=typeof e=="string"?Ly(e):e;co(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=f;let m=p.pathname||"/",x=m;if(l!=="/"){let M=l.replace(/^\//,"").split("/");x="/"+m.replace(/^\//,"").split("/").slice(M.length).join("/")}let b=pU(t,{pathname:x});rf(c||b!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),rf(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 _=LJ(b&&b.map(M=>Object.assign({},M,{params:Object.assign({},o,M.params),pathname:ah([l,r.encodeLocation?r.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?l:ah([l,r.encodeLocation?r.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),i,n);return e&&_?w.createElement(gw.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},_):_}function DJ(){let t=BJ(),e=yJ(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 PJ=w.createElement(DJ,null),CU=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=AJ(t.digest);n&&(t=n)}let e=t!==void 0?w.createElement(Np.Provider,{value:this.props.routeContext},w.createElement(i7.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?w.createElement(IJ,{error:t},e):e}};CU.contextType=SJ;var aA=new WeakMap;function IJ({children:t,error:e}){let{basename:n}=w.useContext(gd);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=EJ(e.digest);if(r){let i=aA.get(e);if(i)throw i;let s=yU(r.location,n);if(vU&&!aA.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 aA.set(e,o),o}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function OJ({routeContext:t,match:e,children:n}){let r=w.useContext(jy);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),w.createElement(Np.Provider,{value:t},n)}function LJ(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 f=i.findIndex(p=>p.route.id&&(s==null?void 0:s[p.route.id])!==void 0);co(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,f+1))}let o=!1,a=-1;if(n&&r){o=r.renderFallback;for(let f=0;f<i.length;f++){let p=i[f];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(a=f),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?(f,p)=>{var m,x;l(f,{location:r.location,params:((x=(m=r.matches)==null?void 0:m[0])==null?void 0:x.params)??{},unstable_pattern:bJ(r.matches),errorInfo:p})}:void 0;return i.reduceRight((f,p,m)=>{let x,b=!1,_=null,S=null;r&&(x=s&&p.route.id?s[p.route.id]:void 0,_=p.route.errorElement||PJ,o&&(a<0&&m===0?(EU("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=f,w.createElement(OJ,{match:p,routeContext:{outlet:f,matches:M,isDataRoute:r!=null},children:A})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?w.createElement(CU,{location:r.location,revalidation:r.revalidation,component:_,error:x,children:C(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:c}):C()},null)}function s7(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function jJ(t){let e=w.useContext(jy);return co(e,s7(t)),e}function zJ(t){let e=w.useContext(dT);return co(e,s7(t)),e}function FJ(t){let e=w.useContext(Np);return co(e,s7(t)),e}function o7(t){let e=FJ(t),n=e.matches[e.matches.length-1];return co(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function UJ(){return o7("useRouteId")}function BJ(){var r;let t=w.useContext(i7),e=zJ("useRouteError"),n=o7("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function HJ(){let{router:t}=jJ("useNavigate"),e=o7("useNavigate"),n=w.useRef(!1);return MU(()=>{n.current=!0}),w.useCallback(async(i,s={})=>{rf(n.current,wU),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var SP={};function EU(t,e,n){!e&&!SP[t]&&(SP[t]=!0,rf(!1,n))}w.memo(VJ);function VJ({routes:t,future:e,state:n,isStatic:r,onError:i}){return TU(t,void 0,{state:n,isStatic:r,onError:i})}function $f(t){co(!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 GJ({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){co(!xw(),"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=Ly(n));let{pathname:c="/",search:f="",hash:p="",state:m=null,key:x="default",unstable_mask:b}=n,_=w.useMemo(()=>{let S=bp(c,a);return S==null?null:{location:{pathname:S,search:f,hash:p,state:m,key:x,unstable_mask:b},navigationType:r}},[a,c,f,p,m,x,r,b]);return rf(_!=null,`<Router basename="${a}"> is not able to match the URL "${c}${f}${p}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:w.createElement(gd.Provider,{value:l},w.createElement(gw.Provider,{children:e,value:_}))}function WJ({children:t,location:e}){return RJ(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}co(r.type===$f,`[${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>`),co(!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 e2="get",t2="application/x-www-form-urlencoded";function hT(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function $J(t){return hT(t)&&t.tagName.toLowerCase()==="button"}function qJ(t){return hT(t)&&t.tagName.toLowerCase()==="form"}function XJ(t){return hT(t)&&t.tagName.toLowerCase()==="input"}function YJ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function KJ(t,e){return t.button===0&&(!e||e==="_self")&&!YJ(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 ZJ(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 p4=null;function QJ(){if(p4===null)try{new FormData(document.createElement("form"),0),p4=!1}catch{p4=!0}return p4}var JJ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function lA(t){return t!=null&&!JJ.has(t)?(rf(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${t2}"`),null):t}function eee(t,e){let n,r,i,s,o;if(qJ(t)){let a=t.getAttribute("action");r=a?bp(a,e):null,n=t.getAttribute("method")||e2,i=lA(t.getAttribute("enctype"))||t2,s=new FormData(t)}else if($J(t)||XJ(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?bp(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||e2,i=lA(t.getAttribute("formenctype"))||lA(a.getAttribute("enctype"))||t2,s=new FormData(a,t),!QJ()){let{name:c,type:f,value:p}=t;if(f==="image"){let m=c?`${c}.`:"";s.append(`${m}x`,"0"),s.append(`${m}y`,"0")}else c&&s.append(c,p)}}else{if(hT(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=e2,r=null,i=t2,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 a7(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function tee(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&&bp(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function nee(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 ree(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 iee(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await nee(s,n);return o.links?o.links():[]}return[]}));return lee(r.flat(1).filter(ree).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function wP(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(l,c)=>{var f;return n[c].pathname!==l.pathname||((f=n[c].route.path)==null?void 0:f.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 f=r.routes[l.route.id];if(!f||!f.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 see(t,e,{includeHydrateFallback:n}={}){return oee(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 oee(t){return[...new Set(t)]}function aee(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function lee(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(aee(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function AU(){let t=w.useContext(jy);return a7(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function cee(){let t=w.useContext(dT);return a7(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var l7=w.createContext(void 0);l7.displayName="FrameworkContext";function NU(){let t=w.useContext(l7);return a7(t,"You must render this element inside a <HydratedRouter> element"),t}function uee(t,e){let n=w.useContext(l7),[r,i]=w.useState(!1),[s,o]=w.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:f,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:u_(a,x),onBlur:u_(l,b),onMouseEnter:u_(c,x),onMouseLeave:u_(f,b),onTouchStart:u_(p,x)}]:[!1,m,{}]}function u_(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function dee({page:t,...e}){let{router:n}=AU(),r=w.useMemo(()=>pU(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?w.createElement(hee,{page:t,matches:r,...e}):null}function fee(t){let{manifest:e,routeModules:n}=NU(),[r,i]=w.useState([]);return w.useEffect(()=>{let s=!1;return iee(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function hee({page:t,matches:e,...n}){let r=vh(),{future:i,manifest:s,routeModules:o}=NU(),{basename:a}=AU(),{loaderData:l,matches:c}=cee(),f=w.useMemo(()=>wP(t,e,c,s,r,"data"),[t,e,c,s,r]),p=w.useMemo(()=>wP(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||(!f.some(P=>P.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=tee(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,f,e,t,o]),x=w.useMemo(()=>see(p,s),[p,s]),b=fee(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 pee(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var mee=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{mee&&(window.__reactRouterVersion="7.13.1")}catch{}function gee({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=w.useRef();i.current==null&&(i.current=YQ({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(GJ,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:s,unstable_useTransitions:n})}var kU=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,y2=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:f,preventScrollReset:p,viewTransition:m,unstable_defaultShouldRevalidate:x,...b},_){let{basename:S,navigator:M,unstable_useTransitions:C}=w.useContext(gd),A=typeof f=="string"&&kU.test(f),N=yU(f,S);f=N.to;let P=NJ(f,{relative:i}),k=vh(),O=null;if(a){let H=r7(a,[],k.unstable_mask?k.unstable_mask.pathname:"/",!0);S!=="/"&&(H.pathname=H.pathname==="/"?S:ah([S,H.pathname])),O=M.createHref(H)}let[R,L,B]=uee(r,b),V=bee(f,{replace:o,unstable_mask:a,state:l,target:c,preventScrollReset:p,relative:i,viewTransition:m,unstable_defaultShouldRevalidate:x,unstable_useTransitions:C});function W(H){e&&e(H),H.defaultPrevented||V(H)}let G=!(N.isExternal||s),ee=w.createElement("a",{...b,...B,href:(G?O:void 0)||N.absoluteURL||P,onClick:G?W:e,ref:pee(_,L),target:c,"data-discover":!A&&n==="render"?"true":void 0});return R&&!A?w.createElement(w.Fragment,null,ee,w.createElement(dee,{page:P})):ee});y2.displayName="Link";var xee=w.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},f){let p=vw(o,{relative:c.relative}),m=vh(),x=w.useContext(dT),{navigator:b,basename:_}=w.useContext(gd),S=x!=null&&Tee(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=bp(A,_)||A);const N=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let P=C===M||!i&&C.startsWith(M)&&C.charAt(N)==="/",k=A!=null&&(A===M||!i&&A.startsWith(M)&&A.charAt(M.length)==="/"),O={isActive:P,isPending:k,isTransitioning:S},R=P?e:void 0,L;typeof r=="function"?L=r(O):L=[r,P?"active":null,k?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let B=typeof s=="function"?s(O):s;return w.createElement(y2,{...c,"aria-current":R,className:L,ref:f,style:B,to:o,viewTransition:a},typeof l=="function"?l(O):l)});xee.displayName="NavLink";var vee=w.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=e2,action:a,onSubmit:l,relative:c,preventScrollReset:f,viewTransition:p,unstable_defaultShouldRevalidate:m,...x},b)=>{let{unstable_useTransitions:_}=w.useContext(gd),S=wee(),M=Mee(a,{relative:c}),C=o.toLowerCase()==="get"?"get":"post",A=typeof a=="string"&&kU.test(a),N=P=>{if(l&&l(P),P.defaultPrevented)return;P.preventDefault();let k=P.nativeEvent.submitter,O=(k==null?void 0:k.getAttribute("formmethod"))||o,R=()=>S(k||P.currentTarget,{fetcherKey:e,method:O,navigate:n,replace:i,state:s,relative:c,preventScrollReset:f,viewTransition:p,unstable_defaultShouldRevalidate:m});_&&n!==!1?w.startTransition(()=>R()):R()};return w.createElement("form",{ref:b,method:C,action:M,onSubmit:r?l:N,...x,"data-discover":!A&&t==="render"?"true":void 0})});vee.displayName="Form";function yee(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function RU(t){let e=w.useContext(jy);return co(e,yee(t)),e}function bee(t,{target:e,replace:n,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let f=fT(),p=vh(),m=vw(t,{relative:o});return w.useCallback(x=>{if(KJ(x,e)){x.preventDefault();let b=n!==void 0?n:_S(p)===_S(m),_=()=>f(t,{replace:b,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l});c?w.startTransition(()=>_()):_()}},[p,f,m,n,r,i,e,t,s,o,a,l,c])}function c7(t){rf(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=vh(),i=w.useMemo(()=>ZJ(r.search,n.current?null:e.current),[r.search]),s=fT(),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 _ee=0,See=()=>`__${String(++_ee)}__`;function wee(){let{router:t}=RU("useSubmit"),{basename:e}=w.useContext(gd),n=UJ(),r=t.fetch,i=t.navigate;return w.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:f,body:p}=eee(s,e);if(o.navigate===!1){let m=o.fetcherKey||See();await r(m,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:f,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:f,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 Mee(t,{relative:e}={}){let{basename:n}=w.useContext(gd),r=w.useContext(Np);co(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...vw(t||".",{relative:e})},o=vh();if(t==null){s.search=o.search;let a=new URLSearchParams(s.search),l=a.getAll("index");if(l.some(f=>f==="")){a.delete("index"),l.filter(p=>p).forEach(p=>a.append("index",p));let f=a.toString();s.search=f?`?${f}`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:ah([n,s.pathname])),_S(s)}function Tee(t,{relative:e}={}){let n=w.useContext(_U);co(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=RU("useViewTransitionState"),i=vw(t,{relative:e});if(!n.isTransitioning)return!1;let s=bp(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=bp(n.nextLocation.pathname,r)||n.nextLocation.pathname;return v2(i.pathname,o)!=null||v2(i.pathname,s)!=null}var ql=fU();const Cee=Oy(ql);var zy=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(){}},Eee={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Vm,n7,JF,Aee=(JF=class{constructor(){Bn(this,Vm,Eee);Bn(this,n7,!1)}setTimeoutProvider(t){bn(this,Vm,t)}setTimeout(t,e){return lt(this,Vm).setTimeout(t,e)}clearTimeout(t){lt(this,Vm).clearTimeout(t)}setInterval(t,e){return lt(this,Vm).setInterval(t,e)}clearInterval(t){lt(this,Vm).clearInterval(t)}},Vm=new WeakMap,n7=new WeakMap,JF),Qg=new Aee;function Nee(t){setTimeout(t,0)}var yx=typeof window>"u"||"Deno"in globalThis;function Vl(){}function kee(t,e){return typeof t=="function"?t(e):t}function UN(t){return typeof t=="number"&&t>=0&&t!==1/0}function DU(t,e){return Math.max(t+(e||0)-Date.now(),0)}function n0(t,e){return typeof t=="function"?t(e):t}function td(t,e){return typeof t=="function"?t(e):t}function MP(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==u7(o,e.options))return!1}else if(!wS(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 TP(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(SS(e.options.mutationKey)!==SS(s))return!1}else if(!wS(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function u7(t,e){return((e==null?void 0:e.queryKeyHashFn)||SS)(t)}function SS(t){return JSON.stringify(t,(e,n)=>BN(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function wS(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>wS(t[n],e[n])):!1}var Ree=Object.prototype.hasOwnProperty;function d7(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=CP(t)&&CP(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 f=0;f<a;f++){const p=r?f:o[f],m=t[p],x=e[p];if(m===x){l[p]=m,(r?f<s:Ree.call(t,p))&&c++;continue}if(m===null||x===null||typeof m!="object"||typeof x!="object"){l[p]=x;continue}const b=d7(m,x,n+1);l[p]=b,b===m&&c++}return s===a&&c===s?t:l}function b2(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 CP(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function BN(t){if(!EP(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!EP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function EP(t){return Object.prototype.toString.call(t)==="[object Object]"}function Dee(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?d7(t,e):e}function Ql(t){return t}function Pee(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function Iee(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var f7=Symbol();function PU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===f7?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function IU(t,e){return typeof t=="function"?t(...e):!!t}function Oee(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 rx,Gm,B1,eU,Lee=(eU=class extends zy{constructor(){super();Bn(this,rx);Bn(this,Gm);Bn(this,B1);bn(this,B1,e=>{if(!yx&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){lt(this,Gm)||this.setEventListener(lt(this,B1))}onUnsubscribe(){var e;this.hasListeners()||((e=lt(this,Gm))==null||e.call(this),bn(this,Gm,void 0))}setEventListener(e){var n;bn(this,B1,e),(n=lt(this,Gm))==null||n.call(this),bn(this,Gm,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){lt(this,rx)!==e&&(bn(this,rx,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof lt(this,rx)=="boolean"?lt(this,rx):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},rx=new WeakMap,Gm=new WeakMap,B1=new WeakMap,eU),h7=new Lee;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 jee=Nee;function zee(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=jee;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 Zo=zee(),H1,Wm,V1,tU,Fee=(tU=class extends zy{constructor(){super();Bn(this,H1,!0);Bn(this,Wm);Bn(this,V1);bn(this,V1,e=>{if(!yx&&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(){lt(this,Wm)||this.setEventListener(lt(this,V1))}onUnsubscribe(){var e;this.hasListeners()||((e=lt(this,Wm))==null||e.call(this),bn(this,Wm,void 0))}setEventListener(e){var n;bn(this,V1,e),(n=lt(this,Wm))==null||n.call(this),bn(this,Wm,e(this.setOnline.bind(this)))}setOnline(e){lt(this,H1)!==e&&(bn(this,H1,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return lt(this,H1)}},H1=new WeakMap,Wm=new WeakMap,V1=new WeakMap,tU),_2=new Fee;function Uee(t){return Math.min(1e3*2**t,3e4)}function OU(t){return(t??"online")==="online"?_2.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 LU(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=()=>h7.isFocused()&&(t.networkMode==="always"||_2.isOnline())&&t.canRun(),f=()=>OU(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 k;if(s())return;const C=t.retry??(yx?0:3),A=t.retryDelay??Uee,N=typeof A=="function"?A(n,M):A,P=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,M);if(e||!P){m(M);return}n++,(k=t.onFail)==null||k.call(t,n,M),Dee(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:f,start:()=>(f()?b():x().then(b),i)}}var ix,nU,jU=(nU=class{constructor(){Bn(this,ix)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),UN(this.gcTime)&&bn(this,ix,Qg.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(yx?1/0:300*1e3))}clearGcTimeout(){lt(this,ix)&&(Qg.clearTimeout(lt(this,ix)),bn(this,ix,void 0))}},ix=new WeakMap,nU),sx,G1,Ju,ox,Ca,ow,ax,Xd,op,rU,Bee=(rU=class extends jU{constructor(e){super();Bn(this,Xd);Bn(this,sx);Bn(this,G1);Bn(this,Ju);Bn(this,ox);Bn(this,Ca);Bn(this,ow);Bn(this,ax);bn(this,ax,!1),bn(this,ow,e.defaultOptions),this.setOptions(e.options),this.observers=[],bn(this,ox,e.client),bn(this,Ju,lt(this,ox).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,bn(this,sx,NP(this.options)),this.state=e.state??lt(this,sx),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=lt(this,Ca))==null?void 0:e.promise}setOptions(e){if(this.options={...lt(this,ow),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=NP(this.options);n.data!==void 0&&(this.setState(AP(n.data,n.dataUpdatedAt)),bn(this,sx,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&lt(this,Ju).remove(this)}setData(e,n){const r=HN(this.state.data,e,this.options);return br(this,Xd,op).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){br(this,Xd,op).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=lt(this,Ca))==null?void 0:r.promise;return(i=lt(this,Ca))==null||i.cancel(e),n?n.then(Vl).catch(Vl):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(lt(this,sx))}isActive(){return this.observers.some(e=>td(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===f7||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>n0(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:!DU(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=lt(this,Ca))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=lt(this,Ca))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),lt(this,Ju).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(lt(this,Ca)&&(lt(this,ax)?lt(this,Ca).cancel({revert:!0}):lt(this,Ca).cancelRetry()),this.scheduleGc()),lt(this,Ju).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||br(this,Xd,op).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,f,p,m,x,b,_,S,M,C,A;if(this.state.fetchStatus!=="idle"&&((l=lt(this,Ca))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(lt(this,Ca))return lt(this,Ca).continueRetry(),lt(this,Ca).promise}if(e&&this.setOptions(e),!this.options.queryFn){const N=this.observers.find(P=>P.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,i=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(bn(this,ax,!0),r.signal)})},s=()=>{const N=PU(this.options,n),k=(()=>{const O={client:lt(this,ox),queryKey:this.queryKey,meta:this.meta};return i(O),O})();return bn(this,ax,!1),this.options.persister?this.options.persister(N,k,this):N(k)},a=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:lt(this,ox),state:this.state,fetchFn:s};return i(N),N})();(c=this.options.behavior)==null||c.onFetch(a,this),bn(this,G1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&br(this,Xd,op).call(this,{type:"fetch",meta:(p=a.fetchOptions)==null?void 0:p.meta}),bn(this,Ca,LU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:N=>{N instanceof GN&&N.revert&&this.setState({...lt(this,G1),fetchStatus:"idle"}),r.abort()},onFail:(N,P)=>{br(this,Xd,op).call(this,{type:"failed",failureCount:N,error:P})},onPause:()=>{br(this,Xd,op).call(this,{type:"pause"})},onContinue:()=>{br(this,Xd,op).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const N=await lt(this,Ca).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(x=(m=lt(this,Ju).config).onSuccess)==null||x.call(m,N,this),(_=(b=lt(this,Ju).config).onSettled)==null||_.call(b,N,this.state.error,this),N}catch(N){if(N instanceof GN){if(N.silent)return lt(this,Ca).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw br(this,Xd,op).call(this,{type:"error",error:N}),(M=(S=lt(this,Ju).config).onError)==null||M.call(S,N,this),(A=(C=lt(this,Ju).config).onSettled)==null||A.call(C,this.state.data,N,this),N}finally{this.scheduleGc()}}},sx=new WeakMap,G1=new WeakMap,Ju=new WeakMap,ox=new WeakMap,Ca=new WeakMap,ow=new WeakMap,ax=new WeakMap,Xd=new WeakSet,op=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,...zU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...AP(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return bn(this,G1,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),Zo.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),lt(this,Ju).notify({query:this,type:"updated",action:e})})},rU);function zU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:OU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function AP(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function NP(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 Ac,di,aw,Hl,lx,W1,up,$m,lw,$1,q1,cx,ux,qm,X1,Gi,O_,WN,$N,qN,XN,YN,KN,ZN,FU,iU,p7=(iU=class extends zy{constructor(e,n){super();Bn(this,Gi);Bn(this,Ac);Bn(this,di);Bn(this,aw);Bn(this,Hl);Bn(this,lx);Bn(this,W1);Bn(this,up);Bn(this,$m);Bn(this,lw);Bn(this,$1);Bn(this,q1);Bn(this,cx);Bn(this,ux);Bn(this,qm);Bn(this,X1,new Set);this.options=n,bn(this,Ac,e),bn(this,$m,null),bn(this,up,VN()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(lt(this,di).addObserver(this),kP(lt(this,di),this.options)?br(this,Gi,O_).call(this):this.updateResult(),br(this,Gi,XN).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return QN(lt(this,di),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return QN(lt(this,di),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,br(this,Gi,YN).call(this),br(this,Gi,KN).call(this),lt(this,di).removeObserver(this)}setOptions(e){const n=this.options,r=lt(this,di);if(this.options=lt(this,Ac).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof td(this.options.enabled,lt(this,di))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");br(this,Gi,ZN).call(this),lt(this,di).setOptions(this.options),n._defaulted&&!b2(this.options,n)&&lt(this,Ac).getQueryCache().notify({type:"observerOptionsUpdated",query:lt(this,di),observer:this});const i=this.hasListeners();i&&RP(lt(this,di),r,this.options,n)&&br(this,Gi,O_).call(this),this.updateResult(),i&&(lt(this,di)!==r||td(this.options.enabled,lt(this,di))!==td(n.enabled,lt(this,di))||n0(this.options.staleTime,lt(this,di))!==n0(n.staleTime,lt(this,di)))&&br(this,Gi,WN).call(this);const s=br(this,Gi,$N).call(this);i&&(lt(this,di)!==r||td(this.options.enabled,lt(this,di))!==td(n.enabled,lt(this,di))||s!==lt(this,qm))&&br(this,Gi,qN).call(this,s)}getOptimisticResult(e){const n=lt(this,Ac).getQueryCache().build(lt(this,Ac),e),r=this.createResult(n,e);return Vee(this,r)&&(bn(this,Hl,r),bn(this,W1,this.options),bn(this,lx,lt(this,di).state)),r}getCurrentResult(){return lt(this,Hl)}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&&lt(this,up).status==="pending"&&lt(this,up).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){lt(this,X1).add(e)}getCurrentQuery(){return lt(this,di)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=lt(this,Ac).defaultQueryOptions(e),r=lt(this,Ac).getQueryCache().build(lt(this,Ac),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return br(this,Gi,O_).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),lt(this,Hl)))}createResult(e,n){var L;const r=lt(this,di),i=this.options,s=lt(this,Hl),o=lt(this,lx),a=lt(this,W1),c=e!==r?e.state:lt(this,aw),{state:f}=e;let p={...f},m=!1,x;if(n._optimisticResults){const B=this.hasListeners(),V=!B&&kP(e,n),W=B&&RP(e,r,n,i);(V||W)&&(p={...p,...zU(f.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 B;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(B=s.data,M=!0):B=typeof n.placeholderData=="function"?n.placeholderData((L=lt(this,q1))==null?void 0:L.state.data,lt(this,q1)):n.placeholderData,B!==void 0&&(S="success",x=HN(s==null?void 0:s.data,B,n),m=!0)}if(n.select&&x!==void 0&&!M)if(s&&x===(o==null?void 0:o.data)&&n.select===lt(this,lw))x=lt(this,$1);else try{bn(this,lw,n.select),x=n.select(x),x=HN(s==null?void 0:s.data,x,n),bn(this,$1,x),bn(this,$m,null)}catch(B){bn(this,$m,B)}lt(this,$m)&&(b=lt(this,$m),x=lt(this,$1),_=Date.now(),S="error");const C=p.fetchStatus==="fetching",A=S==="pending",N=S==="error",P=A&&C,k=x!==void 0,R={status:S,fetchStatus:p.fetchStatus,isPending:A,isSuccess:S==="success",isError:N,isInitialLoading:P,isLoading:P,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&&!k,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:N&&k,isStale:m7(e,n),refetch:this.refetch,promise:lt(this,up),isEnabled:td(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const B=R.data!==void 0,V=R.status==="error"&&!B,W=H=>{V?H.reject(R.error):B&&H.resolve(R.data)},G=()=>{const H=bn(this,up,R.promise=VN());W(H)},ee=lt(this,up);switch(ee.status){case"pending":e.queryHash===r.queryHash&&W(ee);break;case"fulfilled":(V||R.data!==ee.value)&&G();break;case"rejected":(!V||R.error!==ee.reason)&&G();break}}return R}updateResult(){const e=lt(this,Hl),n=this.createResult(lt(this,di),this.options);if(bn(this,lx,lt(this,di).state),bn(this,W1,this.options),lt(this,lx).data!==void 0&&bn(this,q1,lt(this,di)),b2(n,e))return;bn(this,Hl,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!lt(this,X1).size)return!0;const o=new Set(s??lt(this,X1));return this.options.throwOnError&&o.add("error"),Object.keys(lt(this,Hl)).some(a=>{const l=a;return lt(this,Hl)[l]!==e[l]&&o.has(l)})};br(this,Gi,FU).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&br(this,Gi,XN).call(this)}},Ac=new WeakMap,di=new WeakMap,aw=new WeakMap,Hl=new WeakMap,lx=new WeakMap,W1=new WeakMap,up=new WeakMap,$m=new WeakMap,lw=new WeakMap,$1=new WeakMap,q1=new WeakMap,cx=new WeakMap,ux=new WeakMap,qm=new WeakMap,X1=new WeakMap,Gi=new WeakSet,O_=function(e){br(this,Gi,ZN).call(this);let n=lt(this,di).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Vl)),n},WN=function(){br(this,Gi,YN).call(this);const e=n0(this.options.staleTime,lt(this,di));if(yx||lt(this,Hl).isStale||!UN(e))return;const r=DU(lt(this,Hl).dataUpdatedAt,e)+1;bn(this,cx,Qg.setTimeout(()=>{lt(this,Hl).isStale||this.updateResult()},r))},$N=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(lt(this,di)):this.options.refetchInterval)??!1},qN=function(e){br(this,Gi,KN).call(this),bn(this,qm,e),!(yx||td(this.options.enabled,lt(this,di))===!1||!UN(lt(this,qm))||lt(this,qm)===0)&&bn(this,ux,Qg.setInterval(()=>{(this.options.refetchIntervalInBackground||h7.isFocused())&&br(this,Gi,O_).call(this)},lt(this,qm)))},XN=function(){br(this,Gi,WN).call(this),br(this,Gi,qN).call(this,br(this,Gi,$N).call(this))},YN=function(){lt(this,cx)&&(Qg.clearTimeout(lt(this,cx)),bn(this,cx,void 0))},KN=function(){lt(this,ux)&&(Qg.clearInterval(lt(this,ux)),bn(this,ux,void 0))},ZN=function(){const e=lt(this,Ac).getQueryCache().build(lt(this,Ac),this.options);if(e===lt(this,di))return;const n=lt(this,di);bn(this,di,e),bn(this,aw,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},FU=function(e){Zo.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(lt(this,Hl))}),lt(this,Ac).getQueryCache().notify({query:lt(this,di),type:"observerResultsUpdated"})})},iU);function Hee(t,e){return td(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function kP(t,e){return Hee(t,e)||t.state.data!==void 0&&QN(t,e,e.refetchOnMount)}function QN(t,e,n){if(td(e.enabled,t)!==!1&&n0(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&m7(t,e)}return!1}function RP(t,e,n,r){return(t!==e||td(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&m7(t,n)}function m7(t,e){return td(e.enabled,t)!==!1&&t.isStaleByTime(n0(e.staleTime,t))}function Vee(t,e){return!b2(t.getCurrentResult(),e)}function DP(t){return{onFetch:(e,n)=>{var f,p,m,x,b;const r=e.options,i=(m=(p=(f=e.fetchOptions)==null?void 0:f.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=>{Oee(A,()=>e.signal,()=>_=!0)},M=PU(e.options,e.fetchOptions),C=async(A,N,P)=>{if(_)return Promise.reject();if(N==null&&A.pages.length)return Promise.resolve(A);const O=(()=>{const V={client:e.client,queryKey:e.queryKey,pageParam:N,direction:P?"backward":"forward",meta:e.options.meta};return S(V),V})(),R=await M(O),{maxPages:L}=e.options,B=P?Iee:Pee;return{pages:B(A.pages,R,L),pageParams:B(A.pageParams,N,L)}};if(i&&s.length){const A=i==="backward",N=A?Gee:PP,P={pages:s,pageParams:o},k=N(r,P);a=await C(P,k,A)}else{const A=t??s.length;do{const N=l===0?o[0]??r.initialPageParam:PP(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 PP(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 Gee(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 cw,Yf,ml,dx,Kf,Om,sU,Wee=(sU=class extends jU{constructor(e){super();Bn(this,Kf);Bn(this,cw);Bn(this,Yf);Bn(this,ml);Bn(this,dx);bn(this,cw,e.client),this.mutationId=e.mutationId,bn(this,ml,e.mutationCache),bn(this,Yf,[]),this.state=e.state||$ee(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){lt(this,Yf).includes(e)||(lt(this,Yf).push(e),this.clearGcTimeout(),lt(this,ml).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){bn(this,Yf,lt(this,Yf).filter(n=>n!==e)),this.scheduleGc(),lt(this,ml).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){lt(this,Yf).length||(this.state.status==="pending"?this.scheduleGc():lt(this,ml).remove(this))}continue(){var e;return((e=lt(this,dx))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,f,p,m,x,b,_,S,M,C,A,N,P,k,O;const n=()=>{br(this,Kf,Om).call(this,{type:"continue"})},r={client:lt(this,cw),meta:this.options.meta,mutationKey:this.options.mutationKey};bn(this,dx,LU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,L)=>{br(this,Kf,Om).call(this,{type:"failed",failureCount:R,error:L})},onPause:()=>{br(this,Kf,Om).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>lt(this,ml).canRun(this)}));const i=this.state.status==="pending",s=!lt(this,dx).canStart();try{if(i)n();else{br(this,Kf,Om).call(this,{type:"pending",variables:e,isPaused:s}),lt(this,ml).config.onMutate&&await lt(this,ml).config.onMutate(e,this,r);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));L!==this.state.context&&br(this,Kf,Om).call(this,{type:"pending",context:L,variables:e,isPaused:s})}const R=await lt(this,dx).start();return await((c=(l=lt(this,ml).config).onSuccess)==null?void 0:c.call(l,R,e,this.state.context,this,r)),await((p=(f=this.options).onSuccess)==null?void 0:p.call(f,R,e,this.state.context,r)),await((x=(m=lt(this,ml).config).onSettled)==null?void 0:x.call(m,R,null,this.state.variables,this.state.context,this,r)),await((_=(b=this.options).onSettled)==null?void 0:_.call(b,R,null,e,this.state.context,r)),br(this,Kf,Om).call(this,{type:"success",data:R}),R}catch(R){try{await((M=(S=lt(this,ml).config).onError)==null?void 0:M.call(S,R,e,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((A=(C=this.options).onError)==null?void 0:A.call(C,R,e,this.state.context,r))}catch(L){Promise.reject(L)}try{await((P=(N=lt(this,ml).config).onSettled)==null?void 0:P.call(N,void 0,R,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((O=(k=this.options).onSettled)==null?void 0:O.call(k,void 0,R,e,this.state.context,r))}catch(L){Promise.reject(L)}throw br(this,Kf,Om).call(this,{type:"error",error:R}),R}finally{lt(this,ml).runNext(this)}}},cw=new WeakMap,Yf=new WeakMap,ml=new WeakMap,dx=new WeakMap,Kf=new WeakSet,Om=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),Zo.batch(()=>{lt(this,Yf).forEach(r=>{r.onMutationUpdate(e)}),lt(this,ml).notify({mutation:this,type:"updated",action:e})})},sU);function $ee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var dp,Yd,uw,oU,qee=(oU=class extends zy{constructor(e={}){super();Bn(this,dp);Bn(this,Yd);Bn(this,uw);this.config=e,bn(this,dp,new Set),bn(this,Yd,new Map),bn(this,uw,0)}build(e,n,r){const i=new Wee({client:e,mutationCache:this,mutationId:++h4(this,uw)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){lt(this,dp).add(e);const n=m4(e);if(typeof n=="string"){const r=lt(this,Yd).get(n);r?r.push(e):lt(this,Yd).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(lt(this,dp).delete(e)){const n=m4(e);if(typeof n=="string"){const r=lt(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&&lt(this,Yd).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=m4(e);if(typeof n=="string"){const r=lt(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=m4(e);if(typeof n=="string"){const i=(r=lt(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(){Zo.batch(()=>{lt(this,dp).forEach(e=>{this.notify({type:"removed",mutation:e})}),lt(this,dp).clear(),lt(this,Yd).clear()})}getAll(){return Array.from(lt(this,dp))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>TP(n,r))}findAll(e={}){return this.getAll().filter(n=>TP(e,n))}notify(e){Zo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Zo.batch(()=>Promise.all(e.map(n=>n.continue().catch(Vl))))}},dp=new WeakMap,Yd=new WeakMap,uw=new WeakMap,oU);function m4(t){var e;return(e=t.options.scope)==null?void 0:e.id}function IP(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function Xee(t,e,n){const r=t.slice(0);return r[e]=n,r}var Y1,ru,K1,Z1,ed,Xm,dw,fw,hw,pw,Ka,JN,ek,tk,nk,rk,aU,Yee=(aU=class extends zy{constructor(e,n,r){super();Bn(this,Ka);Bn(this,Y1);Bn(this,ru);Bn(this,K1);Bn(this,Z1);Bn(this,ed);Bn(this,Xm);Bn(this,dw);Bn(this,fw);Bn(this,hw);Bn(this,pw,[]);bn(this,Y1,e),bn(this,Z1,r),bn(this,K1,[]),bn(this,ed,[]),bn(this,ru,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&lt(this,ed).forEach(e=>{e.subscribe(n=>{br(this,Ka,nk).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,lt(this,ed).forEach(e=>{e.destroy()})}setQueries(e,n){bn(this,K1,e),bn(this,Z1,n),Zo.batch(()=>{const r=lt(this,ed),i=br(this,Ka,tk).call(this,lt(this,K1));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,f=c?!0:o.some((p,m)=>{const x=lt(this,ru)[m];return!x||!b2(p,x)});!c&&!f||(c&&(bn(this,pw,i),bn(this,ed,s)),bn(this,ru,o),this.hasListeners()&&(c&&(IP(r,s).forEach(p=>{p.destroy()}),IP(s,r).forEach(p=>{p.subscribe(m=>{br(this,Ka,nk).call(this,p,m)})})),br(this,Ka,rk).call(this)))})}getCurrentResult(){return lt(this,ru)}getQueries(){return lt(this,ed).map(e=>e.getCurrentQuery())}getObservers(){return lt(this,ed)}getOptimisticResult(e,n){const r=br(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=>br(this,Ka,ek).call(this,o??i,n,s),()=>br(this,Ka,JN).call(this,i,r)]}},Y1=new WeakMap,ru=new WeakMap,K1=new WeakMap,Z1=new WeakMap,ed=new WeakMap,Xm=new WeakMap,dw=new WeakMap,fw=new WeakMap,hw=new WeakMap,pw=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=lt(this,hw),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((o,a)=>o!==i[a]));return(!lt(this,Xm)||lt(this,ru)!==lt(this,fw)||s||n!==lt(this,dw))&&(bn(this,dw,n),bn(this,fw,lt(this,ru)),r!==void 0&&bn(this,hw,r),bn(this,Xm,d7(lt(this,Xm),n(e)))),lt(this,Xm)}return e},tk=function(e){const n=new Map;lt(this,ed).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=lt(this,Y1).defaultQueryOptions(i),a=((l=n.get(s.queryHash))==null?void 0:l.shift())??new p7(lt(this,Y1),s);r.push({defaultedQueryOptions:s,observer:a})}),r},nk=function(e,n){const r=lt(this,ed).indexOf(e);r!==-1&&(bn(this,ru,Xee(lt(this,ru),r,n)),br(this,Ka,rk).call(this))},rk=function(){var e;if(this.hasListeners()){const n=lt(this,Xm),r=br(this,Ka,JN).call(this,lt(this,ru),lt(this,pw)),i=br(this,Ka,ek).call(this,r,(e=lt(this,Z1))==null?void 0:e.combine);n!==i&&Zo.batch(()=>{this.listeners.forEach(s=>{s(lt(this,ru))})})}},aU),Zf,lU,Kee=(lU=class extends zy{constructor(e={}){super();Bn(this,Zf);this.config=e,bn(this,Zf,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??u7(i,n);let o=this.get(s);return o||(o=new Bee({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){lt(this,Zf).has(e.queryHash)||(lt(this,Zf).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=lt(this,Zf).get(e.queryHash);n&&(e.destroy(),n===e&&lt(this,Zf).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Zo.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return lt(this,Zf).get(e)}getAll(){return[...lt(this,Zf).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>MP(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>MP(e,r)):n}notify(e){Zo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Zo.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Zo.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Zf=new WeakMap,lU),So,Ym,Km,Q1,J1,Zm,ey,ty,cU,Zee=(cU=class{constructor(t={}){Bn(this,So);Bn(this,Ym);Bn(this,Km);Bn(this,Q1);Bn(this,J1);Bn(this,Zm);Bn(this,ey);Bn(this,ty);bn(this,So,t.queryCache||new Kee),bn(this,Ym,t.mutationCache||new qee),bn(this,Km,t.defaultOptions||{}),bn(this,Q1,new Map),bn(this,J1,new Map),bn(this,Zm,0)}mount(){h4(this,Zm)._++,lt(this,Zm)===1&&(bn(this,ey,h7.subscribe(async t=>{t&&(await this.resumePausedMutations(),lt(this,So).onFocus())})),bn(this,ty,_2.subscribe(async t=>{t&&(await this.resumePausedMutations(),lt(this,So).onOnline())})))}unmount(){var t,e;h4(this,Zm)._--,lt(this,Zm)===0&&((t=lt(this,ey))==null||t.call(this),bn(this,ey,void 0),(e=lt(this,ty))==null||e.call(this),bn(this,ty,void 0))}isFetching(t){return lt(this,So).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return lt(this,Ym).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=lt(this,So).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=lt(this,So).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(n0(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return lt(this,So).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=lt(this,So).get(r.queryHash),s=i==null?void 0:i.state.data,o=kee(e,s);if(o!==void 0)return lt(this,So).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Zo.batch(()=>lt(this,So).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=lt(this,So).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=lt(this,So);Zo.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=lt(this,So);return Zo.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Zo.batch(()=>lt(this,So).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Vl).catch(Vl)}invalidateQueries(t,e={}){return Zo.batch(()=>(lt(this,So).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=Zo.batch(()=>lt(this,So).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Vl)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Vl)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=lt(this,So).build(this,e);return n.isStaleByTime(n0(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Vl).catch(Vl)}fetchInfiniteQuery(t){return t.behavior=DP(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Vl).catch(Vl)}ensureInfiniteQueryData(t){return t.behavior=DP(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return _2.isOnline()?lt(this,Ym).resumePausedMutations():Promise.resolve()}getQueryCache(){return lt(this,So)}getMutationCache(){return lt(this,Ym)}getDefaultOptions(){return lt(this,Km)}setDefaultOptions(t){bn(this,Km,t)}setQueryDefaults(t,e){lt(this,Q1).set(SS(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...lt(this,Q1).values()],n={};return e.forEach(r=>{wS(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){lt(this,J1).set(SS(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...lt(this,J1).values()],n={};return e.forEach(r=>{wS(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...lt(this,Km).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=u7(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===f7&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...lt(this,Km).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){lt(this,So).clear(),lt(this,Ym).clear()}},So=new WeakMap,Ym=new WeakMap,Km=new WeakMap,Q1=new WeakMap,J1=new WeakMap,Zm=new WeakMap,ey=new WeakMap,ty=new WeakMap,cU),UU=w.createContext(void 0),M0=t=>{const e=w.useContext(UU);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]),d.jsx(UU.Provider,{value:t,children:e})),BU=w.createContext(!1),HU=()=>w.useContext(BU);BU.Provider;function Jee(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var ete=w.createContext(Jee()),VU=()=>w.useContext(ete),GU=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?IU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},WU=t=>{w.useEffect(()=>{t.clearReset()},[t])},$U=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||IU(n,[t.error,r])),qU=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))}},tte=(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 XU({queries:t,...e},n){const r=M0(),i=HU(),s=VU(),o=w.useMemo(()=>t.map(_=>{const S=r.defaultQueryOptions(_);return S._optimisticResults=i?"isRestoring":"optimistic",S}),[t,r,i]);o.forEach(_=>{qU(_);const S=r.getQueryCache().get(_.queryHash);GU(_,s,S)}),WU(s);const[a]=w.useState(()=>new Yee(r,o,e)),[l,c,f]=a.getOptimisticResult(o,e.combine),p=!i&&e.subscribed!==!1;w.useSyncExternalStore(w.useCallback(_=>p?a.subscribe(Zo.batchCalls(_)):Vl,[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 p7(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&&$U({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(f())}function nte(t,e,n){var m,x,b,_;const r=HU(),i=VU(),s=M0(),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",qU(o),GU(o,i,a),WU(i);const l=!s.getQueryCache().get(o.queryHash),[c]=w.useState(()=>new e(s,o)),f=c.getOptimisticResult(o),p=!r&&t.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(S=>{const M=p?c.subscribe(Zo.batchCalls(S)):Vl;return c.updateResult(),M},[c,p]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),ik(o,f))throw sk(o,c,i);if($U({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((_=(b=s.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||_.call(b,o,f),o.experimental_prefetchInRender&&!yx&&tte(f,r)){const S=l?sk(o,c,i):a==null?void 0:a.promise;S==null||S.catch(Vl).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?f:c.trackResult(f)}function Si(t,e){return nte(t,p7)}const Jf={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function YU(t){return"init"in t}function ok(t){return!!t.write}function OP(t){return"v"in t||"e"in t}function S2(t){if("e"in t)throw t.e;if((Jf?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}function w2(t){return typeof(t==null?void 0:t.then)=="function"}function KU(t,e,n){if(!n.p.has(t)){n.p.add(t);const r=()=>n.p.delete(t);e.then(r,r)}}function ZU(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 rte=(t,e,...n)=>e.read(...n),ite=(t,e,...n)=>e.write(...n),ste=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},ote=(t,e,n)=>{var r;return(r=e.onMount)==null?void 0:r.call(e,n)},ate=(t,e)=>{var n;const r=ha(t),i=r[0],s=r[6],o=r[9];if((Jf?"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},lte=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=f=>{try{f()}catch(p){l.push(p)}};do{o.f&&c(o.f);const f=new Set,p=f.add.bind(f);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(),f.forEach(c),r.size&&a(t)}while(r.size||s.size||i.size);if(l.length)throw new AggregateError(l)},cte=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,f=new WeakSet,p=Array.from(i);for(;p.length;){const m=p[p.length-1],x=s(t,m);if(f.has(m)){p.pop();continue}if(c.has(m)){if(r.get(m)===x.n)l.push([m,x]);else if((Jf?"production":void 0)!=="production"&&r.has(m))throw new Error("[Bug] invalidated atom exists");f.add(m),p.pop();continue}c.add(m);for(const b of ZU(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,ute=(t,e)=>{var n,r;const i=ha(t),s=i[1],o=i[2],a=i[3],l=i[6],c=i[7],f=i[11],p=i[12],m=i[13],x=i[14],b=i[16],_=i[17],S=i[20],M=i[26],C=f(t,e);if(OP(C)){if(s.has(e)&&o.get(e)!==C.n)return C;let G=!1;for(const[ee,H]of C.d)if(x(t,ee).n!==H){G=!0;break}if(!G)return C}let A=!0;const N=new Set(C.d.keys()),P=new Map,k=()=>{for(const G of N)P.has(G)||C.d.delete(G)},O=()=>{if(s.has(e)){const G=!a.size;_(t,e),G&&(m(t),p(t))}},R=G=>{var ee;if(G===e){const q=f(t,G);if(!OP(q))if(YU(G))S(t,G,G.init);else throw new Error("no atom init");return S2(q)}const H=x(t,G);try{return S2(H)}finally{P.set(G,H.n),C.d.set(G,H.n),w2(C.v)&&KU(e,C.v,H),s.has(e)&&((ee=s.get(G))==null||ee.t.add(e)),A||O()}};let L,B;const V={get signal(){return L||(L=new AbortController),L.signal},get setSelf(){return(Jf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(Jf?"production":void 0)!=="production"&&!ok(e)&&console.warn("setSelf function cannot be used with read-only atom"),!B&&ok(e)&&(B=(...G)=>{if((Jf?"production":void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)try{return b(t,e,...G)}finally{m(t),p(t)}}),B}},W=C.n;try{(Jf?"production":void 0)!=="production"&&ak.delete(t);const G=c(t,e,R,V);if((Jf?"production":void 0)!=="production"&&ak.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),S(t,e,G),w2(G)){M(t,G,()=>L==null?void 0:L.abort());const ee=()=>{k(),O()};G.then(ee,ee)}else k();return(n=l.r)==null||n.call(l,e),C}catch(G){return delete C.v,C.e=G,++C.n,C}finally{A=!1,W!==C.n&&o.get(e)===W&&(o.set(e,C.n),a.add(e),(r=l.c)==null||r.call(l,e))}},dte=(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 ZU(a,l,r)){const f=s(t,c);i.get(c)!==f.n&&(i.set(c,f.n),o.push(c))}}},fte=(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],f=r[14],p=r[15],m=r[16],x=r[17],b=r[20];let _=!0;const S=C=>S2(f(t,C)),M=(C,...A)=>{var N;const P=a(t,C);try{if(C===e){if(!YU(C))throw new Error("atom not writable");(Jf?"production":void 0)!=="production"&&ak.add(t);const k=P.n,O=A[0];b(t,C,O),x(t,C),k!==P.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}},hte=(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],f=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=f(t,x);b==null||b.t.delete(e)}}},pte=(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],f=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||(f(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 _},mte=(t,e)=>{var n,r;const i=ha(t),s=i[1],o=i[5],a=i[6],l=i[11],c=i[19],f=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 f.d.keys()){const b=c(t,x);b==null||b.t.delete(e)}(r=a.u)==null||r.call(a,e);return}return p},gte=(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(w2(n))for(const c of o.d.keys())KU(e,n,i(t,c));o.v=n,delete o.e,(!a||!Object.is(l,o.v))&&(++o.n,w2(l)&&s(t,l))},xte=(t,e)=>{const n=ha(t)[14];return S2(n(t,e))},vte=(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)}},yte=(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)}},bte=(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)},_te=(t,e)=>{const i=ha(t)[25].get(e);i==null||i.forEach(s=>s())},QU=new WeakMap,ha=t=>{const e=QU.get(t);if((Jf?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function Ste(t){const e=ha(t),n=e[24];return n?n(e):e}function wte(...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,{},rte,ite,ste,ote,ate,lte,cte,ute,dte,fte,hte,pte,mte,gte,xte,vte,yte,void 0,new WeakMap,bte,_te].map((r,i)=>t[i]||r);return QU.set(e,Object.freeze(n)),e}const JU={};let Mte=0;function Rr(t,e){const n=`atom${++Mte}`,r={toString(){return(JU?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Tte,r.write=Cte),e&&(r.write=e),r}function Tte(t){return t(this)}function Cte(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function eB(){return wte()}let d_;function Ete(){return d_||(d_=eB(),(JU?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=d_),globalThis.__JOTAI_DEFAULT_STORE__!==d_&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),d_}const Ate={},lk=w.createContext(void 0);function tB(t){return w.useContext(lk)||Ete()}function Nte({children:t,store:e}){const n=w.useRef(null);return e?w.createElement(lk.Provider,{value:e},t):(n.current===null&&(n.current=eB()),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}))},kte=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)}),cA=new WeakMap,LP=(t,e,n)=>{const i=Ste(t)[26];let s=cA.get(e);return s||(s=new Promise((o,a)=>{let l=e;const c=m=>x=>{l===m&&o(x)},f=m=>x=>{l===m&&a(x)},p=()=>{try{const m=n();ck(m)?(cA.set(m,s),l=m,m.then(c(m),f(m)),i(t,m,p)):o(m)}catch(m){a(m)}};e.then(c(e),f(e)),i(t,e,p)}),cA.set(e,s)),s};function qn(t,e){const{delay:n,unstable_promiseStatus:r=!ni.use}={},i=tB(),[[s,o,a],l]=w.useReducer(f=>{const p=i.get(t);return Object.is(f[0],p)&&f[1]===i&&f[2]===t?f:[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 f=i.sub(t,()=>{if(r)try{const p=i.get(t);ck(p)&&uk(LP(i,p,()=>i.get(t)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),f},[i,t,n,r]),w.useDebugValue(c),ck(c)){const f=LP(i,c,()=>i.get(t));return r&&uk(f),kte(f)}return c}function sd(t,e){const n=tB();return w.useCallback((...i)=>{if((Ate?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function fn(t,e){return[qn(t),sd(t)]}function jP(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pT(...t){return e=>{let n=!1;const r=t.map(i=>{const s=jP(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():jP(t[i],null)}}}}function Gr(...t){return w.useCallback(pT(...t),t)}function s0(t){const e=Rte(t),n=w.forwardRef((r,i)=>{const{children:s,...o}=r,a=w.Children.toArray(s),l=a.find(Dte);if(l){const c=l.props.children,f=a.map(p=>p===l?w.Children.count(c)>1?w.Children.only(null):w.isValidElement(c)?c.props.children:null:p);return d.jsx(e,{...o,ref:i,children:w.isValidElement(c)?w.cloneElement(c,void 0,f):null})}return d.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var nB=s0("Slot");function Rte(t){const e=w.forwardRef((n,r)=>{const{children:i,...s}=n;if(w.isValidElement(i)){const o=Ite(i),a=Pte(s,i.props);return i.type!==w.Fragment&&(a.ref=r?pT(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 rB=Symbol("radix.slottable");function iB(t){const e=({children:n})=>d.jsx(d.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=rB,e}function Dte(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rB}function Pte(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function Ite(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Ote=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pr=Ote.reduce((t,e)=>{const n=s0(`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),d.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function sB(t,e){t&&ql.flushSync(()=>t.dispatchEvent(e))}var oB=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"}),Lte="VisuallyHidden",aB=w.forwardRef((t,e)=>d.jsx(pr.span,{...t,ref:e,style:{...oB,...t.style}}));aB.displayName=Lte;var jte=aB;function zte(t,e){const n=w.createContext(e),r=s=>{const{children:o,...a}=s,l=w.useMemo(()=>a,Object.values(a));return d.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 Su(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 d.jsx(_.Provider,{value:S,children:x})};c.displayName=s+"Provider";function f(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,f]}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,Fte(i,...e)]}function Fte(...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 g7(t){const e=t+"CollectionProvider",[n,r]=Su(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 d.jsx(i,{scope:S,itemMap:A,collectionRef:C,children:M})};o.displayName=e;const a=t+"CollectionSlot",l=s0(a),c=ni.forwardRef((_,S)=>{const{scope:M,children:C}=_,A=s(a,M),N=Gr(S,A.collectionRef);return d.jsx(l,{ref:N,children:C})});c.displayName=a;const f=t+"CollectionItemSlot",p="data-radix-collection-item",m=s0(f),x=ni.forwardRef((_,S)=>{const{scope:M,children:C,...A}=_,N=ni.useRef(null),P=Gr(S,N),k=s(f,M);return ni.useEffect(()=>(k.itemMap.set(N,{ref:N,...A}),()=>void k.itemMap.delete(N))),d.jsx(m,{[p]:"",ref:P,children:C})});x.displayName=f;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((k,O)=>A.indexOf(k.ref.current)-A.indexOf(O.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:o,Slot:c,ItemSlot:x},b,r]}function En(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 ka=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},Ute=uU[" useInsertionEffect ".trim().toString()]||ka;function fd({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=Bte({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const f=w.useRef(t!==void 0);w.useEffect(()=>{const p=f.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.`),f.current=a},[a,r])}const c=w.useCallback(f=>{var p;if(a){const m=Hte(f)?f(t):f;m!==t&&((p=o.current)==null||p.call(o,m))}else s(f)},[a,t,s,o]);return[l,c]}function Bte({defaultProp:t,onChange:e}){const[n,r]=w.useState(t),i=w.useRef(n),s=w.useRef(e);return Ute(()=>{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 Hte(t){return typeof t=="function"}function Vte(t,e){return w.useReducer((n,r)=>e[n][r]??n,t)}var Za=t=>{const{present:e,children:n}=t,r=Gte(e),i=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),s=Gr(r.ref,Wte(i));return typeof n=="function"||r.isPresent?w.cloneElement(i,{ref:s}):null};Za.displayName="Presence";function Gte(t){const[e,n]=w.useState(),r=w.useRef(null),i=w.useRef(t),s=w.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Vte(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=g4(r.current);s.current=a==="mounted"?c:"none"},[a]),ka(()=>{const c=r.current,f=i.current;if(f!==t){const m=s.current,x=g4(c);t?l("MOUNT"):x==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(f&&m!==x?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),ka(()=>{if(e){let c;const f=e.ownerDocument.defaultView??window,p=x=>{const _=g4(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=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},m=x=>{x.target===e&&(s.current=g4(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",p),e.addEventListener("animationend",p),()=>{f.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 g4(t){return(t==null?void 0:t.animationName)||"none"}function Wte(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 $te=uU[" useId ".trim().toString()]||(()=>{}),qte=0;function jc(t){const[e,n]=w.useState($te());return ka(()=>{n(r=>r??String(qte++))},[t]),t||(e?`radix-${e}`:"")}var mT="Collapsible",[Xte]=Su(mT),[Yte,x7]=Xte(mT),lB=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l,c]=fd({prop:r,defaultProp:i??!1,onChange:o,caller:mT});return d.jsx(Yte,{scope:n,disabled:s,contentId:jc(),open:l,onOpenToggle:w.useCallback(()=>c(f=>!f),[c]),children:d.jsx(pr.div,{"data-state":y7(l),"data-disabled":s?"":void 0,...a,ref:e})})});lB.displayName=mT;var cB="CollapsibleTrigger",uB=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=x7(cB,n);return d.jsx(pr.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":y7(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:En(t.onClick,i.onOpenToggle)})});uB.displayName=cB;var v7="CollapsibleContent",dB=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=x7(v7,t.__scopeCollapsible);return d.jsx(Za,{present:n||i.open,children:({present:s})=>d.jsx(Kte,{...r,ref:e,present:s})})});dB.displayName=v7;var Kte=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,o=x7(v7,n),[a,l]=w.useState(r),c=w.useRef(null),f=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)},[]),ka(()=>{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]),d.jsx(pr.div,{"data-state":y7(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!_,...s,ref:f,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...t.style},children:_&&i})});function y7(t){return t?"open":"closed"}var Zte=lB,Qte=uB,Jte=dB,ene=w.createContext(void 0);function yw(t){const e=w.useContext(ene);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 tne(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 nne="DismissableLayer",dk="dismissableLayer.update",rne="dismissableLayer.pointerDownOutside",ine="dismissableLayer.focusOutside",zP,fB=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Fy=w.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=w.useContext(fB),[f,p]=w.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=w.useState({}),b=Gr(e,O=>p(O)),_=Array.from(c.layers),[S]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),M=_.indexOf(S),C=f?_.indexOf(f):-1,A=c.layersWithOutsidePointerEventsDisabled.size>0,N=C>=M,P=ane(O=>{const R=O.target,L=[...c.branches].some(B=>B.contains(R));!N||L||(i==null||i(O),o==null||o(O),O.defaultPrevented||a==null||a())},m),k=lne(O=>{const R=O.target;[...c.branches].some(B=>B.contains(R))||(s==null||s(O),o==null||o(O),O.defaultPrevented||a==null||a())},m);return tne(O=>{C===c.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},m),w.useEffect(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(zP=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),FP(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=zP)}},[f,m,n,c]),w.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),FP())},[f,c]),w.useEffect(()=>{const O=()=>x({});return document.addEventListener(dk,O),()=>document.removeEventListener(dk,O)},[]),d.jsx(pr.div,{...l,ref:b,style:{pointerEvents:A?N?"auto":"none":void 0,...t.style},onFocusCapture:En(t.onFocusCapture,k.onFocusCapture),onBlurCapture:En(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:En(t.onPointerDownCapture,P.onPointerDownCapture)})});Fy.displayName=nne;var sne="DismissableLayerBranch",one=w.forwardRef((t,e)=>{const n=w.useContext(fB),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]),d.jsx(pr.div,{...t,ref:i})});one.displayName=sne;function ane(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(){hB(rne,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 lne(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&&hB(ine,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 FP(){const t=new CustomEvent(dk);document.dispatchEvent(t)}function hB(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?sB(i,s):i.dispatchEvent(s)}var uA="focusScope.autoFocusOnMount",dA="focusScope.autoFocusOnUnmount",UP={bubbles:!1,cancelable:!0},cne="FocusScope",bw=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),f=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:Lm(p.current,{select:!0})},S=function(A){if(x.paused||!a)return;const N=A.relatedTarget;N!==null&&(a.contains(N)||Lm(p.current,{select:!0}))},M=function(A){if(document.activeElement===document.body)for(const P of A)P.removedNodes.length>0&&Lm(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){HP.add(x);const _=document.activeElement;if(!a.contains(_)){const M=new CustomEvent(uA,UP);a.addEventListener(uA,c),a.dispatchEvent(M),M.defaultPrevented||(une(mne(pB(a)),{select:!0}),document.activeElement===_&&Lm(a))}return()=>{a.removeEventListener(uA,c),setTimeout(()=>{const M=new CustomEvent(dA,UP);a.addEventListener(dA,f),a.dispatchEvent(M),M.defaultPrevented||Lm(_??document.body,{select:!0}),a.removeEventListener(dA,f),HP.remove(x)},0)}}},[a,c,f,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]=dne(C);A&&N?!_.shiftKey&&M===N?(_.preventDefault(),n&&Lm(A,{select:!0})):_.shiftKey&&M===A&&(_.preventDefault(),n&&Lm(N,{select:!0})):M===C&&_.preventDefault()}},[n,r,x.paused]);return d.jsx(pr.div,{tabIndex:-1,...o,ref:m,onKeyDown:b})});bw.displayName=cne;function une(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Lm(r,{select:e}),document.activeElement!==n)return}function dne(t){const e=pB(t),n=BP(e,t),r=BP(e.reverse(),t);return[n,r]}function pB(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 BP(t,e){for(const n of t)if(!fne(n,{upTo:e}))return n}function fne(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 hne(t){return t instanceof HTMLInputElement&&"select"in t}function Lm(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&hne(t)&&e&&t.select()}}var HP=pne();function pne(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=VP(t,e),t.unshift(e)},remove(e){var n;t=VP(t,e),(n=t[0])==null||n.resume()}}}function VP(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function mne(t){return t.filter(e=>e.tagName!=="A")}var gne="Portal",Uy=w.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=w.useState(!1);ka(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Cee.createPortal(d.jsx(pr.div,{...r,ref:e}),o):null});Uy.displayName=gne;var fA=0;function gT(){w.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??GP()),document.body.insertAdjacentElement("beforeend",t[1]??GP()),fA++,()=>{fA===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),fA--}},[])}function GP(){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 eh=function(){return eh=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},eh.apply(this,arguments)};function mB(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 xne(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 n2="right-scroll-bar-position",r2="width-before-scroll-bar",vne="with-scroll-bars-hidden",yne="--removed-body-scroll-bar-size";function hA(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function bne(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 _ne=typeof window<"u"?w.useLayoutEffect:w.useEffect,WP=new WeakMap;function Sne(t,e){var n=bne(null,function(r){return t.forEach(function(i){return hA(i,r)})});return _ne(function(){var r=WP.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||hA(a,null)}),s.forEach(function(a){i.has(a)||hA(a,o)})}WP.set(n,t)},[t]),n}function wne(t){return t}function Mne(t,e){e===void 0&&(e=wne);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 f=o;o=[],f.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(f){o.push(f),c()},filter:function(f){return o=o.filter(f),n}}}};return i}function Tne(t){t===void 0&&(t={});var e=Mne(null);return e.options=eh({async:!0,ssr:!1},t),e}var gB=function(t){var e=t.sideCar,n=mB(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,eh({},n))};gB.isSideCarExport=!0;function Cne(t,e){return t.useMedium(e),gB}var xB=Tne(),pA=function(){},xT=w.forwardRef(function(t,e){var n=w.useRef(null),r=w.useState({onScrollCapture:pA,onWheelCapture:pA,onTouchMoveCapture:pA}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,f=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=mB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=m,k=Sne([n,e]),O=eh(eh({},N),i);return w.createElement(w.Fragment,null,f&&w.createElement(P,{sideCar:xB,removeScrollBar:c,shards:p,noRelative:x,noIsolation:b,inert:_,setCallbacks:s,allowPinchZoom:!!S,lockRef:n,gapMode:A}),o?w.cloneElement(w.Children.only(a),eh(eh({},O),{ref:k})):w.createElement(C,eh({},O,{className:l,ref:k}),a))});xT.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};xT.classNames={fullWidth:r2,zeroRight:n2};var Ene=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ane(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Ene();return e&&t.setAttribute("nonce",e),t}function Nne(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function kne(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Rne=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Ane())&&(Nne(e,n),kne(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Dne=function(){var t=Rne();return function(e,n){w.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},vB=function(){var t=Dne(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},Pne={left:0,top:0,right:0,gap:0},mA=function(t){return parseInt(t||"",10)||0},Ine=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[mA(n),mA(r),mA(i)]},One=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Pne;var e=Ine(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},Lne=vB(),T1="data-scroll-locked",jne=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(vne,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(a,"px ").concat(r,`;
  }
  body[`).concat(T1,`] {
    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(n2,` {
    right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(r2,` {
    margin-right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(n2," .").concat(n2,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(r2," .").concat(r2,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(T1,`] {
    `).concat(yne,": ").concat(a,`px;
  }
`)},$P=function(){var t=parseInt(document.body.getAttribute(T1)||"0",10);return isFinite(t)?t:0},zne=function(){w.useEffect(function(){return document.body.setAttribute(T1,($P()+1).toString()),function(){var t=$P()-1;t<=0?document.body.removeAttribute(T1):document.body.setAttribute(T1,t.toString())}},[])},Fne=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;zne();var s=w.useMemo(function(){return One(i)},[i]);return w.createElement(Lne,{styles:jne(s,!e,i,n?"":"!important")})},fk=!1;if(typeof window<"u")try{var x4=Object.defineProperty({},"passive",{get:function(){return fk=!0,!0}});window.addEventListener("test",x4,x4),window.removeEventListener("test",x4,x4)}catch{fk=!1}var zv=fk?{passive:!1}:!1,Une=function(t){return t.tagName==="TEXTAREA"},yB=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Une(t)&&n[e]==="visible")},Bne=function(t){return yB(t,"overflowY")},Hne=function(t){return yB(t,"overflowX")},qP=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=bB(t,r);if(i){var s=_B(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Vne=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Gne=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},bB=function(t,e){return t==="v"?Bne(e):Hne(e)},_B=function(t,e){return t==="v"?Vne(e):Gne(e)},Wne=function(t,e){return t==="h"&&e==="rtl"?-1:1},$ne=function(t,e,n,r,i){var s=Wne(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,f=o>0,p=0,m=0;do{if(!a)break;var x=_B(t,a),b=x[0],_=x[1],S=x[2],M=_-S-s*b;(b||M)&&bB(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(f&&Math.abs(p)<1||!f&&Math.abs(m)<1)&&(c=!0),c},v4=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},XP=function(t){return[t.deltaX,t.deltaY]},YP=function(t){return t&&"current"in t?t.current:t},qne=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Xne=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Yne=0,Fv=[];function Kne(t){var e=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),i=w.useState(Yne++)[0],s=w.useState(vB)[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 _=xne([t.lockRef.current],(t.shards||[]).map(YP),!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=v4(_),C=n.current,A="deltaX"in _?_.deltaX:C[0]-M[0],N="deltaY"in _?_.deltaY:C[1]-M[1],P,k=_.target,O=Math.abs(A)>Math.abs(N)?"h":"v";if("touches"in _&&O==="h"&&k.type==="range")return!1;var R=window.getSelection(),L=R&&R.anchorNode,B=L?L===k||L.contains(k):!1;if(B)return!1;var V=qP(O,k);if(!V)return!0;if(V?P=O:(P=O==="v"?"h":"v",V=qP(O,k)),!V)return!1;if(!r.current&&"changedTouches"in _&&(A||N)&&(r.current=P),!P)return!0;var W=r.current||P;return $ne(W,S,_,W==="h"?A:N)},[]),l=w.useCallback(function(_){var S=_;if(!(!Fv.length||Fv[Fv.length-1]!==s)){var M="deltaY"in S?XP(S):v4(S),C=e.current.filter(function(P){return P.name===S.type&&(P.target===S.target||S.target===P.shadowParent)&&qne(P.delta,M)})[0];if(C&&C.should){S.cancelable&&S.preventDefault();return}if(!C){var A=(o.current.shards||[]).map(YP).filter(Boolean).filter(function(P){return P.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:Zne(M)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(N){return N!==A})},1)},[]),f=w.useCallback(function(_){n.current=v4(_),r.current=void 0},[]),p=w.useCallback(function(_){c(_.type,XP(_),_.target,a(_,t.lockRef.current))},[]),m=w.useCallback(function(_){c(_.type,v4(_),_.target,a(_,t.lockRef.current))},[]);w.useEffect(function(){return Fv.push(s),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",l,zv),document.addEventListener("touchmove",l,zv),document.addEventListener("touchstart",f,zv),function(){Fv=Fv.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,zv),document.removeEventListener("touchmove",l,zv),document.removeEventListener("touchstart",f,zv)}},[]);var x=t.removeScrollBar,b=t.inert;return w.createElement(w.Fragment,null,b?w.createElement(s,{styles:Xne(i)}):null,x?w.createElement(Fne,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Zne(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Qne=Cne(xB,Kne);var _w=w.forwardRef(function(t,e){return w.createElement(xT,eh({},t,{ref:e,sideCar:Qne}))});_w.classNames=xT.classNames;var Jne=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Uv=new WeakMap,y4=new WeakMap,b4={},gA=0,SB=function(t){return t&&(t.host||SB(t.parentNode))},ere=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=SB(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})},tre=function(t,e,n,r){var i=ere(e,Array.isArray(t)?t:[t]);b4[n]||(b4[n]=new WeakMap);var s=b4[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 f=function(p){!p||l.has(p)||Array.prototype.forEach.call(p.children,function(m){if(a.has(m))f(m);else try{var x=m.getAttribute(r),b=x!==null&&x!=="false",_=(Uv.get(m)||0)+1,S=(s.get(m)||0)+1;Uv.set(m,_),s.set(m,S),o.push(m),_===1&&b&&y4.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 f(e),a.clear(),gA++,function(){o.forEach(function(p){var m=Uv.get(p)-1,x=s.get(p)-1;Uv.set(p,m),s.set(p,x),m||(y4.has(p)||p.removeAttribute(r),y4.delete(p)),x||p.removeAttribute(n)}),gA--,gA||(Uv=new WeakMap,Uv=new WeakMap,y4=new WeakMap,b4={})}},vT=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Jne(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),tre(r,i,n,"aria-hidden")):function(){return null}},yT="Dialog",[wB,MB]=Su(yT),[nre,lf]=wB(yT),TB=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,f]=fd({prop:r,defaultProp:i??!1,onChange:s,caller:yT});return d.jsx(nre,{scope:e,triggerRef:a,contentRef:l,contentId:jc(),titleId:jc(),descriptionId:jc(),open:c,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(p=>!p),[f]),modal:o,children:n})};TB.displayName=yT;var CB="DialogTrigger",EB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=lf(CB,n),s=Gr(e,i.triggerRef);return d.jsx(pr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":S7(i.open),...r,ref:s,onClick:En(t.onClick,i.onOpenToggle)})});EB.displayName=CB;var b7="DialogPortal",[rre,AB]=wB(b7,{forceMount:void 0}),NB=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=lf(b7,e);return d.jsx(rre,{scope:e,forceMount:n,children:w.Children.map(r,o=>d.jsx(Za,{present:n||s.open,children:d.jsx(Uy,{asChild:!0,container:i,children:o})}))})};NB.displayName=b7;var M2="DialogOverlay",kB=w.forwardRef((t,e)=>{const n=AB(M2,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=lf(M2,t.__scopeDialog);return s.modal?d.jsx(Za,{present:r||s.open,children:d.jsx(sre,{...i,ref:e})}):null});kB.displayName=M2;var ire=s0("DialogOverlay.RemoveScroll"),sre=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=lf(M2,n);return d.jsx(_w,{as:ire,allowPinchZoom:!0,shards:[i.contentRef],children:d.jsx(pr.div,{"data-state":S7(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),bx="DialogContent",RB=w.forwardRef((t,e)=>{const n=AB(bx,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=lf(bx,t.__scopeDialog);return d.jsx(Za,{present:r||s.open,children:s.modal?d.jsx(ore,{...i,ref:e}):d.jsx(are,{...i,ref:e})})});RB.displayName=bx;var ore=w.forwardRef((t,e)=>{const n=lf(bx,t.__scopeDialog),r=w.useRef(null),i=Gr(e,n.contentRef,r);return w.useEffect(()=>{const s=r.current;if(s)return vT(s)},[]),d.jsx(DB,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:En(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:En(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:En(t.onFocusOutside,s=>s.preventDefault())})}),are=w.forwardRef((t,e)=>{const n=lf(bx,t.__scopeDialog),r=w.useRef(!1),i=w.useRef(!1);return d.jsx(DB,{...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()}})}),DB=w.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=lf(bx,n),l=w.useRef(null),c=Gr(e,l);return gT(),d.jsxs(d.Fragment,{children:[d.jsx(bw,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:d.jsx(Fy,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":S7(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(cre,{titleId:a.titleId}),d.jsx(dre,{contentRef:l,descriptionId:a.descriptionId})]})]})}),_7="DialogTitle",PB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=lf(_7,n);return d.jsx(pr.h2,{id:i.titleId,...r,ref:e})});PB.displayName=_7;var IB="DialogDescription",OB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=lf(IB,n);return d.jsx(pr.p,{id:i.descriptionId,...r,ref:e})});OB.displayName=IB;var LB="DialogClose",jB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=lf(LB,n);return d.jsx(pr.button,{type:"button",...r,ref:e,onClick:En(t.onClick,()=>i.onOpenChange(!1))})});jB.displayName=LB;function S7(t){return t?"open":"closed"}var zB="DialogTitleWarning",[lre,FB]=zte(zB,{contentName:bx,titleName:_7,docsSlug:"dialog"}),cre=({titleId:t})=>{const e=FB(zB),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},ure="DialogDescriptionWarning",dre=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${FB(ure).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},UB=TB,BB=EB,HB=NB,VB=kB,GB=RB,WB=PB,$B=OB,w7=jB,qB="AlertDialog",[fre]=Su(qB,[MB]),kp=MB(),XB=t=>{const{__scopeAlertDialog:e,...n}=t,r=kp(e);return d.jsx(UB,{...r,...n,modal:!0})};XB.displayName=qB;var hre="AlertDialogTrigger",pre=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=kp(n);return d.jsx(BB,{...i,...r,ref:e})});pre.displayName=hre;var mre="AlertDialogPortal",YB=t=>{const{__scopeAlertDialog:e,...n}=t,r=kp(e);return d.jsx(HB,{...r,...n})};YB.displayName=mre;var gre="AlertDialogOverlay",KB=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=kp(n);return d.jsx(VB,{...i,...r,ref:e})});KB.displayName=gre;var C1="AlertDialogContent",[xre,vre]=fre(C1),yre=iB("AlertDialogContent"),ZB=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=kp(n),o=w.useRef(null),a=Gr(e,o),l=w.useRef(null);return d.jsx(lre,{contentName:C1,titleName:QB,docsSlug:"alert-dialog",children:d.jsx(xre,{scope:n,cancelRef:l,children:d.jsxs(GB,{role:"alertdialog",...s,...i,ref:a,onOpenAutoFocus:En(i.onOpenAutoFocus,c=>{var f;c.preventDefault(),(f=l.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[d.jsx(yre,{children:r}),d.jsx(_re,{contentRef:o})]})})})});ZB.displayName=C1;var QB="AlertDialogTitle",JB=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=kp(n);return d.jsx(WB,{...i,...r,ref:e})});JB.displayName=QB;var eH="AlertDialogDescription",tH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=kp(n);return d.jsx($B,{...i,...r,ref:e})});tH.displayName=eH;var bre="AlertDialogAction",nH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=kp(n);return d.jsx(w7,{...i,...r,ref:e})});nH.displayName=bre;var rH="AlertDialogCancel",iH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=vre(rH,n),s=kp(n),o=Gr(e,i);return d.jsx(w7,{...s,...r,ref:o})});iH.displayName=rH;var _re=({contentRef:t})=>{const e=`\`${C1}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${C1}\` by passing a \`${eH}\` 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 \`${C1}\`. 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},Sre=XB,wre=YB,Mre=KB,Tre=ZB,Cre=nH,Ere=iH,Are=JB,Nre=tH,xA={exports:{}},vA={};/**
 * @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 KP;function kre(){if(KP)return vA;KP=1;var t=mw();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 f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return vA.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,vA}var ZP;function Rre(){return ZP||(ZP=1,xA.exports=kre()),xA.exports}function Dre(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 Pre(t){const[e,n]=w.useState(void 0);return ka(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const Ire=["top","right","bottom","left"],o0=Math.min,iu=Math.max,T2=Math.round,_4=Math.floor,lh=t=>({x:t,y:t}),Ore={left:"right",right:"left",bottom:"top",top:"bottom"},Lre={start:"end",end:"start"};function hk(t,e,n){return iu(t,o0(e,n))}function _p(t,e){return typeof t=="function"?t(e):t}function Sp(t){return t.split("-")[0]}function By(t){return t.split("-")[1]}function M7(t){return t==="x"?"y":"x"}function T7(t){return t==="y"?"height":"width"}const jre=new Set(["top","bottom"]);function rh(t){return jre.has(Sp(t))?"y":"x"}function C7(t){return M7(rh(t))}function zre(t,e,n){n===void 0&&(n=!1);const r=By(t),i=C7(t),s=T7(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=C2(o)),[o,C2(o)]}function Fre(t){const e=C2(t);return[pk(t),e,pk(e)]}function pk(t){return t.replace(/start|end/g,e=>Lre[e])}const QP=["left","right"],JP=["right","left"],Ure=["top","bottom"],Bre=["bottom","top"];function Hre(t,e,n){switch(t){case"top":case"bottom":return n?e?JP:QP:e?QP:JP;case"left":case"right":return e?Ure:Bre;default:return[]}}function Vre(t,e,n,r){const i=By(t);let s=Hre(Sp(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(pk)))),s}function C2(t){return t.replace(/left|right|bottom|top/g,e=>Ore[e])}function Gre(t){return{top:0,right:0,bottom:0,left:0,...t}}function sH(t){return typeof t!="number"?Gre(t):{top:t,right:t,bottom:t,left:t}}function E2(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 eI(t,e,n){let{reference:r,floating:i}=t;const s=rh(e),o=C7(e),a=T7(o),l=Sp(e),c=s==="y",f=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:f,y:r.y-i.height};break;case"bottom":x={x:f,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(By(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 Wre(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:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:x=0}=_p(e,t),b=sH(x),S=a[m?p==="floating"?"reference":"floating":p],M=E2(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:f,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},P=E2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:A,strategy:l}):C);return{top:(M.top-P.top+b.top)/N.y,bottom:(P.bottom-M.bottom+b.bottom)/N.y,left:(M.left-P.left+b.left)/N.x,right:(P.right-M.right+b.right)/N.x}}const $re=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:f,y:p}=eI(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:P,reset:k}=await C({x:f,y:p,initialPlacement:r,placement:m,strategy:i,middlewareData:x,rects:c,platform:{...o,detectOverflow:(_=o.detectOverflow)!=null?_:Wre},elements:{reference:t,floating:e}});f=A??f,p=N??p,x={...x,[M]:{...x[M],...P}},k&&b<=50&&(b++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(c=k.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):k.rects),{x:f,y:p}=eI(c,m,l)),S=-1)}return{x:f,y:p,placement:m,strategy:i,middlewareData:x}},qre=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:f=0}=_p(t,e)||{};if(c==null)return{};const p=sH(f),m={x:n,y:r},x=C7(i),b=T7(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],P=m[x]-s.reference[x],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let O=k?k[A]:0;(!O||!await(o.isElement==null?void 0:o.isElement(k)))&&(O=a.floating[A]||s.floating[b]);const R=N/2-P/2,L=O/2-_[b]/2-1,B=o0(p[M],L),V=o0(p[C],L),W=B,G=O-_[b]-V,ee=O/2-_[b]/2+R,H=hk(W,ee,G),q=!l.arrow&&By(i)!=null&&ee!==H&&s.reference[b]/2-(ee<W?B:V)-_[b]/2<0,J=q?ee<W?ee-W:ee-G:0;return{[x]:m[x]+J,data:{[x]:H,centerOffset:ee-H-J,...q&&{alignmentOffset:J}},reset:q}}}),Xre=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:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0,...S}=_p(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const M=Sp(i),C=rh(a),A=Sp(a)===a,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),P=m||(A||!_?[C2(a)]:Fre(a)),k=b!=="none";!m&&k&&P.push(...Vre(a,_,b,N));const O=[a,...P],R=await l.detectOverflow(e,S),L=[];let B=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&L.push(R[M]),p){const ee=zre(i,o,N);L.push(R[ee[0]],R[ee[1]])}if(B=[...B,{placement:i,overflows:L}],!L.every(ee=>ee<=0)){var V,W;const ee=(((V=s.flip)==null?void 0:V.index)||0)+1,H=O[ee];if(H&&(!(p==="alignment"?C!==rh(H):!1)||B.every(K=>rh(K.placement)===C?K.overflows[0]>0:!0)))return{data:{index:ee,overflows:B},reset:{placement:H}};let q=(W=B.filter(J=>J.overflows[0]<=0).sort((J,K)=>J.overflows[1]-K.overflows[1])[0])==null?void 0:W.placement;if(!q)switch(x){case"bestFit":{var G;const J=(G=B.filter(K=>{if(k){const ne=rh(K.placement);return ne===C||ne==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(ne=>ne>0).reduce((ne,U)=>ne+U,0)]).sort((K,ne)=>K[1]-ne[1])[0])==null?void 0:G[0];J&&(q=J);break}case"initialPlacement":q=a;break}if(i!==q)return{reset:{placement:q}}}return{}}}};function tI(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function nI(t){return Ire.some(e=>t[e]>=0)}const Yre=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=_p(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=tI(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:nI(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=tI(o,n.floating);return{data:{escapedOffsets:a,escaped:nI(a)}}}default:return{}}}}},oH=new Set(["left","top"]);async function Kre(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Sp(n),a=By(n),l=rh(n)==="y",c=oH.has(o)?-1:1,f=s&&l?-1:1,p=_p(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*f,y:m*c}:{x:m*c,y:x*f}}const Zre=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 Kre(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}}}}},Qre=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}=_p(t,e),f={x:n,y:r},p=await s.detectOverflow(e,c),m=rh(Sp(i)),x=M7(m);let b=f[x],_=f[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}}}}}},Jre=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}=_p(t,e),f={x:n,y:r},p=rh(i),m=M7(p);let x=f[m],b=f[p];const _=_p(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,P=s.reference[m]+s.reference[A]-S.mainAxis;x<N?x=N:x>P&&(x=P)}if(c){var M,C;const A=m==="y"?"width":"height",N=oH.has(Sp(i)),P=s.reference[p]-s.floating[A]+(N&&((M=o.offset)==null?void 0:M[p])||0)+(N?0:S.crossAxis),k=s.reference[p]+s.reference[A]+(N?0:((C=o.offset)==null?void 0:C[p])||0)-(N?S.crossAxis:0);b<P?b=P:b>k&&(b=k)}return{[m]:x,[p]:b}}}},eie=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}=_p(t,e),f=await o.detectOverflow(e,c),p=Sp(i),m=By(i),x=rh(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=_-f.top-f.bottom,A=b-f.left-f.right,N=o0(_-f[S],C),P=o0(b-f[M],A),k=!e.middlewareData.shift;let O=N,R=P;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=A),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(O=C),k&&!m){const B=iu(f.left,0),V=iu(f.right,0),W=iu(f.top,0),G=iu(f.bottom,0);x?R=b-2*(B!==0||V!==0?B+V:iu(f.left,f.right)):O=_-2*(W!==0||G!==0?W+G:iu(f.top,f.bottom))}await l({...e,availableWidth:R,availableHeight:O});const L=await o.getDimensions(a.floating);return b!==L.width||_!==L.height?{reset:{rects:!0}}:{}}}};function bT(){return typeof window<"u"}function Hy(t){return aH(t)?(t.nodeName||"").toLowerCase():"#document"}function fu(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function yh(t){var e;return(e=(aH(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function aH(t){return bT()?t instanceof Node||t instanceof fu(t).Node:!1}function sf(t){return bT()?t instanceof Element||t instanceof fu(t).Element:!1}function dh(t){return bT()?t instanceof HTMLElement||t instanceof fu(t).HTMLElement:!1}function rI(t){return!bT()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof fu(t).ShadowRoot}const tie=new Set(["inline","contents"]);function Sw(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=of(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!tie.has(i)}const nie=new Set(["table","td","th"]);function rie(t){return nie.has(Hy(t))}const iie=[":popover-open",":modal"];function _T(t){return iie.some(e=>{try{return t.matches(e)}catch{return!1}})}const sie=["transform","translate","scale","rotate","perspective"],oie=["transform","translate","scale","rotate","perspective","filter"],aie=["paint","layout","strict","content"];function E7(t){const e=A7(),n=sf(t)?of(t):t;return sie.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)||oie.some(r=>(n.willChange||"").includes(r))||aie.some(r=>(n.contain||"").includes(r))}function lie(t){let e=a0(t);for(;dh(e)&&!ny(e);){if(E7(e))return e;if(_T(e))return null;e=a0(e)}return null}function A7(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const cie=new Set(["html","body","#document"]);function ny(t){return cie.has(Hy(t))}function of(t){return fu(t).getComputedStyle(t)}function ST(t){return sf(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function a0(t){if(Hy(t)==="html")return t;const e=t.assignedSlot||t.parentNode||rI(t)&&t.host||yh(t);return rI(e)?e.host:e}function lH(t){const e=a0(t);return ny(e)?t.ownerDocument?t.ownerDocument.body:t.body:dh(e)&&Sw(e)?e:lH(e)}function MS(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=lH(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=fu(i);if(s){const a=mk(o);return e.concat(o,o.visualViewport||[],Sw(i)?i:[],a&&n?MS(a):[])}return e.concat(i,MS(i,[],n))}function mk(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function cH(t){const e=of(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=dh(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=T2(n)!==s||T2(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function N7(t){return sf(t)?t:t.contextElement}function E1(t){const e=N7(t);if(!dh(e))return lh(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=cH(e);let o=(s?T2(n.width):n.width)/r,a=(s?T2(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const uie=lh(0);function uH(t){const e=fu(t);return!A7()||!e.visualViewport?uie:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function die(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==fu(t)?!1:e}function _x(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=N7(t);let o=lh(1);e&&(r?sf(r)&&(o=E1(r)):o=E1(t));const a=die(s,n,r)?uH(s):lh(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,f=i.width/o.x,p=i.height/o.y;if(s){const m=fu(s),x=r&&sf(r)?fu(r):r;let b=m,_=mk(b);for(;_&&r&&x!==b;){const S=E1(_),M=_.getBoundingClientRect(),C=of(_),A=M.left+(_.clientLeft+parseFloat(C.paddingLeft))*S.x,N=M.top+(_.clientTop+parseFloat(C.paddingTop))*S.y;l*=S.x,c*=S.y,f*=S.x,p*=S.y,l+=A,c+=N,b=fu(_),_=mk(b)}}return E2({width:f,height:p,x:l,y:c})}function wT(t,e){const n=ST(t).scrollLeft;return e?e.left+n:_x(yh(t)).left+n}function dH(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-wT(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function fie(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=yh(r),a=e?_T(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=lh(1);const f=lh(0),p=dh(r);if((p||!p&&!s)&&((Hy(r)!=="body"||Sw(o))&&(l=ST(r)),dh(r))){const x=_x(r);c=E1(r),f.x=x.x+r.clientLeft,f.y=x.y+r.clientTop}const m=o&&!p&&!s?dH(o,l):lh(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+m.x,y:n.y*c.y-l.scrollTop*c.y+f.y+m.y}}function hie(t){return Array.from(t.getClientRects())}function pie(t){const e=yh(t),n=ST(t),r=t.ownerDocument.body,i=iu(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=iu(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+wT(t);const a=-n.scrollTop;return of(r).direction==="rtl"&&(o+=iu(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const iI=25;function mie(t,e){const n=fu(t),r=yh(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const f=A7();(!f||f&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=wT(r);if(c<=0){const f=r.ownerDocument,p=f.body,m=getComputedStyle(p),x=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(r.clientWidth-p.clientWidth-x);b<=iI&&(s-=b)}else c<=iI&&(s+=c);return{width:s,height:o,x:a,y:l}}const gie=new Set(["absolute","fixed"]);function xie(t,e){const n=_x(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=dh(t)?E1(t):lh(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 sI(t,e,n){let r;if(e==="viewport")r=mie(t,n);else if(e==="document")r=pie(yh(t));else if(sf(e))r=xie(e,n);else{const i=uH(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return E2(r)}function fH(t,e){const n=a0(t);return n===e||!sf(n)||ny(n)?!1:of(n).position==="fixed"||fH(n,e)}function vie(t,e){const n=e.get(t);if(n)return n;let r=MS(t,[],!1).filter(a=>sf(a)&&Hy(a)!=="body"),i=null;const s=of(t).position==="fixed";let o=s?a0(t):t;for(;sf(o)&&!ny(o);){const a=of(o),l=E7(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&gie.has(i.position)||Sw(o)&&!l&&fH(t,o))?r=r.filter(f=>f!==o):i=a,o=a0(o)}return e.set(t,r),r}function yie(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?_T(e)?[]:vie(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,f)=>{const p=sI(e,f,i);return c.top=iu(p.top,c.top),c.right=o0(p.right,c.right),c.bottom=o0(p.bottom,c.bottom),c.left=iu(p.left,c.left),c},sI(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function bie(t){const{width:e,height:n}=cH(t);return{width:e,height:n}}function _ie(t,e,n){const r=dh(e),i=yh(e),s=n==="fixed",o=_x(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=lh(0);function c(){l.x=wT(i)}if(r||!r&&!s)if((Hy(e)!=="body"||Sw(i))&&(a=ST(e)),r){const x=_x(e,!0,s,e);l.x=x.x+e.clientLeft,l.y=x.y+e.clientTop}else i&&c();s&&!r&&i&&c();const f=i&&!r&&!s?dH(i,a):lh(0),p=o.left+a.scrollLeft-l.x-f.x,m=o.top+a.scrollTop-l.y-f.y;return{x:p,y:m,width:o.width,height:o.height}}function yA(t){return of(t).position==="static"}function oI(t,e){if(!dh(t)||of(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return yh(t)===n&&(n=n.ownerDocument.body),n}function hH(t,e){const n=fu(t);if(_T(t))return n;if(!dh(t)){let i=a0(t);for(;i&&!ny(i);){if(sf(i)&&!yA(i))return i;i=a0(i)}return n}let r=oI(t,e);for(;r&&rie(r)&&yA(r);)r=oI(r,e);return r&&ny(r)&&yA(r)&&!E7(r)?n:r||lie(t)||n}const Sie=async function(t){const e=this.getOffsetParent||hH,n=this.getDimensions,r=await n(t.floating);return{reference:_ie(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wie(t){return of(t).direction==="rtl"}const Mie={convertOffsetParentRelativeRectToViewportRelativeRect:fie,getDocumentElement:yh,getClippingRect:yie,getOffsetParent:hH,getElementRects:Sie,getClientRects:hie,getDimensions:bie,getScale:E1,isElement:sf,isRTL:wie};function pH(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Tie(t,e){let n=null,r;const i=yh(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:f,top:p,width:m,height:x}=c;if(a||e(),!m||!x)return;const b=_4(p),_=_4(i.clientWidth-(f+m)),S=_4(i.clientHeight-(p+x)),M=_4(f),A={rootMargin:-b+"px "+-_+"px "+-S+"px "+-M+"px",threshold:iu(0,o0(1,l))||1};let N=!0;function P(k){const O=k[0].intersectionRatio;if(O!==l){if(!N)return o();O?o(!1,O):r=setTimeout(()=>{o(!1,1e-7)},1e3)}O===1&&!pH(c,t.getBoundingClientRect())&&o(),N=!1}try{n=new IntersectionObserver(P,{...A,root:i.ownerDocument})}catch{n=new IntersectionObserver(P,A)}n.observe(t)}return o(!0),s}function Cie(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=N7(t),f=i||s?[...c?MS(c):[],...MS(e)]:[];f.forEach(M=>{i&&M.addEventListener("scroll",n,{passive:!0}),s&&M.addEventListener("resize",n)});const p=c&&a?Tie(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?_x(t):null;l&&S();function S(){const M=_x(t);_&&!pH(_,M)&&n(),_=M,b=requestAnimationFrame(S)}return n(),()=>{var M;f.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 Eie=Zre,Aie=Qre,Nie=Xre,kie=eie,Rie=Yre,aI=qre,Die=Jre,Pie=(t,e,n)=>{const r=new Map,i={platform:Mie,...n},s={...i.platform,_c:r};return $re(t,e,{...i,platform:s})};var Iie=typeof document<"u",Oie=function(){},i2=Iie?w.useLayoutEffect:Oie;function A2(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!A2(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!A2(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function mH(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function lI(t,e){const n=mH(t);return Math.round(e*n)/n}function bA(t){const e=w.useRef(t);return i2(()=>{e.current=t}),e}function Lie(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,[f,p]=w.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,x]=w.useState(r);A2(m,r)||x(r);const[b,_]=w.useState(null),[S,M]=w.useState(null),C=w.useCallback(K=>{K!==k.current&&(k.current=K,_(K))},[]),A=w.useCallback(K=>{K!==O.current&&(O.current=K,M(K))},[]),N=s||b,P=o||S,k=w.useRef(null),O=w.useRef(null),R=w.useRef(f),L=l!=null,B=bA(l),V=bA(i),W=bA(c),G=w.useCallback(()=>{if(!k.current||!O.current)return;const K={placement:e,strategy:n,middleware:m};V.current&&(K.platform=V.current),Pie(k.current,O.current,K).then(ne=>{const U={...ne,isPositioned:W.current!==!1};ee.current&&!A2(R.current,U)&&(R.current=U,ql.flushSync(()=>{p(U)}))})},[m,e,n,V,W]);i2(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[c]);const ee=w.useRef(!1);i2(()=>(ee.current=!0,()=>{ee.current=!1}),[]),i2(()=>{if(N&&(k.current=N),P&&(O.current=P),N&&P){if(B.current)return B.current(N,P,G);G()}},[N,P,G,B,L]);const H=w.useMemo(()=>({reference:k,floating:O,setReference:C,setFloating:A}),[C,A]),q=w.useMemo(()=>({reference:N,floating:P}),[N,P]),J=w.useMemo(()=>{const K={position:n,left:0,top:0};if(!q.floating)return K;const ne=lI(q.floating,f.x),U=lI(q.floating,f.y);return a?{...K,transform:"translate("+ne+"px, "+U+"px)",...mH(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ne,top:U}},[n,a,q.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:G,refs:H,elements:q,floatingStyles:J}),[f,G,H,q,J])}const jie=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?aI({element:r.current,padding:i}).fn(n):{}:r?aI({element:r,padding:i}).fn(n):{}}}},zie=(t,e)=>({...Eie(t),options:[t,e]}),Fie=(t,e)=>({...Aie(t),options:[t,e]}),Uie=(t,e)=>({...Die(t),options:[t,e]}),Bie=(t,e)=>({...Nie(t),options:[t,e]}),Hie=(t,e)=>({...kie(t),options:[t,e]}),Vie=(t,e)=>({...Rie(t),options:[t,e]}),Gie=(t,e)=>({...jie(t),options:[t,e]});var Wie="Arrow",gH=w.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return d.jsx(pr.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});gH.displayName=Wie;var $ie=gH,k7="Popper",[xH,T0]=Su(k7),[qie,vH]=xH(k7),yH=t=>{const{__scopePopper:e,children:n}=t,[r,i]=w.useState(null);return d.jsx(qie,{scope:e,anchor:r,onAnchorChange:i,children:n})};yH.displayName=k7;var bH="PopperAnchor",_H=w.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=vH(bH,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:d.jsx(pr.div,{...i,ref:a})});_H.displayName=bH;var R7="PopperContent",[Xie,Yie]=xH(R7),SH=w.forwardRef((t,e)=>{var ie,fe,Q,ue,he,se;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:x="optimized",onPlaced:b,..._}=t,S=vH(R7,n),[M,C]=w.useState(null),A=Gr(e,Ce=>C(Ce)),[N,P]=w.useState(null),k=Pre(N),O=(k==null?void 0:k.width)??0,R=(k==null?void 0:k.height)??0,L=r+(s!=="center"?"-"+s:""),B=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},V=Array.isArray(c)?c:[c],W=V.length>0,G={padding:B,boundary:V.filter(Zie),altBoundary:W},{refs:ee,floatingStyles:H,placement:q,isPositioned:J,middlewareData:K}=Lie({strategy:"fixed",placement:L,whileElementsMounted:(...Ce)=>Cie(...Ce,{animationFrame:x==="always"}),elements:{reference:S.anchor},middleware:[zie({mainAxis:i+R,alignmentAxis:o}),l&&Fie({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Uie():void 0,...G}),l&&Bie({...G}),Hie({...G,apply:({elements:Ce,rects:de,availableWidth:Me,availableHeight:Te})=>{const{width:Pe,height:oe}=de.reference,Ve=Ce.floating.style;Ve.setProperty("--radix-popper-available-width",`${Me}px`),Ve.setProperty("--radix-popper-available-height",`${Te}px`),Ve.setProperty("--radix-popper-anchor-width",`${Pe}px`),Ve.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),N&&Gie({element:N,padding:a}),Qie({arrowWidth:O,arrowHeight:R}),m&&Vie({strategy:"referenceHidden",...G})]}),[ne,U]=TH(q),z=Aa(b);ka(()=>{J&&(z==null||z())},[J,z]);const Y=(ie=K.arrow)==null?void 0:ie.x,j=(fe=K.arrow)==null?void 0:fe.y,le=((Q=K.arrow)==null?void 0:Q.centerOffset)!==0,[ce,X]=w.useState();return ka(()=>{M&&X(window.getComputedStyle(M).zIndex)},[M]),d.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:J?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(ue=K.transformOrigin)==null?void 0:ue.x,(he=K.transformOrigin)==null?void 0:he.y].join(" "),...((se=K.hide)==null?void 0:se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(Xie,{scope:n,placedSide:ne,onArrowChange:P,arrowX:Y,arrowY:j,shouldHideArrow:le,children:d.jsx(pr.div,{"data-side":ne,"data-align":U,..._,ref:A,style:{..._.style,animation:J?void 0:"none"}})})})});SH.displayName=R7;var wH="PopperArrow",Kie={top:"bottom",right:"left",bottom:"top",left:"right"},MH=w.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=Yie(wH,r),o=Kie[s.placedSide];return d.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:d.jsx($ie,{...i,ref:n,style:{...i.style,display:"block"}})})});MH.displayName=wH;function Zie(t){return t!==null}var Qie=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,f]=TH(n),p={start:"0%",center:"50%",end:"100%"}[f],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 TH(t){const[e,n="center"]=t.split("-");return[e,n]}var ww=yH,Mw=_H,MT=SH,TT=MH,_A="rovingFocusGroup.onEntryFocus",Jie={bubbles:!1,cancelable:!0},Tw="RovingFocusGroup",[gk,CH,ese]=g7(Tw),[tse,CT]=Su(Tw,[ese]),[nse,rse]=tse(Tw),EH=w.forwardRef((t,e)=>d.jsx(gk.Provider,{scope:t.__scopeRovingFocusGroup,children:d.jsx(gk.Slot,{scope:t.__scopeRovingFocusGroup,children:d.jsx(ise,{...t,ref:e})})}));EH.displayName=Tw;var ise=w.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:f=!1,...p}=t,m=w.useRef(null),x=Gr(e,m),b=yw(s),[_,S]=fd({prop:o,defaultProp:a??null,onChange:l,caller:Tw}),[M,C]=w.useState(!1),A=Aa(c),N=CH(n),P=w.useRef(!1),[k,O]=w.useState(0);return w.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(_A,A),()=>R.removeEventListener(_A,A)},[A]),d.jsx(nse,{scope:n,orientation:r,dir:b,loop:i,currentTabStopId:_,onItemFocus:w.useCallback(R=>S(R),[S]),onItemShiftTab:w.useCallback(()=>C(!0),[]),onFocusableItemAdd:w.useCallback(()=>O(R=>R+1),[]),onFocusableItemRemove:w.useCallback(()=>O(R=>R-1),[]),children:d.jsx(pr.div,{tabIndex:M||k===0?-1:0,"data-orientation":r,...p,ref:x,style:{outline:"none",...t.style},onMouseDown:En(t.onMouseDown,()=>{P.current=!0}),onFocus:En(t.onFocus,R=>{const L=!P.current;if(R.target===R.currentTarget&&L&&!M){const B=new CustomEvent(_A,Jie);if(R.currentTarget.dispatchEvent(B),!B.defaultPrevented){const V=N().filter(q=>q.focusable),W=V.find(q=>q.active),G=V.find(q=>q.id===_),H=[W,G,...V].filter(Boolean).map(q=>q.ref.current);kH(H,f)}}P.current=!1}),onBlur:En(t.onBlur,()=>C(!1))})})}),AH="RovingFocusGroupItem",NH=w.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=t,l=jc(),c=s||l,f=rse(AH,n),p=f.currentTabStopId===c,m=CH(n),{onFocusableItemAdd:x,onFocusableItemRemove:b,currentTabStopId:_}=f;return w.useEffect(()=>{if(r)return x(),()=>b()},[r,x,b]),d.jsx(gk.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:d.jsx(pr.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...a,ref:e,onMouseDown:En(t.onMouseDown,S=>{r?f.onItemFocus(c):S.preventDefault()}),onFocus:En(t.onFocus,()=>f.onItemFocus(c)),onKeyDown:En(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const M=ase(S,f.orientation,f.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=f.loop?lse(A,N+1):A.slice(N+1)}setTimeout(()=>kH(A))}}),children:typeof o=="function"?o({isCurrentTabStop:p,hasTabStop:_!=null}):o})})});NH.displayName=AH;var sse={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ose(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function ase(t,e,n){const r=ose(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return sse[r]}function kH(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function lse(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var RH=EH,DH=NH,xk=["Enter"," "],cse=["ArrowDown","PageUp","Home"],PH=["ArrowUp","PageDown","End"],use=[...cse,...PH],dse={ltr:[...xk,"ArrowRight"],rtl:[...xk,"ArrowLeft"]},fse={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cw="Menu",[TS,hse,pse]=g7(Cw),[Dx,IH]=Su(Cw,[pse,T0,CT]),Ew=T0(),OH=CT(),[LH,C0]=Dx(Cw),[mse,Aw]=Dx(Cw),jH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=Ew(e),[l,c]=w.useState(null),f=w.useRef(!1),p=Aa(s),m=yw(i);return w.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.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})}},[]),d.jsx(ww,{...a,children:d.jsx(LH,{scope:e,open:n,onOpenChange:p,content:l,onContentChange:c,children:d.jsx(mse,{scope:e,onClose:w.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:o,children:r})})})};jH.displayName=Cw;var gse="MenuAnchor",D7=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=Ew(n);return d.jsx(Mw,{...i,...r,ref:e})});D7.displayName=gse;var P7="MenuPortal",[xse,zH]=Dx(P7,{forceMount:void 0}),FH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=C0(P7,e);return d.jsx(xse,{scope:e,forceMount:n,children:d.jsx(Za,{present:n||s.open,children:d.jsx(Uy,{asChild:!0,container:i,children:r})})})};FH.displayName=P7;var ud="MenuContent",[vse,I7]=Dx(ud),UH=w.forwardRef((t,e)=>{const n=zH(ud,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=C0(ud,t.__scopeMenu),o=Aw(ud,t.__scopeMenu);return d.jsx(TS.Provider,{scope:t.__scopeMenu,children:d.jsx(Za,{present:r||s.open,children:d.jsx(TS.Slot,{scope:t.__scopeMenu,children:o.modal?d.jsx(yse,{...i,ref:e}):d.jsx(bse,{...i,ref:e})})})})}),yse=w.forwardRef((t,e)=>{const n=C0(ud,t.__scopeMenu),r=w.useRef(null),i=Gr(e,r);return w.useEffect(()=>{const s=r.current;if(s)return vT(s)},[]),d.jsx(O7,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:En(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bse=w.forwardRef((t,e)=>{const n=C0(ud,t.__scopeMenu);return d.jsx(O7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),_se=s0("MenuContent.ScrollLock"),O7=w.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:x,disableOutsideScroll:b,..._}=t,S=C0(ud,n),M=Aw(ud,n),C=Ew(n),A=OH(n),N=hse(n),[P,k]=w.useState(null),O=w.useRef(null),R=Gr(e,O,S.onContentChange),L=w.useRef(0),B=w.useRef(""),V=w.useRef(0),W=w.useRef(null),G=w.useRef("right"),ee=w.useRef(0),H=b?_w:w.Fragment,q=b?{as:_se,allowPinchZoom:!0}:void 0,J=ne=>{var ie,fe;const U=B.current+ne,z=N().filter(Q=>!Q.disabled),Y=document.activeElement,j=(ie=z.find(Q=>Q.ref.current===Y))==null?void 0:ie.textValue,le=z.map(Q=>Q.textValue),ce=Pse(le,U,j),X=(fe=z.find(Q=>Q.textValue===ce))==null?void 0:fe.ref.current;(function Q(ue){B.current=ue,window.clearTimeout(L.current),ue!==""&&(L.current=window.setTimeout(()=>Q(""),1e3))})(U),X&&setTimeout(()=>X.focus())};w.useEffect(()=>()=>window.clearTimeout(L.current),[]),gT();const K=w.useCallback(ne=>{var z,Y;return G.current===((z=W.current)==null?void 0:z.side)&&Ose(ne,(Y=W.current)==null?void 0:Y.area)},[]);return d.jsx(vse,{scope:n,searchRef:B,onItemEnter:w.useCallback(ne=>{K(ne)&&ne.preventDefault()},[K]),onItemLeave:w.useCallback(ne=>{var U;K(ne)||((U=O.current)==null||U.focus(),k(null))},[K]),onTriggerLeave:w.useCallback(ne=>{K(ne)&&ne.preventDefault()},[K]),pointerGraceTimerRef:V,onPointerGraceIntentChange:w.useCallback(ne=>{W.current=ne},[]),children:d.jsx(H,{...q,children:d.jsx(bw,{asChild:!0,trapped:i,onMountAutoFocus:En(s,ne=>{var U;ne.preventDefault(),(U=O.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:d.jsx(Fy,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:x,children:d.jsx(RH,{asChild:!0,...A,dir:M.dir,orientation:"vertical",loop:r,currentTabStopId:P,onCurrentTabStopIdChange:k,onEntryFocus:En(l,ne=>{M.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(MT,{role:"menu","aria-orientation":"vertical","data-state":rV(S.open),"data-radix-menu-content":"",dir:M.dir,...C,..._,ref:R,style:{outline:"none",..._.style},onKeyDown:En(_.onKeyDown,ne=>{const z=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,Y=ne.ctrlKey||ne.altKey||ne.metaKey,j=ne.key.length===1;z&&(ne.key==="Tab"&&ne.preventDefault(),!Y&&j&&J(ne.key));const le=O.current;if(ne.target!==le||!use.includes(ne.key))return;ne.preventDefault();const X=N().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);PH.includes(ne.key)&&X.reverse(),Rse(X)}),onBlur:En(t.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(L.current),B.current="")}),onPointerMove:En(t.onPointerMove,CS(ne=>{const U=ne.target,z=ee.current!==ne.clientX;if(ne.currentTarget.contains(U)&&z){const Y=ne.clientX>ee.current?"right":"left";G.current=Y,ee.current=ne.clientX}}))})})})})})})});UH.displayName=ud;var Sse="MenuGroup",L7=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(pr.div,{role:"group",...r,ref:e})});L7.displayName=Sse;var wse="MenuLabel",BH=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(pr.div,{...r,ref:e})});BH.displayName=wse;var N2="MenuItem",cI="menu.itemSelect",ET=w.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=w.useRef(null),o=Aw(N2,t.__scopeMenu),a=I7(N2,t.__scopeMenu),l=Gr(e,s),c=w.useRef(!1),f=()=>{const p=s.current;if(!n&&p){const m=new CustomEvent(cI,{bubbles:!0,cancelable:!0});p.addEventListener(cI,x=>r==null?void 0:r(x),{once:!0}),sB(p,m),m.defaultPrevented?c.current=!1:o.onClose()}};return d.jsx(HH,{...i,ref:l,disabled:n,onClick:En(t.onClick,f),onPointerDown:p=>{var m;(m=t.onPointerDown)==null||m.call(t,p),c.current=!0},onPointerUp:En(t.onPointerUp,p=>{var m;c.current||(m=p.currentTarget)==null||m.click()}),onKeyDown:En(t.onKeyDown,p=>{const m=a.searchRef.current!=="";n||m&&p.key===" "||xk.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});ET.displayName=N2;var HH=w.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=I7(N2,n),a=OH(n),l=w.useRef(null),c=Gr(e,l),[f,p]=w.useState(!1),[m,x]=w.useState("");return w.useEffect(()=>{const b=l.current;b&&x((b.textContent??"").trim())},[s.children]),d.jsx(TS.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:d.jsx(DH,{asChild:!0,...a,focusable:!r,children:d.jsx(pr.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:En(t.onPointerMove,CS(b=>{r?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:En(t.onPointerLeave,CS(b=>o.onItemLeave(b))),onFocus:En(t.onFocus,()=>p(!0)),onBlur:En(t.onBlur,()=>p(!1))})})})}),Mse="MenuCheckboxItem",VH=w.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return d.jsx(XH,{scope:t.__scopeMenu,checked:n,children:d.jsx(ET,{role:"menuitemcheckbox","aria-checked":k2(n)?"mixed":n,...i,ref:e,"data-state":F7(n),onSelect:En(i.onSelect,()=>r==null?void 0:r(k2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});VH.displayName=Mse;var GH="MenuRadioGroup",[Tse,Cse]=Dx(GH,{value:void 0,onValueChange:()=>{}}),WH=w.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Aa(r);return d.jsx(Tse,{scope:t.__scopeMenu,value:n,onValueChange:s,children:d.jsx(L7,{...i,ref:e})})});WH.displayName=GH;var $H="MenuRadioItem",qH=w.forwardRef((t,e)=>{const{value:n,...r}=t,i=Cse($H,t.__scopeMenu),s=n===i.value;return d.jsx(XH,{scope:t.__scopeMenu,checked:s,children:d.jsx(ET,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":F7(s),onSelect:En(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});qH.displayName=$H;var j7="MenuItemIndicator",[XH,Ese]=Dx(j7,{checked:!1}),YH=w.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=Ese(j7,n);return d.jsx(Za,{present:r||k2(s.checked)||s.checked===!0,children:d.jsx(pr.span,{...i,ref:e,"data-state":F7(s.checked)})})});YH.displayName=j7;var Ase="MenuSeparator",KH=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(pr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});KH.displayName=Ase;var Nse="MenuArrow",ZH=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=Ew(n);return d.jsx(TT,{...i,...r,ref:e})});ZH.displayName=Nse;var z7="MenuSub",[kse,QH]=Dx(z7),JH=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:i}=t,s=C0(z7,e),o=Ew(e),[a,l]=w.useState(null),[c,f]=w.useState(null),p=Aa(i);return w.useEffect(()=>(s.open===!1&&p(!1),()=>p(!1)),[s.open,p]),d.jsx(ww,{...o,children:d.jsx(LH,{scope:e,open:r,onOpenChange:p,content:c,onContentChange:f,children:d.jsx(kse,{scope:e,contentId:jc(),triggerId:jc(),trigger:a,onTriggerChange:l,children:n})})})};JH.displayName=z7;var L_="MenuSubTrigger",eV=w.forwardRef((t,e)=>{const n=C0(L_,t.__scopeMenu),r=Aw(L_,t.__scopeMenu),i=QH(L_,t.__scopeMenu),s=I7(L_,t.__scopeMenu),o=w.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},f=w.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return w.useEffect(()=>f,[f]),w.useEffect(()=>{const p=a.current;return()=>{window.clearTimeout(p),l(null)}},[a,l]),d.jsx(D7,{asChild:!0,...c,children:d.jsx(HH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":rV(n.open),...t,ref:pT(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:En(t.onPointerMove,CS(p=>{s.onItemEnter(p),!p.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:En(t.onPointerLeave,CS(p=>{var x,b;f();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:En(t.onKeyDown,p=>{var x;const m=s.searchRef.current!=="";t.disabled||m&&p.key===" "||dse[r.dir].includes(p.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),p.preventDefault())})})})});eV.displayName=L_;var tV="MenuSubContent",nV=w.forwardRef((t,e)=>{const n=zH(ud,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=C0(ud,t.__scopeMenu),o=Aw(ud,t.__scopeMenu),a=QH(tV,t.__scopeMenu),l=w.useRef(null),c=Gr(e,l);return d.jsx(TS.Provider,{scope:t.__scopeMenu,children:d.jsx(Za,{present:r||s.open,children:d.jsx(TS.Slot,{scope:t.__scopeMenu,children:d.jsx(O7,{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:f=>{var p;o.isUsingKeyboardRef.current&&((p=l.current)==null||p.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:En(t.onFocusOutside,f=>{f.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:En(t.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:En(t.onKeyDown,f=>{var x;const p=f.currentTarget.contains(f.target),m=fse[o.dir].includes(f.key);p&&m&&(s.onOpenChange(!1),(x=a.trigger)==null||x.focus(),f.preventDefault())})})})})})});nV.displayName=tV;function rV(t){return t?"open":"closed"}function k2(t){return t==="indeterminate"}function F7(t){return k2(t)?"indeterminate":t?"checked":"unchecked"}function Rse(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Dse(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Pse(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=Dse(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Ise(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,f=a.y,p=l.x,m=l.y;f>r!=m>r&&n<(p-c)*(r-f)/(m-f)+c&&(i=!i)}return i}function Ose(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Ise(n,e)}function CS(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Lse=jH,jse=D7,zse=FH,Fse=UH,Use=L7,Bse=BH,Hse=ET,Vse=VH,Gse=WH,Wse=qH,$se=YH,qse=KH,Xse=ZH,Yse=JH,Kse=eV,Zse=nV,AT="DropdownMenu",[Qse]=Su(AT,[IH]),_l=IH(),[Jse,iV]=Qse(AT),sV=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),[f,p]=fd({prop:i,defaultProp:s??!1,onChange:o,caller:AT});return d.jsx(Jse,{scope:e,triggerId:jc(),triggerRef:c,contentId:jc(),open:f,onOpenChange:p,onOpenToggle:w.useCallback(()=>p(m=>!m),[p]),modal:a,children:d.jsx(Lse,{...l,open:f,onOpenChange:p,dir:r,modal:a,children:n})})};sV.displayName=AT;var oV="DropdownMenuTrigger",aV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=iV(oV,n),o=_l(n);return d.jsx(jse,{asChild:!0,...o,children:d.jsx(pr.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:pT(e,s.triggerRef),onPointerDown:En(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:En(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});aV.displayName=oV;var eoe="DropdownMenuPortal",lV=t=>{const{__scopeDropdownMenu:e,...n}=t,r=_l(e);return d.jsx(zse,{...r,...n})};lV.displayName=eoe;var cV="DropdownMenuContent",uV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=iV(cV,n),s=_l(n),o=w.useRef(!1);return d.jsx(Fse,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:En(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:En(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,f=l.button===2||c;(!i.modal||f)&&(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)"}})});uV.displayName=cV;var toe="DropdownMenuGroup",noe=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Use,{...i,...r,ref:e})});noe.displayName=toe;var roe="DropdownMenuLabel",dV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Bse,{...i,...r,ref:e})});dV.displayName=roe;var ioe="DropdownMenuItem",fV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Hse,{...i,...r,ref:e})});fV.displayName=ioe;var soe="DropdownMenuCheckboxItem",hV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Vse,{...i,...r,ref:e})});hV.displayName=soe;var ooe="DropdownMenuRadioGroup",aoe=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Gse,{...i,...r,ref:e})});aoe.displayName=ooe;var loe="DropdownMenuRadioItem",coe=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Wse,{...i,...r,ref:e})});coe.displayName=loe;var uoe="DropdownMenuItemIndicator",pV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx($se,{...i,...r,ref:e})});pV.displayName=uoe;var doe="DropdownMenuSeparator",mV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(qse,{...i,...r,ref:e})});mV.displayName=doe;var foe="DropdownMenuArrow",hoe=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Xse,{...i,...r,ref:e})});hoe.displayName=foe;var poe=t=>{const{__scopeDropdownMenu:e,children:n,open:r,onOpenChange:i,defaultOpen:s}=t,o=_l(e),[a,l]=fd({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return d.jsx(Yse,{...o,open:a,onOpenChange:l,children:n})},moe="DropdownMenuSubTrigger",gV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Kse,{...i,...r,ref:e})});gV.displayName=moe;var goe="DropdownMenuSubContent",xV=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_l(n);return d.jsx(Zse,{...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)"}})});xV.displayName=goe;var xoe=sV,voe=aV,yoe=lV,boe=uV,_oe=dV,Soe=fV,woe=hV,Moe=pV,Toe=mV,Coe=poe,Eoe=gV,Aoe=xV,Noe="Label",vV=w.forwardRef((t,e)=>d.jsx(pr.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())}}));vV.displayName=Noe;var koe=vV;function vk(t,[e,n]){return Math.min(n,Math.max(e,t))}var NT="Popover",[yV]=Su(NT,[T0]),Nw=T0(),[Roe,E0]=yV(NT),bV=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=Nw(e),l=w.useRef(null),[c,f]=w.useState(!1),[p,m]=fd({prop:r,defaultProp:i??!1,onChange:s,caller:NT});return d.jsx(ww,{...a,children:d.jsx(Roe,{scope:e,contentId:jc(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:w.useCallback(()=>m(x=>!x),[m]),hasCustomAnchor:c,onCustomAnchorAdd:w.useCallback(()=>f(!0),[]),onCustomAnchorRemove:w.useCallback(()=>f(!1),[]),modal:o,children:n})})};bV.displayName=NT;var _V="PopoverAnchor",Doe=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=E0(_V,n),s=Nw(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return w.useEffect(()=>(o(),()=>a()),[o,a]),d.jsx(Mw,{...s,...r,ref:e})});Doe.displayName=_V;var SV="PopoverTrigger",wV=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=E0(SV,n),s=Nw(n),o=Gr(e,i.triggerRef),a=d.jsx(pr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":AV(i.open),...r,ref:o,onClick:En(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:d.jsx(Mw,{asChild:!0,...s,children:a})});wV.displayName=SV;var U7="PopoverPortal",[Poe,Ioe]=yV(U7,{forceMount:void 0}),MV=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=E0(U7,e);return d.jsx(Poe,{scope:e,forceMount:n,children:d.jsx(Za,{present:n||s.open,children:d.jsx(Uy,{asChild:!0,container:i,children:r})})})};MV.displayName=U7;var ry="PopoverContent",TV=w.forwardRef((t,e)=>{const n=Ioe(ry,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=E0(ry,t.__scopePopover);return d.jsx(Za,{present:r||s.open,children:s.modal?d.jsx(Loe,{...i,ref:e}):d.jsx(joe,{...i,ref:e})})});TV.displayName=ry;var Ooe=s0("PopoverContent.RemoveScroll"),Loe=w.forwardRef((t,e)=>{const n=E0(ry,t.__scopePopover),r=w.useRef(null),i=Gr(e,r),s=w.useRef(!1);return w.useEffect(()=>{const o=r.current;if(o)return vT(o)},[]),d.jsx(_w,{as:Ooe,allowPinchZoom:!0,children:d.jsx(CV,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:En(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:En(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:En(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),joe=w.forwardRef((t,e)=>{const n=E0(ry,t.__scopePopover),r=w.useRef(!1),i=w.useRef(!1);return d.jsx(CV,{...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()}})}),CV=w.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:f,...p}=t,m=E0(ry,n),x=Nw(n);return gT(),d.jsx(bw,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:d.jsx(Fy,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>m.onOpenChange(!1),children:d.jsx(MT,{"data-state":AV(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)"}})})})}),EV="PopoverClose",zoe=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=E0(EV,n);return d.jsx(pr.button,{type:"button",...r,ref:e,onClick:En(t.onClick,()=>i.onOpenChange(!1))})});zoe.displayName=EV;var Foe="PopoverArrow",Uoe=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=Nw(n);return d.jsx(TT,{...i,...r,ref:e})});Uoe.displayName=Foe;function AV(t){return t?"open":"closed"}var Boe=bV,Hoe=wV,Voe=MV,Goe=TV;function Woe(t,e){return w.useReducer((n,r)=>e[n][r]??n,t)}var B7="ScrollArea",[NV]=Su(B7),[$oe,xd]=NV(B7),kV=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=w.useState(null),[c,f]=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),[P,k]=w.useState(!1),[O,R]=w.useState(!1),L=Gr(e,V=>l(V)),B=yw(i);return d.jsx($oe,{scope:n,type:r,dir:B,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:f,content:p,onContentChange:m,scrollbarX:x,onScrollbarXChange:b,scrollbarXEnabled:P,onScrollbarXEnabledChange:k,scrollbarY:_,onScrollbarYChange:S,scrollbarYEnabled:O,onScrollbarYEnabledChange:R,onCornerWidthChange:C,onCornerHeightChange:N,children:d.jsx(pr.div,{dir:B,...o,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":M+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});kV.displayName=B7;var RV="ScrollAreaViewport",DV=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...s}=t,o=xd(RV,n),a=w.useRef(null),l=Gr(e,a,o.onViewportChange);return d.jsxs(d.Fragment,{children:[d.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}),d.jsx(pr.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:d.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});DV.displayName=RV;var bh="ScrollAreaScrollbar",PV=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=xd(bh,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"?d.jsx(qoe,{...r,ref:e,forceMount:n}):i.type==="scroll"?d.jsx(Xoe,{...r,ref:e,forceMount:n}):i.type==="auto"?d.jsx(IV,{...r,ref:e,forceMount:n}):i.type==="always"?d.jsx(H7,{...r,ref:e}):null});PV.displayName=bh;var qoe=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=xd(bh,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)},f=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",f)}}},[i.scrollArea,i.scrollHideDelay]),d.jsx(Za,{present:n||s,children:d.jsx(IV,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Xoe=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=xd(bh,t.__scopeScrollArea),s=t.orientation==="horizontal",o=RT(()=>l("SCROLL_END"),100),[a,l]=Woe("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,f=s?"scrollLeft":"scrollTop";if(c){let p=c[f];const m=()=>{const x=c[f];p!==x&&(l("SCROLL"),o()),p=x};return c.addEventListener("scroll",m),()=>c.removeEventListener("scroll",m)}},[i.viewport,s,l,o]),d.jsx(Za,{present:n||a!=="hidden",children:d.jsx(H7,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:En(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:En(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),IV=w.forwardRef((t,e)=>{const n=xd(bh,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,o]=w.useState(!1),a=t.orientation==="horizontal",l=RT(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,f=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?c:f)}},10);return iy(n.viewport,l),iy(n.content,l),d.jsx(Za,{present:r||s,children:d.jsx(H7,{"data-state":s?"visible":"hidden",...i,ref:e})})}),H7=w.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=xd(bh,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=FV(a.viewport,a.content),f={...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 eae(m,o.current,a,x)}return n==="horizontal"?d.jsx(Yoe,{...f,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollLeft,x=uI(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"?d.jsx(Koe,{...f,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollTop,x=uI(m,a);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollTop=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollTop=p(m))}}):null}),Yoe=w.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=xd(bh,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]),d.jsx(LV,{"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":kT(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,p)=>{if(s.viewport){const m=s.viewport.scrollLeft+f.deltaX;t.onWheelScroll(m),BV(m,p)&&f.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:D2(o.paddingLeft),paddingEnd:D2(o.paddingRight)}})}})}),Koe=w.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=xd(bh,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]),d.jsx(LV,{"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":kT(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,p)=>{if(s.viewport){const m=s.viewport.scrollTop+f.deltaY;t.onWheelScroll(m),BV(m,p)&&f.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:D2(o.paddingTop),paddingEnd:D2(o.paddingBottom)}})}})}),[Zoe,OV]=NV(bh),LV=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:f,onResize:p,...m}=t,x=xd(bh,n),[b,_]=w.useState(null),S=Gr(e,L=>_(L)),M=w.useRef(null),C=w.useRef(""),A=x.viewport,N=r.content-r.viewport,P=Aa(f),k=Aa(l),O=RT(p,10);function R(L){if(M.current){const B=L.clientX-M.current.left,V=L.clientY-M.current.top;c({x:B,y:V})}}return w.useEffect(()=>{const L=B=>{const V=B.target;(b==null?void 0:b.contains(V))&&P(B,N)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[A,b,N,P]),w.useEffect(k,[r,k]),iy(b,O),iy(x.content,O),d.jsx(Zoe,{scope:n,scrollbar:b,hasThumb:i,onThumbChange:Aa(s),onThumbPointerUp:Aa(o),onThumbPositionChange:k,onThumbPointerDown:Aa(a),children:d.jsx(pr.div,{...m,ref:S,style:{position:"absolute",...m.style},onPointerDown:En(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),M.current=b.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),R(L))}),onPointerMove:En(t.onPointerMove,R),onPointerUp:En(t.onPointerUp,L=>{const B=L.target;B.hasPointerCapture(L.pointerId)&&B.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=C.current,x.viewport&&(x.viewport.style.scrollBehavior=""),M.current=null})})})}),R2="ScrollAreaThumb",jV=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=OV(R2,t.__scopeScrollArea);return d.jsx(Za,{present:n||i.hasThumb,children:d.jsx(Qoe,{ref:e,...r})})}),Qoe=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=xd(R2,n),o=OV(R2,n),{onThumbPositionChange:a}=o,l=Gr(e,p=>o.onThumbChange(p)),c=w.useRef(void 0),f=RT(()=>{c.current&&(c.current(),c.current=void 0)},100);return w.useEffect(()=>{const p=s.viewport;if(p){const m=()=>{if(f(),!c.current){const x=tae(p,a);c.current=x,a()}};return a(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[s.viewport,f,a]),d.jsx(pr.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:En(t.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),b=p.clientX-x.left,_=p.clientY-x.top;o.onThumbPointerDown({x:b,y:_})}),onPointerUp:En(t.onPointerUp,o.onThumbPointerUp)})});jV.displayName=R2;var V7="ScrollAreaCorner",zV=w.forwardRef((t,e)=>{const n=xd(V7,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.jsx(Joe,{...t,ref:e}):null});zV.displayName=V7;var Joe=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=xd(V7,n),[s,o]=w.useState(0),[a,l]=w.useState(0),c=!!(s&&a);return iy(i.scrollbarX,()=>{var p;const f=((p=i.scrollbarX)==null?void 0:p.offsetHeight)||0;i.onCornerHeightChange(f),l(f)}),iy(i.scrollbarY,()=>{var p;const f=((p=i.scrollbarY)==null?void 0:p.offsetWidth)||0;i.onCornerWidthChange(f),o(f)}),c?d.jsx(pr.div,{...r,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function D2(t){return t?parseInt(t,10):0}function FV(t,e){const n=t/e;return isNaN(n)?0:n}function kT(t){const e=FV(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function eae(t,e,n,r="ltr"){const i=kT(n),s=i/2,o=e||s,a=i-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,f=n.content-n.viewport,p=r==="ltr"?[0,f]:[f*-1,0];return UV([l,c],p)(t)}function uI(t,e,n="ltr"){const r=kT(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 UV([0,o],[0,a])(c)}function UV(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 BV(t,e){return t>0&&t<e}var tae=(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 RT(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 iy(t,e){const n=Aa(e);ka(()=>{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 nae=kV,rae=DV,iae=zV,sae=[" ","Enter","ArrowUp","ArrowDown"],oae=[" ","Enter"],Sx="Select",[DT,PT,aae]=g7(Sx),[Vy]=Su(Sx,[aae,T0]),IT=T0(),[lae,A0]=Vy(Sx),[cae,uae]=Vy(Sx),HV=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:f,autoComplete:p,disabled:m,required:x,form:b}=t,_=IT(e),[S,M]=w.useState(null),[C,A]=w.useState(null),[N,P]=w.useState(!1),k=yw(c),[O,R]=fd({prop:r,defaultProp:i??!1,onChange:s,caller:Sx}),[L,B]=fd({prop:o,defaultProp:a,onChange:l,caller:Sx}),V=w.useRef(null),W=S?b||!!S.closest("form"):!0,[G,ee]=w.useState(new Set),H=Array.from(G).map(q=>q.props.value).join(";");return d.jsx(ww,{..._,children:d.jsxs(lae,{required:x,scope:e,trigger:S,onTriggerChange:M,valueNode:C,onValueNodeChange:A,valueNodeHasChildren:N,onValueNodeHasChildrenChange:P,contentId:jc(),value:L,onValueChange:B,open:O,onOpenChange:R,dir:k,triggerPointerDownPosRef:V,disabled:m,children:[d.jsx(DT.Provider,{scope:e,children:d.jsx(cae,{scope:t.__scopeSelect,onNativeOptionAdd:w.useCallback(q=>{ee(J=>new Set(J).add(q))},[]),onNativeOptionRemove:w.useCallback(q=>{ee(J=>{const K=new Set(J);return K.delete(q),K})},[]),children:n})}),W?d.jsxs(uG,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:p,value:L,onChange:q=>B(q.target.value),disabled:m,form:b,children:[L===void 0?d.jsx("option",{value:""}):null,Array.from(G)]},H):null]})})};HV.displayName=Sx;var VV="SelectTrigger",GV=w.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=IT(n),o=A0(VV,n),a=o.disabled||r,l=Gr(e,o.onTriggerChange),c=PT(n),f=w.useRef("touch"),[p,m,x]=fG(_=>{const S=c().filter(A=>!A.disabled),M=S.find(A=>A.value===o.value),C=hG(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 d.jsx(Mw,{asChild:!0,...s,children:d.jsx(pr.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":dG(o.value)?"":void 0,...i,ref:l,onClick:En(i.onClick,_=>{_.currentTarget.focus(),f.current!=="mouse"&&b(_)}),onPointerDown:En(i.onPointerDown,_=>{f.current=_.pointerType;const S=_.target;S.hasPointerCapture(_.pointerId)&&S.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(b(_),_.preventDefault())}),onKeyDown:En(i.onKeyDown,_=>{const S=p.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&m(_.key),!(S&&_.key===" ")&&sae.includes(_.key)&&(b(),_.preventDefault())})})})});GV.displayName=VV;var WV="SelectValue",$V=w.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=t,l=A0(WV,n),{onValueNodeHasChildrenChange:c}=l,f=s!==void 0,p=Gr(e,l.onValueNodeChange);return ka(()=>{c(f)},[c,f]),d.jsx(pr.span,{...a,ref:p,style:{pointerEvents:"none"},children:dG(l.value)?d.jsx(d.Fragment,{children:o}):s})});$V.displayName=WV;var dae="SelectIcon",qV=w.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return d.jsx(pr.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});qV.displayName=dae;var fae="SelectPortal",XV=t=>d.jsx(Uy,{asChild:!0,...t});XV.displayName=fae;var wx="SelectContent",YV=w.forwardRef((t,e)=>{const n=A0(wx,t.__scopeSelect),[r,i]=w.useState();if(ka(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?ql.createPortal(d.jsx(KV,{scope:t.__scopeSelect,children:d.jsx(DT.Slot,{scope:t.__scopeSelect,children:d.jsx("div",{children:t.children})})}),s):null}return d.jsx(ZV,{...t,ref:e})});YV.displayName=wx;var qd=10,[KV,N0]=Vy(wx),hae="SelectContentImpl",pae=s0("SelectContent.RemoveScroll"),ZV=w.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:_,avoidCollisions:S,...M}=t,C=A0(wx,n),[A,N]=w.useState(null),[P,k]=w.useState(null),O=Gr(e,ie=>N(ie)),[R,L]=w.useState(null),[B,V]=w.useState(null),W=PT(n),[G,ee]=w.useState(!1),H=w.useRef(!1);w.useEffect(()=>{if(A)return vT(A)},[A]),gT();const q=w.useCallback(ie=>{const[fe,...Q]=W().map(se=>se.ref.current),[ue]=Q.slice(-1),he=document.activeElement;for(const se of ie)if(se===he||(se==null||se.scrollIntoView({block:"nearest"}),se===fe&&P&&(P.scrollTop=0),se===ue&&P&&(P.scrollTop=P.scrollHeight),se==null||se.focus(),document.activeElement!==he))return},[W,P]),J=w.useCallback(()=>q([R,A]),[q,R,A]);w.useEffect(()=>{G&&J()},[G,J]);const{onOpenChange:K,triggerPointerDownPosRef:ne}=C;w.useEffect(()=>{if(A){let ie={x:0,y:0};const fe=ue=>{var he,se;ie={x:Math.abs(Math.round(ue.pageX)-(((he=ne.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(ue.pageY)-(((se=ne.current)==null?void 0:se.y)??0))}},Q=ue=>{ie.x<=10&&ie.y<=10?ue.preventDefault():A.contains(ue.target)||K(!1),document.removeEventListener("pointermove",fe),ne.current=null};return ne.current!==null&&(document.addEventListener("pointermove",fe),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",fe),document.removeEventListener("pointerup",Q,{capture:!0})}}},[A,K,ne]),w.useEffect(()=>{const ie=()=>K(!1);return window.addEventListener("blur",ie),window.addEventListener("resize",ie),()=>{window.removeEventListener("blur",ie),window.removeEventListener("resize",ie)}},[K]);const[U,z]=fG(ie=>{const fe=W().filter(he=>!he.disabled),Q=fe.find(he=>he.ref.current===document.activeElement),ue=hG(fe,ie,Q);ue&&setTimeout(()=>ue.ref.current.focus())}),Y=w.useCallback((ie,fe,Q)=>{const ue=!H.current&&!Q;(C.value!==void 0&&C.value===fe||ue)&&(L(ie),ue&&(H.current=!0))},[C.value]),j=w.useCallback(()=>A==null?void 0:A.focus(),[A]),le=w.useCallback((ie,fe,Q)=>{const ue=!H.current&&!Q;(C.value!==void 0&&C.value===fe||ue)&&V(ie)},[C.value]),ce=r==="popper"?yk:QV,X=ce===yk?{side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:_,avoidCollisions:S}:{};return d.jsx(KV,{scope:n,content:A,viewport:P,onViewportChange:k,itemRefCallback:Y,selectedItem:R,onItemLeave:j,itemTextRefCallback:le,focusSelectedItem:J,selectedItemText:B,position:r,isPositioned:G,searchRef:U,children:d.jsx(_w,{as:pae,allowPinchZoom:!0,children:d.jsx(bw,{asChild:!0,trapped:C.open,onMountAutoFocus:ie=>{ie.preventDefault()},onUnmountAutoFocus:En(i,ie=>{var fe;(fe=C.trigger)==null||fe.focus({preventScroll:!0}),ie.preventDefault()}),children:d.jsx(Fy,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:ie=>ie.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ie=>ie.preventDefault(),...M,...X,onPlaced:()=>ee(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...M.style},onKeyDown:En(M.onKeyDown,ie=>{const fe=ie.ctrlKey||ie.altKey||ie.metaKey;if(ie.key==="Tab"&&ie.preventDefault(),!fe&&ie.key.length===1&&z(ie.key),["ArrowUp","ArrowDown","Home","End"].includes(ie.key)){let ue=W().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(ie.key)&&(ue=ue.slice().reverse()),["ArrowUp","ArrowDown"].includes(ie.key)){const he=ie.target,se=ue.indexOf(he);ue=ue.slice(se+1)}setTimeout(()=>q(ue)),ie.preventDefault()}})})})})})})});ZV.displayName=hae;var mae="SelectItemAlignedPosition",QV=w.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=A0(wx,n),o=N0(wx,n),[a,l]=w.useState(null),[c,f]=w.useState(null),p=Gr(e,O=>f(O)),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 O=s.trigger.getBoundingClientRect(),R=c.getBoundingClientRect(),L=s.valueNode.getBoundingClientRect(),B=M.getBoundingClientRect();if(s.dir!=="rtl"){const he=B.left-R.left,se=L.left-he,Ce=O.left-se,de=O.width+Ce,Me=Math.max(de,R.width),Te=window.innerWidth-qd,Pe=vk(se,[qd,Math.max(qd,Te-Me)]);a.style.minWidth=de+"px",a.style.left=Pe+"px"}else{const he=R.right-B.right,se=window.innerWidth-L.right-he,Ce=window.innerWidth-O.right-se,de=O.width+Ce,Me=Math.max(de,R.width),Te=window.innerWidth-qd,Pe=vk(se,[qd,Math.max(qd,Te-Me)]);a.style.minWidth=de+"px",a.style.right=Pe+"px"}const V=m(),W=window.innerHeight-qd*2,G=_.scrollHeight,ee=window.getComputedStyle(c),H=parseInt(ee.borderTopWidth,10),q=parseInt(ee.paddingTop,10),J=parseInt(ee.borderBottomWidth,10),K=parseInt(ee.paddingBottom,10),ne=H+q+G+K+J,U=Math.min(S.offsetHeight*5,ne),z=window.getComputedStyle(_),Y=parseInt(z.paddingTop,10),j=parseInt(z.paddingBottom,10),le=O.top+O.height/2-qd,ce=W-le,X=S.offsetHeight/2,ie=S.offsetTop+X,fe=H+q+ie,Q=ne-fe;if(fe<=le){const he=V.length>0&&S===V[V.length-1].ref.current;a.style.bottom="0px";const se=c.clientHeight-_.offsetTop-_.offsetHeight,Ce=Math.max(ce,X+(he?j:0)+se+J),de=fe+Ce;a.style.height=de+"px"}else{const he=V.length>0&&S===V[0].ref.current;a.style.top="0px";const Ce=Math.max(le,H+_.offsetTop+(he?Y:0)+X)+Q;a.style.height=Ce+"px",_.scrollTop=fe-le+_.offsetTop}a.style.margin=`${qd}px 0`,a.style.minHeight=U+"px",a.style.maxHeight=W+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[m,s.trigger,s.valueNode,a,c,_,S,M,s.dir,r]);ka(()=>A(),[A]);const[N,P]=w.useState();ka(()=>{c&&P(window.getComputedStyle(c).zIndex)},[c]);const k=w.useCallback(O=>{O&&b.current===!0&&(A(),C==null||C(),b.current=!1)},[A,C]);return d.jsx(xae,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:x,onScrollButtonChange:k,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:d.jsx(pr.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});QV.displayName=mae;var gae="SelectPopperPosition",yk=w.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=qd,...s}=t,o=IT(n);return d.jsx(MT,{...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=gae;var[xae,G7]=Vy(wx,{}),bk="SelectViewport",JV=w.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=N0(bk,n),o=G7(bk,n),a=Gr(e,s.onViewportChange),l=w.useRef(0);return d.jsxs(d.Fragment,{children:[d.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}),d.jsx(DT.Slot,{scope:n,children:d.jsx(pr.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:En(i.onScroll,c=>{const f=c.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&p){const x=Math.abs(l.current-f.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"&&(f.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});JV.displayName=bk;var eG="SelectGroup",[vae,yae]=Vy(eG),bae=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=jc();return d.jsx(vae,{scope:n,id:i,children:d.jsx(pr.div,{role:"group","aria-labelledby":i,...r,ref:e})})});bae.displayName=eG;var tG="SelectLabel",_ae=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=yae(tG,n);return d.jsx(pr.div,{id:i.id,...r,ref:e})});_ae.displayName=tG;var P2="SelectItem",[Sae,nG]=Vy(P2),rG=w.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=t,a=A0(P2,n),l=N0(P2,n),c=a.value===r,[f,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)}),_=jc(),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 d.jsx(Sae,{scope:n,value:r,disabled:i,textId:_,isSelected:c,onItemTextChange:w.useCallback(C=>{p(A=>A||((C==null?void 0:C.textContent)??"").trim())},[]),children:d.jsx(DT.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:d.jsx(pr.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:En(o.onFocus,()=>x(!0)),onBlur:En(o.onBlur,()=>x(!1)),onClick:En(o.onClick,()=>{S.current!=="mouse"&&M()}),onPointerUp:En(o.onPointerUp,()=>{S.current==="mouse"&&M()}),onPointerDown:En(o.onPointerDown,C=>{S.current=C.pointerType}),onPointerMove:En(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:En(o.onPointerLeave,C=>{var A;C.currentTarget===document.activeElement&&((A=l.onItemLeave)==null||A.call(l))}),onKeyDown:En(o.onKeyDown,C=>{var N;((N=l.searchRef)==null?void 0:N.current)!==""&&C.key===" "||(oae.includes(C.key)&&M(),C.key===" "&&C.preventDefault())})})})})});rG.displayName=P2;var j_="SelectItemText",iG=w.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,o=A0(j_,n),a=N0(j_,n),l=nG(j_,n),c=uae(j_,n),[f,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=f==null?void 0:f.textContent,b=w.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:x},l.value),[l.disabled,l.value,x]),{onNativeOptionAdd:_,onNativeOptionRemove:S}=c;return ka(()=>(_(b),()=>S(b)),[_,S,b]),d.jsxs(d.Fragment,{children:[d.jsx(pr.span,{id:l.textId,...s,ref:m}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ql.createPortal(s.children,o.valueNode):null]})});iG.displayName=j_;var sG="SelectItemIndicator",oG=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return nG(sG,n).isSelected?d.jsx(pr.span,{"aria-hidden":!0,...r,ref:e}):null});oG.displayName=sG;var _k="SelectScrollUpButton",aG=w.forwardRef((t,e)=>{const n=N0(_k,t.__scopeSelect),r=G7(_k,t.__scopeSelect),[i,s]=w.useState(!1),o=Gr(e,r.onScrollButtonChange);return ka(()=>{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?d.jsx(cG,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});aG.displayName=_k;var Sk="SelectScrollDownButton",lG=w.forwardRef((t,e)=>{const n=N0(Sk,t.__scopeSelect),r=G7(Sk,t.__scopeSelect),[i,s]=w.useState(!1),o=Gr(e,r.onScrollButtonChange);return ka(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<c;s(f)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?d.jsx(cG,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});lG.displayName=Sk;var cG=w.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=N0("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]),ka(()=>{var f;const c=a().find(p=>p.ref.current===document.activeElement);(f=c==null?void 0:c.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),d.jsx(pr.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:En(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:En(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:En(i.onPointerLeave,()=>{l()})})}),wae="SelectSeparator",Mae=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return d.jsx(pr.div,{"aria-hidden":!0,...r,ref:e})});Mae.displayName=wae;var wk="SelectArrow",Tae=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=IT(n),s=A0(wk,n),o=N0(wk,n);return s.open&&o.position==="popper"?d.jsx(TT,{...i,...r,ref:e}):null});Tae.displayName=wk;var Cae="SelectBubbleInput",uG=w.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=w.useRef(null),s=Gr(r,i),o=Dre(e);return w.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&f){const p=new Event("change",{bubbles:!0});f.call(a,e),a.dispatchEvent(p)}},[o,e]),d.jsx(pr.select,{...n,style:{...oB,...n.style},ref:s,defaultValue:e})});uG.displayName=Cae;function dG(t){return t===""||t===void 0}function fG(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 hG(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=Eae(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 Eae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Aae=HV,Nae=GV,kae=$V,Rae=qV,Dae=XV,Pae=YV,Iae=JV,Oae=rG,Lae=iG,jae=oG,zae=aG,Fae=lG,pG="Toggle",W7=w.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...s}=t,[o,a]=fd({prop:n,onChange:i,defaultProp:r??!1,caller:pG});return d.jsx(pr.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:En(t.onClick,()=>{t.disabled||a(!o)})})});W7.displayName=pG;var Uae=W7,k0="ToggleGroup",[mG]=Su(k0,[CT]),gG=CT(),$7=ni.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const i=r;return d.jsx(Bae,{...i,ref:e})}if(n==="multiple"){const i=r;return d.jsx(Hae,{...i,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${k0}\``)});$7.displayName=k0;var[xG,vG]=mG(k0),Bae=ni.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=fd({prop:n,defaultProp:r??"",onChange:i,caller:k0});return d.jsx(xG,{scope:t.__scopeToggleGroup,type:"single",value:ni.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:ni.useCallback(()=>a(""),[a]),children:d.jsx(yG,{...s,ref:e})})}),Hae=ni.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=fd({prop:n,defaultProp:r??[],onChange:i,caller:k0}),l=ni.useCallback(f=>a((p=[])=>[...p,f]),[a]),c=ni.useCallback(f=>a((p=[])=>p.filter(m=>m!==f)),[a]);return d.jsx(xG,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:l,onItemDeactivate:c,children:d.jsx(yG,{...s,ref:e})})});$7.displayName=k0;var[Vae,Gae]=mG(k0),yG=ni.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:s,dir:o,loop:a=!0,...l}=t,c=gG(n),f=yw(o),p={role:"group",dir:f,...l};return d.jsx(Vae,{scope:n,rovingFocus:i,disabled:r,children:i?d.jsx(RH,{asChild:!0,...c,orientation:s,dir:f,loop:a,children:d.jsx(pr.div,{...p,ref:e})}):d.jsx(pr.div,{...p,ref:e})})}),I2="ToggleGroupItem",bG=ni.forwardRef((t,e)=>{const n=vG(I2,t.__scopeToggleGroup),r=Gae(I2,t.__scopeToggleGroup),i=gG(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?d.jsx(DH,{asChild:!0,...i,focusable:!o,active:s,ref:l,children:d.jsx(dI,{...a,ref:e})}):d.jsx(dI,{...a,ref:e})});bG.displayName=I2;var dI=ni.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...i}=t,s=vG(I2,n),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},a=s.type==="single"?o:void 0;return d.jsx(W7,{...a,...i,ref:e,onPressedChange:l=>{l?s.onItemActivate(r):s.onItemDeactivate(r)}})}),Wae=$7,$ae=bG,[OT]=Su("Tooltip",[T0]),LT=T0(),_G="TooltipProvider",qae=700,Mk="tooltip.open",[Xae,q7]=OT(_G),SG=t=>{const{__scopeTooltip:e,delayDuration:n=qae,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)},[]),d.jsx(Xae,{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})};SG.displayName=_G;var ES="Tooltip",[Yae,kw]=OT(ES),wG=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=t,l=q7(ES,t.__scopeTooltip),c=LT(e),[f,p]=w.useState(null),m=jc(),x=w.useRef(0),b=o??l.disableHoverableContent,_=a??l.delayDuration,S=w.useRef(!1),[M,C]=fd({prop:r,defaultProp:i??!1,onChange:O=>{O?(l.onOpen(),document.dispatchEvent(new CustomEvent(Mk))):l.onClose(),s==null||s(O)},caller:ES}),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]),P=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,C(!1)},[C]),k=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)},[]),d.jsx(ww,{...c,children:d.jsx(Yae,{scope:e,contentId:m,open:M,stateAttribute:A,trigger:f,onTriggerChange:p,onTriggerEnter:w.useCallback(()=>{l.isOpenDelayedRef.current?k():N()},[l.isOpenDelayedRef,k,N]),onTriggerLeave:w.useCallback(()=>{b?P():(window.clearTimeout(x.current),x.current=0)},[P,b]),onOpen:N,onClose:P,disableHoverableContent:b,children:n})})};wG.displayName=ES;var Tk="TooltipTrigger",MG=w.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=kw(Tk,n),s=q7(Tk,n),o=LT(n),a=w.useRef(null),l=Gr(e,a,i.onTriggerChange),c=w.useRef(!1),f=w.useRef(!1),p=w.useCallback(()=>c.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),d.jsx(Mw,{asChild:!0,...o,children:d.jsx(pr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:En(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:En(t.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:En(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:En(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:En(t.onBlur,i.onClose),onClick:En(t.onClick,i.onClose)})})});MG.displayName=Tk;var X7="TooltipPortal",[Kae,Zae]=OT(X7,{forceMount:void 0}),TG=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=kw(X7,e);return d.jsx(Kae,{scope:e,forceMount:n,children:d.jsx(Za,{present:n||s.open,children:d.jsx(Uy,{asChild:!0,container:i,children:r})})})};TG.displayName=X7;var sy="TooltipContent",CG=w.forwardRef((t,e)=>{const n=Zae(sy,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=kw(sy,t.__scopeTooltip);return d.jsx(Za,{present:r||o.open,children:o.disableHoverableContent?d.jsx(EG,{side:i,...s,ref:e}):d.jsx(Qae,{side:i,...s,ref:e})})}),Qae=w.forwardRef((t,e)=>{const n=kw(sy,t.__scopeTooltip),r=q7(sy,t.__scopeTooltip),i=w.useRef(null),s=Gr(e,i),[o,a]=w.useState(null),{trigger:l,onClose:c}=n,f=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=rle(M,S.getBoundingClientRect()),A=ile(M,C),N=sle(_.getBoundingClientRect()),P=ale([...A,...N]);a(P),p(!0)},[p]);return w.useEffect(()=>()=>m(),[m]),w.useEffect(()=>{if(l&&f){const b=S=>x(S,f),_=S=>x(S,l);return l.addEventListener("pointerleave",b),f.addEventListener("pointerleave",_),()=>{l.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",_)}}},[l,f,x,m]),w.useEffect(()=>{if(o){const b=_=>{const S=_.target,M={x:_.clientX,y:_.clientY},C=(l==null?void 0:l.contains(S))||(f==null?void 0:f.contains(S)),A=!ole(M,o);C?m():A&&(m(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,f,o,c,m]),d.jsx(EG,{...t,ref:s})}),[Jae,ele]=OT(ES,{isInside:!1}),tle=iB("TooltipContent"),EG=w.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=t,l=kw(sy,n),c=LT(n),{onClose:f}=l;return w.useEffect(()=>(document.addEventListener(Mk,f),()=>document.removeEventListener(Mk,f)),[f]),w.useEffect(()=>{if(l.trigger){const p=m=>{const x=m.target;x!=null&&x.contains(l.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[l.trigger,f]),d.jsx(Fy,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:d.jsxs(MT,{"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:[d.jsx(tle,{children:r}),d.jsx(Jae,{scope:n,isInside:!0,children:d.jsx(jte,{id:l.contentId,role:"tooltip",children:i||r})})]})})});CG.displayName=sy;var AG="TooltipArrow",nle=w.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=LT(n);return ele(AG,n).isInside?null:d.jsx(TT,{...i,...r,ref:e})});nle.displayName=AG;function rle(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 ile(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 sle(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 ole(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,f=a.y,p=l.x,m=l.y;f>r!=m>r&&n<(p-c)*(r-f)/(m-f)+c&&(i=!i)}return i}function ale(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),lle(e)}function lle(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 cle=SG,ule=wG,dle=MG,fle=TG,hle=CG;function NG(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=NG(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function kG(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=NG(t))&&(r&&(r+=" "),r+=e);return r}const ple=(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},mle=(t,e)=>({classGroupId:t,validator:e}),RG=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),O2="-",fI=[],gle="arbitrary..",xle=t=>{const e=yle(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return vle(o);const a=o.split(O2),l=a[0]===""&&a.length>1?1:0;return DG(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?ple(c,l):l:c||fI}return n[o]||fI}}},DG=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=DG(t,e+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(O2):t.slice(e).join(O2),l=o.length;for(let c=0;c<l;c++){const f=o[c];if(f.validator(a))return f.classGroupId}},vle=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?gle+r:void 0})(),yle=t=>{const{theme:e,classGroups:n}=t;return ble(n,e)},ble=(t,e)=>{const n=RG();for(const r in t){const i=t[r];Y7(i,n,r,e)}return n},Y7=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];_le(o,e,n,r)}},_le=(t,e,n,r)=>{if(typeof t=="string"){Sle(t,e,n);return}if(typeof t=="function"){wle(t,e,n,r);return}Mle(t,e,n,r)},Sle=(t,e,n)=>{const r=t===""?e:PG(e,t);r.classGroupId=n},wle=(t,e,n,r)=>{if(Tle(t)){Y7(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(mle(n,t))},Mle=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];Y7(l,PG(e,a),n,r)}},PG=(t,e)=>{let n=t;const r=e.split(O2),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=RG(),n.nextPart.set(o,a)),n=a}return n},Tle=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Cle=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="!",hI=":",Ele=[],pI=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ale=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,l=0,c;const f=i.length;for(let _=0;_<f;_++){const S=i[_];if(o===0&&a===0){if(S===hI){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 pI(s,x,m,b)};if(e){const i=e+hI,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):pI(Ele,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},Nle=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}},kle=t=>({cache:Cle(t.cacheSize),parseClassName:Ale(t),sortModifiers:Nle(t),...xle(t)}),Rle=/\s+/,Dle=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(Rle);let l="";for(let c=a.length-1;c>=0;c-=1){const f=a[c],{isExternal:p,modifiers:m,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:_}=n(f);if(p){l=f+(l.length>0?" "+l:l);continue}let S=!!_,M=r(S?b.substring(0,_):b);if(!M){if(!S){l=f+(l.length>0?" "+l:l);continue}if(M=r(b),!M){l=f+(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 P=i(M,S);for(let k=0;k<P.length;++k){const O=P[k];o.push(A+O)}l=f+(l.length>0?" "+l:l)}return l},Ple=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=IG(n))&&(i&&(i+=" "),i+=r);return i},IG=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=IG(t[r]))&&(n&&(n+=" "),n+=e);return n},Ile=(t,...e)=>{let n,r,i,s;const o=l=>{const c=e.reduce((f,p)=>p(f),t());return n=kle(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const f=Dle(l,n);return i(l,f),f};return s=o,(...l)=>s(Ple(...l))},Ole=[],ca=t=>{const e=n=>n[t]||Ole;return e.isThemeGetter=!0,e},OG=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,LG=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Lle=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,jle=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zle=/\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$/,Fle=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ule=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ble=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_m=t=>Lle.test(t),Yr=t=>!!t&&!Number.isNaN(Number(t)),Sm=t=>!!t&&Number.isInteger(Number(t)),SA=t=>t.endsWith("%")&&Yr(t.slice(0,-1)),Qh=t=>jle.test(t),jG=()=>!0,Hle=t=>zle.test(t)&&!Fle.test(t),K7=()=>!1,Vle=t=>Ule.test(t),Gle=t=>Ble.test(t),Wle=t=>!Fn(t)&&!Un(t),$le=t=>R0(t,UG,K7),Fn=t=>OG.test(t),Mg=t=>R0(t,BG,Hle),mI=t=>R0(t,ece,Yr),qle=t=>R0(t,VG,jG),Xle=t=>R0(t,HG,K7),gI=t=>R0(t,zG,K7),Yle=t=>R0(t,FG,Gle),S4=t=>R0(t,GG,Vle),Un=t=>LG.test(t),f_=t=>Px(t,BG),Kle=t=>Px(t,HG),xI=t=>Px(t,zG),Zle=t=>Px(t,UG),Qle=t=>Px(t,FG),w4=t=>Px(t,GG,!0),Jle=t=>Px(t,VG,!0),R0=(t,e,n)=>{const r=OG.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Px=(t,e,n=!1)=>{const r=LG.exec(t);return r?r[1]?e(r[1]):n:!1},zG=t=>t==="position"||t==="percentage",FG=t=>t==="image"||t==="url",UG=t=>t==="length"||t==="size"||t==="bg-size",BG=t=>t==="length",ece=t=>t==="number",HG=t=>t==="family-name",VG=t=>t==="number"||t==="weight",GG=t=>t==="shadow",tce=()=>{const t=ca("color"),e=ca("font"),n=ca("text"),r=ca("font-weight"),i=ca("tracking"),s=ca("leading"),o=ca("breakpoint"),a=ca("container"),l=ca("spacing"),c=ca("radius"),f=ca("shadow"),p=ca("inset-shadow"),m=ca("text-shadow"),x=ca("drop-shadow"),b=ca("blur"),_=ca("perspective"),S=ca("aspect"),M=ca("ease"),C=ca("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"],P=()=>[...N(),Un,Fn],k=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],R=()=>[Un,Fn,l],L=()=>[_m,"full","auto",...R()],B=()=>[Sm,"none","subgrid",Un,Fn],V=()=>["auto",{span:["full",Sm,Un,Fn]},Sm,Un,Fn],W=()=>[Sm,"auto",Un,Fn],G=()=>["auto","min","max","fr",Un,Fn],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...R()],J=()=>[_m,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],K=()=>[_m,"screen","full","dvw","lvw","svw","min","max","fit",...R()],ne=()=>[_m,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],U=()=>[t,Un,Fn],z=()=>[...N(),xI,gI,{position:[Un,Fn]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",Zle,$le,{size:[Un,Fn]}],le=()=>[SA,f_,Mg],ce=()=>["","none","full",c,Un,Fn],X=()=>["",Yr,f_,Mg],ie=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[Yr,SA,xI,gI],ue=()=>["","none",b,Un,Fn],he=()=>["none",Yr,Un,Fn],se=()=>["none",Yr,Un,Fn],Ce=()=>[Yr,Un,Fn],de=()=>[_m,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qh],breakpoint:[Qh],color:[jG],container:[Qh],"drop-shadow":[Qh],ease:["in","out","in-out"],font:[Wle],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qh],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qh],shadow:[Qh],spacing:["px",Yr],text:[Qh],"text-shadow":[Qh],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",_m,Fn,Un,S]}],container:["container"],columns:[{columns:[Yr,Fn,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:P()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Sm,"auto",Un,Fn]}],basis:[{basis:[_m,"full","auto",a,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Yr,_m,"auto","initial","none",Fn]}],grow:[{grow:["",Yr,Un,Fn]}],shrink:[{shrink:["",Yr,Un,Fn]}],order:[{order:[Sm,"first","last","none",Un,Fn]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...ne()]}],"min-block-size":[{"min-block":["auto",...ne()]}],"max-block-size":[{"max-block":["none",...ne()]}],w:[{w:[a,"screen",...J()]}],"min-w":[{"min-w":[a,"screen","none",...J()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",n,f_,Mg]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Jle,qle]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",SA,Fn]}],"font-family":[{font:[Kle,Xle,e]}],"font-features":[{"font-features":[Fn]}],"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,Fn]}],"line-clamp":[{"line-clamp":[Yr,"none",Un,mI]}],leading:[{leading:[s,...R()]}],"list-image":[{"list-image":["none",Un,Fn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Un,Fn]}],"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:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[Yr,"from-font","auto",Un,Mg]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Yr,"auto",Un,Fn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Un,Fn]}],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,Fn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sm,Un,Fn],radial:["",Un,Fn],conic:[Sm,Un,Fn]},Qle,Yle]}],"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:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-bs":[{"border-bs":X()}],"border-w-be":[{"border-be":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"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:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Yr,Un,Fn]}],"outline-w":[{outline:["",Yr,f_,Mg]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",f,w4,S4]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",p,w4,S4]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Yr,Mg]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",m,w4,S4]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Yr,Un,Fn]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"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":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"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":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"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":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"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":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"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":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"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":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"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":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Un,Fn]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"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":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"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:z()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Un,Fn]}],filter:[{filter:["","none",Un,Fn]}],blur:[{blur:ue()}],brightness:[{brightness:[Yr,Un,Fn]}],contrast:[{contrast:[Yr,Un,Fn]}],"drop-shadow":[{"drop-shadow":["","none",x,w4,S4]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Yr,Un,Fn]}],"hue-rotate":[{"hue-rotate":[Yr,Un,Fn]}],invert:[{invert:["",Yr,Un,Fn]}],saturate:[{saturate:[Yr,Un,Fn]}],sepia:[{sepia:["",Yr,Un,Fn]}],"backdrop-filter":[{"backdrop-filter":["","none",Un,Fn]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Yr,Un,Fn]}],"backdrop-contrast":[{"backdrop-contrast":[Yr,Un,Fn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Yr,Un,Fn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Yr,Un,Fn]}],"backdrop-invert":[{"backdrop-invert":["",Yr,Un,Fn]}],"backdrop-opacity":[{"backdrop-opacity":[Yr,Un,Fn]}],"backdrop-saturate":[{"backdrop-saturate":[Yr,Un,Fn]}],"backdrop-sepia":[{"backdrop-sepia":["",Yr,Un,Fn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Un,Fn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Yr,"initial",Un,Fn]}],ease:[{ease:["linear","initial",M,Un,Fn]}],delay:[{delay:[Yr,Un,Fn]}],animate:[{animate:["none",C,Un,Fn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Un,Fn]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[Un,Fn,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"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,Fn]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Un,Fn]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Yr,f_,Mg,mI]}],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"]}},nce=Ile(tce);function bt(...t){return nce(kG(t))}function WG({delayDuration:t=0,...e}){return d.jsx(cle,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Ix({...t}){return d.jsx(WG,{children:d.jsx(ule,{"data-slot":"tooltip",...t})})}function Ox({...t}){return d.jsx(dle,{"data-slot":"tooltip-trigger",...t})}function Lx({className:t,sideOffset:e=4,children:n,...r}){return d.jsx(fle,{children:d.jsx(hle,{"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 Z7={},rce=Symbol((Z7?"production":void 0)!=="production"?"RESET":""),$G=t=>typeof(t==null?void 0:t.then)=="function";function ice(t=()=>{try{return window.localStorage}catch(n){(Z7?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,i;const s={getItem:(l,c)=>{var f,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=(f=t())==null?void 0:f.getItem(l))!=null?p:null;return $G(x)?x.then(m):m(x)},setItem:(l,c)=>{var f;return(f=t())==null?void 0:f.setItem(l,JSON.stringify(c,void 0))},removeItem:l=>{var c;return(c=t())==null?void 0:c.removeItem(l)}},o=l=>(c,f,p)=>l(c,m=>{let x;try{x=JSON.parse(m||"")}catch{x=p}f(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 f=p=>{p.storageArea===t()&&p.key===l&&c(p.newValue)};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}}),a&&(s.subscribe=o(a)),s}const sce=ice();function Mo(t,e,n=sce,r){const i=Rr(e);return(Z7?"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===rce?(a(i,e),n.removeItem(t)):$G(c)?c.then(f=>(a(i,f),n.setItem(t,f))):(a(i,c),n.setItem(t,c))})}const as=Mo("dark-mode",!1),qG=Rr(!1),XG=Rr(!1),YG=Rr(!1),oce=()=>{try{const t=localStorage.getItem("selected-run-path");if(t!==null)return JSON.parse(t)}catch{}return null},vI=Rr(oce()),bl=Rr(t=>t(vI),(t,e,n)=>{e(vI,n);try{n===null?localStorage.removeItem("selected-run-path"):localStorage.setItem("selected-run-path",JSON.stringify(n))}catch{}}),jT=Mo("visible-runs",[]),KG=Rr(!1),ZG=Rr(!1);function vs(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 QG=Rr(!1),JG=Rr(!1),ace=Mo("overview-show-ema",!1),lce=Mo("overview-ema-span",10),cce=Mo("overview-show-all-runs",!1),uce=[{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"}],dce=Mo("overview-plots",uce),fce=Rr(!1),hce=Rr(10),pce=Rr("step"),mce=Rr(!1),gce=Rr(100),xce=Rr(3600),vce=Rr(0),yce=Rr("all"),bce=Rr(null),_ce=Rr(null),Q7=Rr({}),Sce=vs(0),wce=Rr(30),zT=vs(null),yI=vs(null),Mce=Rr(0),Tce=Rr(0),FT=Rr(!0),Cce=Rr(!0),eW=Rr(!1),Ece=Rr(!1),Ace=Rr(14),Nce=Rr(0),kce=Mo("inference-max-lanes",128),tW=vs(null),nW=vs(null),Rce=Mo("rollouts-selected-metrics",[]),Dce=Mo("rollouts-discarded-selected-metrics",[]),J7=Mo("rollouts-metrics-sidebar-open",!0),wA=Mo("rollouts-discarded-metrics-sidebar-open",!0),e8=Mo("rollouts-sample-picker-sidebar-open",!0),MA=Mo("rollouts-discarded-sample-picker-sidebar-open",!0),rW=vs(null),bI=vs(null),iW=vs(null),_I=vs(null),sW=vs(null),SI=vs(null),oW=Rr("groups"),Pce=Mo("rollouts-sample-picker-display-metrics",["gen_length_avg","reward"]),Ice=Mo("rollouts-sample-picker-tooltips",!0),Oce=Mo("rollouts-sample-view-metrics",[]),wI=Rr("groups"),MI=vs(null),Lce=vs(null),TI=vs(null),CI=vs(null),EI=vs(null),TA=Mo("evals-sample-picker-sidebar-open",!0),AI=Rr("groups"),CA=Mo("evals-metrics-sidebar-open",!0),jce=Mo("evals-selected-metrics",[]),zce=Rr("metrics"),Fce=vs(0),Uce=Rr(60),Bce=Rr(!0),Hce=Rr(!1),Vce=Rr(1),Gce=vs(0),Wce=vs("separated"),$ce=vs(!0),qce=vs(!0),Xce=vs(!0),Yce=vs(!0),Kce=vs("combined"),Zce=vs("combined"),Qce=vs(!0),Jce=Mo("sidebar-project-filter",null),UT=Rr(null),BT=Mo("rollouts-render-options",["markdown","latex","code"]),HT=Mo("rollouts-format-think",!0),aW=Rr(null);function eue(){const t=qn(as);return w.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]),null}function tue({children:t}){const[e]=w.useState(()=>new Zee({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1}}}));return d.jsxs(Nte,{children:[d.jsx(eue,{}),d.jsx(Qee,{client:e,children:d.jsx(WG,{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 nue=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rue=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),NI=t=>{const e=rue(t);return e.charAt(0).toUpperCase()+e.slice(1)},lW=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),iue=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 sue={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 oue=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,...sue,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:lW("lucide",i),...!s&&!iue(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,f])=>w.createElement(c,f)),...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(oue,{ref:s,iconNode:e,className:lW(`lucide-${nue(NI(t))}`,`lucide-${t}`,r),...i}));return n.displayName=NI(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 aue=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],lue=ri("arrow-down",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:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],s2=ri("arrow-left",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:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],due=ri("arrow-right",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 fue=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],hue=ri("arrow-up",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 pue=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],D0=ri("check",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 mue=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],kr=ri("chevron-down",mue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gue=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],VT=ri("chevron-left",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 xue=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],r0=ri("chevron-right",xue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vue=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],t8=ri("chevron-up",vue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yue=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],bue=ri("chevrons-left",yue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _ue=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Sue=ri("chevrons-right",_ue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wue=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Mue=ri("circle-check",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=[["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"}]],Cue=ri("circle-x",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=[["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"}]],GT=ri("copy",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 Aue=[["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"}]],Nue=ri("database",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 kue=[["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"}]],Rue=ri("file-code-corner",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 Due=[["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"}]],Pue=ri("folder-open",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 Iue=[["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"}]],Oue=ri("folder",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 Lue=[["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"}]],WT=ri("grip-vertical",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:"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"}]],zue=ri("layers",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 Fue=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Sl=ri("loader-circle",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 Uue=[["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"}]],$T=ri("maximize-2",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 Bue=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Ek=ri("menu",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 Hue=[["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"}]],qT=ri("minimize-2",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 Vue=[["path",{d:"M5 12h14",key:"1ays0h"}]],Gue=ri("minus",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 Wue=[["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"}]],$ue=ri("moon",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 que=[["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"}]],Xue=ri("panel-left-close",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 Yue=[["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"}]],Kue=ri("panel-right-close",Yue);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zue=[["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"}]],cW=ri("pencil",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=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],pp=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 Jue=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ede=ri("search",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 tde=[["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"}]],uW=ri("settings",tde);/**
 * @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:"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"}]],cf=ri("sliders-horizontal",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 rde=[["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"}]],ide=ri("sun",rde);/**
 * @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 sde=[["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"}]],ode=ri("trash-2",sde);/**
 * @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 ade=[["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"}]],lde=ri("triangle-alert",ade);/**
 * @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 cde=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Na=ri("x",cde);function su({...t}){return d.jsx(UB,{"data-slot":"dialog",...t})}function XT({...t}){return d.jsx(BB,{"data-slot":"dialog-trigger",...t})}function ude({...t}){return d.jsx(HB,{"data-slot":"dialog-portal",...t})}function dde({className:t,...e}){return d.jsx(VB,{"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 ou({className:t,children:e,...n}){return d.jsxs(ude,{children:[d.jsx(dde,{}),d.jsxs(GB,{"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,d.jsxs(w7,{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:[d.jsx(Na,{}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Dc({className:t,...e}){return d.jsx("div",{"data-slot":"dialog-header",className:bt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function AS({className:t,...e}){return d.jsx("div",{"data-slot":"dialog-footer",className:bt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Pc({className:t,...e}){return d.jsx(WB,{"data-slot":"dialog-title",className:bt("text-lg leading-none font-semibold",t),...e})}function Um({className:t,...e}){return d.jsx($B,{"data-slot":"dialog-description",className:bt("text-muted-foreground text-sm",t),...e})}function Gs({...t}){return d.jsx(xoe,{"data-slot":"dropdown-menu",...t})}function Ws({...t}){return d.jsx(voe,{"data-slot":"dropdown-menu-trigger",...t})}function $s({className:t,align:e="start",sideOffset:n=4,...r}){return d.jsx(yoe,{children:d.jsx(boe,{"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 Yo({className:t,inset:e,variant:n="default",...r}){return d.jsx(Soe,{"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 ur({className:t,children:e,checked:n,...r}){return d.jsxs(woe,{"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:[d.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:d.jsx(Moe,{children:d.jsx(D0,{})})}),e]})}function l0({className:t,inset:e,...n}){return d.jsx(_oe,{"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 Ds({className:t,...e}){return d.jsx(Toe,{"data-slot":"dropdown-menu-separator",className:bt("bg-border -mx-1 my-1 h-px",t),...e})}function fde({...t}){return d.jsx(Coe,{"data-slot":"dropdown-menu-sub",...t})}function hde({className:t,inset:e,children:n,...r}){return d.jsxs(Eoe,{"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,d.jsx(r0,{className:"ml-auto"})]})}function pde({className:t,...e}){return d.jsx(Aoe,{"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 kI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,RI=kG,n8=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return RI(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 f=n==null?void 0:n[c],p=s==null?void 0:s[c];if(f===null)return null;const m=kI(f)||kI(p);return i[c][m]}),a=n&&Object.entries(n).reduce((c,f)=>{let[p,m]=f;return m===void 0||(c[p]=m),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:p,className:m,...x}=f;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 RI(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},mde=n8("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 wn({className:t,variant:e="default",size:n="default",asChild:r=!1,...i}){const s=r?nB:"button";return d.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:bt(mde({variant:e,size:n,className:t})),...i})}function Jd({className:t,type:e,...n}){return d.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 gde({className:t,...e}){return d.jsx(koe,{"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 d.jsx(Sl,{role:"status","aria-label":"Loading",className:bt("size-4 animate-spin",t),...e})}function jx({className:t,children:e,...n}){return d.jsxs(nae,{"data-slot":"scroll-area",className:bt("relative",t),...n,children:[d.jsx(rae,{"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}),d.jsx(xde,{}),d.jsx(iae,{})]})}function xde({className:t,orientation:e="vertical",...n}){return d.jsx(PV,{"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:d.jsx(jV,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function YT({...t}){return d.jsx(Boe,{"data-slot":"popover",...t})}function KT({...t}){return d.jsx(Hoe,{"data-slot":"popover-trigger",...t})}function ZT({className:t,align:e="center",sideOffset:n=4,...r}){return d.jsx(Voe,{children:d.jsx(Goe,{"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 L2({...t}){return d.jsx(Sre,{"data-slot":"alert-dialog",...t})}function vde({...t}){return d.jsx(wre,{"data-slot":"alert-dialog-portal",...t})}function yde({className:t,...e}){return d.jsx(Mre,{"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 j2({className:t,size:e="default",...n}){return d.jsxs(vde,{children:[d.jsx(yde,{}),d.jsx(Tre,{"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 z2({className:t,...e}){return d.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 F2({className:t,...e}){return d.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 bde({className:t,...e}){return d.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 U2({className:t,...e}){return d.jsx(Are,{"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 B2({className:t,...e}){return d.jsx(Nre,{"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 H2({className:t,variant:e="default",size:n="default",...r}){return d.jsx(wn,{variant:e,size:n,asChild:!0,children:d.jsx(Cre,{"data-slot":"alert-dialog-action",className:bt(t),...r})})}function V2({className:t,variant:e="outline",size:n="default",...r}){return d.jsx(wn,{variant:e,size:n,asChild:!0,children:d.jsx(Ere,{"data-slot":"alert-dialog-cancel",className:bt(t),...r})})}const Xn="",fo=5e3,EA={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"},z_={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"},Y_="#0284c7",AA="#10b981",QT="#ababab",JT="#555555",eC="#c9c9c9",NS="#4a4a4a",DI={request:Y_,weight_broadcast:"#f97316"},kS="#e6e9ed",r8="#2a2d32",tC="#6b7280";function i8(t){if(EA[t])return EA[t];for(const[e,n]of Object.entries(EA))if(t.startsWith(e))return n;return tC}function G2(t){if(z_[t])return z_[t];if(t.includes("/")){const e=t.split("/")[0];if(z_[e])return z_[e]}return tC}function dW(t){return DI[t]?DI[t]:tC}function s8(t){return t.replace(/_step_\d+$/,"").replace(/_/g," ")}function fW(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 P0(){return Si({queryKey:["runs"],queryFn:async()=>{const t=await fetch(`${Xn}/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:fo}})}function _de(t=!0){return Si({queryKey:["removed-runs"],queryFn:async()=>{const e=await fetch(`${Xn}/removed-runs`);if(!e.ok)throw new Error("Failed to fetch removed runs");return e.json()},enabled:t})}function Sde(t=!0){return Si({queryKey:["known-projects"],queryFn:async()=>{const e=await fetch(`${Xn}/known-projects`);if(!e.ok)throw new Error("Failed to fetch known projects");return e.json()},enabled:t})}function wde(t,e,n,r){return Si({queryKey:["rollouts",t,e],queryFn:async()=>{const i=await fetch(`${Xn}/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:fo})}function Mde(t,e,n,r){return Si({queryKey:["rollouts-discarded",t,e],queryFn:async()=>{const i=await fetch(`${Xn}/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:fo})}function Tde(t,e,n,r,i){return Si({queryKey:["evals",t,e,n],queryFn:async()=>{const s=await fetch(`${Xn}/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:fo})}function hW(t,e,n,r,i){return Si({queryKey:["sample-details",t,e,n,i??!1],queryFn:async()=>{const s=await fetch(`${Xn}/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 o8(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 Si({queryKey:["sample-statuses",t,i],queryFn:async()=>{const s=await fetch(`${Xn}/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 _h(t,e,n){return Si({queryKey:["run-summary",t],queryFn:async()=>{const r=await fetch(`${Xn}/run-summary/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch run summary");return r.json()},enabled:e&&!!t,refetchInterval:n?fo:!1})}function a8(t,e){const n=XU({queries:t.map(r=>({queryKey:["run-summary",r],queryFn:async()=>{const i=await fetch(`${Xn}/run-summary/${encodeURIComponent(r)}`);if(!i.ok)throw new Error("Failed to fetch run summary");return i.json()},enabled:!!r,refetchInterval:fo}))});return w.useMemo(()=>{var x,b,_;const r=n.map(S=>S.data).filter(S=>S!=null),i={};for(const S of r){const M=((x=S.step_metrics_info)==null?void 0:x.custom_metric_sections)??{};for(const[C,A]of Object.entries(M)){i[C]||(i[C]={});for(const[N,P]of Object.entries(A)){i[C][N]||(i[C][N]=[]);const k=new Set(i[C][N]);for(const O of P)k.has(O)||i[C][N].push(O)}}}const s=new Set;for(const S of r)for(const M of S.available_rollout_metric_names??[])s.add(M);const o=new Map;for(const S of r)for(const M of((b=S.eval_info)==null?void 0:b.evals)??[]){o.has(M.eval_name)||o.set(M.eval_name,new Set);const C=o.get(M.eval_name);for(const A of M.available_rollout_metric_names)C.add(A)}const a=Array.from(o.entries()).map(([S,M])=>({eval_name:S,available_rollout_metric_names:Array.from(M)})),l={};for(const S of r)for(const[M,C]of Object.entries(S.available_sample_tags??{})){l[M]||(l[M]=[]);const A=new Set(l[M]);for(const N of C)A.has(N)||l[M].push(N)}const c=new Set;for(const S of r)for(const M of S.available_envs??[])c.add(M);const f=Math.max(0,...r.map(S=>{var M;return((M=S.step_metrics_info)==null?void 0:M.local_steps)??0})),p=n.some(S=>S.isLoading),m=((_=n.find(S=>S.error))==null?void 0:_.error)??null;return{customMetricSections:i,availableRewardNames:Array.from(s),evalsList:a,availableSampleTags:l,availableEnvs:Array.from(c),totalSteps:f,isLoading:p,error:m}},[n])}function Cde(t,e,n,r){return Si({queryKey:["logs",t,e,n],queryFn:async()=>{const i=await fetch(`${Xn}/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:fo,placeholderData:Ql})}function Ede(t,e){return Si({queryKey:["logs-summary",t],queryFn:async()=>{const n=await fetch(`${Xn}/api/logs/summary/${encodeURIComponent(t)}`);if(!n.ok)throw new Error("Failed to fetch logs summary");return n.json()},enabled:!!t,staleTime:1e4})}function PI(t,e){return Si({queryKey:["run-code-tree",t],queryFn:async()=>{const n=await fetch(`${Xn}/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 II(t,e,n){return Si({queryKey:["run-code-file",t,e],queryFn:async()=>{const r=await fetch(`${Xn}/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:Ql})}function Ade(t,e,n){return Si({queryKey:["run-code-diff-summary",t,e],queryFn:async()=>{const r=await fetch(`${Xn}/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:Ql})}function Nde(t,e,n,r,i){return Si({queryKey:["timeline-paginated",t,e,n],queryFn:async()=>{const s=await fetch(`${Xn}/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:fo,placeholderData:Ql,gcTime:0})}function kde(t,e,n){return Si({queryKey:["inflight-generations",t],queryFn:async()=>{const r=await fetch(`${Xn}/events/inflight/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch inflight generations");return r.json()},enabled:e&&!!t,refetchInterval:fo,placeholderData:Ql})}function Rde(t,e,n){return Si({queryKey:["inference-events-by-group",t,e],queryFn:async()=>{const r=await fetch(`${Xn}/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 Dde(t,e,n,r,i){return Si({queryKey:["trainer-breakdown-events",t,e,n,r],queryFn:async()=>{const s=await fetch(`${Xn}/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 Zu(t,e,n,r=60){return Si({queryKey:["inference-performance",t,r],queryFn:async()=>{const i=await fetch(`${Xn}/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?fo:!1,placeholderData:Ql})}function Qu(t,e,n,r=60){return Si({queryKey:["trainer-performance",t,r],queryFn:async()=>{const i=await fetch(`${Xn}/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?fo:!1,placeholderData:Ql})}function Pde(t,e,n,r,i,s,o){const a=n.filter(l=>Number.isFinite(l.rank));return XU({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(`${Xn}/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:fo,placeholderData:Ql}))})}function Ide(t,e,n,r,i,s){return Si({queryKey:["gpu-metrics-paginated",t,e,n,r],queryFn:async()=>{const o=await fetch(`${Xn}/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:fo,placeholderData:Ql})}function Ode(t,e,n,r,i,s,o,a){return Si({queryKey:["cpu-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Xn}/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:fo,placeholderData:Ql})}function Lde(t,e,n,r,i,s,o,a){return Si({queryKey:["vllm-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Xn}/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:fo,placeholderData:Ql})}function jde(t,e,n,r,i,s){const o=M0(),a=w.useRef([]),l=t.join("\0"),c=a.current.join("\0");if(l!==c){const f=a.current;if(f.length>0&&t.length<f.length){const p=new Set(f);if(t.every(x=>p.has(x))){const x=["step-metrics-multi",f,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 Si({queryKey:["step-metrics-multi",t,e,i,s],queryFn:async()=>{const f={run_paths:t,metric_names:e,limit:1e5};i&&Object.keys(i).length>0&&(f.tag_filters=i),s&&s.length>0&&(f.env_filters=s);const p=await fetch(`${Xn}/step-metrics/multi`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!p.ok)throw new Error("Failed to fetch step metrics (multi-run)");return p.json()},enabled:n&&t.length>0,refetchInterval:r?fo:!1,staleTime:fo})}function Vr(t,e,n){return Si({queryKey:["step-times",t],queryFn:async()=>{const r=await fetch(`${Xn}/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?fo:!1})}function pW(t,e,n,r){return Si({queryKey:["step-metric-single",t,e],queryFn:async()=>{const i=await fetch(`${Xn}/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?fo:!1,placeholderData:Ql})}function zde(t,e,n,r,i,s){return Si({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(`${Xn}/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?fo:!1,placeholderData:Ql})}function Fde(t,e,n,r,i,s){const o=M0(),a=w.useRef([]),l=t.join("\0"),c=a.current.join("\0");if(l!==c){const f=a.current;if(f.length>0&&t.length<f.length){const p=new Set(f);if(t.every(x=>p.has(x))){const x=["eval-step-metrics-multi",f,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 Si({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(`${Xn}/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?fo:!1,staleTime:fo})}function Ude(t,e,n,r){return Si({queryKey:["step-histogram",t,e,n],queryFn:async()=>{const i=await fetch(`${Xn}/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:Ql})}function mW(t,e,n,r){return Si({queryKey:["step-distribution-over-time",t,e],queryFn:async()=>{const i=await fetch(`${Xn}/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?fo:!1,staleTime:3e4,placeholderData:Ql})}function gW(){return Si({queryKey:["custom-metrics-layout"],queryFn:async()=>{const t=await fetch(`${Xn}/custom-metrics-layout`);if(!t.ok)throw new Error("Failed to fetch custom metrics layout");return t.json()},staleTime:6e4})}function Bde(){return Si({queryKey:["custom-metrics-templates"],queryFn:async()=>{const t=await fetch(`${Xn}/custom-metrics-templates`);if(!t.ok)throw new Error("Failed to fetch custom metrics templates");return t.json()},staleTime:6e4})}function Hde(t){return Si({queryKey:["custom-metrics-template",t],queryFn:async()=>{const e=await fetch(`${Xn}/custom-metrics-templates/${t}`);if(!e.ok)throw new Error("Failed to fetch template");return e.json()},enabled:!!t,staleTime:6e4})}function c0(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 mp(t){return`${t.toFixed(0)}s`}function vu(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 xW(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 nC(t){if(t<60)return`${xW(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=`${xW(t)}s`;return t<60?e:`${nC(t)} <span class="text-muted-foreground font-normal">(${e})</span>`}function yu(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 Vs(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 oy(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 A1=16,Vde=6,OI=4,Gde=2;function vW(t,e=A1){const n=Math.max(Vde,e);if(!t||t.length<=n)return{prefix:t,suffix:"",isTruncated:!1};const r=Math.max(Gde,n-OI);return{prefix:t.slice(0,r),suffix:t.slice(-OI),isTruncated:!0}}function Di({...t}){return d.jsx(Zte,{"data-slot":"collapsible",...t})}function Pi({...t}){return d.jsx(Qte,{"data-slot":"collapsible-trigger",...t})}function Ii({...t}){return d.jsx(Jte,{"data-slot":"collapsible-content",...t})}function Wde(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 $de(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 qde(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"?Wde(t,2):String(t)}function Xde(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 LI(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 Yde(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 f=$de(c),p=l==="environments"?Xde(f):f;let m=!1;for(const x of e)if(x.match(l)){n.get(x.key).items.push({key:l,displayKey:LI(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:LI(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 f=new Map(c.order.map((p,m)=>[p,m]));l.items.sort((p,m)=>{const x=f.get(p.key)??1/0,b=f.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 Kde({displayKey:t,value:e}){const n=qde(e);return typeof e=="object"&&e!==null?d.jsxs("div",{className:"py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:t}),d.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})]}):d.jsxs("div",{className:"flex items-baseline gap-2 py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors whitespace-nowrap",children:t}),d.jsx("span",{className:"text-sm font-sans font-medium break-all",children:n})]})}const Zde="ml-[22px]",Qde="ml-[38px]";function yW({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,f]=w.useState(i);r!==a&&(l(r),o(!1)),i!==c&&(f(i),o(!0));const p=t.subcategories&&t.subcategories.length>0;return d.jsxs(Di,{open:s,onOpenChange:o,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:bt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",n&&"ml-4"),children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!s&&"-rotate-90")}),d.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),d.jsx(Ii,{children:p?d.jsx("div",{className:"mt-1",children:t.subcategories.map(m=>d.jsx(yW,{category:m,nested:!0,collapseAllSignal:r,expandAllSignal:i},m.key))}):d.jsx("div",{className:bt("mt-1",n?Qde:Zde),children:t.items.map(m=>d.jsx(Kde,{displayKey:m.displayKey,value:m.value},m.key))})})]})}function bW({config:t,collapseAllSignal:e=0,expandAllSignal:n=0}){const r=w.useMemo(()=>Yde(t),[t]),i=new Set(["model","environments"]);return r.length===0?d.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"}):d.jsx("div",{className:"space-y-1",children:r.map(s=>d.jsx(yW,{category:s,defaultOpen:i.has(s.key),collapseAllSignal:e,expandAllSignal:n},s.key))})}const _W="#e67439",Jde="linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",efe=["#865ed6","#f07fdd","#e67439","#87cec0","#dc4cdc","#ffb83e","#5ac5db","#239487","#fab796","#9bc750","#ad6f51","#c2337a","#a2a9ad","#538ae6","#f1444f","#479a60"];function N1(t){return Math.max(0,Math.min(1,t))}function fx(t){return Math.max(0,Math.min(255,Math.round(t)))}function W2({r:t,g:e,b:n}){const r=i=>i.toString(16).padStart(2,"0");return`#${r(fx(t))}${r(fx(e))}${r(fx(n))}`}function l8(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 tfe({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 nfe({h:t,s:e,v:n}){const r=(t%360+360)%360,i=N1(e),s=N1(n),o=s*i,a=o*(1-Math.abs(r/60%2-1)),l=s-o;let c=0,f=0,p=0;return r<60?(c=o,f=a):r<120?(c=a,f=o):r<180?(f=o,p=a):r<240?(f=a,p=o):r<300?(c=a,p=o):(c=o,p=a),{r:fx((c+l)*255),g:fx((f+l)*255),b:fx((p+l)*255)}}function rfe(t,e){const n=l8(t);if(!n)return"#000000";const r=N1(1-e);return W2({r:n.r*r,g:n.g*r,b:n.b*r})}function K_(t,e=_W){const n=l8(t);return n?W2(n):e}function ife({value:t,onChange:e,className:n}){const r=w.useMemo(()=>K_(t,_W),[t]),i=w.useMemo(()=>l8(r),[r]),s=w.useMemo(()=>tfe(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=W2(nfe(x));e(b)},[e]),c=w.useCallback(x=>{const b=x.currentTarget.getBoundingClientRect(),_=N1((x.clientX-b.left)/b.width),S=N1((x.clientY-b.top)/b.height);l({h:s.h,s:_,v:1-S})},[s.h,l]),f=w.useCallback(x=>{const b=x.currentTarget.getBoundingClientRect(),_=N1((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,"")}`,_=K_(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]:fx(_)};e(W2(S))},[e,i]);return d.jsxs("div",{className:bt("w-[196px] space-y-1.5 text-[10px]",n),children:[d.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:[d.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white to-transparent"}),d.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black to-transparent"}),d.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}%`}})]}),d.jsx("div",{className:"relative h-2 w-full cursor-ew-resize rounded-md border border-border touch-none select-none",style:{background:Jde},onPointerDown:x=>{x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),f(x)},onPointerMove:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&f(x)},onPointerUp:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&x.currentTarget.releasePointerCapture(x.pointerId)},children:d.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)`}})}),d.jsxs("div",{className:"grid grid-cols-[1fr_48px] items-end gap-1",children:[d.jsxs("div",{className:"space-y-0.5",children:[d.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:"Hex"}),d.jsx(Jd,{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"})]}),d.jsx("div",{className:"h-6 rounded-md border border-border",style:{backgroundColor:r},"aria-label":"Selected color preview"})]}),d.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,_])=>d.jsxs("div",{className:"space-y-0.5",children:[d.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:x}),d.jsx(Jd,{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))}),d.jsx("div",{className:"grid grid-cols-8 gap-x-0.5 gap-y-1.5 pt-0.5",children:efe.map(x=>d.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:rfe(x,.2)},onClick:()=>e(x),"aria-label":`Use color ${x}`},x))})]})}function ay({...t}){return d.jsx(Aae,{"data-slot":"select",...t})}function ly({...t}){return d.jsx(kae,{"data-slot":"select-value",...t})}function cy({className:t,size:e="default",children:n,...r}){return d.jsxs(Nae,{"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,d.jsx(Rae,{asChild:!0,children:d.jsx(kr,{className:"text-muted-foreground size-4 pointer-events-none"})})]})}function uy({className:t,children:e,position:n="item-aligned",align:r="center",...i}){return d.jsx(Dae,{children:d.jsxs(Pae,{"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:[d.jsx(sfe,{}),d.jsx(Iae,{"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}),d.jsx(ofe,{})]})})}function Mx({className:t,children:e,...n}){return d.jsxs(Oae,{"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:[d.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:d.jsx(jae,{children:d.jsx(D0,{className:"pointer-events-none"})})}),d.jsx(Lae,{children:e})]})}function sfe({className:t,...e}){return d.jsx(zae,{"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:d.jsx(t8,{})})}function ofe({className:t,...e}){return d.jsx(Fae,{"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:d.jsx(kr,{})})}const SW=[{key:"pausing_syncs",label:"Pausing syncs"},{key:"exporting",label:"Exporting database"},{key:"importing",label:"Compressing data"},{key:"finalizing",label:"Finalizing"}],afe=SW.map(t=>t.key);function lfe(t){return afe.indexOf(t)}function NA(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 cfe({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",f=w.useCallback(async()=>{s(!0);try{const M=await fetch(`${Xn}/database-info`);if(M.ok){const C=await M.json();r(C.size_bytes)}}catch{}finally{s(!1)}},[]);w.useEffect(()=>(t&&(f(),a(null)),()=>{l.current&&clearInterval(l.current),l.current=null}),[t,f]);const p=async()=>{try{const M=await fetch(`${Xn}/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(`${Xn}/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?lfe(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 d.jsx(su,{open:t,onOpenChange:m,children:d.jsxs(ou,{className:bt("sm:max-w-md",c&&"[&>[data-slot=dialog-close]]:hidden"),onInteractOutside:M=>{c&&M.preventDefault()},onEscapeKeyDown:M=>{c&&M.preventDefault()},children:[d.jsxs(Dc,{children:[d.jsxs(Pc,{className:"flex items-center gap-2",children:[d.jsx(Nue,{className:"h-4 w-4"}),"Database"]}),!S&&d.jsx(Um,{children:"Manage your local database storage."})]}),!S&&d.jsxs("div",{className:"space-y-4 py-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm text-muted-foreground",children:"Database size"}),d.jsx("span",{className:"text-sm font-medium",children:i?d.jsx(gl,{className:"h-3.5 w-3.5"}):n!=null?NA(n):"—"})]}),d.jsx("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:d.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&&d.jsxs("div",{className:"space-y-3 py-2",children:[SW.map((M,C)=>{const A=M.key===o.status,N=b||x>C||_&&x>C,P=_&&M.key===o.status;return d.jsxs("div",{className:"flex items-center gap-2.5",children:[N?d.jsx(Mue,{className:"h-4 w-4 text-green-500 shrink-0"}):P?d.jsx(Cue,{className:"h-4 w-4 text-destructive shrink-0"}):A?d.jsx(gl,{className:"h-4 w-4 text-primary shrink-0"}):d.jsx("div",{className:"h-4 w-4 rounded-full border border-border shrink-0"}),d.jsxs("span",{className:bt("text-sm",N&&"text-muted-foreground",A&&!_&&"text-foreground font-medium",P&&"text-destructive font-medium",!N&&!A&&!P&&"text-muted-foreground/60"),children:[M.label,A&&!b&&!_&&"…"]})]},M.key)}),c&&d.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&&d.jsx("div",{className:"rounded-md border border-green-500/20 bg-green-500/5 p-3 mt-2",children:d.jsxs("p",{className:"text-sm text-foreground",children:[d.jsx("span",{className:"font-medium",children:NA(o.size_before)})," → ",d.jsx("span",{className:"font-medium text-green-600 dark:text-green-400",children:NA(o.size_after)}),d.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",Math.round((1-o.size_after/o.size_before)*100),"% reduction)"]})]})}),_&&o.error&&d.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/5 p-3 mt-2",children:[d.jsx("p",{className:"text-sm text-destructive",children:o.error}),d.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The original database has been restored."})]})]}),d.jsxs(AS,{children:[!S&&d.jsx(wn,{onClick:p,disabled:i||n==null,children:"Compress Database"}),(b||_)&&d.jsx(wn,{onClick:()=>e(!1),children:"Close"})]})]})})}function M4({name:t,className:e,maxChars:n=A1}){const r=e??"text-xs font-sans",{isTruncated:i,prefix:s,suffix:o}=vW(t,n);return i?d.jsxs(Ix,{delayDuration:300,children:[d.jsx(Ox,{asChild:!0,children:d.jsxs("span",{className:bt("flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",r),children:[d.jsx("span",{className:"shrink-0",children:s}),d.jsxs("span",{className:"relative shrink-0 inline-flex items-center px-0.5 text-muted-foreground/50",style:{backgroundColor:"var(--run-item-bg)"},children:[d.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"}),"..."]}),d.jsx("span",{className:"shrink-0",children:o})]})}),d.jsx(Lx,{side:"top",className:"max-w-56 break-all text-xs font-sans",children:t})]}):d.jsx("span",{className:bt("truncate",r),children:s})}function ufe(){const{pathname:t}=vh(),e=M0(),[n,r]=fn(bl),[i,s]=fn(jT),[o,a]=fn(qG),[l,c]=fn(XG),[f,p]=fn(as),m=sd(UT),x=sd(QG),b=sd(JG),[_,S]=w.useState(!1),[M,C]=fn(YG),[A,N]=fn(Jce),[P,k]=w.useState(""),[O,R]=w.useState(!1),[L,B]=w.useState(null),[V,W]=w.useState(null),[G,ee]=w.useState(!1),[H,q]=w.useState(""),[J,K]=w.useState(!1),[ne,U]=w.useState(!1),[z,Y]=w.useState(null),[j,le]=w.useState(null),[ce,X]=w.useState("removed_at"),[ie,fe]=w.useState("desc"),[Q,ue]=w.useState(null),[he,se]=w.useState(null),[Ce,de]=w.useState(null),[Me,Te]=w.useState(null),[Pe,oe]=w.useState(!1),[Ve,He]=w.useState(""),[ze,Ge]=w.useState(null),[ae,Z]=w.useState(!1),[ge,we]=w.useState(null),[_e,ve]=w.useState({}),[Ue,Se]=w.useState(null),[ke,qe]=w.useState(""),[Je,nt]=w.useState(!1),tt=sd(ZG),be=sd(KG),{data:Le,isLoading:Ze}=P0(),{data:Ee,isLoading:Ye}=_de(_),{data:it,refetch:mt}=Sde(M),ft=w.useRef(new Map);w.useEffect(()=>{if(!(Le!=null&&Le.runs))return;const Oe=ft.current,gt=[];for(const _t of Le.runs){const Vt=Oe.get(_t.run_id);Vt!=null&&Vt.is_syncing&&!_t.is_syncing&&gt.push(_t.run_id),Vt!=null&&Vt.is_tracking&&!_t.is_tracking&&gt.push(_t.run_id),Oe.set(_t.run_id,{is_syncing:_t.is_syncing,is_tracking:_t.is_tracking})}if(gt.length>0){const _t=[...new Set(gt)];for(const Vt of _t)e.invalidateQueries({predicate:vn=>{const ye=vn.queryKey;return Array.isArray(ye)?ye.some(et=>!!(et===Vt||Array.isArray(et)&&et.includes(Vt))):!1}});e.invalidateQueries({queryKey:["runs"]})}},[Le==null?void 0:Le.runs,e]),w.useEffect(()=>{if(!(Le!=null&&Le.runs)||!n)return;const Oe=Le.runs.find(gt=>gt.run_id===n);Oe&&(tt(Oe.is_syncing),be(Oe.is_tracking))},[Le==null?void 0:Le.runs,n,tt,be]),w.useEffect(()=>{t!=="/"&&(x(!1),b(!1))},[t,x,b]),w.useEffect(()=>{if(!(Le!=null&&Le.runs))return;const Oe=new Set(Le.runs.map(gt=>gt.run_id));s(gt=>{const _t=gt.filter(Vt=>Oe.has(Vt));return _t.length===gt.length?gt:_t}),n&&!Oe.has(n)&&(r(null),tt(!1),be(!1))},[Le==null?void 0:Le.runs,n,r,s,tt,be]);const Qe=w.useMemo(()=>{const Oe=(Ee==null?void 0:Ee.runs)??[];return Oe.length===0?Oe:[...Oe].sort((gt,_t)=>{const Vt=ce;let vn,ye;if(Vt==="run_id"?(vn=gt.run_id.split("/").pop()??gt.run_id,ye=_t.run_id.split("/").pop()??_t.run_id):(vn=gt[Vt],ye=_t[Vt]),vn==null&&ye==null)return 0;if(vn==null)return 1;if(ye==null)return-1;const et=vn.localeCompare(ye);return ie==="asc"?et:-et})},[Ee==null?void 0:Ee.runs,ce,ie]),Ae=Oe=>{ce===Oe?fe(gt=>gt==="asc"?"desc":"asc"):(X(Oe),fe("asc"))},Xe=async Oe=>{Oe.preventDefault();const gt=J?{use_netrc:!0}:{api_key:H.trim(),use_netrc:!1};if(!(!J&&!H.trim())){U(!0);try{const _t=await fetch(`${Xn}/wandb-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(gt)});if(!_t.ok){const Vt=await _t.json();throw new Error(Vt.detail||"Failed to configure W&B")}a(!0),e.invalidateQueries({queryKey:["runs"]}),c(!1),q("")}catch(_t){console.error("Failed to configure W&B:",_t)}finally{U(!1)}}},Re=Oe=>{S(!1),r(Oe),fetch(`${Xn}/add-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Oe})}).then(gt=>{if(!gt.ok)return gt.json().then(_t=>{throw new Error(_t.detail||"Failed to add run")})}).then(()=>{e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}).catch(gt=>{console.error("Failed to add run:",gt)})},Be=async()=>{const Oe=P.trim();if(Oe){R(!0),B(null);try{const gt=await fetch(`${Xn}/add-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Oe})});if(!gt.ok){const _t=await gt.json();B(_t.detail||"Failed to add project");return}k(""),C(!1),mt(),e.invalidateQueries({queryKey:["runs"]})}catch{B("Failed to add project")}finally{R(!1)}}},ot=async Oe=>{W(Oe);try{const gt=await fetch(`${Xn}/remove-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Oe})});if(!gt.ok){const _t=await gt.json();throw new Error(_t.detail||"Failed to remove project")}mt()}catch(gt){console.error("Failed to remove project:",gt)}finally{W(null)}},dt=async Oe=>{if(Oe){Y(Oe);try{const gt=await fetch(`${Xn}/remove-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Oe})});if(!gt.ok){const _t=await gt.json();throw new Error(_t.detail||"Failed to remove run")}s(_t=>_t.filter(Vt=>Vt!==Oe)),n===Oe&&r(null),e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}catch(gt){console.error("Failed to remove run:",gt)}finally{Y(null),le(null)}}},Nt=Oe=>{s(gt=>gt.includes(Oe)?gt.filter(_t=>_t!==Oe):[...gt,Oe])},Dt=w.useCallback((Oe,gt)=>{e.setQueryData(["runs"],_t=>_t&&{..._t,runs:_t.runs.map(Vt=>Vt.run_id===Oe?{...Vt,color:gt}:Vt)})},[e]),St=w.useCallback(async(Oe,gt,_t)=>{const Vt=K_(gt,_t);if(Vt.toLowerCase()!==_t.toLowerCase()){Dt(Oe,Vt);try{const vn=await fetch(`${Xn}/set-run-color`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Oe,color:Vt})});if(!vn.ok){let ye="Failed to update run color";try{ye=(await vn.json()).detail??ye}catch{}throw new Error(ye)}}catch(vn){console.error("Failed to update run color:",vn),Dt(Oe,_t)}finally{e.invalidateQueries({queryKey:["runs"]})}}},[e,Dt]),Ht=w.useCallback((Oe,gt,_t)=>{if(gt){we(Oe),ve(vn=>vn[Oe]===_t?vn:{...vn,[Oe]:_t});return}we(vn=>vn===Oe?null:vn);const Vt=_e[Oe];Vt&&St(Oe,Vt,_t),ve(vn=>{if(!(Oe in vn))return vn;const ye={...vn};return delete ye[Oe],ye})},[St,_e]),rn=w.useCallback(async Oe=>{de(Oe);try{const gt=Le==null?void 0:Le.runs.find(Vt=>Vt.run_id===Oe);gt!=null&&gt.is_tracking&&await fetch(`${Xn}/stop-tracking`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Oe})});const _t=await fetch(`${Xn}/delete-run-data`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Oe})});if(!_t.ok){const Vt=await _t.json();throw new Error(Vt.detail||"Failed to delete run data")}await fetch(`${Xn}/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Oe})}),e.invalidateQueries({queryKey:["run-summary",Oe]}),e.invalidateQueries({queryKey:["runs"]})}catch(gt){console.error("Failed to force full resync:",gt)}finally{de(null),se(null)}},[Le==null?void 0:Le.runs,e]),Ut=w.useCallback(async Oe=>{Te(Oe);try{const gt=await fetch(`${Xn}/sync-evals-after-training`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Oe})});if(!gt.ok){const _t=await gt.json();throw new Error(_t.detail||"Failed to start evals sync")}e.invalidateQueries({queryKey:["run-summary",Oe]}),e.invalidateQueries({queryKey:["runs"]})}catch(gt){console.error("Failed to sync evals after training:",gt)}finally{Te(null)}},[e]),Ft=Ve.trimStart().toLowerCase().startsWith("config:"),Bt=w.useCallback(async()=>{const gt=Ve.trimStart().slice(7).trim();if(gt){Z(!0);try{const _t=await fetch(`${Xn}/search-runs-by-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:gt})});if(!_t.ok){Ge([]);return}const Vt=await _t.json();Ge(Vt.run_ids??[])}catch{Ge([])}finally{Z(!1)}}},[Ve]);w.useEffect(()=>{Ft||Ge(null)},[Ft]);const Kt=(Le==null?void 0:Le.runs)||[],dn=w.useMemo(()=>{const Oe=new Set;for(const gt of Kt)gt.project&&Oe.add(gt.project);return[...Oe].sort((gt,_t)=>gt.localeCompare(_t))},[Kt]),Rt=Le==null?void 0:Le.discovery,Pt=(Le==null?void 0:Le.has_wandb_key)??o,Lt=(Le==null?void 0:Le.has_netrc_wandb_key)??!1,ln=(Le==null?void 0:Le.wandb_key_source)??"unconfigured";w.useEffect(()=>{l&&K(ln==="netrc")},[l,ln]);const It=[{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 d.jsxs(d.Fragment,{children:[d.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:[d.jsxs("div",{className:"py-2.5 px-4 border-b border-sidebar-border shrink-0 flex items-center justify-between",children:[d.jsx(y2,{to:"/about",className:"flex items-center h-7 hover:opacity-80 transition-opacity",children:d.jsx("img",{src:f?"/logo-full-dark.svg":"/logo-full.svg",alt:"Telescope",className:"h-5"})}),d.jsx("button",{onClick:()=>p(Oe=>!Oe),className:"text-sidebar-foreground/60 hover:text-sidebar-foreground transition-colors","aria-label":"Toggle dark mode",children:f?d.jsx($ue,{className:"h-4 w-4"}):d.jsx(ide,{className:"h-4 w-4"})})]}),d.jsx("nav",{className:"flex flex-col gap-1 p-2 border-b border-sidebar-border shrink-0",children:It.map(Oe=>d.jsx(y2,{to:Oe.href,onClick:()=>{Oe.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",Oe.isActive&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),children:Oe.title},Oe.href))}),d.jsxs("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[d.jsxs("div",{className:"px-2 py-2 shrink-0 flex items-center gap-1",children:[d.jsxs("div",{className:"relative flex-1 min-w-0",children:[d.jsx(Jd,{type:"text",placeholder:"Search runs…",value:Ve,onChange:Oe=>He(Oe.target.value),onKeyDown:Oe=>{Oe.key==="Enter"&&Ft&&(Oe.preventDefault(),Bt())},className:bt("h-6 text-[11px] w-full placeholder:text-muted-foreground/60 placeholder:text-[10px]",Ft&&"pr-10")}),Ft&&d.jsx(wn,{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:Bt,disabled:ae,children:ae?d.jsx(gl,{className:"h-2.5 w-2.5"}):"Go"})]}),dn.length>1&&d.jsxs(ay,{value:A??"__all__",onValueChange:Oe=>N(Oe==="__all__"?null:Oe),children:[d.jsx(cy,{size:"sm",className:"h-6 text-[11px] min-w-0 max-w-[100px] rounded-md border-input px-1.5 py-0 gap-0.5 [&_svg]:size-3",children:d.jsx(ly,{})}),d.jsxs(uy,{children:[d.jsx(Mx,{value:"__all__",className:"text-xs",children:"All"}),dn.map(Oe=>d.jsx(Mx,{value:Oe,className:"text-xs",children:Oe},Oe))]})]}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx(wn,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-foreground",children:d.jsx(Ek,{className:"h-3.5 w-3.5"})})}),d.jsxs($s,{align:"end",className:"w-48",children:[d.jsx(Yo,{className:"text-xs",onClick:()=>C(!0),children:"Add Project"}),d.jsx(Yo,{className:"text-xs",onClick:()=>S(!0),children:"Add Run"}),d.jsxs(Yo,{className:"text-xs",onClick:()=>c(!0),children:["W&B Key"," ",Pt?d.jsx("span",{className:"!text-green-500 ml-1",children:"added"}):d.jsx("span",{className:"!text-red-500 ml-1",children:"missing"})]}),d.jsx(Ds,{}),d.jsx(Yo,{className:"text-xs",onClick:()=>{s([]),r(null)},children:"Unselect All"}),d.jsxs(Yo,{className:"text-xs flex items-center justify-between",onClick:()=>oe(Oe=>!Oe),children:["Only Show Selected",d.jsx(D0,{className:bt("h-3.5 w-3.5",Pe?"opacity-100":"opacity-0")})]}),d.jsx(Ds,{}),d.jsx(Yo,{className:"text-xs flex items-center gap-1.5",onClick:()=>ee(!0),children:"Database"})]})]})]}),(Rt==null?void 0:Rt.status)==="discovering"?d.jsx("div",{className:"px-4 pb-2 shrink-0",children:d.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-muted/50 px-2.5 py-2",children:[d.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Fetching runs from W&B…"}),d.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[d.jsx(gl,{className:"h-3 w-3 shrink-0"}),(Rt==null?void 0:Rt.runs_found)??0," found"]}),d.jsx("span",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Looking for telescope-tagged runs…"})]})}):null,d.jsx(jx,{className:"flex-1 min-h-0 overflow-hidden",children:d.jsx("div",{className:"px-2 pb-2",children:Ze?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx(gl,{className:"h-4 w-4"})}):d.jsxs("div",{className:"flex flex-col",children:[Kt.filter(Oe=>{if(A&&Oe.project!==A||Pe&&n!==Oe.run_id&&!i.includes(Oe.run_id))return!1;if(Ft){if(ze!==null&&!ze.includes(Oe.run_id))return!1}else if(Ve.trim()){const gt=Ve.trim().toLowerCase(),_t=(Oe.name||"").toLowerCase(),Vt=Oe.run_id.toLowerCase();if(!_t.includes(gt)&&!Vt.includes(gt))return!1}return!0}).map(Oe=>{const gt=n===Oe.run_id,_t=gt||i.includes(Oe.run_id),Vt=_e[Oe.run_id],vn=K_(Vt??Oe.color,Oe.color),ye=Oe.last_rollout_step===-1&&!Oe.is_syncing&&!Oe.is_tracking,et=Number(Oe.is_tracking)+Number(Oe.is_syncing),xt=et>=2?A1-4:et===1?A1-2:A1-1,vt=Oe.name||Oe.run_id.split("/").pop()||Oe.run_id;return d.jsxs("div",{className:bt("group flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors w-full cursor-pointer",!gt&&"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [--run-item-bg:var(--sidebar)] hover:[--run-item-bg:var(--sidebar-accent)]",gt&&"bg-[var(--sidebar-selected)] text-sidebar-accent-foreground [--run-item-bg:var(--sidebar-selected)]"),onClick:()=>r(Oe.run_id),onMouseEnter:()=>{_t&&m(Oe.run_id)},onMouseLeave:()=>m(null),children:[d.jsx("button",{onClick:ut=>{ut.stopPropagation(),gt||Nt(Oe.run_id)},disabled:gt,className:bt("w-3 h-3 rounded-sm border shrink-0 flex items-center justify-center transition-colors",_t?"bg-foreground border-foreground":"border-muted-foreground/50",gt&&"opacity-50 cursor-not-allowed"),children:_t&&d.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",className:"text-background",children:d.jsx("path",{d:"M1 4L3 6L7 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),d.jsxs(YT,{open:ge===Oe.run_id,onOpenChange:ut=>Ht(Oe.run_id,ut,Oe.color),children:[d.jsx(KT,{asChild:!0,children:d.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:vn},onClick:ut=>ut.stopPropagation(),"aria-label":`Change color for ${vt}`})}),d.jsx(ZT,{side:"right",align:"start",className:"w-auto p-1.5",onClick:ut=>ut.stopPropagation(),onOpenAutoFocus:ut=>ut.preventDefault(),children:d.jsx(ife,{value:vn,onChange:ut=>{ve(qt=>({...qt,[Oe.run_id]:K_(ut,Oe.color)}))}})})]}),d.jsx("div",{className:bt("flex-1 min-w-0 text-left",ye&&"text-muted-foreground/60"),children:d.jsx(M4,{name:vt,maxChars:xt})}),Oe.is_tracking&&d.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0",title:"Live"}),Oe.is_syncing&&d.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),d.jsxs("div",{className:"ml-auto relative h-6 w-6 flex items-center justify-center",children:[d.jsx("span",{className:"absolute text-[10px] text-muted-foreground transition-opacity group-hover:opacity-0",children:oy(Oe.created_at)}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx(wn,{variant:"ghost",size:"icon",className:"absolute h-6 w-6 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-transparent",disabled:z===Oe.run_id,onClick:ut=>ut.stopPropagation(),children:d.jsx(Ek,{className:"h-3.5 w-3.5"})})}),d.jsxs($s,{align:"end",className:"w-auto",children:[d.jsx(l0,{className:"text-xs font-normal",children:d.jsx("span",{className:"font-sans",children:Oe.run_id})}),d.jsx(Ds,{}),d.jsx(Yo,{onClick:ut=>{ut.stopPropagation(),qe(Oe.name||Oe.run_id.split("/").pop()||""),Se(Oe.run_id)},children:"Rename"}),d.jsx(Yo,{disabled:Ce===Oe.run_id,onClick:ut=>{ut.stopPropagation(),se(Oe.run_id)},children:Ce===Oe.run_id?"Resyncing...":"Force Full Resync"}),d.jsx(Yo,{disabled:Me===Oe.run_id,onClick:ut=>{ut.stopPropagation(),Ut(Oe.run_id)},children:Me===Oe.run_id?"Syncing evals...":"Sync Evals After Training"}),d.jsx(Yo,{className:"text-destructive",disabled:z===Oe.run_id,onClick:ut=>{ut.stopPropagation(),le(Oe.run_id)},children:"Remove"})]})]})]})]},Oe.run_id)}),Kt.length===0&&d.jsx("div",{className:"text-center py-4 px-2",children:Pt?d.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"}):d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs text-muted-foreground",children:"No wandb key added yet"}),d.jsx(wn,{size:"sm",className:"h-6 px-2 text-[11px] bg-green-600 hover:bg-green-700",onClick:()=>c(!0),children:"Add wandb key"})]})})]})})})]})]}),d.jsx(su,{open:l,onOpenChange:c,children:d.jsxs(ou,{className:"sm:max-w-md",children:[d.jsxs(Dc,{children:[d.jsx(Pc,{children:"Configure W&B"}),d.jsx(Um,{children:J?d.jsxs(d.Fragment,{children:["Use the API key saved by"," ",d.jsx("span",{className:"font-sans",children:"wandb login"})," to fetch all runs tagged ",d.jsx("span",{className:"font-sans",children:"telescope"}),"."]}):d.jsxs(d.Fragment,{children:["Paste your W&B API key to fetch all runs tagged"," ",d.jsx("span",{className:"font-sans",children:"telescope"}),"."]})})]}),d.jsxs("form",{onSubmit:Xe,children:[d.jsxs("div",{className:"space-y-4 py-4",children:[d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[d.jsx("input",{type:"checkbox",checked:J,onChange:Oe=>K(Oe.target.checked),className:"accent-primary h-3.5 w-3.5"}),d.jsxs("span",{className:"text-sm",children:["Use key from"," ",d.jsx("span",{className:"font-sans text-xs",children:"wandb login"})]}),J&&!Lt&&d.jsxs("span",{className:"text-[11px] text-red-500 font-medium",children:["Not found — run"," ",d.jsx("code",{className:"text-[10px]",children:"wandb login"})]}),J&&Lt&&d.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Found"})]}),!J&&d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(gde,{htmlFor:"config-api-key",children:"W&B API Key"}),Pt&&ln==="custom"?d.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Key added"}):d.jsx("span",{className:"text-[11px] text-red-500 font-medium",children:"No key configured"})]}),d.jsx(Jd,{id:"config-api-key",type:"password",placeholder:"Enter API key",value:H,onChange:Oe=>q(Oe.target.value),required:!0})]})]}),d.jsxs(AS,{children:[d.jsx(wn,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),d.jsx(wn,{type:"submit",disabled:ne||(J?!Lt:!H.trim()),children:ne?d.jsxs(d.Fragment,{children:[d.jsx(gl,{className:"mr-2 h-4 w-4"}),"Saving..."]}):"Ok"})]})]})]})}),d.jsx(su,{open:_,onOpenChange:S,children:d.jsxs(ou,{className:"sm:max-w-3xl !grid-rows-[auto_1fr] !gap-0 max-h-[80vh] overflow-hidden",onOpenAutoFocus:Oe=>{Oe.preventDefault();const gt=Oe.currentTarget;gt==null||gt.focus()},children:[d.jsxs(Dc,{className:"pb-3",children:[d.jsx(Pc,{children:"Add Run"}),d.jsx(Um,{children:"Select a removed run to add it back. Uses the stored W&B API key."})]}),d.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[d.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:[d.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(Oe=>d.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",Oe.cls),onClick:()=>Ae(Oe.key),children:[Oe.label,ce===Oe.key&&(ie==="asc"?d.jsx(hue,{className:"h-2.5 w-2.5"}):d.jsx(lue,{className:"h-2.5 w-2.5"}))]},Oe.key)),d.jsx("span",{className:"text-[10px] font-medium text-muted-foreground text-center",children:"Config"})]}),d.jsx("div",{className:"py-1",children:Ye?d.jsx("div",{className:"flex items-center justify-center py-6",children:d.jsx(gl,{className:"h-4 w-4"})}):d.jsxs(d.Fragment,{children:[Qe.map(Oe=>{const gt=Oe.run_id.split("/").pop()??Oe.run_id;return d.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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-full cursor-pointer",style:{backgroundColor:Oe.color??"#888"},onClick:()=>Re(Oe.run_id)}),d.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Re(Oe.run_id),children:d.jsx(M4,{name:Oe.name??"Unnamed"})}),d.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Re(Oe.run_id),children:d.jsx(M4,{name:Oe.entity??"—",className:"text-xs font-sans text-muted-foreground"})}),d.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Re(Oe.run_id),children:d.jsx(M4,{name:Oe.project??"—",className:"text-xs font-sans text-muted-foreground"})}),d.jsx("span",{className:"text-xs font-sans text-muted-foreground truncate cursor-pointer",onClick:()=>Re(Oe.run_id),children:gt}),d.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap cursor-pointer",onClick:()=>Re(Oe.run_id),children:Oe.created_at?new Date(Oe.created_at).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"}):"—"}),d.jsx("span",{className:"text-[10px] text-red-400 whitespace-nowrap text-center cursor-pointer",onClick:()=>Re(Oe.run_id),children:Oe.removed_at?oy(Oe.removed_at):"—"}),d.jsx(wn,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:_t=>{_t.stopPropagation(),ue(Oe)},disabled:!Oe.config,children:"View"})]},Oe.run_id)}),Qe.length===0&&d.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No removed runs"})]})})]})]})}),d.jsx(su,{open:M,onOpenChange:C,children:d.jsxs(ou,{className:"sm:max-w-lg max-h-[70vh] !grid-rows-[auto_1fr] !gap-0 overflow-hidden",children:[d.jsxs(Dc,{className:"pb-3",children:[d.jsx(Pc,{children:"Known Projects"}),d.jsx(Um,{children:"Projects polled for new telescope-tagged runs. Add an entity/project pair to start discovering runs from it."})]}),d.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[d.jsxs("div",{className:"flex flex-col gap-1 mb-3",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx(Jd,{className:"h-7 text-xs flex-1",placeholder:"entity/project",value:P,onChange:Oe=>{k(Oe.target.value),L&&B(null)},onKeyDown:Oe=>{Oe.key==="Enter"&&Be()}}),d.jsx(wn,{variant:"default",size:"sm",className:"h-7 px-3 text-xs",onClick:Be,disabled:O||!P.trim(),children:O?d.jsx(gl,{className:"h-3 w-3"}):"Ok"})]}),L&&d.jsx("span",{className:"text-[11px] text-red-500",children:L})]}),d.jsxs("div",{className:"space-y-1",children:[it==null?void 0:it.projects.map(Oe=>d.jsxs("div",{className:"flex items-center justify-between rounded-md px-3 py-1.5 hover:bg-muted transition-colors group",children:[d.jsxs("div",{className:"flex flex-col min-w-0",children:[d.jsx("span",{className:"text-xs font-mono truncate",children:Oe.project}),d.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Oe.source==="user"?"User-added":"From existing runs",Oe.added_at&&` · ${new Date(Oe.added_at).toLocaleDateString()}`]})]}),Oe.source==="user"&&d.jsx(wn,{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:()=>ot(Oe.project),disabled:V===Oe.project,children:V===Oe.project?d.jsx(gl,{className:"h-3 w-3"}):d.jsx(ode,{className:"h-3 w-3"})})]},Oe.project)),(it==null?void 0:it.projects.length)===0&&d.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."})]})]})]})}),d.jsx(su,{open:!!Q,onOpenChange:Oe=>{Oe||ue(null)},children:d.jsxs(ou,{className:"sm:max-w-2xl max-h-[85vh] !grid-rows-[auto_1fr] overflow-hidden",children:[d.jsxs(Dc,{children:[d.jsxs(Pc,{className:"flex items-center gap-2",children:[(Q==null?void 0:Q.color)&&d.jsx("div",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:Q.color}}),"Configuration —"," ",(Q==null?void 0:Q.name)??(Q==null?void 0:Q.run_id.split("/").pop())]}),d.jsx(Um,{children:Q==null?void 0:Q.run_id})]}),d.jsx("div",{className:"overflow-y-auto -mx-6 px-6",children:Q!=null&&Q.config?d.jsx(bW,{config:Q.config}):d.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"})})]})}),d.jsx(L2,{open:!!j,onOpenChange:Oe=>{Oe||le(null)},children:d.jsxs(j2,{children:[d.jsxs(z2,{children:[d.jsx(U2,{children:"Remove run locally?"}),d.jsx(B2,{children:"All the data of this run will be removed from your local database. It will not be removed from W&B, your data is safe in W&B and you can add it again locally if you want."})]}),d.jsxs(F2,{children:[d.jsx(V2,{children:"Cancel"}),d.jsx(H2,{onClick:()=>{j&&dt(j)},children:"Remove"})]})]})}),d.jsx(L2,{open:!!he,onOpenChange:Oe=>{Oe||se(null)},children:d.jsxs(j2,{children:[d.jsxs(z2,{children:[d.jsx(bde,{className:"bg-destructive/10",children:d.jsx(lde,{className:"text-destructive"})}),d.jsx(U2,{children:"Force Full Resync"}),d.jsx(B2,{children:"This will stop tracking (if active), delete all data for this run from the database, and then sync all data again from scratch. This action cannot be undone."})]}),d.jsxs(F2,{children:[d.jsx(V2,{children:"Cancel"}),d.jsx(H2,{variant:"destructive",onClick:()=>{he&&rn(he)},children:"Yes, Delete & Resync"})]})]})}),d.jsx(su,{open:!!Ue,onOpenChange:Oe=>{Oe||(Se(null),qe(""))},children:d.jsxs(ou,{className:"sm:max-w-md",children:[d.jsxs(Dc,{children:[d.jsx(Pc,{children:"Rename Run"}),d.jsx(Um,{children:"This will update the run name locally and on W&B."})]}),d.jsxs("form",{onSubmit:async Oe=>{Oe.preventDefault();const gt=ke.trim();if(!(!gt||!Ue)){nt(!0),e.setQueryData(["runs"],_t=>_t&&{..._t,runs:_t.runs.map(Vt=>Vt.run_id===Ue?{...Vt,name:gt}:Vt)});try{if(!(await fetch(`${Xn}/rename-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ue,name:gt})})).ok)throw new Error("Failed to rename run")}catch(_t){console.error("Failed to rename run:",_t)}finally{e.invalidateQueries({queryKey:["runs"]}),nt(!1),Se(null),qe("")}}},children:[d.jsx("div",{className:"py-2",children:d.jsx(Jd,{value:ke,onChange:Oe=>qe(Oe.target.value),placeholder:"Run name",autoFocus:!0})}),d.jsxs(AS,{children:[d.jsx(wn,{type:"button",variant:"outline",onClick:()=>{Se(null),qe("")},children:"Cancel"}),d.jsx(wn,{type:"submit",disabled:!ke.trim()||Je,children:Je?"Renaming...":"Rename"})]})]})]})}),d.jsx(cfe,{open:G,onOpenChange:ee})]})}function dfe(){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 rC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gy(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function c8(t){return"nodeType"in t}function Fc(t){var e,n;return t?Gy(t)?t:c8(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function u8(t){const{Document:e}=Fc(t);return t instanceof e}function Rw(t){return Gy(t)?!1:t instanceof Fc(t).HTMLElement}function wW(t){return t instanceof Fc(t).SVGElement}function Wy(t){return t?Gy(t)?t.document:c8(t)?u8(t)?t:Rw(t)||wW(t)?t.ownerDocument:document:document:document}const fh=rC?w.useLayoutEffect:w.useEffect;function d8(t){const e=w.useRef(t);return fh(()=>{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 ffe(){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 RS(t,e){e===void 0&&(e=[t]);const n=w.useRef(t);return fh(()=>{n.current!==t&&(n.current=t)},e),n}function Dw(t,e){const n=w.useRef();return w.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function $2(t){const e=d8(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 kA={};function Pw(t,e){return w.useMemo(()=>{if(e)return e;const n=kA[t]==null?0:kA[t]+1;return kA[t]=n,t+"-"+n},[t,e])}function MW(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 f=s[l];f!=null&&(s[l]=f+t*c)}return s},{...e})}}const k1=MW(1),DS=MW(-1);function hfe(t){return"clientX"in t&&"clientY"in t}function f8(t){if(!t)return!1;const{KeyboardEvent:e}=Fc(t.target);return e&&t instanceof e}function pfe(t){if(!t)return!1;const{TouchEvent:e}=Fc(t.target);return e&&t instanceof e}function kk(t){if(pfe(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 hfe(t)?{x:t.clientX,y:t.clientY}:null}const dy=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[dy.Translate.toString(t),dy.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),jI="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function mfe(t){return t.matches(jI)?t:t.querySelector(jI)}const gfe={display:"none"};function xfe(t){let{id:e,value:n}=t;return ni.createElement("div",{id:e,style:gfe},n)}function vfe(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 yfe(){const[t,e]=w.useState("");return{announce:w.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const TW=w.createContext(null);function bfe(t){const e=w.useContext(TW);w.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function _fe(){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 Sfe={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.
  `},wfe={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 Mfe(t){let{announcements:e=wfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Sfe}=t;const{announce:s,announcement:o}=yfe(),a=Pw("DndLiveRegion"),[l,c]=w.useState(!1);if(w.useEffect(()=>{c(!0)},[]),bfe(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 f=ni.createElement(ni.Fragment,null,ni.createElement(xfe,{id:r,value:i.draggable}),ni.createElement(vfe,{id:a,announcement:o}));return n?ql.createPortal(f,n):f}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 q2(){}function od(t,e){return w.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function fy(){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 af=Object.freeze({x:0,y:0});function CW(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function EW(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function Tfe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function zI(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 AW(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function FI(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 hy=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=FI(e,e.left,e.top),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=CW(FI(l),i);s.push({id:a,data:{droppableContainer:o,value:c}})}}return s.sort(EW)},Cfe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=zI(e),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=zI(l),f=i.reduce((m,x,b)=>m+CW(c[b],x),0),p=Number((f/4).toFixed(4));s.push({id:a,data:{droppableContainer:o,value:p}})}}return s.sort(EW)};function Efe(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,f=o*a,p=f/(l+c-f);return Number(p.toFixed(4))}return 0}const Afe=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=Efe(a,e);l>0&&i.push({id:o,data:{droppableContainer:s,value:l}})}}return i.sort(Tfe)};function Nfe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function NW(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:af}function kfe(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 Rfe=kfe(1);function Dfe(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 Pfe(t,e,n){const r=Dfe(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)),f=i?t.width/i:t.width,p=s?t.height/s:t.height;return{width:f,height:p,top:c,right:l+f,bottom:c+p,left:l}}const Ife={ignoreTransform:!1};function $y(t,e){e===void 0&&(e=Ife);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:f}=Fc(t).getComputedStyle(t);c&&(n=Pfe(n,c,f))}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 UI(t){return $y(t,{ignoreTransform:!0})}function Ofe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Lfe(t,e){return e===void 0&&(e=Fc(t).getComputedStyle(t)),e.position==="fixed"}function jfe(t,e){e===void 0&&(e=Fc(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 iC(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(u8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Rw(i)||wW(i)||n.includes(i))return n;const s=Fc(t).getComputedStyle(i);return i!==t&&jfe(i,s)&&n.push(i),Lfe(i,s)?n:r(i.parentNode)}return t?r(t):n}function kW(t){const[e]=iC(t,1);return e??null}function RA(t){return!rC||!t?null:Gy(t)?t:c8(t)?u8(t)||t===Wy(t).scrollingElement?window:Rw(t)?t:null:null}function RW(t){return Gy(t)?t.scrollX:t.scrollLeft}function DW(t){return Gy(t)?t.scrollY:t.scrollTop}function Rk(t){return{x:RW(t),y:DW(t)}}var Ea;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ea||(Ea={}));function PW(t){return!rC||!t?!1:t===document.scrollingElement}function IW(t){const e={x:0,y:0},n=PW(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 zfe={x:.2,y:.2};function Ffe(t,e,n,r,i){let{top:s,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=zfe);const{isTop:c,isBottom:f,isLeft:p,isRight:m}=IW(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)):!f&&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 Ufe(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 OW(t){return t.reduce((e,n)=>k1(e,Rk(n)),af)}function Bfe(t){return t.reduce((e,n)=>e+RW(n),0)}function Hfe(t){return t.reduce((e,n)=>e+DW(n),0)}function Vfe(t,e){if(e===void 0&&(e=$y),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);kW(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Gfe=[["x",["left","right"],Bfe],["y",["top","bottom"],Hfe]];class h8{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=iC(n),i=OW(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,a]of Gfe)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),f=i[s]-c;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Z_{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 Wfe(t){const{EventTarget:e}=Fc(t);return t instanceof e?t:Wy(t)}function DA(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 nd;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(nd||(nd={}));function BI(t){t.preventDefault()}function $fe(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 LW={start:[fi.Space,fi.Enter],cancel:[fi.Esc],end:[fi.Space,fi.Enter,fi.Tab]},qfe=(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 u0{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 Z_(Wy(n)),this.windowListeners=new Z_(Fc(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(nd.Resize,this.handleCancel),this.windowListeners.add(nd.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(nd.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Vfe(r),n(af)}handleKeyDown(e){if(f8(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=LW,coordinateGetter:o=qfe,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,f=c?{x:c.left,y:c.top}:af;this.referenceCoordinates||(this.referenceCoordinates=f);const p=o(e,{active:n,context:r.current,currentCoordinates:f});if(p){const m=DS(p,f),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:P,minScroll:k}=IW(_),O=Ufe(_),R={x:Math.min(S===fi.Right?O.right-O.width/2:O.right,Math.max(S===fi.Right?O.left:O.left+O.width/2,p.x)),y:Math.min(S===fi.Down?O.bottom-O.height/2:O.bottom,Math.max(S===fi.Down?O.top:O.top+O.height/2,p.y))},L=S===fi.Right&&!C||S===fi.Left&&!A,B=S===fi.Down&&!N||S===fi.Up&&!M;if(L&&R.x!==p.x){const V=_.scrollLeft+m.x,W=S===fi.Right&&V<=P.x||S===fi.Left&&V>=k.x;if(W&&!m.y){_.scrollTo({left:V,behavior:a});return}W?x.x=_.scrollLeft-V:x.x=S===fi.Right?_.scrollLeft-P.x:_.scrollLeft-k.x,x.x&&_.scrollBy({left:-x.x,behavior:a});break}else if(B&&R.y!==p.y){const V=_.scrollTop+m.y,W=S===fi.Down&&V<=P.y||S===fi.Up&&V>=k.y;if(W&&!m.x){_.scrollTo({top:V,behavior:a});return}W?x.y=_.scrollTop-V:x.y=S===fi.Down?_.scrollTop-P.y:_.scrollTop-k.y,x.y&&_.scrollBy({top:-x.y,behavior:a});break}}this.handleMove(e,k1(DS(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()}}u0.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=LW,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 HI(t){return!!(t&&"distance"in t)}function VI(t){return!!(t&&"delay"in t)}class p8{constructor(e,n,r){var i;r===void 0&&(r=Wfe(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=Wy(o),this.documentListeners=new Z_(this.document),this.listeners=new Z_(r),this.windowListeners=new Z_(Fc(o)),this.initialCoordinates=(i=kk(s))!=null?i:af,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(nd.Resize,this.handleCancel),this.windowListeners.add(nd.DragStart,BI),this.windowListeners.add(nd.VisibilityChange,this.handleCancel),this.windowListeners.add(nd.ContextMenu,BI),this.documentListeners.add(nd.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(VI(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(HI(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(nd.Click,$fe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(nd.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:af,c=DS(i,l);if(!r&&a){if(HI(a)){if(a.tolerance!=null&&DA(c,a.tolerance))return this.handleCancel();if(DA(c,a.distance))return this.handleStart()}if(VI(a)&&DA(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 Xfe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class d0 extends p8{constructor(e){const{event:n}=e,r=Wy(n.target);super(e,Xfe,r)}}d0.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 Yfe={move:{name:"mousemove"},end:{name:"mouseup"}};var Dk;(function(t){t[t.RightClick=2]="RightClick"})(Dk||(Dk={}));class Kfe extends p8{constructor(e){super(e,Yfe,Wy(e.event.target))}}Kfe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Dk.RightClick?!1:(r==null||r({event:n}),!0)}}];const PA={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Zfe extends p8{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(){}}}Zfe.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 Q_;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Q_||(Q_={}));var X2;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(X2||(X2={}));function Qfe(t){let{acceleration:e,activator:n=Q_.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:a=X2.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:f,delta:p,threshold:m}=t;const x=ehe({delta:p,disabled:!s}),[b,_]=ffe(),S=w.useRef({x:0,y:0}),M=w.useRef({x:0,y:0}),C=w.useMemo(()=>{switch(n){case Q_.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Q_.DraggableRect:return i}},[n,i,l]),A=w.useRef(null),N=w.useCallback(()=>{const k=A.current;if(!k)return;const O=S.current.x*M.current.x,R=S.current.y*M.current.y;k.scrollBy(O,R)},[]),P=w.useMemo(()=>a===X2.TreeOrder?[...c].reverse():c,[a,c]);w.useEffect(()=>{if(!s||!c.length||!C){_();return}for(const k of P){if((r==null?void 0:r(k))===!1)continue;const O=c.indexOf(k),R=f[O];if(!R)continue;const{direction:L,speed:B}=Ffe(k,R,C,e,m);for(const V of["x","y"])x[V][L[V]]||(B[V]=0,L[V]=0);if(B.x>0||B.y>0){_(),A.current=k,b(N,o),S.current=B,M.current=L;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,P,f,JSON.stringify(m)])}const Jfe={x:{[Ea.Backward]:!1,[Ea.Forward]:!1},y:{[Ea.Backward]:!1,[Ea.Forward]:!1}};function ehe(t){let{delta:e,disabled:n}=t;const r=Nk(e);return Dw(i=>{if(n||!r||!i)return Jfe;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 the(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Dw(i=>{var s;return e==null?null:(s=r??i)!=null?s:null},[r,e])}function nhe(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 PS;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(PS||(PS={}));var Pk;(function(t){t.Optimized="optimized"})(Pk||(Pk={}));const GI=new Map;function rhe(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,o]=w.useState(null),{frequency:a,measure:l,strategy:c}=i,f=w.useRef(t),p=S(),m=RS(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),_=Dw(M=>{if(p&&!n)return GI;if(!M||M===GI||f.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,P=N?new h8(l(N),N):null;A.rect.current=P,P&&C.set(A.id,P)}return C}return M},[t,s,n,p,l]);return w.useEffect(()=>{f.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 PS.Always:return!1;case PS.BeforeDragging:return n;default:return!n}}}function jW(t,e){return Dw(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function ihe(t,e){return jW(t,e)}function she(t){let{callback:e,disabled:n}=t;const r=d8(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 sC(t){let{callback:e,disabled:n}=t;const r=d8(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 ohe(t){return new h8($y(t),t)}function WI(t,e,n){e===void 0&&(e=ohe);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 f=e(t);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const o=she({callback(l){if(t)for(const c of l){const{type:f,target:p}=c;if(f==="childList"&&p instanceof HTMLElement&&p.contains(t)){s();break}}}}),a=sC({callback:s});return fh(()=>{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 ahe(t){const e=jW(t);return NW(t,e)}const $I=[];function lhe(t){const e=w.useRef(t),n=Dw(r=>t?r&&r!==$I&&t&&e.current&&t.parentNode===e.current.parentNode?r:iC(t):$I,[t]);return w.useEffect(()=>{e.current=t},[t]),n}function che(t){const[e,n]=w.useState(null),r=w.useRef(t),i=w.useCallback(s=>{const o=RA(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=RA(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=RA(l);c==null||c.removeEventListener("scroll",i)})}},[i,t]),w.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,o)=>k1(s,o),af):OW(t):af,[t,e])}function qI(t,e){e===void 0&&(e=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},e),w.useEffect(()=>{const r=t!==af;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?DS(t,n.current):af}function uhe(t){w.useEffect(()=>{if(!rC)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 dhe(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 zW(t){return w.useMemo(()=>t?Ofe(t):null,[t])}const XI=[];function fhe(t,e){e===void 0&&(e=$y);const[n]=t,r=zW(n?Fc(n):null),[i,s]=w.useState(XI);function o(){s(()=>t.length?t.map(l=>PW(l)?r:new h8(e(l),l)):XI)}const a=sC({callback:o});return fh(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),i}function hhe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Rw(e)?e:t}function phe(t){let{measure:e}=t;const[n,r]=w.useState(null),i=w.useCallback(c=>{for(const{target:f}of c)if(Rw(f)){r(p=>{const m=e(f);return p?{...p,width:m.width,height:m.height}:m});break}},[e]),s=sC({callback:i}),o=w.useCallback(c=>{const f=hhe(c);s==null||s.disconnect(),f&&(s==null||s.observe(f)),r(f?e(f):null)},[e,s]),[a,l]=$2(o);return w.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const mhe=[{sensor:d0,options:{}},{sensor:u0,options:{}}],ghe={current:{}},o2={draggable:{measure:UI},droppable:{measure:UI,strategy:PS.WhileDragging,frequency:Pk.Optimized},dragOverlay:{measure:$y}};class J_ 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 xhe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new J_,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:q2},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:o2,measureDroppableContainers:q2,windowRect:null,measuringScheduled:!1},vhe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:q2,draggableNodes:new Map,over:null,measureDroppableContainers:q2},oC=w.createContext(vhe),FW=w.createContext(xhe);function yhe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new J_}}}function bhe(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 J_(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 J_(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 J_(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function _he(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=w.useContext(oC),s=Nk(r),o=Nk(n==null?void 0:n.id);return w.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!f8(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 f of[l.current,c.current]){if(!f)continue;const p=mfe(f);if(p){p.focus();break}}})}},[r,e,i,o,s]),null}function She(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function whe(t){return w.useMemo(()=>({draggable:{...o2.draggable,...t==null?void 0:t.draggable},droppable:{...o2.droppable,...t==null?void 0:t.droppable},dragOverlay:{...o2.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 Mhe(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;fh(()=>{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 f=n(c),p=NW(f,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=kW(c);m&&m.scrollBy({top:p.y,left:p.x})}},[e,o,a,r,n])}const UW=w.createContext({...af,scaleX:1,scaleY:1});var jm;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(jm||(jm={}));const py=w.memo(function(e){var n,r,i,s;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:f=mhe,collisionDetection:p=Afe,measuring:m,modifiers:x,...b}=e;const _=w.useReducer(bhe,void 0,yhe),[S,M]=_,[C,A]=_fe(),[N,P]=w.useState(jm.Uninitialized),k=N===jm.Initialized,{draggable:{active:O,nodes:R,translate:L},droppable:{containers:B}}=S,V=O!=null?R.get(O):null,W=w.useRef({initial:null,translated:null}),G=w.useMemo(()=>{var mt;return O!=null?{id:O,data:(mt=V==null?void 0:V.data)!=null?mt:ghe,rect:W}:null},[O,V]),ee=w.useRef(null),[H,q]=w.useState(null),[J,K]=w.useState(null),ne=RS(b,Object.values(b)),U=Pw("DndDescribedBy",o),z=w.useMemo(()=>B.getEnabled(),[B]),Y=whe(m),{droppableRects:j,measureDroppableContainers:le,measuringScheduled:ce}=rhe(z,{dragging:k,dependencies:[L.x,L.y],config:Y.droppable}),X=the(R,O),ie=w.useMemo(()=>J?kk(J):null,[J]),fe=it(),Q=ihe(X,Y.draggable.measure);Mhe({activeNode:O!=null?R.get(O):null,config:fe.layoutShiftCompensation,initialRect:Q,measure:Y.draggable.measure});const ue=WI(X,Y.draggable.measure,Q),he=WI(X?X.parentElement:null),se=w.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ce=B.getNodeFor((n=se.current.over)==null?void 0:n.id),de=phe({measure:Y.dragOverlay.measure}),Me=(r=de.nodeRef.current)!=null?r:X,Te=k?(i=de.rect)!=null?i:ue:null,Pe=!!(de.nodeRef.current&&de.rect),oe=ahe(Pe?null:ue),Ve=zW(Me?Fc(Me):null),He=lhe(k?Ce??X:null),ze=fhe(He),Ge=She(x,{transform:{x:L.x-oe.x,y:L.y-oe.y,scaleX:1,scaleY:1},activatorEvent:J,active:G,activeNodeRect:ue,containerNodeRect:he,draggingNodeRect:Te,over:se.current.over,overlayNodeRect:de.rect,scrollableAncestors:He,scrollableAncestorRects:ze,windowRect:Ve}),ae=ie?k1(ie,L):null,Z=che(He),ge=qI(Z),we=qI(Z,[ue]),_e=k1(Ge,ge),ve=Te?Rfe(Te,Ge):null,Ue=G&&ve?p({active:G,collisionRect:ve,droppableRects:j,droppableContainers:z,pointerCoordinates:ae}):null,Se=AW(Ue,"id"),[ke,qe]=w.useState(null),Je=Pe?Ge:k1(Ge,we),nt=Nfe(Je,(s=ke==null?void 0:ke.rect)!=null?s:null,ue),tt=w.useRef(null),be=w.useCallback((mt,ft)=>{let{sensor:Qe,options:Ae}=ft;if(ee.current==null)return;const Xe=R.get(ee.current);if(!Xe)return;const Re=mt.nativeEvent,Be=new Qe({active:ee.current,activeNode:Xe,event:Re,options:Ae,context:se,onAbort(dt){if(!R.get(dt))return;const{onDragAbort:Dt}=ne.current,St={id:dt};Dt==null||Dt(St),C({type:"onDragAbort",event:St})},onPending(dt,Nt,Dt,St){if(!R.get(dt))return;const{onDragPending:rn}=ne.current,Ut={id:dt,constraint:Nt,initialCoordinates:Dt,offset:St};rn==null||rn(Ut),C({type:"onDragPending",event:Ut})},onStart(dt){const Nt=ee.current;if(Nt==null)return;const Dt=R.get(Nt);if(!Dt)return;const{onDragStart:St}=ne.current,Ht={activatorEvent:Re,active:{id:Nt,data:Dt.data,rect:W}};ql.unstable_batchedUpdates(()=>{St==null||St(Ht),P(jm.Initializing),M({type:fa.DragStart,initialCoordinates:dt,active:Nt}),C({type:"onDragStart",event:Ht}),q(tt.current),K(Re)})},onMove(dt){M({type:fa.DragMove,coordinates:dt})},onEnd:ot(fa.DragEnd),onCancel:ot(fa.DragCancel)});tt.current=Be;function ot(dt){return async function(){const{active:Dt,collisions:St,over:Ht,scrollAdjustedTranslate:rn}=se.current;let Ut=null;if(Dt&&rn){const{cancelDrop:Ft}=ne.current;Ut={activatorEvent:Re,active:Dt,collisions:St,delta:rn,over:Ht},dt===fa.DragEnd&&typeof Ft=="function"&&await Promise.resolve(Ft(Ut))&&(dt=fa.DragCancel)}ee.current=null,ql.unstable_batchedUpdates(()=>{M({type:dt}),P(jm.Uninitialized),qe(null),q(null),K(null),tt.current=null;const Ft=dt===fa.DragEnd?"onDragEnd":"onDragCancel";if(Ut){const Bt=ne.current[Ft];Bt==null||Bt(Ut),C({type:Ft,event:Ut})}})}}},[R]),Le=w.useCallback((mt,ft)=>(Qe,Ae)=>{const Xe=Qe.nativeEvent,Re=R.get(Ae);if(ee.current!==null||!Re||Xe.dndKit||Xe.defaultPrevented)return;const Be={active:Re};mt(Qe,ft.options,Be)===!0&&(Xe.dndKit={capturedBy:ft.sensor},ee.current=Ae,be(Qe,ft))},[R,be]),Ze=nhe(f,Le);uhe(f),fh(()=>{ue&&N===jm.Initializing&&P(jm.Initialized)},[ue,N]),w.useEffect(()=>{const{onDragMove:mt}=ne.current,{active:ft,activatorEvent:Qe,collisions:Ae,over:Xe}=se.current;if(!ft||!Qe)return;const Re={active:ft,activatorEvent:Qe,collisions:Ae,delta:{x:_e.x,y:_e.y},over:Xe};ql.unstable_batchedUpdates(()=>{mt==null||mt(Re),C({type:"onDragMove",event:Re})})},[_e.x,_e.y]),w.useEffect(()=>{const{active:mt,activatorEvent:ft,collisions:Qe,droppableContainers:Ae,scrollAdjustedTranslate:Xe}=se.current;if(!mt||ee.current==null||!ft||!Xe)return;const{onDragOver:Re}=ne.current,Be=Ae.get(Se),ot=Be&&Be.rect.current?{id:Be.id,rect:Be.rect.current,data:Be.data,disabled:Be.disabled}:null,dt={active:mt,activatorEvent:ft,collisions:Qe,delta:{x:Xe.x,y:Xe.y},over:ot};ql.unstable_batchedUpdates(()=>{qe(ot),Re==null||Re(dt),C({type:"onDragOver",event:dt})})},[Se]),fh(()=>{se.current={activatorEvent:J,active:G,activeNode:X,collisionRect:ve,collisions:Ue,droppableRects:j,draggableNodes:R,draggingNode:Me,draggingNodeRect:Te,droppableContainers:B,over:ke,scrollableAncestors:He,scrollAdjustedTranslate:_e},W.current={initial:Te,translated:ve}},[G,X,Ue,ve,R,Me,Te,j,B,ke,He,_e]),Qfe({...fe,delta:L,draggingRect:ve,pointerCoordinates:ae,scrollableAncestors:He,scrollableAncestorRects:ze});const Ee=w.useMemo(()=>({active:G,activeNode:X,activeNodeRect:ue,activatorEvent:J,collisions:Ue,containerNodeRect:he,dragOverlay:de,draggableNodes:R,droppableContainers:B,droppableRects:j,over:ke,measureDroppableContainers:le,scrollableAncestors:He,scrollableAncestorRects:ze,measuringConfiguration:Y,measuringScheduled:ce,windowRect:Ve}),[G,X,ue,J,Ue,he,de,R,B,j,ke,le,He,ze,Y,ce,Ve]),Ye=w.useMemo(()=>({activatorEvent:J,activators:Ze,active:G,activeNodeRect:ue,ariaDescribedById:{draggable:U},dispatch:M,draggableNodes:R,over:ke,measureDroppableContainers:le}),[J,Ze,G,ue,M,U,R,ke,le]);return ni.createElement(TW.Provider,{value:A},ni.createElement(oC.Provider,{value:Ye},ni.createElement(FW.Provider,{value:Ee},ni.createElement(UW.Provider,{value:nt},c)),ni.createElement(_he,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ni.createElement(Mfe,{...a,hiddenTextDescribedById:U}));function it(){const mt=(H==null?void 0:H.autoScrollEnabled)===!1,ft=typeof l=="object"?l.enabled===!1:l===!1,Qe=k&&!mt&&!ft;return typeof l=="object"?{...l,enabled:Qe}:{enabled:Qe}}}),The=w.createContext(null),YI="button",Che="Draggable";function Ehe(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=Pw(Che),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:f,draggableNodes:p,over:m}=w.useContext(oC),{role:x=YI,roleDescription:b="draggable",tabIndex:_=0}=i??{},S=(l==null?void 0:l.id)===e,M=w.useContext(S?UW:The),[C,A]=$2(),[N,P]=$2(),k=dhe(o,e),O=RS(n);fh(()=>(p.set(e,{id:e,key:s,node:C,activatorNode:N,data:O}),()=>{const L=p.get(e);L&&L.key===s&&p.delete(e)}),[p,e]);const R=w.useMemo(()=>({role:x,tabIndex:_,"aria-disabled":r,"aria-pressed":S&&x===YI?!0:void 0,"aria-roledescription":b,"aria-describedby":f.draggable}),[r,x,_,S,b,f.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:R,isDragging:S,listeners:r?void 0:k,node:C,over:m,setNodeRef:A,setActivatorNodeRef:P,transform:M}}function Ahe(){return w.useContext(FW)}const Nhe="Droppable",khe={timeout:25};function Rhe(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=Pw(Nhe),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=w.useContext(oC),f=w.useRef({disabled:n}),p=w.useRef(!1),m=w.useRef(null),x=w.useRef(null),{disabled:b,updateMeasurementsFor:_,timeout:S}={...khe,...i},M=RS(_??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=sC({callback:C,disabled:b||!o}),N=w.useCallback((R,L)=>{A&&(L&&(A.unobserve(L),p.current=!1),R&&A.observe(R))},[A]),[P,k]=$2(N),O=RS(e);return w.useEffect(()=>{!A||!P.current||(A.disconnect(),p.current=!1,A.observe(P.current))},[P,A]),w.useEffect(()=>(a({type:fa.RegisterDroppable,element:{id:r,key:s,disabled:n,node:P,rect:m,data:O}}),()=>a({type:fa.UnregisterDroppable,key:s,id:r})),[r]),w.useEffect(()=>{n!==f.current.disabled&&(a({type:fa.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,a]),{active:o,rect:m,isOver:(l==null?void 0:l.id)===r,node:P,over:l,setNodeRef:k}}function f0(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Dhe(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function T4(t){return t!==null&&t>=0}function Phe(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 Ihe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Iw=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=f0(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}},C4={scaleX:1,scaleY:1},m8=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,...C4}:null}const l=Ohe(s,i,n);return i>n&&i<=o?{x:0,y:-a.height-l,...C4}:i<n&&i>=o?{x:0,y:a.height+l,...C4}:{x:0,y:0,...C4}};function Ohe(t,e,n){const r=t[e],i=t[e-1],s=t[e+1];return r?n<e?i?r.top-(i.top+i.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const BW="Sortable",HW=ni.createContext({activeIndex:-1,containerId:BW,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Iw,disabled:{draggable:!1,droppable:!1}});function my(t){let{children:e,id:n,items:r,strategy:i=Iw,disabled:s=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:f}=Ahe(),p=Pw(BW,n),m=a.rect!==null,x=w.useMemo(()=>r.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),b=o!=null,_=o?x.indexOf(o.id):-1,S=c?x.indexOf(c.id):-1,M=w.useRef(x),C=!Phe(x,M.current),A=S!==-1&&_===-1||C,N=Ihe(s);fh(()=>{C&&b&&f(x)},[C,x,b,f]),w.useEffect(()=>{M.current=x},[x]);const P=w.useMemo(()=>({activeIndex:_,containerId:p,disabled:N,disableTransforms:A,items:x,overIndex:S,useDragOverlay:m,sortedRects:Dhe(x,l),strategy:i}),[_,p,N.draggable,N.droppable,A,x,S,l,m,i]);return ni.createElement(HW.Provider,{value:P},e)}const Lhe=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return f0(n,r,i).indexOf(e)},jhe=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},zhe={duration:200,easing:"ease"},VW="transform",Fhe=dy.Transition.toString({property:VW,duration:0,easing:"linear"}),Uhe={roleDescription:"sortable"};function Bhe(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,o]=w.useState(null),a=w.useRef(n);return fh(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=$y(r.current,{ignoreTransform:!0}),f={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(f.x||f.y)&&o(f)}}n!==a.current&&(a.current=n)},[e,n,r,i]),w.useEffect(()=>{s&&o(null)},[s]),s}function aC(t){let{animateLayoutChanges:e=jhe,attributes:n,disabled:r,data:i,getNewIndex:s=Lhe,id:o,strategy:a,resizeObserverConfig:l,transition:c=zhe}=t;const{items:f,containerId:p,activeIndex:m,disabled:x,disableTransforms:b,sortedRects:_,overIndex:S,useDragOverlay:M,strategy:C}=w.useContext(HW),A=Hhe(r,x),N=f.indexOf(o),P=w.useMemo(()=>({sortable:{containerId:p,index:N,items:f},...i}),[p,i,N,f]),k=w.useMemo(()=>f.slice(f.indexOf(o)),[f,o]),{rect:O,node:R,isOver:L,setNodeRef:B}=Rhe({id:o,data:P,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:V,activatorEvent:W,activeNodeRect:G,attributes:ee,setNodeRef:H,listeners:q,isDragging:J,over:K,setActivatorNodeRef:ne,transform:U}=Ehe({id:o,data:P,attributes:{...Uhe,...n},disabled:A.draggable}),z=dfe(B,H),Y=!!V,j=Y&&!b&&T4(m)&&T4(S),le=!M&&J,ce=le&&j?U:null,ie=j?ce??(a??C)({rects:_,activeNodeRect:G,activeIndex:m,overIndex:S,index:N}):null,fe=T4(m)&&T4(S)?s({id:o,items:f,activeIndex:m,overIndex:S}):N,Q=V==null?void 0:V.id,ue=w.useRef({activeId:Q,items:f,newIndex:fe,containerId:p}),he=f!==ue.current.items,se=e({active:V,containerId:p,isDragging:J,isSorting:Y,id:o,index:N,items:f,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:c,wasDragging:ue.current.activeId!=null}),Ce=Bhe({disabled:!se,index:N,node:R,rect:O});return w.useEffect(()=>{Y&&ue.current.newIndex!==fe&&(ue.current.newIndex=fe),p!==ue.current.containerId&&(ue.current.containerId=p),f!==ue.current.items&&(ue.current.items=f)},[Y,fe,p,f]),w.useEffect(()=>{if(Q===ue.current.activeId)return;if(Q!=null&&ue.current.activeId==null){ue.current.activeId=Q;return}const Me=setTimeout(()=>{ue.current.activeId=Q},50);return()=>clearTimeout(Me)},[Q]),{active:V,activeIndex:m,attributes:ee,data:P,rect:O,index:N,newIndex:fe,items:f,isOver:L,isSorting:Y,isDragging:J,listeners:q,node:R,overIndex:S,over:K,setNodeRef:z,setActivatorNodeRef:ne,setDroppableNodeRef:B,setDraggableNodeRef:H,transform:Ce??ie,transition:de()};function de(){if(Ce||he&&ue.current.newIndex===N)return Fhe;if(!(le&&!f8(W)||!c)&&(Y||se))return dy.Transition.toString({...c,property:VW})}}function Hhe(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 Y2(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 Vhe=[fi.Down,fi.Right,fi.Up,fi.Left],gy=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:o,scrollableAncestors:a}}=e;if(Vhe.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=Cfe({collisionRect:r,droppableRects:i,droppableContainers:l});let f=AW(c,"id");if(f===(o==null?void 0:o.id)&&c.length>1&&(f=c[1].id),f!=null){const p=s.get(n.id),m=s.get(f),x=m?i.get(m.id):null,b=m==null?void 0:m.node.current;if(b&&x&&p&&m){const S=iC(b).some((k,O)=>a[O]!==k),M=GW(p,m),C=Ghe(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:DS(N,A)}}}};function GW(t,e){return!Y2(t)||!Y2(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Ghe(t,e){return!Y2(t)||!Y2(e)||!GW(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function dd({className:t,size:e="default",...n}){return d.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 KI({className:t,...e}){return d.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 E4({className:t,...e}){return d.jsx("div",{"data-slot":"card-title",className:bt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function A4({className:t,...e}){return d.jsx("div",{"data-slot":"card-description",className:bt("text-muted-foreground text-sm",t),...e})}function ch({className:t,...e}){return d.jsx("div",{"data-slot":"card-content",className:bt("px-4 group-data-[size=sm]/card:px-3",t),...e})}function ap({className:t,...e}){return d.jsx("div",{"data-slot":"skeleton",className:bt("bg-muted rounded-md animate-pulse",t),...e})}const WW=n8("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 R1({className:t,variant:e="default",size:n="default",...r}){return d.jsx(Uae,{"data-slot":"toggle",className:bt(WW({variant:e,size:n,className:t})),...r})}const $W=w.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function h0({className:t,variant:e,size:n,spacing:r=0,orientation:i="horizontal",children:s,...o}){return d.jsx(Wae,{"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:d.jsx($W.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($W);return d.jsx($ae,{"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",WW({variant:s.variant||n,size:s.size||r}),t),...i,children:e})}function IS({label:t,enabled:e,onEnabledChange:n,value:r,onValueChange:i,onValueCommit:s,inputType:o="number",inputMin:a,inputMax:l,inputWidth:c="w-12",icon:f,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 d.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:[d.jsxs(R1,{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:[f,d.jsx("span",{children:t})]}),d.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 Whe=n8("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 xy({className:t,variant:e="default",asChild:n=!1,...r}){const i=n?nB:"span";return d.jsx(i,{"data-slot":"badge","data-variant":e,className:bt(Whe({variant:e}),t),...r})}const qW="...";function $he(t,e){if(!t||e<=0||t.length<=e)return{prefix:t,suffix:"",isTruncated:!1};const n=e-qW.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 y1({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}),f=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=$he(t,M);c(A=>A.prefix===C.prefix&&A.suffix===C.suffix&&A.isTruncated===C.isTruncated?A:C)},[t]);w.useLayoutEffect(()=>{f();const m=o.current;if(!m||typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{f()});return x.observe(m),()=>x.disconnect()},[f]);const p=d.jsxs("span",{ref:o,className:bt("relative flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",e),children:[d.jsx("span",{ref:a,className:"pointer-events-none absolute -z-10 opacity-0","aria-hidden":"true",children:t||"M"}),l.isTruncated?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"shrink-0",children:l.prefix}),d.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:qW}),d.jsx("span",{className:"shrink-0",children:l.suffix})]}):d.jsx("span",{className:"truncate",children:t})]});return l.isTruncated?d.jsxs(Ix,{delayDuration:s,children:[d.jsx(Ox,{asChild:!0,children:p}),d.jsx(Lx,{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 XW(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 ZI(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 QI(t){const e=t.split("/");return e[e.length-1].replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function g8(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 qhe(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 f=XW(c);if(f===null)continue;let p=!1;for(const m of e)if(m.match(l)){n.get(m.key).items.push({key:l,displayKey:QI(l),value:f}),p=!0;break}p||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:QI(l),value:f}))}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 f=new Map(c.order.map((p,m)=>[p,m]));l.items.sort((p,m)=>{const x=f.get(p.key)??1/0,b=f.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 JI(t){const e=new Map;for(const[n,r]of Object.entries(t)){if(n==="_wandb")continue;const i=XW(r);i!==null&&e.set(n,i)}return e}function x8(t,e,n){return t.subcategories?t.subcategories.some(r=>x8(r,e,n)):t.items.some(r=>{const i=e.get(r.key),s=n.get(r.key);return!g8(i,s)})}function Xhe({runs:t,currentRunId:e,onSelect:n}){return d.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 d.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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:r.color}}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"min-w-0",children:d.jsx(y1,{text:s,className:"text-sm font-medium"})}),d.jsx("div",{className:"truncate text-xs text-muted-foreground",children:r.run_id})]}),i&&d.jsx(xy,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),r.is_tracking&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),r.is_syncing&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),r.created_at&&d.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:oy(r.created_at)})]},r.run_id)}),t.length===0&&d.jsx("div",{className:"text-sm text-muted-foreground text-center py-4",children:"No other runs available"})]})}function eO({value:t,formatted:e,isDifferent:n}){const r=e.length>20,i=d.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?d.jsxs(Ix,{children:[d.jsx(Ox,{asChild:!0,children:i}),d.jsx(Lx,{side:"top",className:"max-w-xs break-all font-sans text-xs",children:e})]}):i}function Yhe({displayKey:t,value1:e,value2:n,showOnlyDifferences:r}){const i=ZI(e),s=ZI(n),o=!g8(e,n);return r&&!o?null:d.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:[d.jsxs(Ix,{children:[d.jsx(Ox,{asChild:!0,children:d.jsx("span",{className:bt("text-sm truncate min-w-0",o?"text-foreground":"text-muted-foreground"),children:t})}),d.jsx(Lx,{side:"left",className:"text-xs",children:t})]}),d.jsx("div",{className:"min-w-0 overflow-hidden",children:d.jsx(eO,{value:e,formatted:i,isDifferent:o})}),d.jsx("div",{className:"min-w-0 overflow-hidden",children:d.jsx(eO,{value:n,formatted:s,isDifferent:o})})]})}const Khe="ml-[22px]",Zhe="ml-[38px]";function YW({category:t,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:i=!1,defaultOpen:s}){const o=x8(t,e,n),[a,l]=w.useState(s??o);if(r&&!o)return null;const c=t.subcategories&&t.subcategories.length>0;return d.jsxs(Di,{open:a,onOpenChange:l,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:bt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",i&&"ml-4",!o&&"opacity-40"),children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!a&&"-rotate-90")}),d.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),d.jsx(Ii,{children:c?d.jsx("div",{className:"mt-1",children:t.subcategories.map(f=>d.jsx(YW,{category:f,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:!0},f.key))}):d.jsx("div",{className:bt("mt-1",i?Zhe:Khe),children:t.items.map(f=>d.jsx(Yhe,{displayKey:f.displayKey,value1:e.get(f.key),value2:n.get(f.key),showOnlyDifferences:r},f.key))})})]})}function Qhe({config1:t,config2:e,run1Name:n,run2Name:r,run1Path:i,run2Path:s,run1Color:o,run2Color:a}){const[l,c]=w.useState(!0),f=w.useMemo(()=>JI(t),[t]),p=w.useMemo(()=>JI(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(()=>qhe(m),[m]),b=w.useMemo(()=>{let _=0;for(const[S,M]of f){const C=p.get(S);g8(M,C)||_++}for(const[S]of p)f.has(S)||_++;return _},[f,p]);return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between gap-4 pb-2 border-b",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(xy,{variant:"secondary",className:"text-xs",children:[b," difference",b!==1?"s":""]})}),d.jsxs(h0,{type:"single",value:l?"differences":"everything",onValueChange:_=>{_&&c(_==="differences")},variant:"outline",size:"sm",children:[d.jsx(Xa,{value:"everything",className:"text-xs px-3",children:"Everything"}),d.jsx(Xa,{value:"differences",className:"text-xs px-3",children:"Only differences"})]})]}),d.jsxs("div",{className:"grid grid-cols-[1fr_2fr_2fr] gap-3 pb-2 border-b text-sm font-medium",children:[d.jsx("span",{className:"text-muted-foreground",children:"Config"}),d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:o}}),d.jsx(y1,{text:n,className:"text-sm font-medium min-w-0"})]}),d.jsx("div",{className:"ml-4",children:d.jsx(y1,{text:i,className:"text-xs font-normal text-muted-foreground min-w-0"})})]}),d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:a}}),d.jsx(y1,{text:r,className:"text-sm font-medium min-w-0"})]}),d.jsx("div",{className:"ml-4",children:d.jsx(y1,{text:s,className:"text-xs font-normal text-muted-foreground min-w-0"})})]})]}),d.jsx(jx,{className:"h-[72vh]",children:d.jsx("div",{className:"space-y-1 pr-4",children:x.map(_=>{let S;return _.key==="hardware"&&(S=x.filter(C=>C.key!=="hardware"&&x8(C,f,p)).length===0),d.jsx(YW,{category:_,config1Map:f,config2Map:p,showOnlyDifferences:l,defaultOpen:S},_.key)})})})]})}function Jhe({currentRunId:t,currentConfig:e}){const[n,r]=w.useState(!1),[i,s]=w.useState(null),{data:o,isLoading:a}=P0(),l=(o==null?void 0:o.runs)||[],{data:c,isLoading:f}=_h(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 d.jsxs(su,{open:n,onOpenChange:N=>{N?r(!0):M()},children:[d.jsx(XT,{asChild:!0,children:d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Compare"})}),d.jsx(ou,{className:"sm:max-w-4xl max-h-[95vh]",children:i?d.jsxs(d.Fragment,{children:[d.jsx(Dc,{children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(wn,{variant:"ghost",size:"sm",onClick:S,className:"h-7 px-2",children:"← Back"}),d.jsx("div",{children:d.jsx(Pc,{children:"Configuration Comparison"})})]})}),f?d.jsxs("div",{className:"flex items-center justify-center py-16",children:[d.jsx(gl,{className:"h-6 w-6"}),d.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading configuration..."})]}):c!=null&&c.config?d.jsx(Qhe,{config1:c.config,config2:e,run1Name:A,run2Name:C,run1Path:i||"",run2Path:t,run1Color:b,run2Color:x}):d.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No configuration data available for the selected run."})]}):d.jsxs(d.Fragment,{children:[d.jsxs(Dc,{children:[d.jsx(Pc,{children:"Compare Configuration"}),d.jsxs(Um,{children:["Select another run to compare its configuration with"," ",d.jsx("span",{className:"font-sans text-foreground",children:C})]})]}),d.jsx(jx,{className:"h-[500px] pr-4",children:a?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx(gl,{className:"h-5 w-5"})}):d.jsx(Xhe,{runs:l,currentRunId:t,onSelect:_})})]})})]})}class epe{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,f=a+l;r.maxEditLength!=null&&(f=Math.min(f,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],P=x[C+1];N&&(x[C-1]=void 0);let k=!1;if(P){const R=P.oldPos-C;k=P&&0<=R&&R<a}const O=N&&N.oldPos+1<l;if(!k&&!O){x[C]=void 0;continue}if(!O||k&&N.oldPos<P.oldPos?A=this.addToPath(P,!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>f||Date.now()>m)return i(void 0);M()||C()},0)})();else for(;c<=f&&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,f=0;for(;c+1<o&&l+1<a&&this.equals(r[l+1],n[c+1],s);)c++,l++,f++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return f&&!s.oneChangePerToken&&(e.lastComponent={count:f,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 f=i[a];if(f.removed)f.value=this.join(r.slice(c,c+f.count)),c+=f.count;else{if(!f.added&&this.useLongestToken){let p=n.slice(l,l+f.count);p=p.map(function(m,x){const b=r[c+x];return b.length>m.length?b:m}),f.value=this.join(p)}else f.value=this.join(n.slice(l,l+f.count));l+=f.count,f.added||(c+=f.count)}}return i}}class tpe extends epe{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const npe=new tpe;function rpe(t,e,n){return npe.diff(t,e,n)}function ipe({runs:t,currentRunId:e,selectedCompareRunId:n,onSelect:r}){return d.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 d.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:[d.jsx("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:i.color}}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("div",{className:"min-w-0",children:d.jsx(y1,{text:a,className:"text-sm font-medium"})}),d.jsx("div",{className:"truncate text-xs text-muted-foreground",children:i.run_id})]}),s&&d.jsx(xy,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),!s&&o&&d.jsx(xy,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Comparing"}),i.is_tracking&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),i.is_syncing&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),i.created_at&&d.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:oy(i.created_at)})]},i.run_id)}),t.length===0&&d.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No other runs available."})]})}function tO({currentRunId:t,selectedCompareRunId:e,onSelectCompareRun:n,disabled:r=!1}){const[i,s]=w.useState(!1),{data:o,isLoading:a}=P0(),l=(o==null?void 0:o.runs)??[],c=l.find(x=>x.run_id===t)??null,f=(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 d.jsxs(su,{open:i,onOpenChange:x=>{s(x)},children:[d.jsx(XT,{asChild:!0,children:d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:r,children:"Compare"})}),d.jsxs(ou,{className:"sm:max-w-4xl max-h-[90vh]",children:[d.jsxs(Dc,{children:[d.jsx(Pc,{children:"Select Run To Compare"}),d.jsxs(Um,{children:["Choose another run to compare against"," ",d.jsx("span",{className:"font-sans text-foreground",children:f}),"."]})]}),e&&d.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-xs",children:[d.jsxs("span",{className:"text-muted-foreground",children:["Currently comparing with"," ",d.jsx("span",{className:"font-medium text-foreground",children:m||e})]}),d.jsx(wn,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{n(null),s(!1)},children:"Stop comparing"})]}),d.jsx(jx,{className:"h-[480px] pr-4",children:a?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx(gl,{className:"h-5 w-5"})}):d.jsx(ipe,{runs:l,currentRunId:t,selectedCompareRunId:e,onSelect:x=>{n(x),s(!1)}})})]})]})}const spe={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"]},ope=new Set(["python","bash","yaml","toml"]),ape=new Set(["sql"]);function lpe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cpe(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 upe(t){return ope.has(t)?"#.*$":ape.has(t)?"--.*$":t==="json"?null:"//.*$"}function zm(t,e){if(t.length===0)return[{text:" "}];const n=spe[e]??[],r=new Set(n),i="\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`",s=upe(e),o=n.length>0?`\\b(?:${n.map(m=>lpe(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"),f=[];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&&f.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"),f.push({text:x,className:_}),p=b+x.length}return p<t.length&&f.push({text:t.slice(p)}),f}function dpe(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 IA(t,e){const n=t.split(/\r?\n/);if(e!=="python")return n.map(s=>zm(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(...zm(b,e)),i.push(_);continue}const o=dpe(s);if(!o){i.push(zm(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(...zm(l,e)),m.push({text:s.slice(o.index),className:"text-muted-foreground"}),i.push(m),r=o.quote;continue}const c=[],f=s.slice(o.index,a+3),p=s.slice(a+3);l.length>0&&c.push(...zm(l,e)),c.push({text:f,className:"text-muted-foreground"}),p.length>0&&c.push(...zm(p,e)),i.push(c)}return i}function nO(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 fpe(t,e){const n=nO(t),r=nO(e),i=rpe(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 KW(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)?KW(e.children):void 0}})}function ZW(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 f=a?l?"common":"removed":"added";if(c.type==="directory"){const p=ZW((a==null?void 0:a.children)??[],(l==null?void 0:l.children)??[]),m=f==="common"&&p.some(x=>x.status!=="common")?"modified":f;s.push({name:c.name,path:c.path,type:"directory",status:m,children:p})}else{const p=f==="common"&&(a==null?void 0:a.hash)!=null&&(l==null?void 0:l.hash)!=null&&a.hash!==l.hash?"modified":f;s.push({name:c.name,path:c.path,type:"file",status:p})}}return s}function hpe(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 OA(t){const e=t.split("/"),n=[];for(let r=1;r<e.length;r++)n.push(e.slice(0,r).join("/"));return n}function ppe(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 QW(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=QW(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 JW(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)&&JW(r.children,e))return!0;return!1}function rO(t){const e=new Set;for(const n of t)n.type==="directory"&&e.add(n.path);return e}function mpe({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),[f,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}=P0(),N=(A==null?void 0:A.runs.find(Rt=>Rt.run_id===t))??null,P=(N==null?void 0:N.name)||t.split("/").pop()||t,k=(A==null?void 0:A.runs.find(Rt=>Rt.run_id===o))??null,O=(k==null?void 0:k.name)||(o==null?void 0:o.split("/").pop())||o,{data:R,isLoading:L,error:B}=PI(t,!!t),{data:V,isLoading:W,error:G}=PI(o||"",!!o),{data:ee,isFetching:H}=Ade(o||"",t,!!o&&!!(R!=null&&R.available)&&!!(V!=null&&V.available)&&!W),q=w.useMemo(()=>R!=null&&R.available?R.tree:[],[R]),J=w.useMemo(()=>V!=null&&V.available?V.tree:[],[V]),K=o!==null,ne=K&&!W&&(V==null?void 0:V.available)===!0,U=w.useMemo(()=>ne?ZW(J,q):KW(q),[ne,q,J]),z=rO(U),Y=n??z,j=U.length===0?null:i&&JW(U,i)?i:QW(U),le=cpe(j),ce=!!j&&Ok(q,j),X=!!j&&Ok(J,j),{data:ie,isLoading:fe,isFetching:Q,error:ue}=II(t,j??"",!!t&&!!j&&!!(R!=null&&R.available)&&ce),{data:he,isLoading:se,isFetching:Ce,error:de}=II(o??"",j??"",!!o&&!!j&&!!(V!=null&&V.available)&&X),Me=ce?ie:null,Te=X?he:null,Pe=j&&(Me==null?void 0:Me.file_path)===j?Me:null,oe=j&&(Te==null?void 0:Te.file_path)===j?Te:null,Ve=(Me==null?void 0:Me.content)??null,He=(Pe==null?void 0:Pe.content)??null,ze=(oe==null?void 0:oe.content)??null,Ge=ce?He:"",ae=X?ze:"",Z=j&&(m==null?void 0:m.targetPath)===j?m:null,we=K&&!(Ge!==null&&ae!==null)&&Z!==null,_e=we?Z.rightContent:Ge,ve=we?Z.leftContent:ae,Ue=Rt=>{r(Pt=>{const Lt=new Set(Pt??z);return Lt.has(Rt)?Lt.delete(Rt):Lt.add(Rt),Lt})},Se=(Rt,Pt)=>Rt.map(Lt=>{var gt;const ln=Lt.status==="added"?"text-emerald-700 dark:text-emerald-400":Lt.status==="removed"?"text-[#f27c7e] line-through":Lt.status==="modified"?"text-[#ab6100]":"",It=Lt.status==="added"?"text-emerald-700 dark:text-emerald-400":Lt.status==="removed"?"text-[#f27c7e]":Lt.status==="modified"?"text-[#ab6100]":"text-muted-foreground";if(Lt.type==="directory"){const _t=Y.has(Lt.path);return d.jsxs("div",{children:[d.jsxs("button",{type:"button",onClick:()=>Ue(Lt.path),className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",style:{paddingLeft:`${Pt*14+6}px`},children:[d.jsx("span",{className:bt("inline-flex h-4 w-4 items-center justify-center",It),children:_t?d.jsx(kr,{className:"h-3 w-3"}):d.jsx(r0,{className:"h-3 w-3"})}),_t?d.jsx(Pue,{className:bt("h-3.5 w-3.5",It)}):d.jsx(Oue,{className:bt("h-3.5 w-3.5",It)}),d.jsx("span",{className:bt("truncate",ln),children:Lt.name})]}),_t&&((gt=Lt.children)!=null&&gt.length)?Se(Lt.children,Pt+1):null]},Lt.path)}const Oe=j===Lt.path;return d.jsxs("button",{type:"button",ref:_t=>{_.current[Lt.path]=_t},onClick:()=>{Ft(Lt.path),s(Lt.path),K&&(p(0),S.current=!0,M.current=Lt.path)},className:bt("flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",Oe&&"bg-muted font-medium"),style:{paddingLeft:`${Pt*14+26}px`},children:[d.jsx(Rue,{className:bt("h-3.5 w-3.5",It)}),d.jsx("span",{className:bt("truncate",ln),children:Lt.name})]},Lt.path)}),ke=w.useMemo(()=>IA(Ve??"",le),[Ve,le]),qe=w.useMemo(()=>IA(ve??"",le),[ve,le]),Je=w.useMemo(()=>IA(_e??"",le),[_e,le]),nt=w.useMemo(()=>!K||!j?[]:fpe(ve??"",_e??""),[K,j,ve,_e]),tt=!!j&&K&&!we&&(ce&&Ge===null&&!ue||X&&ae===null&&!de),be=!!j&&K&&(ce&&Q||X&&Ce),Le=!ce||Pe!==null&&!fe&&!Q,Ze=!X||oe!==null&&!se&&!Ce,Ee=!!(oe!=null&&oe.is_binary),Ye=!!(Me!=null&&Me.is_binary),it=!!(Pe!=null&&Pe.is_binary),mt=K?ce?_e:X?ve:null:Ve,Qe=!!j&&mt!==null&&!(K?ce?it:X?Ee:!1:Ye),Ae=w.useMemo(()=>ppe(nt),[nt]),Xe=w.useMemo(()=>hpe(U),[U]),Re=j?Xe.indexOf(j):-1,Be=Ae.length>0?(f%Ae.length+Ae.length)%Ae.length:0,ot=Ae.length>0?Be+1:0,dt=Xe.length>0&&Re>=0?Re+1:0,Nt=w.useMemo(()=>nt.reduce((Rt,Pt)=>Rt+(Pt.kind==="add"?1:0),0),[nt]),Dt=w.useMemo(()=>nt.reduce((Rt,Pt)=>Rt+(Pt.kind==="remove"?1:0),0),[nt]),St=(ee==null?void 0:ee.added_lines)??0,Ht=(ee==null?void 0:ee.removed_lines)??0,rn=l!==null&&l===j,Ut=async()=>{!Qe||mt===null||(await navigator.clipboard.writeText(mt),c(j),setTimeout(()=>c(null),2e3))},Ft=Rt=>{K&&x({targetPath:Rt,leftContent:ve??"",rightContent:_e??""})},Bt=Rt=>{var ln;if(Ae.length===0)return;const Pt=(Be+Rt+Ae.length)%Ae.length;p(Pt);const Lt=Ae[Pt].startRowIndex;(ln=b.current[Lt])==null||ln.scrollIntoView({behavior:"smooth",block:"center"})},Kt=Rt=>{if(Xe.length===0)return;const Pt=Re<0?Rt===1?0:Xe.length-1:(Re+Rt+Xe.length)%Xe.length;if(Pt===Re)return;const Lt=Xe[Pt];Ft(Lt),s(Lt),r(ln=>{const It=new Set(ln??z);for(const Oe of OA(Lt))It.add(Oe);return It}),p(0),S.current=!0,M.current=Lt,setTimeout(()=>{var ln;(ln=_.current[Lt])==null||ln.scrollIntoView({behavior:"smooth",block:"center"})},0)},dn=()=>{if(Xe.length===0)return;const Rt=Xe[0];Ft(Rt),s(Rt),r(Pt=>{const Lt=new Set(Pt??z);for(const ln of OA(Rt))Lt.add(ln);return Lt}),p(0),S.current=!0,M.current=Rt,setTimeout(()=>{var Pt;(Pt=_.current[Rt])==null||Pt.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||!ne||C.current!==o||(C.current=null,Xe.length===0))return;const Rt=Xe[0];S.current=!0,M.current=Rt;const Pt=window.setTimeout(()=>{var Lt;j!==Rt&&(x({targetPath:Rt,leftContent:ve??"",rightContent:_e??""}),s(Rt),r(ln=>{const It=new Set(ln??rO(U));for(const Oe of OA(Rt))It.add(Oe);return It})),p(0),(Lt=_.current[Rt])==null||Lt.scrollIntoView({behavior:"smooth",block:"center"})},0);return()=>window.clearTimeout(Pt)},[K,o,ne,Xe,j,ve,_e,U]),w.useEffect(()=>{if(!K||!j||!S.current||M.current!==null&&M.current!==j||!Le||!Ze)return;const Rt=Ae.length>0?Ae[0].startRowIndex:null,Pt=requestAnimationFrame(()=>{var Lt;Rt!==null&&((Lt=b.current[Rt])==null||Lt.scrollIntoView({behavior:"smooth",block:"center"})),S.current=!1,M.current=null});return()=>cancelAnimationFrame(Pt)},[K,j,Ae,Le,Ze]),d.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[K&&O&&d.jsxs("div",{className:"flex h-9 items-center gap-2 border-b px-3 text-xs",children:[d.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[d.jsx("span",{className:"truncate font-medium",children:O}),(k==null?void 0:k.created_at)&&d.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:oy(k.created_at)})]}),d.jsx(due,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),d.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[d.jsx("span",{className:"truncate font-medium",children:P}),(N==null?void 0:N.created_at)&&d.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:oy(N.created_at)})]})]}),d.jsxs("div",{className:"ml-2 flex shrink-0 items-center gap-2 tabular-nums",children:[d.jsxs("span",{className:bt("text-emerald-700 transition-opacity dark:text-emerald-400",H&&"opacity-70"),children:["+",St]}),d.jsxs("span",{className:bt("text-red-500 transition-opacity dark:text-red-300",H&&"opacity-70"),children:["-",Ht]})]}),d.jsx(wn,{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:d.jsx(Na,{className:"h-3.5 w-3.5"})})]}),d.jsx("div",{className:"min-h-0 flex-1",children:L&&!R?d.jsx("div",{className:"h-full min-h-0"}):B?d.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d.jsx("div",{className:"flex h-10 items-center border-b px-2",children:d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[d.jsx(s2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]})}),d.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load code tree."})]}):R!=null&&R.available?d.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden grid-cols-1 lg:grid-cols-[320px_minmax(0,1fr)]",children:[d.jsxs("div",{className:"flex min-h-0 flex-col border-b lg:border-b-0 lg:border-r",children:[d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[d.jsx(s2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),d.jsx(tO,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!j})]}),d.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2",children:Se(U,0)})]}),d.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col",children:[d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-3",children:[d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:j??"Select a file"}),j&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:Ut,disabled:!Qe,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:rn?"Copied!":"Copy code",children:rn?d.jsx(D0,{className:"h-3.5 w-3.5"}):d.jsx(GT,{className:"h-3.5 w-3.5"})}),d.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:le})]}),K&&j&&d.jsxs("div",{className:"ml-1 flex shrink-0 items-center gap-2 text-[11px] tabular-nums",children:[d.jsxs("span",{className:"text-emerald-700 dark:text-emerald-400",children:["+",Nt]}),d.jsxs("span",{className:"text-red-500 dark:text-red-300",children:["-",Dt]})]})]}),d.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[d.jsx("div",{className:bt("h-full overflow-auto",K&&"pb-14"),children:j?K?W&&!V?d.jsx("div",{className:"h-full"}):G?d.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load compared run code."}):o&&!W&&V&&!V.available?d.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Compared run has no downloaded code snapshot."}):tt?d.jsx("div",{className:"h-full"}):ce&&ue&&!Pe||X&&de&&!oe?d.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load one side of the comparison."}):it||Ee?d.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Binary file comparison is not supported."}):d.jsx("div",{className:bt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",be&&"opacity-50"),children:nt.map((Rt,Pt)=>{const Lt=Rt.kind==="add"?Je[(Rt.rightLine??1)-1]??zm(Rt.text.length>0?Rt.text:" ",le):qe[(Rt.leftLine??1)-1]??zm(Rt.text.length>0?Rt.text:" ",le);return d.jsxs("div",{ref:ln=>{Rt.kind!=="context"&&(b.current[Pt]=ln)},className:bt("flex",Rt.kind==="add"&&"bg-emerald-500/18",Rt.kind==="remove"&&"bg-red-400/10"),children:[d.jsxs("div",{className:bt("sticky left-0 z-10 flex shrink-0 bg-background",Rt.kind==="add"&&"border-l-2 border-emerald-500/60",Rt.kind==="remove"&&"border-l-2 border-red-400/35"),children:[d.jsx("span",{className:bt("select-none w-6 px-1.5 py-0.5 text-right text-[11px]",Rt.kind==="add"&&"bg-emerald-500/18 text-emerald-700 dark:text-emerald-400",Rt.kind==="remove"&&"bg-red-400/10 text-red-500 dark:text-red-300",Rt.kind==="context"&&"text-muted-foreground"),children:Rt.kind==="add"?"+":Rt.kind==="remove"?"-":" "}),d.jsx("span",{className:bt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",Rt.kind==="add"&&"bg-emerald-500/18",Rt.kind==="remove"&&"bg-red-400/10"),children:Rt.leftLine??""}),d.jsx("span",{className:bt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",Rt.kind==="add"&&"bg-emerald-500/18",Rt.kind==="remove"&&"bg-red-400/10"),children:Rt.rightLine??""})]}),d.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Lt.map((ln,It)=>d.jsx("span",{className:bt(ln.className),children:ln.text},`diff-line-${Pt}-token-${It}`))})]},`diff-line-${Pt}`)})}):fe&&!Me?d.jsx("div",{className:"h-full"}):ue&&!Me?d.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load file content."}):Ye?d.jsx("div",{className:bt("p-4 text-sm text-muted-foreground transition-opacity",Q&&"opacity-50"),children:"Binary file preview is not supported."}):d.jsxs("div",{className:bt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",Q&&"opacity-50"),children:[(Me==null?void 0:Me.truncated)&&d.jsx("div",{className:"border-b px-3 py-1 text-[11px] text-muted-foreground",children:"Showing first 2MB of this file."}),ke.map((Rt,Pt)=>d.jsxs("div",{className:"flex",children:[d.jsx("div",{className:"sticky left-0 z-10 flex shrink-0 bg-background",children:d.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:Pt+1})}),d.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Rt.map((Lt,ln)=>d.jsx("span",{className:bt(Lt.className),children:Lt.text},`line-${Pt}-token-${ln}`))})]},`line-${Pt}`))]}):d.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Select a file on the left to view its source."})}),K&&j&&d.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:Ae.length===0?d.jsx("div",{className:"pointer-events-auto rounded-full border border-border/75 bg-background/90 px-2 py-1 backdrop-blur-sm",children:d.jsx(wn,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:dn,disabled:Xe.length===0,children:d.jsxs("span",{className:"inline-flex items-center gap-1",children:[d.jsx("span",{children:"See Changes"}),d.jsx(r0,{className:"h-3.5 w-3.5"})]})})}):d.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:[d.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[d.jsx(wn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Bt(-1),disabled:Ae.length===0,children:d.jsx(t8,{className:"h-3.5 w-3.5"})}),d.jsxs("span",{className:"min-w-[4rem] text-center tabular-nums",children:[ot," / ",Ae.length]}),d.jsx(wn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Bt(1),disabled:Ae.length===0,children:d.jsx(kr,{className:"h-3.5 w-3.5"})})]}),d.jsx("div",{className:"h-4 w-px bg-border"}),d.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[d.jsx(wn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Kt(-1),disabled:Xe.length===0,children:d.jsx(VT,{className:"h-3.5 w-3.5"})}),d.jsxs("span",{className:"min-w-[6rem] text-center tabular-nums",children:[dt," / ",Xe.length," files"]}),d.jsx(wn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Kt(1),disabled:Xe.length===0,children:d.jsx(r0,{className:"h-3.5 w-3.5"})})]})]})})]})]})]}):d.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[d.jsx(s2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),d.jsx(tO,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!j})]}),d.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"This run does not have a local `code/source.zip` extracted yet."})]})})]})}const iO={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 gpe({runPath:t,onBack:e}){const[n,r]=w.useState(0),[i,s]=w.useState(null),[o,a]=w.useState(null),[l,c]=w.useState([]),[f,p]=w.useState(""),[m,x]=w.useState(""),b=w.useRef(null),_=w.useRef(null),{data:S}=Ede(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}=Cde(t,n,M);w.useEffect(()=>{r(0)},[i,l,o,m]);const N=w.useCallback(B=>{p(B),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>x(B),300)},[]),P=B=>{c(V=>V.includes(B)?V.filter(W=>W!==B):[...V,B])},k=B=>new Date(B*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),O=(C==null?void 0:C.logs)??[],R=(C==null?void 0:C.total_pages)??1,L=(C==null?void 0:C.total)??0;return d.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[d.jsx(s2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),d.jsx("span",{className:"text-xs font-medium",children:"Logs"}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:[L.toLocaleString()," records"]}),A&&d.jsx("span",{className:"text-xs text-muted-foreground animate-pulse",children:"loading..."})]}),d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[((S==null?void 0:S.components.length)??0)>0&&d.jsxs(ay,{value:i??"",onValueChange:s,children:[d.jsx(cy,{size:"sm",className:"text-xs h-7 gap-1",children:d.jsx(ly,{placeholder:"Component"})}),d.jsx(uy,{children:((S==null?void 0:S.components)??[]).map(B=>d.jsx(Mx,{value:B,className:"text-xs",children:B},B))})]}),((S==null?void 0:S.sources.length)??0)>0&&d.jsxs(ay,{value:o??"",onValueChange:a,children:[d.jsx(cy,{size:"sm",className:"text-xs h-7 gap-1",children:d.jsx(ly,{placeholder:"Source"})}),d.jsx(uy,{children:((S==null?void 0:S.sources)??[]).map(B=>d.jsx(Mx,{value:B,className:"text-xs",children:B},B))})]}),d.jsx("div",{className:"flex items-center gap-1",children:((S==null?void 0:S.levels)??[]).map(B=>d.jsx("button",{onClick:()=>P(B),className:bt("px-1.5 py-0.5 text-[10px] rounded border transition-colors",l.includes(B)?"border-blue-600 bg-blue-600/10":l.length===0?"border-border hover:border-ring":"border-border text-muted-foreground/50 hover:border-ring",iO[B]??"text-muted-foreground"),children:B},B))}),d.jsxs("div",{className:"relative flex-1 max-w-xs",children:[d.jsx(ede,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),d.jsx(Jd,{type:"text",placeholder:"Search messages...",value:f,onChange:B=>N(B.target.value),className:"h-7 pl-7 pr-7 text-xs"}),f&&d.jsx("button",{onClick:()=>{p(""),x("")},className:"absolute right-2 top-1/2 -translate-y-1/2",children:d.jsx(Na,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"})})]})]}),d.jsx("div",{ref:b,className:"min-h-0 flex-1 overflow-auto font-mono text-[11px] leading-[18px]",children:O.length===0?d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:L===0?"No logs available":"No logs match filters"}):d.jsx("table",{className:"w-full",children:d.jsx("tbody",{children:O.map((B,V)=>d.jsxs("tr",{className:"hover:bg-muted/50 align-top",children:[d.jsx("td",{className:"px-2 py-px text-muted-foreground whitespace-nowrap select-none",children:k(B.timestamp)}),d.jsx("td",{className:bt("px-1 py-px whitespace-nowrap w-[60px] select-none",iO[B.level]??"text-muted-foreground"),children:B.level.substring(0,5).padEnd(5)}),d.jsx("td",{className:"px-2 py-px text-foreground whitespace-pre-wrap break-all",children:B.message})]},`${n}-${V}`))})})}),R>1&&d.jsxs("div",{className:"flex items-center justify-between px-2 border-t h-10",children:[d.jsxs("span",{className:"text-xs text-muted-foreground",children:["Page ",n+1," of ",R]}),d.jsxs("div",{className:"flex items-center gap-0.5",children:[d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:n===0,onClick:()=>r(B=>Math.max(0,B-1)),children:d.jsx(VT,{className:"h-3.5 w-3.5"})}),d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:n>=R-1,onClick:()=>r(B=>B+1),children:d.jsx(r0,{className:"h-3.5 w-3.5"})})]})]})]})}function I0({description:t}){const e=qn(qG),n=sd(XG),r=sd(YG),{data:i,isLoading:s}=P0(),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,f=(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&&!f,b=!m&&!x&&!c;return p?d.jsx("div",{className:"flex h-full items-center justify-center p-8",children:d.jsx(dd,{className:"max-w-md w-full border-dashed",children:d.jsxs(KI,{className:"items-center text-center",children:[d.jsx(E4,{children:"Fetching runs from W&B…"}),d.jsxs(A4,{className:"flex items-center gap-1.5 font-medium",children:[d.jsx(gl,{className:"h-3 w-3 shrink-0"}),(a==null?void 0:a.runs_found)??0," found"]})]})})}):b?d.jsx("div",{className:"flex h-full items-center justify-center p-8",children:d.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"})}):d.jsx("div",{className:"flex h-full items-center justify-center p-8",children:d.jsx(dd,{className:"max-w-md w-full border-dashed",children:d.jsx(KI,{className:"text-center items-center",children:m?d.jsxs(d.Fragment,{children:[d.jsx(E4,{children:"No wandb key added yet"}),d.jsx(A4,{children:"Add your W&B API key to discover and sync runs."}),d.jsx(wn,{className:"mt-4 bg-green-600 hover:bg-green-700",onClick:()=>n(!0),children:"Add wandb key"})]}):x?d.jsxs(d.Fragment,{children:[d.jsx(E4,{children:"Add a project"}),d.jsx(A4,{children:"Add a W&B project to start discovering telescope-tagged runs."}),d.jsx(wn,{className:"mt-4",onClick:()=>r(!0),children:"Add project"})]}):d.jsxs(d.Fragment,{children:[d.jsx(E4,{children:"No Run Selected"}),d.jsx(A4,{children:t})]})})})})}const xpe=!0,xa="u-",vpe="uplot",ype=xa+"hz",bpe=xa+"vt",_pe=xa+"title",Spe=xa+"wrap",wpe=xa+"under",Mpe=xa+"over",Tpe=xa+"axis",Kg=xa+"off",Cpe=xa+"select",Epe=xa+"cursor-x",Ape=xa+"cursor-y",Npe=xa+"cursor-pt",kpe=xa+"legend",Rpe=xa+"live",Dpe=xa+"inline",Ppe=xa+"series",Ipe=xa+"marker",sO=xa+"label",Ope=xa+"value",F_="width",U_="height",h_="top",oO="bottom",Bv="left",LA="right",v8="#000",aO=v8+"0",jA="mousemove",lO="mousedown",zA="mouseup",cO="mouseenter",uO="mouseleave",dO="dblclick",Lpe="resize",jpe="scroll",fO="change",K2="dppxchange",y8="--",qy=typeof window<"u",Lk=qy?document:null,D1=qy?window:null,zpe=qy?navigator:null;let Ri,N4;function jk(){let t=devicePixelRatio;Ri!=t&&(Ri=t,N4&&Fk(fO,N4,jk),N4=matchMedia(`(min-resolution: ${Ri-.001}dppx) and (max-resolution: ${Ri+.001}dppx)`),hx(fO,N4,jk),D1.dispatchEvent(new CustomEvent(K2)))}function nu(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 Rs(t,e,n){t.style[e]=n+"px"}function $d(t,e,n,r){let i=Lk.createElement(t);return e!=null&&nu(i,e),n!=null&&n.insertBefore(i,r),i}function Ku(t,e){return $d("div",t,e)}const hO=new WeakMap;function zf(t,e,n,r,i){let s="translate("+e+"px,"+n+"px)",o=hO.get(t);s!=o&&(t.style.transform=s,hO.set(t,s),e<0||n<0||e>r||n>i?nu(t,Kg):zk(t,Kg))}const pO=new WeakMap;function mO(t,e,n){let r=e+n,i=pO.get(t);r!=i&&(pO.set(t,r),t.style.background=e,t.style.borderColor=n)}const gO=new WeakMap;function xO(t,e,n,r){let i=e+""+n,s=gO.get(t);i!=s&&(gO.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 b8={passive:!0},Fpe={...b8,capture:!0};function hx(t,e,n,r){e.addEventListener(t,n,r?Fpe:b8)}function Fk(t,e,n,r){e.removeEventListener(t,n,b8)}qy&&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:hu((n+r)/2),e[i]<t?n=i:r=i;return t-e[n]<=e[r]-t?n:r}function e$(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 t$=t=>t!=null,n$=t=>t!=null&&t>0,lC=e$(t$),Upe=e$(n$);function Bpe(t,e,n,r=0,i=!1){let s=i?Upe:lC,o=i?n$:t$;[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 f=t[c];o(f)&&(f<a?a=f:f>l&&(l=f))}return[a??ts,l??-ts]}function cC(t,e,n,r){let i=bO(t),s=bO(e);t==e&&(i==-1?(t*=n,e/=n):(t/=n,e*=n));let o=n==10?gp:r$,a=i==1?hu:rd,l=s==1?rd:hu,c=a(o(da(t))),f=l(o(da(e))),p=vy(n,c),m=vy(n,f);return n==10&&(c<0&&(p=ns(p,-c)),f<0&&(m=ns(m,-f))),r||n==2?(t=p*i,e=m*s):(t=a$(t,p),e=uC(e,m)),[t,e]}function _8(t,e,n,r){let i=cC(t,e,n,r);return t==0&&(i[0]=0),e==0&&(i[1]=0),i}const S8=.1,vO={mode:3,pad:S8},eS={pad:0,soft:null,mode:0},Hpe={min:eS,max:eS};function Z2(t,e,n,r){return dC(n)?yO(t,e,n):(eS.pad=n,eS.soft=r?0:null,eS.mode=r?3:0,yO(t,e,Hpe))}function Ci(t,e){return t??e}function Vpe(t,e,n){for(e=Ci(e,0),n=Ci(n,t.length-1);e<=n;){if(t[e]!=null)return!0;e++}return!1}function yO(t,e,n){let r=n.min,i=n.max,s=Ci(r.pad,0),o=Ci(i.pad,0),a=Ci(r.hard,-ts),l=Ci(i.hard,ts),c=Ci(r.soft,ts),f=Ci(i.soft,-ts),p=Ci(r.mode,0),m=Ci(i.mode,0),x=e-t,b=gp(x),_=Xl(da(t),da(e)),S=gp(_),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&&f!=-ts&&(o=0)));let C=x||_||1e3,A=gp(C),N=vy(10,hu(A)),P=C*(x==0?t==0?.1:1:s),k=ns(a$(t-P,N/10),24),O=t>=c&&(p==1||p==3&&k<=c||p==2&&k>=c)?c:ts,R=Xl(a,k<O&&t>=O?O:Qd(O,k)),L=C*(x==0?e==0?.1:1:o),B=ns(uC(e+L,N/10),24),V=e<=f&&(m==1||m==3&&B>=f||m==2&&B<=f)?f:-ts,W=Qd(l,B>V&&e<=V?V:Xl(V,B));return R==W&&R==0&&(W=100),[R,W]}const Gpe=new Intl.NumberFormat(qy?zpe.language:"en-US"),w8=t=>Gpe.format(t),wu=Math,a2=wu.PI,da=wu.abs,hu=wu.floor,ua=wu.round,rd=wu.ceil,Qd=wu.min,Xl=wu.max,vy=wu.pow,bO=wu.sign,gp=wu.log10,r$=wu.log2,Wpe=(t,e=1)=>wu.sinh(t)*e,FA=(t,e=1)=>wu.asinh(t/e),ts=1/0;function _O(t){return(gp((t^t>>31)-(t>>31))|0)+1}function Uk(t,e,n){return Qd(Xl(t,e),n)}function i$(t){return typeof t=="function"}function ai(t){return i$(t)?t:()=>t}const $pe=()=>{},s$=t=>t,o$=(t,e)=>e,qpe=t=>null,SO=t=>!0,wO=(t,e)=>t==e,Xpe=/\.\d*?(?=9{6,}|0{6,})/gm,Tx=t=>{if(c$(t)||p0.has(t))return t;const e=`${t}`,n=e.match(Xpe);if(n==null)return t;let r=n[0].length-1;if(e.indexOf("e-")!=-1){let[i,s]=e.split("e");return+`${Tx(i)}e${s}`}return ns(t,r)};function Wg(t,e){return Tx(ns(Tx(t/e))*e)}function uC(t,e){return Tx(rd(Tx(t/e))*e)}function a$(t,e){return Tx(hu(Tx(t/e))*e)}function ns(t,e=0){if(c$(t))return t;let n=10**e,r=t*n*(1+Number.EPSILON);return ua(r)/n}const p0=new Map;function l$(t){return((""+t).split(".")[1]||"").length}function OS(t,e,n,r){let i=[],s=r.map(l$);for(let o=e;o<n;o++){let a=da(o),l=ns(vy(t,o),a);for(let c=0;c<r.length;c++){let f=t==10?+`${r[c]}e${o}`:r[c]*l,p=(o>=0?0:a)+(o>=s[c]?0:s[c]),m=t==10?f:ns(f,p);i.push(m),p0.set(m,p)}}return i}const tS={},M8=[],yy=[null,null],Fm=Array.isArray,c$=Number.isInteger,Ype=t=>t===void 0;function MO(t){return typeof t=="string"}function dC(t){let e=!1;if(t!=null){let n=t.constructor;e=n==null||n==Object}return e}function Kpe(t){return t!=null&&typeof t=="object"}const Zpe=Object.getPrototypeOf(Uint8Array),u$="__proto__";function by(t,e=dC){let n;if(Fm(t)){let r=t.find(i=>i!=null);if(Fm(r)||e(r)){n=Array(t.length);for(let i=0;i<t.length;i++)n[i]=by(t[i],e)}else n=t.slice()}else if(t instanceof Zpe)n=t.slice();else if(e(t)){n={};for(let r in t)r!=u$&&(n[r]=by(t[r],e))}else n=t;return n}function Ko(t){let e=arguments;for(let n=1;n<e.length;n++){let r=e[n];for(let i in r)i!=u$&&(dC(t[i])?Ko(t[i],by(r[i])):t[i]=by(r[i]))}return t}const Qpe=0,Jpe=1,eme=2;function tme(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 nme(t,e){if(sme(t)){let o=t[0].slice();for(let a=1;a<t.length;a++)o.push(...t[a].slice(1));return ome(o[0])||(o=ime(o)),o}let n=new Set;for(let o=0;o<t.length;o++){let l=t[o][0],c=l.length;for(let f=0;f<c;f++)n.add(l[f])}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 f=a[c],p=Array(i).fill(void 0),m=e?e[o][c]:Jpe,x=[];for(let b=0;b<f.length;b++){let _=f[b],S=s.get(l[b]);_===null?m!=Qpe&&(p[S]=_,m==eme&&x.push(S)):p[S]=_}tme(p,x,i),r.push(p)}}return r}const rme=typeof queueMicrotask>"u"?t=>Promise.resolve().then(t):queueMicrotask;function ime(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 sme(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 ome(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=Xl(1,hu((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 d$=["January","February","March","April","May","June","July","August","September","October","November","December"],f$=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function h$(t){return t.slice(0,3)}const ame=f$.map(h$),lme=d$.map(h$),cme={MMMM:d$,MMM:lme,WWWW:f$,WWW:ame};function p_(t){return(t<10?"0":"")+t}function ume(t){return(t<10?"00":t<100?"0":"")+t}const dme={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=>p_(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>p_(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>p_(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=>p_(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>p_(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>ume(t.getMilliseconds())};function T8(t,e){e=e||cme;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(t);)n.push(i[0][0]=="{"?dme[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 fme=new Intl.DateTimeFormat().resolvedOptions().timeZone;function hme(t,e){let n;return e=="UTC"||e=="Etc/UTC"?n=new Date(+t+t.getTimezoneOffset()*6e4):e==fme?n=t:(n=new Date(t.toLocaleString("en-US",{timeZone:e})),n.setMilliseconds(t.getMilliseconds())),n}const p$=t=>t%1==0,Q2=[1,2,2.5,5],pme=OS(10,-32,0,Q2),m$=OS(10,0,32,Q2),mme=m$.filter(p$),$g=pme.concat(m$),C8=`
`,g$="{YYYY}",TO=C8+g$,x$="{M}/{D}",B_=C8+x$,k4=B_+"/{YY}",v$="{aa}",gme="{h}:{mm}",g1=gme+v$,CO=C8+g1,EO=":{ss}",Bi=null;function y$(t){let e=t*1e3,n=e*60,r=n*60,i=r*24,s=i*30,o=i*365,l=(t==1?OS(10,0,3,Q2).filter(p$):OS(10,-3,0,Q2)).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,g$,Bi,Bi,Bi,Bi,Bi,Bi,1],[i*28,"{MMM}",TO,Bi,Bi,Bi,Bi,Bi,1],[i,x$,TO,Bi,Bi,Bi,Bi,Bi,1],[r,"{h}"+v$,k4,Bi,B_,Bi,Bi,Bi,1],[n,g1,k4,Bi,B_,Bi,Bi,Bi,1],[e,EO,k4+" "+g1,Bi,B_+" "+g1,Bi,CO,Bi,1],[t,EO+".{fff}",k4+" "+g1,Bi,B_+" "+g1,Bi,CO,Bi,1]];function f(p){return(m,x,b,_,S,M)=>{let C=[],A=S>=o,N=S>=s&&S<o,P=p(b),k=ns(P*t,3),O=UA(P.getFullYear(),A?0:P.getMonth(),N||A?1:P.getDate()),R=ns(O*t,3);if(N||A){let L=N?S/s:0,B=A?S/o:0,V=k==R?k:ns(UA(O.getFullYear()+B,O.getMonth()+L,1)*t,3),W=new Date(ua(V/t)),G=W.getFullYear(),ee=W.getMonth();for(let H=0;V<=_;H++){let q=UA(G+B*H,ee+L*H,1),J=q-p(ns(q*t,3));V=ns((+q+J)*t,3),V<=_&&C.push(V)}}else{let L=S>=i?i:S,B=hu(b)-hu(k),V=R+B+uC(k-R,L);C.push(V);let W=p(V),G=W.getHours()+W.getMinutes()/n+W.getSeconds()/r,ee=S/r,H=m.axes[x]._space,q=M/H;for(;V=ns(V+S,t==1?0:3),!(V>_);)if(ee>1){let J=hu(ns(G+ee,6))%24,U=p(V).getHours()-J;U>1&&(U=-1),V-=U*r,G=(G+ee)%24;let z=C[C.length-1];ns((V-z)/S,3)*q>=.7&&C.push(V)}else C.push(V)}return C}}return[l,c,f]}const[xme,vme,yme]=y$(1),[bme,_me,Sme]=y$(.001);OS(2,-53,53,[1]);function AO(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 NO(t,e){return(n,r,i,s,o)=>{let a=e.find(b=>o>=b[0])||e[e.length-1],l,c,f,p,m,x;return r.map(b=>{let _=t(b),S=_.getFullYear(),M=_.getMonth(),C=_.getDate(),A=_.getHours(),N=_.getMinutes(),P=_.getSeconds(),k=S!=l&&a[2]||M!=c&&a[3]||C!=f&&a[4]||A!=p&&a[5]||N!=m&&a[6]||P!=x&&a[7]||a[1];return l=S,c=M,f=C,p=A,m=N,x=P,k(_)})}}function wme(t,e){let n=T8(e);return(r,i,s,o,a)=>i.map(l=>n(t(l)))}function UA(t,e,n){return new Date(t,e,n)}function kO(t,e){return e(t)}const Mme="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function RO(t,e){return(n,r,i,s)=>s==null?y8:e(t(r))}function Tme(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null}function Cme(t,e){return t.series[e].fill(t,e)}const Eme={show:!0,live:!0,isolate:!1,mount:$pe,markers:{show:!0,width:2,stroke:Tme,fill:Cme,dash:"solid"},idx:null,idxs:null,values:[]};function Ame(t,e){let n=t.cursor.points,r=Ku(),i=n.size(t,e);Rs(r,F_,i),Rs(r,U_,i);let s=i/-2;Rs(r,"marginLeft",s),Rs(r,"marginTop",s);let o=n.width(t,e,i);return o&&Rs(r,"borderWidth",o),r}function Nme(t,e){let n=t.series[e].points;return n._fill||n._stroke}function kme(t,e){let n=t.series[e].points;return n._stroke||n._fill}function Rme(t,e){return t.series[e].points.size}const BA=[0,0];function Dme(t,e,n){return BA[0]=e,BA[1]=n,BA}function R4(t,e,n,r=!0){return i=>{i.button==0&&(!r||i.target==e)&&n(i)}}function HA(t,e,n,r=!0){return i=>{(!r||i.target==e)&&n(i)}}const Pme={show:!0,x:!0,y:!0,lock:!1,move:Dme,points:{one:!1,show:Ame,size:Rme,width:0,stroke:kme,fill:Nme},bind:{mousedown:R4,mouseup:R4,click:R4,dblclick:R4,mousemove:HA,mouseleave:HA,mouseenter:HA},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},b$={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},E8=Ko({},b$,{filter:o$}),_$=Ko({},E8,{size:10}),S$=Ko({},b$,{show:!1}),A8='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"',w$="bold "+A8,M$=1.5,DO={show:!0,scale:"x",stroke:v8,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:w$,side:2,grid:E8,ticks:_$,border:S$,font:A8,lineGap:M$,rotate:0},Ime="Value",Ome="Time",PO={show:!0,scale:"x",auto:!1,sorted:1,min:ts,max:-ts,idxs:[]};function Lme(t,e,n,r,i){return e.map(s=>s==null?"":w8(s))}function jme(t,e,n,r,i,s,o){let a=[],l=p0.get(i)||0;n=o?n:ns(uC(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?gp:r$,f=hu(c(n));i=vy(l,f),l==10&&(i=$g[Kd(i,$g)]);let p=n,m=i*l;l==10&&(m=$g[Kd(m,$g)]);do a.push(p),p=p+i,l==10&&!p0.has(p)&&(p=ns(p,p0.get(i))),p>=m&&(i=p,m=i*l,l==10&&(m=$g[Kd(m,$g)]));while(p<=r);return a}function zme(t,e,n,r,i,s,o){let l=t.scales[t.axes[e].scale].asinh,c=r>l?Bk(t,e,Xl(l,n),r,i):[l],f=r>=0&&n<=0?[0]:[];return(n<-l?Bk(t,e,Xl(l,-r),-n,i):[l]).reverse().map(m=>-m).concat(f,c)}const T$=/./,Fme=/[12357]/,Ume=/[125]/,IO=/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 Bme(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=t.scales[o],l=t.valToPos,c=s._space,f=l(10,o),p=l(9,o)-f>=c?T$:l(7,o)-f>=c?Fme:l(5,o)-f>=c?Ume:IO;if(p==IO){let m=da(l(1,o)-f);if(m<c)return Hk(e.slice().reverse(),a.distr,p,rd(c/m)).reverse()}return Hk(e,a.distr,p,1)}function Hme(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,T$,rd(a/c)).reverse():e}function Vme(t,e,n,r){return r==null?y8:e==null?"":w8(e)}const OO={show:!0,scale:"y",stroke:v8,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:w$,side:3,grid:E8,ticks:_$,border:S$,font:A8,lineGap:M$,rotate:0};function Gme(t,e){let n=3+(t||1)*2;return ns(n*e,3)}function Wme(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 LO={scale:null,auto:!0,sorted:0,min:ts,max:-ts},C$=(t,e,n,r,i)=>i,jO={show:!0,auto:!0,sorted:0,gaps:C$,alpha:1,facets:[Ko({},LO,{scale:"x"}),Ko({},LO,{scale:"y"})]},zO={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:C$,alpha:1,points:{show:Wme,filter:null},values:null,min:ts,max:-ts,idxs:[],path:null,clip:null};function $me(t,e,n,r,i){return n/10}const E$={time:xpe,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},qme=Ko({},E$,{time:!1,ori:1}),FO={};function A$(t,e){let n=FO[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 f=0;f<n.plots.length;f++)n.plots[f]!=i&&n.plots[f].pub(r,i,s,o,a,l,c)}},t!=null&&(FO[t]=n)),n}const _y=1,Vk=2;function zx(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],f=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 f.ori==0?n(i,l,c,f,p,S,M,m,x,b,_,hC,Xy,mC,k$,D$):n(i,l,c,f,p,M,S,x,m,_,b,pC,Yy,R8,R$,P$)}function N8(t,e){let n=0,r=0,i=Ci(t.bands,M8);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 Xme(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 xp(t,e,n,r,i,s){return zx(t,e,(o,a,l,c,f,p,m,x,b,_,S)=>{let M=o.pxRound;const C=c.dir*(c.ori==0?1:-1),A=c.ori==0?Xy:Yy;let N,P;C==1?(N=n,P=r):(N=r,P=n);let k=M(p(a[N],c,_,x)),O=M(m(l[N],f,S,b)),R=M(p(a[P],c,_,x)),L=M(m(s==1?f.max:f.min,f,S,b)),B=new Path2D(i);return A(B,R,L),A(B,k,L),A(B,k,O),B})}function fC(t,e,n,r,i,s){let o=null;if(t.length>0){o=new Path2D;const a=e==0?mC:R8;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,f=10;c>0&&a(o,l,r-f/2,c,r+s+f)}return o}function Yme(t,e,n){let r=t[t.length-1];r&&r[0]==e?r[1]=n:t.push([e,n])}function k8(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 UO(t){return t==0?s$:t==1?ua:e=>Wg(e,t)}function N$(t){let e=t==0?hC:pC,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,f=0)=>{c==0&&f==0?r(i,s,o,a,l):(c=Qd(c,a/2,l/2),f=Qd(f,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,f),n(i,s,o+l,s,o,f),n(i,s,o,s+a,o,c),i.closePath())}}const hC=(t,e,n)=>{t.moveTo(e,n)},pC=(t,e,n)=>{t.moveTo(n,e)},Xy=(t,e,n)=>{t.lineTo(e,n)},Yy=(t,e,n)=>{t.lineTo(n,e)},mC=N$(0),R8=N$(1),k$=(t,e,n,r,i,s)=>{t.arc(e,n,r,i,s)},R$=(t,e,n,r,i,s)=>{t.arc(n,e,r,i,s)},D$=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(e,n,r,i,s,o)},P$=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(n,e,i,r,o,s)};function I$(t){return(e,n,r,i,s)=>zx(e,n,(o,a,l,c,f,p,m,x,b,_,S)=>{let{pxRound:M,points:C}=o,A,N;c.ori==0?(A=hC,N=k$):(A=pC,N=R$);const P=ns(C.width*Ri,3);let k=(C.size-C.width)/2*Ri,O=ns(k*2,3),R=new Path2D,L=new Path2D,{left:B,top:V,width:W,height:G}=e.bbox;mC(L,B-O,V-O,W+O*2,G+O*2);const ee=H=>{if(l[H]!=null){let q=M(p(a[H],c,_,x)),J=M(m(l[H],f,S,b));A(R,q+k,J),N(R,q,J,k,0,a2*2)}};if(s)s.forEach(ee);else for(let H=r;H<=i;H++)ee(H);return{stroke:P>0?R:null,fill:R,clip:L,flags:_y|Vk}})}function O$(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 Kme=O$(Xy),Zme=O$(Yy);function L$(t){const e=Ci(t==null?void 0:t.alignGaps,0);return(n,r,i,s)=>zx(n,r,(o,a,l,c,f,p,m,x,b,_,S)=>{[i,s]=lC(l,i,s);let M=o.pxRound,C=G=>M(p(G,c,_,x)),A=G=>M(m(G,f,S,b)),N,P;c.ori==0?(N=Xy,P=Kme):(N=Yy,P=Zme);const k=c.dir*(c.ori==0?1:-1),O={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:_y},R=O.stroke;let L=!1;if(s-i>=_*4){let G=j=>n.posToVal(j,c.key,!0),ee=null,H=null,q,J,K,ne=C(a[k==1?i:s]),U=C(a[i]),z=C(a[s]),Y=G(k==1?U+1:z-1);for(let j=k==1?i:s;j>=i&&j<=s;j+=k){let le=a[j],X=(k==1?le<Y:le>Y)?ne:C(le),ie=l[j];X==ne?ie!=null?(J=ie,ee==null?(N(R,X,A(J)),q=ee=H=J):J<ee?ee=J:J>H&&(H=J)):ie===null&&(L=!0):(ee!=null&&P(R,ne,A(ee),A(H),A(q),A(J)),ie!=null?(J=ie,N(R,X,A(J)),ee=H=q=J):(ee=H=null,ie===null&&(L=!0)),ne=X,Y=G(ne+k))}ee!=null&&ee!=H&&K!=ne&&P(R,ne,A(ee),A(H),A(q),A(J))}else for(let G=k==1?i:s;G>=i&&G<=s;G+=k){let ee=l[G];ee===null?L=!0:ee!=null&&N(R,C(a[G]),A(ee))}let[V,W]=N8(n,r);if(o.fill!=null||V!=0){let G=O.fill=new Path2D(R),ee=o.fillTo(n,r,o.min,o.max,V),H=A(ee),q=C(a[i]),J=C(a[s]);k==-1&&([J,q]=[q,J]),N(G,J,H),N(G,q,H)}if(!o.spanGaps){let G=[];L&&G.push(...k8(a,l,i,s,k,C,e)),O.gaps=G=o.gaps(n,r,i,s,G),O.clip=fC(G,c.ori,x,b,_,S)}return W!=0&&(O.band=W==2?[xp(n,r,i,s,R,-1),xp(n,r,i,s,R,1)]:xp(n,r,i,s,R,W)),O})}function Qme(t){const e=Ci(t.align,1),n=Ci(t.ascDesc,!1),r=Ci(t.alignGaps,0),i=Ci(t.extend,!1);return(s,o,a,l)=>zx(s,o,(c,f,p,m,x,b,_,S,M,C,A)=>{[a,l]=lC(p,a,l);let N=c.pxRound,{left:P,width:k}=s.bbox,O=U=>N(b(U,m,C,S)),R=U=>N(_(U,x,A,M)),L=m.ori==0?Xy:Yy;const B={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:_y},V=B.stroke,W=m.dir*(m.ori==0?1:-1);let G=R(p[W==1?a:l]),ee=O(f[W==1?a:l]),H=ee,q=ee;i&&e==-1&&(q=P,L(V,q,G)),L(V,ee,G);for(let U=W==1?a:l;U>=a&&U<=l;U+=W){let z=p[U];if(z==null)continue;let Y=O(f[U]),j=R(z);e==1?L(V,Y,G):L(V,H,j),L(V,Y,j),G=j,H=Y}let J=H;i&&e==1&&(J=P+k,L(V,J,G));let[K,ne]=N8(s,o);if(c.fill!=null||K!=0){let U=B.fill=new Path2D(V),z=c.fillTo(s,o,c.min,c.max,K),Y=R(z);L(U,J,Y),L(U,q,Y)}if(!c.spanGaps){let U=[];U.push(...k8(f,p,a,l,W,O,r));let z=c.width*Ri/2,Y=n||e==1?z:-z,j=n||e==-1?-z:z;U.forEach(le=>{le[0]+=Y,le[1]+=j}),B.gaps=U=c.gaps(s,o,a,l,U),B.clip=fC(U,m.ori,S,M,C,A)}return ne!=0&&(B.band=ne==2?[xp(s,o,a,l,V,-1),xp(s,o,a,l,V,1)]:xp(s,o,a,l,V,ne)),B})}function BO(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 f=da(t[l]-t[a]);f<c&&(c=f,o=da(n(t[l],r,i,s)-n(t[a],r,i,s)))}a=l}}return o}function Jme(t){t=t||tS;const e=Ci(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=Ci(e[1],ts),l=Ci(e[2],1),c=Ci(t.disp,tS),f=Ci(t.each,x=>{}),{fill:p,stroke:m}=c;return(x,b,_,S)=>zx(x,b,(M,C,A,N,P,k,O,R,L,B,V)=>{let W=M.pxRound,G=n,ee=r*Ri,H=a*Ri,q=l*Ri,J,K;N.ori==0?[J,K]=s(x,b):[K,J]=s(x,b);const ne=N.dir*(N.ori==0?1:-1);let U=N.ori==0?mC:R8,z=N.ori==0?f:(ge,we,_e,ve,Ue,Se,ke)=>{f(ge,we,_e,Ue,ve,ke,Se)},Y=Ci(x.bands,M8).find(ge=>ge.series[0]==b),j=Y!=null?Y.dir:0,le=M.fillTo(x,b,M.min,M.max,j),ce=W(O(le,P,V,L)),X,ie,fe,Q=B,ue=W(M.width*Ri),he=!1,se=null,Ce=null,de=null,Me=null;p!=null&&(ue==0||m!=null)&&(he=!0,se=p.values(x,b,_,S),Ce=new Map,new Set(se).forEach(ge=>{ge!=null&&Ce.set(ge,new Path2D)}),ue>0&&(de=m.values(x,b,_,S),Me=new Map,new Set(de).forEach(ge=>{ge!=null&&Me.set(ge,new Path2D)})));let{x0:Te,size:Pe}=c;if(Te!=null&&Pe!=null){G=1,C=Te.values(x,b,_,S),Te.unit==2&&(C=C.map(_e=>x.posToVal(R+_e*B,N.key,!0)));let ge=Pe.values(x,b,_,S);Pe.unit==2?ie=ge[0]*B:ie=k(ge[0],N,B,R)-k(0,N,B,R),Q=BO(C,A,k,N,B,R,Q),fe=Q-ie+ee}else Q=BO(C,A,k,N,B,R,Q),fe=Q*o+ee,ie=Q-fe;fe<1&&(fe=0),ue>=ie/2&&(ue=0),fe<5&&(W=s$);let oe=fe>0,Ve=Q-fe-(oe?ue:0);ie=W(Uk(Ve,q,H)),X=(G==0?ie/2:G==ne?0:ie)-G*ne*((G==0?ee/2:0)+(oe?ue/2:0));const He={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},ze=he?null:new Path2D;let Ge=null;if(Y!=null)Ge=x.data[Y.series[1]];else{let{y0:ge,y1:we}=c;ge!=null&&we!=null&&(A=we.values(x,b,_,S),Ge=ge.values(x,b,_,S))}let ae=J*ie,Z=K*ie;for(let ge=ne==1?_:S;ge>=_&&ge<=S;ge+=ne){let we=A[ge];if(we==null)continue;if(Ge!=null){let nt=Ge[ge]??0;if(we-nt==0)continue;ce=O(nt,P,V,L)}let _e=N.distr!=2||c!=null?C[ge]:ge,ve=k(_e,N,B,R),Ue=O(Ci(we,le),P,V,L),Se=W(ve-X),ke=W(Xl(Ue,ce)),qe=W(Qd(Ue,ce)),Je=ke-qe;if(we!=null){let nt=we<0?Z:ae,tt=we<0?ae:Z;he?(ue>0&&de[ge]!=null&&U(Me.get(de[ge]),Se,qe+hu(ue/2),ie,Xl(0,Je-ue),nt,tt),se[ge]!=null&&U(Ce.get(se[ge]),Se,qe+hu(ue/2),ie,Xl(0,Je-ue),nt,tt)):U(ze,Se,qe+hu(ue/2),ie,Xl(0,Je-ue),nt,tt),z(x,b,ge,Se-ue/2,qe,ie+ue,Je)}}return ue>0?He.stroke=he?Me:ze:he||(He._fill=M.width==0?M._fill:M._stroke??M._fill,He.width=0),He.fill=he?Ce:ze,He})}function e0e(t,e){const n=Ci(e==null?void 0:e.alignGaps,0);return(r,i,s,o)=>zx(r,i,(a,l,c,f,p,m,x,b,_,S,M)=>{[s,o]=lC(c,s,o);let C=a.pxRound,A=J=>C(m(J,f,S,b)),N=J=>C(x(J,p,M,_)),P,k,O;f.ori==0?(P=hC,O=Xy,k=D$):(P=pC,O=Yy,k=P$);const R=f.dir*(f.ori==0?1:-1);let L=A(l[R==1?s:o]),B=L,V=[],W=[];for(let J=R==1?s:o;J>=s&&J<=o;J+=R)if(c[J]!=null){let ne=l[J],U=A(ne);V.push(B=U),W.push(N(c[J]))}const G={stroke:t(V,W,P,O,k,C),fill:null,clip:null,band:null,gaps:null,flags:_y},ee=G.stroke;let[H,q]=N8(r,i);if(a.fill!=null||H!=0){let J=G.fill=new Path2D(ee),K=a.fillTo(r,i,a.min,a.max,H),ne=N(K);O(J,B,ne),O(J,L,ne)}if(!a.spanGaps){let J=[];J.push(...k8(l,c,s,o,R,A,n)),G.gaps=J=a.gaps(r,i,s,o,J),G.clip=fC(J,f.ori,b,_,S,M)}return q!=0&&(G.band=q==2?[xp(r,i,s,o,ee,-1),xp(r,i,s,o,ee,1)]:xp(r,i,s,o,ee,q)),G})}function t0e(t){return e0e(n0e,t)}function n0e(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),f=Array(o-1),p=Array(o-1);for(let m=0;m<o-1;m++)f[m]=e[m+1]-e[m],p[m]=t[m+1]-t[m],c[m]=f[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 HO(){for(let t of Gk)t.syncRect(!0)}qy&&(hx(Lpe,D1,HO),hx(jpe,D1,HO,!0),hx(K2,D1,()=>{ss.pxRatio=Ri}));const r0e=L$(),i0e=I$();function VO(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 s0e(t,e){return t.map((n,r)=>r==0?{}:Ko({},e,n))}function Wk(t,e,n,r){return Ko({},e==0?n:r,t)}function j$(t,e,n){return e==null?yy:[e,n]}const o0e=j$;function a0e(t,e,n){return e==null?yy:Z2(e,n,S8,!0)}function z$(t,e,n,r){return e==null?yy:cC(e,n,t.scales[r].log,!1)}const l0e=z$;function F$(t,e,n,r){return e==null?yy:_8(e,n,t.scales[r].log,!1)}const c0e=F$;function u0e(t,e,n,r,i){let s=Xl(_O(t),_O(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?p0.get(l):0)<=17)return[l,c]}while(++a<n.length);return[0,0]}function GO(t){let e,n;return t=t.replace(/(\d+)px/,(r,i)=>(e=ua((n=+i)*Ri))+"px"),[t,e,n]}function d0e(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 ss(t,e,n){const r={mode:Ci(t.mode,1)},i=r.mode;function s(xe,De,$e,Ke){let ht=De.valToPct(xe);return Ke+$e*(De.dir==-1?1-ht:ht)}function o(xe,De,$e,Ke){let ht=De.valToPct(xe);return Ke+$e*(De.dir==-1?ht:1-ht)}function a(xe,De,$e,Ke){return De.ori==0?s(xe,De,$e,Ke):o(xe,De,$e,Ke)}r.valToPosH=s,r.valToPosV=o;let l=!1;r.status=0;const c=r.root=Ku(vpe);if(t.id!=null&&(c.id=t.id),nu(c,t.class),t.title){let xe=Ku(_pe,c);xe.textContent=t.title}const f=$d("canvas"),p=r.ctx=f.getContext("2d"),m=Ku(Spe,c);hx("click",m,xe=>{xe.target===b&&(ii!=_s||Wr!=Ja)&&wr.click(r,xe)},!0);const x=r.under=Ku(wpe,m);m.appendChild(f);const b=r.over=Ku(Mpe,m);t=by(t);const _=+Ci(t.pxAlign,1),S=UO(_);(t.plugins||[]).forEach(xe=>{xe.opts&&(t=xe.opts(r,t)||t)});const M=t.ms||.001,C=r.series=i==1?VO(t.series||[],PO,zO,!1):s0e(t.series||[null],jO),A=r.axes=VO(t.axes||[],DO,OO,!0),N=r.scales={},P=r.bands=t.bands||[];P.forEach(xe=>{xe.fill=ai(xe.fill||null),xe.dir=Ci(xe.dir,-1)});const k=i==2?C[1].facets[0].scale:C[0].scale,O={axes:Ra,series:ls},R=(t.drawOrder||["axes","series"]).map(xe=>O[xe]);function L(xe){const De=xe.distr==3?$e=>gp($e>0?$e:xe.clamp(r,$e,xe.min,xe.max,xe.key)):xe.distr==4?$e=>FA($e,xe.asinh):xe.distr==100?$e=>xe.fwd($e):$e=>$e;return $e=>{let Ke=De($e),{_min:ht,_max:Tt}=xe,Xt=Tt-ht;return(Ke-ht)/Xt}}function B(xe){let De=N[xe];if(De==null){let $e=(t.scales||tS)[xe]||tS;if($e.from!=null){B($e.from);let Ke=Ko({},N[$e.from],$e,{key:xe});Ke.valToPct=L(Ke),N[xe]=Ke}else{De=N[xe]=Ko({},xe==k?E$:qme,$e),De.key=xe;let Ke=De.time,ht=De.range,Tt=Fm(ht);if((xe!=k||i==2&&!Ke)&&(Tt&&(ht[0]==null||ht[1]==null)&&(ht={min:ht[0]==null?vO:{mode:1,hard:ht[0],soft:ht[0]},max:ht[1]==null?vO:{mode:1,hard:ht[1],soft:ht[1]}},Tt=!1),!Tt&&dC(ht))){let Xt=ht;ht=(Jt,cn,Cn)=>cn==null?yy:Z2(cn,Cn,Xt)}De.range=ai(ht||(Ke?o0e:xe==k?De.distr==3?l0e:De.distr==4?c0e:j$:De.distr==3?z$:De.distr==4?F$:a0e)),De.auto=ai(Tt?!1:De.auto),De.clamp=ai(De.clamp||$me),De._min=De._max=null,De.valToPct=L(De)}}}B("x"),B("y"),i==1&&C.forEach(xe=>{B(xe.scale)}),A.forEach(xe=>{B(xe.scale)});for(let xe in t.scales)B(xe);const V=N[k],W=V.distr;let G,ee;V.ori==0?(nu(c,ype),G=s,ee=o):(nu(c,bpe),G=o,ee=s);const H={};for(let xe in N){let De=N[xe];(De.min!=null||De.max!=null)&&(H[xe]={min:De.min,max:De.max},De.min=De.max=null)}const q=t.tzDate||(xe=>new Date(ua(xe/M))),J=t.fmtDate||T8,K=M==1?yme(q):Sme(q),ne=NO(q,AO(M==1?vme:_me,J)),U=RO(q,kO(Mme,J)),z=[],Y=r.legend=Ko({},Eme,t.legend),j=r.cursor=Ko({},Pme,{drag:{y:i==2}},t.cursor),le=Y.show,ce=j.show,X=Y.markers;Y.idxs=z,X.width=ai(X.width),X.dash=ai(X.dash),X.stroke=ai(X.stroke),X.fill=ai(X.fill);let ie,fe,Q,ue=[],he=[],se,Ce=!1,de={};if(Y.live){const xe=C[1]?C[1].values:null;Ce=xe!=null,se=Ce?xe(r,1,0):{_:0};for(let De in se)de[De]=y8}if(le)if(ie=$d("table",kpe,c),Q=$d("tbody",null,ie),Y.mount(r,ie),Ce){fe=$d("thead",null,ie,Q);let xe=$d("tr",null,fe);$d("th",null,xe);for(var Me in se)$d("th",sO,xe).textContent=Me}else nu(ie,Dpe),Y.live&&nu(ie,Rpe);const Te={show:!0},Pe={show:!1};function oe(xe,De){if(De==0&&(Ce||!Y.live||i==2))return yy;let $e=[],Ke=$d("tr",Ppe,Q,Q.childNodes[De]);nu(Ke,xe.class),xe.show||nu(Ke,Kg);let ht=$d("th",null,Ke);if(X.show){let Jt=Ku(Ipe,ht);if(De>0){let cn=X.width(r,De);cn&&(Jt.style.border=cn+"px "+X.dash(r,De)+" "+X.stroke(r,De)),Jt.style.background=X.fill(r,De)}}let Tt=Ku(sO,ht);xe.label instanceof HTMLElement?Tt.appendChild(xe.label):Tt.textContent=xe.label,De>0&&(X.show||(Tt.style.color=xe.width>0?X.stroke(r,De):X.fill(r,De)),He("click",ht,Jt=>{if(j._lock)return;ot(Jt);let cn=C.indexOf(xe);if((Jt.ctrlKey||Jt.metaKey)!=Y.isolate){let Cn=C.some((An,Pn)=>Pn>0&&Pn!=cn&&An.show);C.forEach((An,Pn)=>{Pn>0&&gi(Pn,Cn?Pn==cn?Te:Pe:Te,!0,ws.setSeries)})}else gi(cn,{show:!xe.show},!0,ws.setSeries)},!1),Dt&&He(cO,ht,Jt=>{j._lock||(ot(Jt),gi(C.indexOf(xe),Ss,!0,ws.setSeries))},!1));for(var Xt in se){let Jt=$d("td",Ope,Ke);Jt.textContent="--",$e.push(Jt)}return[Ke,$e]}const Ve=new Map;function He(xe,De,$e,Ke=!0){const ht=Ve.get(De)||{},Tt=j.bind[xe](r,De,$e,Ke);Tt&&(hx(xe,De,ht[xe]=Tt),Ve.set(De,ht))}function ze(xe,De,$e){const Ke=Ve.get(De)||{};for(let ht in Ke)(xe==null||ht==xe)&&(Fk(ht,De,Ke[ht]),delete Ke[ht]);xe==null&&Ve.delete(De)}let Ge=0,ae=0,Z=0,ge=0,we=0,_e=0,ve=we,Ue=_e,Se=Z,ke=ge,qe=0,Je=0,nt=0,tt=0;r.bbox={};let be=!1,Le=!1,Ze=!1,Ee=!1,Ye=!1,it=!1;function mt(xe,De,$e){($e||xe!=r.width||De!=r.height)&&ft(xe,De),tc(!1),Ze=!0,Le=!0,Qa()}function ft(xe,De){r.width=Ge=Z=xe,r.height=ae=ge=De,we=_e=0,Re(),Be();let $e=r.bbox;qe=$e.left=Wg(we*Ri,.5),Je=$e.top=Wg(_e*Ri,.5),nt=$e.width=Wg(Z*Ri,.5),tt=$e.height=Wg(ge*Ri,.5)}const Qe=3;function Ae(){let xe=!1,De=0;for(;!xe;){De++;let $e=ta(De),Ke=va(De);xe=De==Qe||$e&&Ke,xe||(ft(r.width,r.height),Le=!0)}}function Xe({width:xe,height:De}){mt(xe,De)}r.setSize=Xe;function Re(){let xe=!1,De=!1,$e=!1,Ke=!1;A.forEach((ht,Tt)=>{if(ht.show&&ht._show){let{side:Xt,_size:Jt}=ht,cn=Xt%2,Cn=ht.label!=null?ht.labelSize:0,An=Jt+Cn;An>0&&(cn?(Z-=An,Xt==3?(we+=An,Ke=!0):$e=!0):(ge-=An,Xt==0?(_e+=An,xe=!0):De=!0))}}),Rt[0]=xe,Rt[1]=$e,Rt[2]=De,Rt[3]=Ke,Z-=It[1]+It[3],we+=It[3],ge-=It[2]+It[0],_e+=It[0]}function Be(){let xe=we+Z,De=_e+ge,$e=we,Ke=_e;function ht(Tt,Xt){switch(Tt){case 1:return xe+=Xt,xe-Xt;case 2:return De+=Xt,De-Xt;case 3:return $e-=Xt,$e+Xt;case 0:return Ke-=Xt,Ke+Xt}}A.forEach((Tt,Xt)=>{if(Tt.show&&Tt._show){let Jt=Tt.side;Tt._pos=ht(Jt,Tt._size),Tt.label!=null&&(Tt._lpos=ht(Jt,Tt.labelSize))}})}if(j.dataIdx==null){let xe=j.hover,De=xe.skip=new Set(xe.skip??[]);De.add(void 0);let $e=xe.prox=ai(xe.prox),Ke=xe.bias??(xe.bias=0);j.dataIdx=(ht,Tt,Xt,Jt)=>{if(Tt==0)return Xt;let cn=Xt,Cn=$e(ht,Tt,Xt,Jt)??ts,An=Cn>=0&&Cn<ts,Pn=V.ori==0?Z:ge,ar=j.left,Jr=e[0],lr=e[Tt];if(De.has(lr[Xt])){cn=null;let xr=null,$n=null,Ln;if(Ke==0||Ke==-1)for(Ln=Xt;xr==null&&Ln-- >0;)De.has(lr[Ln])||(xr=Ln);if(Ke==0||Ke==1)for(Ln=Xt;$n==null&&Ln++<lr.length;)De.has(lr[Ln])||($n=Ln);if(xr!=null||$n!=null)if(An){let Qn=xr==null?-1/0:G(Jr[xr],V,Pn,0),Ji=$n==null?1/0:G(Jr[$n],V,Pn,0),js=ar-Qn,xi=Ji-ar;js<=xi?js<=Cn&&(cn=xr):xi<=Cn&&(cn=$n)}else cn=$n==null?xr:xr==null?$n:Xt-xr<=$n-Xt?xr:$n}else An&&da(ar-G(Jr[Xt],V,Pn,0))>Cn&&(cn=null);return cn}}const ot=xe=>{j.event=xe};j.idxs=z,j._lock=!1;let dt=j.points;dt.show=ai(dt.show),dt.size=ai(dt.size),dt.stroke=ai(dt.stroke),dt.width=ai(dt.width),dt.fill=ai(dt.fill);const Nt=r.focus=Ko({},t.focus||{alpha:.3},j.focus),Dt=Nt.prox>=0,St=Dt&&dt.one;let Ht=[],rn=[],Ut=[];function Ft(xe,De){let $e=dt.show(r,De);if($e instanceof HTMLElement)return nu($e,Npe),nu($e,xe.class),zf($e,-10,-10,Z,ge),b.insertBefore($e,Ht[De]),$e}function Bt(xe,De){if(i==1||De>0){let $e=i==1&&N[xe.scale].time,Ke=xe.value;xe.value=$e?MO(Ke)?RO(q,kO(Ke,J)):Ke||U:Ke||Vme,xe.label=xe.label||($e?Ome:Ime)}if(St||De>0){xe.width=xe.width==null?1:xe.width,xe.paths=xe.paths||r0e||qpe,xe.fillTo=ai(xe.fillTo||Xme),xe.pxAlign=+Ci(xe.pxAlign,_),xe.pxRound=UO(xe.pxAlign),xe.stroke=ai(xe.stroke||null),xe.fill=ai(xe.fill||null),xe._stroke=xe._fill=xe._paths=xe._focus=null;let $e=Gme(Xl(1,xe.width),1),Ke=xe.points=Ko({},{size:$e,width:Xl(1,$e*.2),stroke:xe.stroke,space:$e*2,paths:i0e,_stroke:null,_fill:null},xe.points);Ke.show=ai(Ke.show),Ke.filter=ai(Ke.filter),Ke.fill=ai(Ke.fill),Ke.stroke=ai(Ke.stroke),Ke.paths=ai(Ke.paths),Ke.pxAlign=xe.pxAlign}if(le){let $e=oe(xe,De);ue.splice(De,0,$e[0]),he.splice(De,0,$e[1]),Y.values.push(null)}if(ce){z.splice(De,0,null);let $e=null;St?De==0&&($e=Ft(xe,De)):De>0&&($e=Ft(xe,De)),Ht.splice(De,0,$e),rn.splice(De,0,0),Ut.splice(De,0,0)}Ls("addSeries",De)}function Kt(xe,De){De=De??C.length,xe=i==1?Wk(xe,De,PO,zO):Wk(xe,De,{},jO),C.splice(De,0,xe),Bt(C[De],De)}r.addSeries=Kt;function dn(xe){if(C.splice(xe,1),le){Y.values.splice(xe,1),he.splice(xe,1);let De=ue.splice(xe,1)[0];ze(null,De.firstChild),De.remove()}ce&&(z.splice(xe,1),Ht.splice(xe,1)[0].remove(),rn.splice(xe,1),Ut.splice(xe,1)),Ls("delSeries",xe)}r.delSeries=dn;const Rt=[!1,!1,!1,!1];function Pt(xe,De){if(xe._show=xe.show,xe.show){let $e=xe.side%2,Ke=N[xe.scale];Ke==null&&(xe.scale=$e?C[1].scale:k,Ke=N[xe.scale]);let ht=Ke.time;xe.size=ai(xe.size),xe.space=ai(xe.space),xe.rotate=ai(xe.rotate),Fm(xe.incrs)&&xe.incrs.forEach(Xt=>{!p0.has(Xt)&&p0.set(Xt,l$(Xt))}),xe.incrs=ai(xe.incrs||(Ke.distr==2?mme:ht?M==1?xme:bme:$g)),xe.splits=ai(xe.splits||(ht&&Ke.distr==1?K:Ke.distr==3?Bk:Ke.distr==4?zme:jme)),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 Tt=xe.values;xe.values=Fm(Tt)&&!Fm(Tt[0])?ai(Tt):ht?Fm(Tt)?NO(q,AO(Tt,J)):MO(Tt)?wme(q,Tt):Tt||ne:Tt||Lme,xe.filter=ai(xe.filter||(Ke.distr>=3&&Ke.log==10?Bme:Ke.distr==3&&Ke.log==2?Hme:o$)),xe.font=GO(xe.font),xe.labelFont=GO(xe.labelFont),xe._size=xe.size(r,null,De,0),xe._space=xe._rotate=xe._incrs=xe._found=xe._splits=xe._values=null,xe._size>0&&(Rt[De]=!0,xe._el=Ku(Tpe,m))}}function Lt(xe,De,$e,Ke){let[ht,Tt,Xt,Jt]=$e,cn=De%2,Cn=0;return cn==0&&(Jt||Tt)&&(Cn=De==0&&!ht||De==2&&!Xt?ua(DO.size/3):0),cn==1&&(ht||Xt)&&(Cn=De==1&&!Tt||De==3&&!Jt?ua(OO.size/2):0),Cn}const ln=r.padding=(t.padding||[Lt,Lt,Lt,Lt]).map(xe=>ai(Ci(xe,Lt))),It=r._padding=ln.map((xe,De)=>xe(r,De,Rt,0));let Oe,gt=null,_t=null;const Vt=i==1?C[0].idxs:null;let vn=null,ye=!1;function et(xe,De){if(e=xe??[],r.data=r._data=e,i==2){Oe=0;for(let $e=1;$e<C.length;$e++)Oe+=e[$e][0].length}else{e.length==0&&(r.data=r._data=e=[[]]),vn=e[0],Oe=vn.length;let $e=e;if(W==2){$e=e.slice();let Ke=$e[0]=Array(Oe);for(let ht=0;ht<Oe;ht++)Ke[ht]=ht}r._data=e=$e}if(tc(!0),Ls("setData"),W==2&&(Ze=!0),De!==!1){let $e=V;$e.auto(r,ye)?xt():To(k,$e.min,$e.max),Ee=Ee||j.left>=0,it=!0,Qa()}}r.setData=et;function xt(){ye=!0;let xe,De;i==1&&(Oe>0?(gt=Vt[0]=0,_t=Vt[1]=Oe-1,xe=e[0][gt],De=e[0][_t],W==2?(xe=gt,De=_t):xe==De&&(W==3?[xe,De]=cC(xe,xe,V.log,!1):W==4?[xe,De]=_8(xe,xe,V.log,!1):V.time?De=xe+ua(86400/M):[xe,De]=Z2(xe,De,S8,!0))):(gt=Vt[0]=xe=null,_t=Vt[1]=De=null)),To(k,xe,De)}let vt,ut,qt,en,Qt,Gt,hn,Sn,Nn,nn;function Gn(xe,De,$e,Ke,ht,Tt){xe??(xe=aO),$e??($e=M8),Ke??(Ke="butt"),ht??(ht=aO),Tt??(Tt="round"),xe!=vt&&(p.strokeStyle=vt=xe),ht!=ut&&(p.fillStyle=ut=ht),De!=qt&&(p.lineWidth=qt=De),Tt!=Qt&&(p.lineJoin=Qt=Tt),Ke!=Gt&&(p.lineCap=Gt=Ke),$e!=en&&p.setLineDash(en=$e)}function vr(xe,De,$e,Ke){De!=ut&&(p.fillStyle=ut=De),xe!=hn&&(p.font=hn=xe),$e!=Sn&&(p.textAlign=Sn=$e),Ke!=Nn&&(p.textBaseline=Nn=Ke)}function sr(xe,De,$e,Ke,ht=0){if(Ke.length>0&&xe.auto(r,ye)&&(De==null||De.min==null)){let Tt=Ci(gt,0),Xt=Ci(_t,Ke.length-1),Jt=$e.min==null?Bpe(Ke,Tt,Xt,ht,xe.distr==3):[$e.min,$e.max];xe.min=Qd(xe.min,$e.min=Jt[0]),xe.max=Xl(xe.max,$e.max=Jt[1])}}const Yn={min:null,max:null};function fr(){for(let Ke in N){let ht=N[Ke];H[Ke]==null&&(ht.min==null||H[k]!=null&&ht.auto(r,ye))&&(H[Ke]=Yn)}for(let Ke in N){let ht=N[Ke];H[Ke]==null&&ht.from!=null&&H[ht.from]!=null&&(H[Ke]=Yn)}H[k]!=null&&tc(!0);let xe={};for(let Ke in H){let ht=H[Ke];if(ht!=null){let Tt=xe[Ke]=by(N[Ke],Kpe);if(ht.min!=null)Ko(Tt,ht);else if(Ke!=k||i==2)if(Oe==0&&Tt.from==null){let Xt=Tt.range(r,null,null,Ke);Tt.min=Xt[0],Tt.max=Xt[1]}else Tt.min=ts,Tt.max=-ts}}if(Oe>0){C.forEach((Ke,ht)=>{if(i==1){let Tt=Ke.scale,Xt=H[Tt];if(Xt==null)return;let Jt=xe[Tt];if(ht==0){let cn=Jt.range(r,Jt.min,Jt.max,Tt);Jt.min=cn[0],Jt.max=cn[1],gt=Kd(Jt.min,e[0]),_t=Kd(Jt.max,e[0]),_t-gt>1&&(e[0][gt]<Jt.min&&gt++,e[0][_t]>Jt.max&&_t--),Ke.min=vn[gt],Ke.max=vn[_t]}else Ke.show&&Ke.auto&&sr(Jt,Xt,Ke,e[ht],Ke.sorted);Ke.idxs[0]=gt,Ke.idxs[1]=_t}else if(ht>0&&Ke.show&&Ke.auto){let[Tt,Xt]=Ke.facets,Jt=Tt.scale,cn=Xt.scale,[Cn,An]=e[ht],Pn=xe[Jt],ar=xe[cn];Pn!=null&&sr(Pn,H[Jt],Tt,Cn,Tt.sorted),ar!=null&&sr(ar,H[cn],Xt,An,Xt.sorted),Ke.min=Xt.min,Ke.max=Xt.max}});for(let Ke in xe){let ht=xe[Ke],Tt=H[Ke];if(ht.from==null&&(Tt==null||Tt.min==null)){let Xt=ht.range(r,ht.min==ts?null:ht.min,ht.max==-ts?null:ht.max,Ke);ht.min=Xt[0],ht.max=Xt[1]}}}for(let Ke in xe){let ht=xe[Ke];if(ht.from!=null){let Tt=xe[ht.from];if(Tt.min==null)ht.min=ht.max=null;else{let Xt=ht.range(r,Tt.min,Tt.max,Ke);ht.min=Xt[0],ht.max=Xt[1]}}}let De={},$e=!1;for(let Ke in xe){let ht=xe[Ke],Tt=N[Ke];if(Tt.min!=ht.min||Tt.max!=ht.max){Tt.min=ht.min,Tt.max=ht.max;let Xt=Tt.distr;Tt._min=Xt==3?gp(Tt.min):Xt==4?FA(Tt.min,Tt.asinh):Xt==100?Tt.fwd(Tt.min):Tt.min,Tt._max=Xt==3?gp(Tt.max):Xt==4?FA(Tt.max,Tt.asinh):Xt==100?Tt.fwd(Tt.max):Tt.max,De[Ke]=$e=!0}}if($e){C.forEach((Ke,ht)=>{i==2?ht>0&&De.y&&(Ke._paths=null):De[Ke.scale]&&(Ke._paths=null)});for(let Ke in De)Ze=!0,Ls("setScale",Ke);ce&&j.left>=0&&(Ee=it=!0)}for(let Ke in H)H[Ke]=null}function un(xe){let De=Uk(gt-1,0,Oe-1),$e=Uk(_t+1,0,Oe-1);for(;xe[De]==null&&De>0;)De--;for(;xe[$e]==null&&$e<Oe-1;)$e++;return[De,$e]}function ls(){if(Oe>0){let xe=C.some(De=>De._focus)&&nn!=Nt.alpha;xe&&(p.globalAlpha=nn=Nt.alpha),C.forEach((De,$e)=>{if($e>0&&De.show&&(jn($e,!1),jn($e,!0),De._paths==null)){let Ke=nn;nn!=De.alpha&&(p.globalAlpha=nn=De.alpha);let ht=i==2?[0,e[$e][0].length-1]:un(e[$e]);De._paths=De.paths(r,$e,ht[0],ht[1]),nn!=Ke&&(p.globalAlpha=nn=Ke)}}),C.forEach((De,$e)=>{if($e>0&&De.show){let Ke=nn;nn!=De.alpha&&(p.globalAlpha=nn=De.alpha),De._paths!=null&&ys($e,!1);{let ht=De._paths!=null?De._paths.gaps:null,Tt=De.points.show(r,$e,gt,_t,ht),Xt=De.points.filter(r,$e,Tt,ht);(Tt||Xt)&&(De.points._paths=De.points.paths(r,$e,gt,_t,Xt),ys($e,!0))}nn!=Ke&&(p.globalAlpha=nn=Ke),Ls("drawSeries",$e)}}),xe&&(p.globalAlpha=nn=1)}}function jn(xe,De){let $e=De?C[xe].points:C[xe];$e._stroke=$e.stroke(r,xe),$e._fill=$e.fill(r,xe)}function ys(xe,De){let $e=De?C[xe].points:C[xe],{stroke:Ke,fill:ht,clip:Tt,flags:Xt,_stroke:Jt=$e._stroke,_fill:cn=$e._fill,_width:Cn=$e.width}=$e._paths;Cn=ns(Cn*Ri,3);let An=null,Pn=Cn%2/2;De&&cn==null&&(cn=Cn>0?"#fff":Jt);let ar=$e.pxAlign==1&&Pn>0;if(ar&&p.translate(Pn,Pn),!De){let Jr=qe-Cn/2,lr=Je-Cn/2,xr=nt+Cn,$n=tt+Cn;An=new Path2D,An.rect(Jr,lr,xr,$n)}De?bs(Jt,Cn,$e.dash,$e.cap,cn,Ke,ht,Xt,Tt):Ps(xe,Jt,Cn,$e.dash,$e.cap,cn,Ke,ht,Xt,An,Tt),ar&&p.translate(-Pn,-Pn)}function Ps(xe,De,$e,Ke,ht,Tt,Xt,Jt,cn,Cn,An){let Pn=!1;cn!=0&&P.forEach((ar,Jr)=>{if(ar.series[0]==xe){let lr=C[ar.series[1]],xr=e[ar.series[1]],$n=(lr._paths||tS).band;Fm($n)&&($n=ar.dir==1?$n[0]:$n[1]);let Ln,Qn=null;lr.show&&$n&&Vpe(xr,gt,_t)?(Qn=ar.fill(r,Jr)||Tt,Ln=lr._paths.clip):$n=null,bs(De,$e,Ke,ht,Qn,Xt,Jt,cn,Cn,An,Ln,$n),Pn=!0}}),Pn||bs(De,$e,Ke,ht,Tt,Xt,Jt,cn,Cn,An)}const Li=_y|Vk;function bs(xe,De,$e,Ke,ht,Tt,Xt,Jt,cn,Cn,An,Pn){Gn(xe,De,$e,Ke,ht),(cn||Cn||Pn)&&(p.save(),cn&&p.clip(cn),Cn&&p.clip(Cn)),Pn?(Jt&Li)==Li?(p.clip(Pn),An&&p.clip(An),pi(ht,Xt),Sr(xe,Tt,De)):Jt&Vk?(pi(ht,Xt),p.clip(Pn),Sr(xe,Tt,De)):Jt&_y&&(p.save(),p.clip(Pn),An&&p.clip(An),pi(ht,Xt),p.restore(),Sr(xe,Tt,De)):(pi(ht,Xt),Sr(xe,Tt,De)),(cn||Cn||Pn)&&p.restore()}function Sr(xe,De,$e){$e>0&&(De instanceof Map?De.forEach((Ke,ht)=>{p.strokeStyle=vt=ht,p.stroke(Ke)}):De!=null&&xe&&p.stroke(De))}function pi(xe,De){De instanceof Map?De.forEach(($e,Ke)=>{p.fillStyle=ut=Ke,p.fill($e)}):De!=null&&xe&&p.fill(De)}function Is(xe,De,$e,Ke){let ht=A[xe],Tt;if(Ke<=0)Tt=[0,0];else{let Xt=ht._space=ht.space(r,xe,De,$e,Ke),Jt=ht._incrs=ht.incrs(r,xe,De,$e,Ke,Xt);Tt=u0e(De,$e,Jt,Ke,Xt)}return ht._found=Tt}function ji(xe,De,$e,Ke,ht,Tt,Xt,Jt,cn,Cn){let An=Xt%2/2;_==1&&p.translate(An,An),Gn(Jt,Xt,cn,Cn,Jt),p.beginPath();let Pn,ar,Jr,lr,xr=ht+(Ke==0||Ke==3?-Tt:Tt);$e==0?(ar=ht,lr=xr):(Pn=ht,Jr=xr);for(let $n=0;$n<xe.length;$n++)De[$n]!=null&&($e==0?Pn=Jr=xe[$n]:ar=lr=xe[$n],p.moveTo(Pn,ar),p.lineTo(Jr,lr));p.stroke(),_==1&&p.translate(-An,-An)}function ta(xe){let De=!0;return A.forEach(($e,Ke)=>{if(!$e.show)return;let ht=N[$e.scale];if(ht.min==null){$e._show&&(De=!1,$e._show=!1,tc(!1));return}else $e._show||(De=!1,$e._show=!0,tc(!1));let Tt=$e.side,Xt=Tt%2,{min:Jt,max:cn}=ht,[Cn,An]=Is(Ke,Jt,cn,Xt==0?Z:ge);if(An==0)return;let Pn=ht.distr==2,ar=$e._splits=$e.splits(r,Ke,Jt,cn,Cn,An,Pn),Jr=ht.distr==2?ar.map(Ln=>vn[Ln]):ar,lr=ht.distr==2?vn[ar[1]]-vn[ar[0]]:Cn,xr=$e._values=$e.values(r,$e.filter(r,Jr,Ke,An,lr),Ke,An,lr);$e._rotate=Tt==2?$e.rotate(r,xr,Ke,An):0;let $n=$e._size;$e._size=rd($e.size(r,xr,Ke,xe)),$n!=null&&$e._size!=$n&&(De=!1)}),De}function va(xe){let De=!0;return ln.forEach(($e,Ke)=>{let ht=$e(r,Ke,Rt,xe);ht!=It[Ke]&&(De=!1),It[Ke]=ht}),De}function Ra(){for(let xe=0;xe<A.length;xe++){let De=A[xe];if(!De.show||!De._show)continue;let $e=De.side,Ke=$e%2,ht,Tt,Xt=De.stroke(r,xe),Jt=$e==0||$e==3?-1:1,[cn,Cn]=De._found;if(De.label!=null){let mo=De.labelGap*Jt,Eo=ua((De._lpos+mo)*Ri);vr(De.labelFont[0],Xt,"center",$e==2?h_:oO),p.save(),Ke==1?(ht=Tt=0,p.translate(Eo,ua(Je+tt/2)),p.rotate(($e==3?-a2:a2)/2)):(ht=ua(qe+nt/2),Tt=Eo);let qc=i$(De.label)?De.label(r,xe,cn,Cn):De.label;p.fillText(qc,ht,Tt),p.restore()}if(Cn==0)continue;let An=N[De.scale],Pn=Ke==0?nt:tt,ar=Ke==0?qe:Je,Jr=De._splits,lr=An.distr==2?Jr.map(mo=>vn[mo]):Jr,xr=An.distr==2?vn[Jr[1]]-vn[Jr[0]]:cn,$n=De.ticks,Ln=De.border,Qn=$n.show?$n.size:0,Ji=ua(Qn*Ri),js=ua((De.alignTo==2?De._size-Qn-De.gap:De.gap)*Ri),xi=De._rotate*-a2/180,ci=S(De._pos*Ri),cs=(Ji+js)*Jt,zs=ci+cs;Tt=Ke==0?zs:0,ht=Ke==1?zs:0;let ia=De.font[0],zo=De.align==1?Bv:De.align==2?LA:xi>0?Bv:xi<0?LA:Ke==0?"center":$e==3?LA:Bv,Wi=xi||Ke==1?"middle":$e==2?h_:oO;vr(ia,Xt,zo,Wi);let Zs=De.font[1]*De.lineGap,Fo=Jr.map(mo=>S(a(mo,An,Pn,ar))),Oa=De._values;for(let mo=0;mo<Oa.length;mo++){let Eo=Oa[mo];if(Eo!=null){Ke==0?ht=Fo[mo]:Tt=Fo[mo],Eo=""+Eo;let qc=Eo.indexOf(`
`)==-1?[Eo]:Eo.split(/\n/gm);for(let Uo=0;Uo<qc.length;Uo++){let $x=qc[Uo];xi?(p.save(),p.translate(ht,Tt+Uo*Zs),p.rotate(xi),p.fillText($x,0,0),p.restore()):p.fillText($x,ht,Tt+Uo*Zs)}}}$n.show&&ji(Fo,$n.filter(r,lr,xe,Cn,xr),Ke,$e,ci,Ji,ns($n.width*Ri,3),$n.stroke(r,xe),$n.dash,$n.cap);let po=De.grid;po.show&&ji(Fo,po.filter(r,lr,xe,Cn,xr),Ke,Ke==0?2:1,Ke==0?Je:qe,Ke==0?tt:nt,ns(po.width*Ri,3),po.stroke(r,xe),po.dash,po.cap),Ln.show&&ji([ci],[1],Ke==0?1:0,Ke==0?1:2,Ke==1?Je:qe,Ke==1?tt:nt,ns(Ln.width*Ri,3),Ln.stroke(r,xe),Ln.dash,Ln.cap)}Ls("drawAxes")}function tc(xe){C.forEach((De,$e)=>{$e>0&&(De._paths=null,xe&&(i==1?(De.min=null,De.max=null):De.facets.forEach(Ke=>{Ke.min=null,Ke.max=null})))})}let Tl=!1,ya=!1,Os=[];function nc(){ya=!1;for(let xe=0;xe<Os.length;xe++)Ls(...Os[xe]);Os.length=0}function Qa(){Tl||(rme(Pa),Tl=!0)}function Da(xe,De=!1){Tl=!0,ya=De,xe(r),Pa(),De&&Os.length>0&&queueMicrotask(nc)}r.batch=Da;function Pa(){if(be&&(fr(),be=!1),Ze&&(Ae(),Ze=!1),Le){if(Rs(x,Bv,we),Rs(x,h_,_e),Rs(x,F_,Z),Rs(x,U_,ge),Rs(b,Bv,we),Rs(b,h_,_e),Rs(b,F_,Z),Rs(b,U_,ge),Rs(m,F_,Ge),Rs(m,U_,ae),f.width=ua(Ge*Ri),f.height=ua(ae*Ri),A.forEach(({_el:xe,_show:De,_size:$e,_pos:Ke,side:ht})=>{if(xe!=null)if(De){let Tt=ht===3||ht===0?$e:0,Xt=ht%2==1;Rs(xe,Xt?"left":"top",Ke-Tt),Rs(xe,Xt?"width":"height",$e),Rs(xe,Xt?"top":"left",Xt?_e:we),Rs(xe,Xt?"height":"width",Xt?ge:Z),zk(xe,Kg)}else nu(xe,Kg)}),vt=ut=qt=Qt=Gt=hn=Sn=Nn=en=null,nn=1,wd(!0),we!=ve||_e!=Ue||Z!=Se||ge!=ke){tc(!1);let xe=Z/Se,De=ge/ke;if(ce&&!Ee&&j.left>=0){j.left*=xe,j.top*=De,na&&zf(na,ua(j.left),0,Z,ge),ho&&zf(ho,0,ua(j.top),Z,ge);for(let $e=0;$e<Ht.length;$e++){let Ke=Ht[$e];Ke!=null&&(rn[$e]*=xe,Ut[$e]*=De,zf(Ke,rd(rn[$e]),rd(Ut[$e]),Z,ge))}}if(Kr.show&&!Ye&&Kr.left>=0&&Kr.width>0){Kr.left*=xe,Kr.width*=xe,Kr.top*=De,Kr.height*=De;for(let $e in W0)Rs(Ia,$e,Kr[$e])}ve=we,Ue=_e,Se=Z,ke=ge}Ls("setSize"),Le=!1}Ge>0&&ae>0&&(p.clearRect(0,0,f.width,f.height),Ls("drawClear"),R.forEach(xe=>xe()),Ls("draw")),Kr.show&&Ye&&(El(Kr),Ye=!1),ce&&Ee&&(sc(null,!0,!1),Ee=!1),Y.show&&Y.live&&it&&(zp(),it=!1),l||(l=!0,r.status=1,Ls("ready")),ye=!1,Tl=!1}r.redraw=(xe,De)=>{Ze=De||!1,xe!==!1?To(k,V.min,V.max):Qa()};function Vc(xe,De){let $e=N[xe];if($e.from==null){if(Oe==0){let Ke=$e.range(r,De.min,De.max,xe);De.min=Ke[0],De.max=Ke[1]}if(De.min>De.max){let Ke=De.min;De.min=De.max,De.max=Ke}if(Oe>1&&De.min!=null&&De.max!=null&&De.max-De.min<1e-16)return;xe==k&&$e.distr==2&&Oe>0&&(De.min=Kd(De.min,e[0]),De.max=Kd(De.max,e[0]),De.min==De.max&&De.max++),H[xe]=De,be=!0,Qa()}}r.setScale=Vc;let Gc,rc,na,ho,jo,Cl,_s,Ja,el,Wc,ii,Wr,ra=!1;const wr=j.drag;let wi=wr.x,zi=wr.y;ce&&(j.x&&(Gc=Ku(Epe,b)),j.y&&(rc=Ku(Ape,b)),V.ori==0?(na=Gc,ho=rc):(na=rc,ho=Gc),ii=j.left,Wr=j.top);const Kr=r.select=Ko({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),Ia=Kr.show?Ku(Cpe,Kr.over?b:x):null;function El(xe,De){if(Kr.show){for(let $e in xe)Kr[$e]=xe[$e],$e in W0&&Rs(Ia,$e,xe[$e]);De!==!1&&Ls("setSelect")}}r.setSelect=El;function ic(xe){if(C[xe].show)le&&zk(ue[xe],Kg);else if(le&&nu(ue[xe],Kg),ce){let $e=St?Ht[0]:Ht[xe];$e!=null&&zf($e,-10,-10,Z,ge)}}function To(xe,De,$e){Vc(xe,{min:De,max:$e})}function gi(xe,De,$e,Ke){De.focus!=null&&Al(xe),De.show!=null&&C.forEach((ht,Tt)=>{Tt>0&&(xe==Tt||xe==null)&&(ht.show=De.show,ic(Tt),i==2?(To(ht.facets[0].scale,null,null),To(ht.facets[1].scale,null,null)):To(ht.scale,null,null),Qa())}),$e!==!1&&Ls("setSeries",xe,De),Ke&&Cd("setSeries",r,xe,De)}r.setSeries=gi;function Eh(xe,De){Ko(P[xe],De)}function yd(xe,De){xe.fill=ai(xe.fill||null),xe.dir=Ci(xe.dir,-1),De=De??P.length,P.splice(De,0,xe)}function bd(xe){xe==null?P.length=0:P.splice(xe,1)}r.addBand=yd,r.setBand=Eh,r.delBand=bd;function df(xe,De){C[xe].alpha=De,ce&&Ht[xe]!=null&&(Ht[xe].style.opacity=De),le&&ue[xe]&&(ue[xe].style.opacity=De)}let ba,qi,Ys;const Ss={focus:!0};function Al(xe){if(xe!=Ys){let De=xe==null,$e=Nt.alpha!=1;C.forEach((Ke,ht)=>{if(i==1||ht>0){let Tt=De||ht==0||ht==xe;Ke._focus=De?null:Tt,$e&&df(ht,Tt?1:Nt.alpha)}}),Ys=xe,$e&&Qa()}}le&&Dt&&He(uO,ie,xe=>{j._lock||(ot(xe),Ys!=null&&gi(null,Ss,!0,ws.setSeries))});function Co(xe,De,$e){let Ke=N[De];$e&&(xe=xe/Ri-(Ke.ori==1?_e:we));let ht=Z;Ke.ori==1&&(ht=ge,xe=ht-xe),Ke.dir==-1&&(xe=ht-xe);let Tt=Ke._min,Xt=Ke._max,Jt=xe/ht,cn=Tt+(Xt-Tt)*Jt,Cn=Ke.distr;return Cn==3?vy(10,cn):Cn==4?Wpe(cn,Ke.asinh):Cn==100?Ke.bwd(cn):cn}function Lp(xe,De){let $e=Co(xe,k,De);return Kd($e,e[0],gt,_t)}r.valToIdx=xe=>Kd(xe,e[0]),r.posToIdx=Lp,r.posToVal=Co,r.valToPos=(xe,De,$e)=>N[De].ori==0?s(xe,N[De],$e?nt:Z,$e?qe:0):o(xe,N[De],$e?tt:ge,$e?Je:0),r.setCursor=(xe,De,$e)=>{ii=xe.left,Wr=xe.top,sc(null,De,$e)};function Ah(xe,De){Rs(Ia,Bv,Kr.left=xe),Rs(Ia,F_,Kr.width=De)}function V0(xe,De){Rs(Ia,h_,Kr.top=xe),Rs(Ia,U_,Kr.height=De)}let ff=V.ori==0?Ah:V0,_d=V.ori==1?Ah:V0;function jp(){if(le&&Y.live)for(let xe=i==2?1:0;xe<C.length;xe++){if(xe==0&&Ce)continue;let De=Y.values[xe],$e=0;for(let Ke in De)he[xe][$e++].firstChild.nodeValue=De[Ke]}}function zp(xe,De){if(xe!=null&&(xe.idxs?xe.idxs.forEach(($e,Ke)=>{z[Ke]=$e}):Ype(xe.idx)||z.fill(xe.idx),Y.idx=z[0]),le&&Y.live){for(let $e=0;$e<C.length;$e++)($e>0||i==1&&!Ce)&&Sd($e,z[$e]);jp()}it=!1,De!==!1&&Ls("setLegend")}r.setLegend=zp;function Sd(xe,De){let $e=C[xe],Ke=xe==0&&W==2?vn:e[xe],ht;Ce?ht=$e.values(r,xe,De)??de:(ht=$e.value(r,De==null?null:Ke[De],xe,De),ht=ht==null?de:{_:ht}),Y.values[xe]=ht}function sc(xe,De,$e){el=ii,Wc=Wr,[ii,Wr]=j.move(r,ii,Wr),j.left=ii,j.top=Wr,ce&&(na&&zf(na,ua(ii),0,Z,ge),ho&&zf(ho,0,ua(Wr),Z,ge));let Ke,ht=gt>_t;ba=ts,qi=null;let Tt=V.ori==0?Z:ge,Xt=V.ori==1?Z:ge;if(ii<0||Oe==0||ht){Ke=j.idx=null;for(let Jt=0;Jt<C.length;Jt++){let cn=Ht[Jt];cn!=null&&zf(cn,-10,-10,Z,ge)}Dt&&gi(null,Ss,!0,xe==null&&ws.setSeries),Y.live&&(z.fill(Ke),it=!0)}else{let Jt,cn,Cn;i==1&&(Jt=V.ori==0?ii:Wr,cn=Co(Jt,k),Ke=j.idx=Kd(cn,e[0],gt,_t),Cn=G(e[0][Ke],V,Tt,0));let An=-10,Pn=-10,ar=0,Jr=0,lr=!0,xr="",$n="";for(let Ln=i==2?1:0;Ln<C.length;Ln++){let Qn=C[Ln],Ji=z[Ln],js=Ji==null?null:i==1?e[Ln][Ji]:e[Ln][1][Ji],xi=j.dataIdx(r,Ln,Ke,cn),ci=xi==null?null:i==1?e[Ln][xi]:e[Ln][1][xi];if(it=it||ci!=js||xi!=Ji,z[Ln]=xi,Ln>0&&Qn.show){let cs=xi==null?-10:xi==Ke?Cn:G(i==1?e[0][xi]:e[Ln][0][xi],V,Tt,0),zs=ci==null?-10:ee(ci,i==1?N[Qn.scale]:N[Qn.facets[1].scale],Xt,0);if(Dt&&ci!=null){let ia=V.ori==1?ii:Wr,zo=da(Nt.dist(r,Ln,xi,zs,ia));if(zo<ba){let Wi=Nt.bias;if(Wi!=0){let Zs=Co(ia,Qn.scale),Fo=ci>=0?1:-1,Oa=Zs>=0?1:-1;Oa==Fo&&(Oa==1?Wi==1?ci>=Zs:ci<=Zs:Wi==1?ci<=Zs:ci>=Zs)&&(ba=zo,qi=Ln)}else ba=zo,qi=Ln}}if(it||St){let ia,zo;V.ori==0?(ia=cs,zo=zs):(ia=zs,zo=cs);let Wi,Zs,Fo,Oa,po,mo,Eo=!0,qc=dt.bbox;if(qc!=null){Eo=!1;let Uo=qc(r,Ln);Fo=Uo.left,Oa=Uo.top,Wi=Uo.width,Zs=Uo.height}else Fo=ia,Oa=zo,Wi=Zs=dt.size(r,Ln);if(mo=dt.fill(r,Ln),po=dt.stroke(r,Ln),St)Ln==qi&&ba<=Nt.prox&&(An=Fo,Pn=Oa,ar=Wi,Jr=Zs,lr=Eo,xr=mo,$n=po);else{let Uo=Ht[Ln];Uo!=null&&(rn[Ln]=Fo,Ut[Ln]=Oa,xO(Uo,Wi,Zs,Eo),mO(Uo,mo,po),zf(Uo,rd(Fo),rd(Oa),Z,ge))}}}}if(St){let Ln=Nt.prox,Qn=Ys==null?ba<=Ln:ba>Ln||qi!=Ys;if(it||Qn){let Ji=Ht[0];Ji!=null&&(rn[0]=An,Ut[0]=Pn,xO(Ji,ar,Jr,lr),mO(Ji,xr,$n),zf(Ji,rd(An),rd(Pn),Z,ge))}}}if(Kr.show&&ra)if(xe!=null){let[Jt,cn]=ws.scales,[Cn,An]=ws.match,[Pn,ar]=xe.cursor.sync.scales,Jr=xe.cursor.drag;if(wi=Jr._x,zi=Jr._y,wi||zi){let{left:lr,top:xr,width:$n,height:Ln}=xe.select,Qn=xe.scales[Pn].ori,Ji=xe.posToVal,js,xi,ci,cs,zs,ia=Jt!=null&&Cn(Jt,Pn),zo=cn!=null&&An(cn,ar);ia&&wi?(Qn==0?(js=lr,xi=$n):(js=xr,xi=Ln),ci=N[Jt],cs=G(Ji(js,Pn),ci,Tt,0),zs=G(Ji(js+xi,Pn),ci,Tt,0),ff(Qd(cs,zs),da(zs-cs))):ff(0,Tt),zo&&zi?(Qn==1?(js=lr,xi=$n):(js=xr,xi=Ln),ci=N[cn],cs=ee(Ji(js,ar),ci,Xt,0),zs=ee(Ji(js+xi,ar),ci,Xt,0),_d(Qd(cs,zs),da(zs-cs))):_d(0,Xt)}else Ks()}else{let Jt=da(el-jo),cn=da(Wc-Cl);if(V.ori==1){let ar=Jt;Jt=cn,cn=ar}wi=wr.x&&Jt>=wr.dist,zi=wr.y&&cn>=wr.dist;let Cn=wr.uni;Cn!=null?wi&&zi&&(wi=Jt>=Cn,zi=cn>=Cn,!wi&&!zi&&(cn>Jt?zi=!0:wi=!0)):wr.x&&wr.y&&(wi||zi)&&(wi=zi=!0);let An,Pn;wi&&(V.ori==0?(An=_s,Pn=ii):(An=Ja,Pn=Wr),ff(Qd(An,Pn),da(Pn-An)),zi||_d(0,Xt)),zi&&(V.ori==1?(An=_s,Pn=ii):(An=Ja,Pn=Wr),_d(Qd(An,Pn),da(Pn-An)),wi||ff(0,Tt)),!wi&&!zi&&(ff(0,0),_d(0,0))}if(wr._x=wi,wr._y=zi,xe==null){if($e){if(Hp!=null){let[Jt,cn]=ws.scales;ws.values[0]=Jt!=null?Co(V.ori==0?ii:Wr,Jt):null,ws.values[1]=cn!=null?Co(V.ori==1?ii:Wr,cn):null}Cd(jA,r,ii,Wr,Z,ge,Ke)}if(Dt){let Jt=$e&&ws.setSeries,cn=Nt.prox;Ys==null?ba<=cn&&gi(qi,Ss,!0,Jt):ba>cn?gi(null,Ss,!0,Jt):qi!=Ys&&gi(qi,Ss,!0,Jt)}}it&&(Y.idx=Ke,zp()),De!==!1&&Ls("setCursor")}let oc=null;Object.defineProperty(r,"rect",{get(){return oc==null&&wd(!1),oc}});function wd(xe=!1){xe?oc=null:(oc=b.getBoundingClientRect(),Ls("syncRect",oc))}function G0(xe,De,$e,Ke,ht,Tt,Xt){j._lock||ra&&xe!=null&&xe.movementX==0&&xe.movementY==0||(Fp(xe,De,$e,Ke,ht,Tt,Xt,!1,xe!=null),xe!=null?sc(null,!0,!0):sc(De,!0,!1))}function Fp(xe,De,$e,Ke,ht,Tt,Xt,Jt,cn){if(oc==null&&wd(!1),ot(xe),xe!=null)$e=xe.clientX-oc.left,Ke=xe.clientY-oc.top;else{if($e<0||Ke<0){ii=-10,Wr=-10;return}let[Cn,An]=ws.scales,Pn=De.cursor.sync,[ar,Jr]=Pn.values,[lr,xr]=Pn.scales,[$n,Ln]=ws.match,Qn=De.axes[0].side%2==1,Ji=V.ori==0?Z:ge,js=V.ori==1?Z:ge,xi=Qn?Tt:ht,ci=Qn?ht:Tt,cs=Qn?Ke:$e,zs=Qn?$e:Ke;if(lr!=null?$e=$n(Cn,lr)?a(ar,N[Cn],Ji,0):-10:$e=Ji*(cs/xi),xr!=null?Ke=Ln(An,xr)?a(Jr,N[An],js,0):-10:Ke=js*(zs/ci),V.ori==1){let ia=$e;$e=Ke,Ke=ia}}cn&&(De==null||De.cursor.event.type==jA)&&(($e<=1||$e>=Z-1)&&($e=Wg($e,Z)),(Ke<=1||Ke>=ge-1)&&(Ke=Wg(Ke,ge))),Jt?(jo=$e,Cl=Ke,[_s,Ja]=j.move(r,$e,Ke)):(ii=$e,Wr=Ke)}const W0={width:0,height:0,left:0,top:0};function Ks(){El(W0,!1)}let $0,q0,X0,Y0;function Cu(xe,De,$e,Ke,ht,Tt,Xt){ra=!0,wi=zi=wr._x=wr._y=!1,Fp(xe,De,$e,Ke,ht,Tt,Xt,!0,!1),xe!=null&&(He(zA,Lk,Md,!1),Cd(lO,r,_s,Ja,Z,ge,null));let{left:Jt,top:cn,width:Cn,height:An}=Kr;$0=Jt,q0=cn,X0=Cn,Y0=An}function Md(xe,De,$e,Ke,ht,Tt,Xt){ra=wr._x=wr._y=!1,Fp(xe,De,$e,Ke,ht,Tt,Xt,!1,!0);let{left:Jt,top:cn,width:Cn,height:An}=Kr,Pn=Cn>0||An>0,ar=$0!=Jt||q0!=cn||X0!=Cn||Y0!=An;if(Pn&&ar&&El(Kr),wr.setScale&&Pn&&ar){let Jr=Jt,lr=Cn,xr=cn,$n=An;if(V.ori==1&&(Jr=cn,lr=An,xr=Jt,$n=Cn),wi&&To(k,Co(Jr,k),Co(Jr+lr,k)),zi)for(let Ln in N){let Qn=N[Ln];Ln!=k&&Qn.from==null&&Qn.min!=ts&&To(Ln,Co(xr+$n,Ln),Co(xr,Ln))}Ks()}else j.lock&&(j._lock=!j._lock,sc(De,!0,xe!=null));xe!=null&&(ze(zA,Lk),Cd(zA,r,ii,Wr,Z,ge,null))}function Up(xe,De,$e,Ke,ht,Tt,Xt){if(j._lock)return;ot(xe);let Jt=ra;if(ra){let cn=!0,Cn=!0,An=10,Pn,ar;V.ori==0?(Pn=wi,ar=zi):(Pn=zi,ar=wi),Pn&&ar&&(cn=ii<=An||ii>=Z-An,Cn=Wr<=An||Wr>=ge-An),Pn&&cn&&(ii=ii<_s?0:Z),ar&&Cn&&(Wr=Wr<Ja?0:ge),sc(null,!0,!0),ra=!1}ii=-10,Wr=-10,z.fill(null),sc(null,!0,!0),Jt&&(ra=Jt)}function Bp(xe,De,$e,Ke,ht,Tt,Xt){j._lock||(ot(xe),xt(),Ks(),xe!=null&&Cd(dO,r,ii,Wr,Z,ge,null))}function K0(){A.forEach(d0e),mt(r.width,r.height,!0)}hx(K2,D1,K0);const ac={};ac.mousedown=Cu,ac.mousemove=G0,ac.mouseup=Md,ac.dblclick=Bp,ac.setSeries=(xe,De,$e,Ke)=>{let ht=ws.match[2];$e=ht(r,De,$e),$e!=-1&&gi($e,Ke,!0,!1)},ce&&(He(lO,b,Cu),He(jA,b,G0),He(cO,b,xe=>{ot(xe),wd(!1)}),He(uO,b,Up),He(dO,b,Bp),Gk.add(r),r.syncRect=wd);const Td=r.hooks=t.hooks||{};function Ls(xe,De,$e){ya?Os.push([xe,De,$e]):xe in Td&&Td[xe].forEach(Ke=>{Ke.call(null,r,De,$e)})}(t.plugins||[]).forEach(xe=>{for(let De in xe.hooks)Td[De]=(Td[De]||[]).concat(xe.hooks[De])});const Eu=(xe,De,$e)=>$e,ws=Ko({key:null,setSeries:!1,filters:{pub:SO,sub:SO},scales:[k,C[1]?C[1].scale:null],match:[wO,wO,Eu],values:[null,null]},j.sync);ws.match.length==2&&ws.match.push(Eu),j.sync=ws;const Hp=ws.key,Nh=A$(Hp);function Cd(xe,De,$e,Ke,ht,Tt,Xt){ws.filters.pub(xe,De,$e,Ke,ht,Tt,Xt)&&Nh.pub(xe,De,$e,Ke,ht,Tt,Xt)}Nh.sub(r);function Vp(xe,De,$e,Ke,ht,Tt,Xt){ws.filters.sub(xe,De,$e,Ke,ht,Tt,Xt)&&ac[xe](null,De,$e,Ke,ht,Tt,Xt)}r.pub=Vp;function Au(){Nh.unsub(r),Gk.delete(r),Ve.clear(),Fk(K2,D1,K0),c.remove(),ie==null||ie.remove(),Ls("destroy")}r.destroy=Au;function $c(){Ls("init",t,e),et(e||t.data,!1),H[k]?Vc(k,H[k]):xt(),Ye=Kr.show&&(Kr.width>0||Kr.height>0),Ee=it=!0,mt(t.width,t.height)}return C.forEach(Bt),A.forEach(Pt),n?n instanceof HTMLElement?(n.appendChild(c),$c()):n(r,$c):$c(),r}ss.assign=Ko;ss.fmtNum=w8;ss.rangeNum=Z2;ss.rangeLog=cC;ss.rangeAsinh=_8;ss.orient=zx;ss.pxRatio=Ri;ss.join=nme;ss.fmtDate=T8,ss.tzDate=hme;ss.sync=A$;{ss.addGap=Yme,ss.clipGaps=fC;let t=ss.paths={points:I$};t.linear=L$,t.stepped=Qme,t.bars=Jme,t.spline=t0e}const f0e=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"]),D8=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 rs({label:t,onRemove:e}){return d.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,d.jsx(Na,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function O0(){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?ql.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function L0({isFullscreen:t,onClick:e}){return d.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?d.jsx(qT,{className:"h-3 w-3"}):d.jsx($T,{className:"h-3 w-3"})})}function gC(t){if(t.length<4)return null;const e=[...t].sort((c,f)=>c-f),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 U$(t){return t.split("/").pop()||t}function wp(t){var n;return((n=t.runName)==null?void 0:n.trim())||U$(t.runPath)}const h0e=A1-1,WO="max-w-[190px]";function H_(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function p0e(t){const e=H_(t),{isTruncated:n,prefix:r,suffix:i}=vW(t,h0e);return n?`<span class="inline-flex ${WO} min-w-0 items-center align-bottom" title="${e}"><span class="shrink-0">${H_(r)}</span><span class="shrink-0 px-0.5 text-muted-foreground/70">...</span><span class="shrink-0">${H_(i)}</span></span>`:`<span class="inline-block ${WO} truncate align-bottom" title="${e}">${H_(r)}</span>`}function Ow(t){const e=p0e(wp(t)),n=H_(U$(t.runPath));return`${e} <span class="text-muted-foreground/70">(${n})</span>`}function B$(t){const e=Math.abs(t);if(e>=60)return nC(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 yu(t)}const m0e=28;function g0e(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,f=l<t.length?t[l]:void 0,p=c!=null,m=f!=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 D4(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const x0e={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 v0e(t){const e={...x0e};if(t.length>0){const n=t.map(r=>({prefix:`reward_${r}`,label:y0e(r)}));e.samples_metrics={title:"Samples Metrics",prefixes:n}}return e}function y0e(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const H$=["mean","std","min","max"],V$={mean:"Mean",std:"Std",min:"Min",max:"Max"};function j0(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",f=(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:f});return m.observe(p),()=>{m.disconnect(),a.current&&clearTimeout(a.current)}},[t,l,c,f]),r||s}function b0e({runs:t,shouldPoll:e,maxStep:n,maxTime:r,showEma:i=!1,emaSpan:s=10,hoveredRunId:o=null,availableRewardNames:a=[],availableSampleTags:l,availableEnvs:c,customMetricSections:f={},xAxisMode:p="step",scrollRoot:m=null,evalsList:x=[]}){var Je,nt,tt,be,Le,Ze,Ee,Ye,it,mt,ft,Qe,Ae,Xe,Re,Be,ot,dt,Nt,Dt;const[b,_]=w.useState({}),[S,M]=w.useState(!0),[C,A]=w.useState(!0),[N,P]=w.useState(!0),[k,O]=w.useState(!0),[R,L]=w.useState({}),[B,V]=w.useState(!0),[W,G]=w.useState(!0),[ee,H]=w.useState(!0),[q,J]=w.useState(!0),[K,ne]=w.useState(!0),[U,z]=w.useState(!0),Y=w.useMemo(()=>v0e(a),[a]),j=p==="time",le=Vr(((Je=t[0])==null?void 0:Je.runPath)||"",j&&!!t[0],e),ce=Vr(((nt=t[1])==null?void 0:nt.runPath)||"",j&&!!t[1],e),X=Vr(((tt=t[2])==null?void 0:tt.runPath)||"",j&&!!t[2],e),ie=Vr(((be=t[3])==null?void 0:be.runPath)||"",j&&!!t[3],e),fe=Vr(((Le=t[4])==null?void 0:Le.runPath)||"",j&&!!t[4],e),Q=Vr(((Ze=t[5])==null?void 0:Ze.runPath)||"",j&&!!t[5],e),ue=Vr(((Ee=t[6])==null?void 0:Ee.runPath)||"",j&&!!t[6],e),he=Vr(((Ye=t[7])==null?void 0:Ye.runPath)||"",j&&!!t[7],e),se=Vr(((it=t[8])==null?void 0:it.runPath)||"",j&&!!t[8],e),Ce=Vr(((mt=t[9])==null?void 0:mt.runPath)||"",j&&!!t[9],e),de=Vr(((ft=t[10])==null?void 0:ft.runPath)||"",j&&!!t[10],e),Me=Vr(((Qe=t[11])==null?void 0:Qe.runPath)||"",j&&!!t[11],e),Te=Vr(((Ae=t[12])==null?void 0:Ae.runPath)||"",j&&!!t[12],e),Pe=Vr(((Xe=t[13])==null?void 0:Xe.runPath)||"",j&&!!t[13],e),oe=Vr(((Re=t[14])==null?void 0:Re.runPath)||"",j&&!!t[14],e),Ve=Vr(((Be=t[15])==null?void 0:Be.runPath)||"",j&&!!t[15],e),He=Vr(((ot=t[16])==null?void 0:ot.runPath)||"",j&&!!t[16],e),ze=Vr(((dt=t[17])==null?void 0:dt.runPath)||"",j&&!!t[17],e),Ge=Vr(((Nt=t[18])==null?void 0:Nt.runPath)||"",j&&!!t[18],e),ae=Vr(((Dt=t[19])==null?void 0:Dt.runPath)||"",j&&!!t[19],e),{isStepTimesFetching:Z,isStepTimesRefetching:ge}=w.useMemo(()=>{if(!j)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const St=[le,ce,X,ie,fe,Q,ue,he,se,Ce,de,Me,Te,Pe,oe,Ve,He,ze,Ge,ae],Ht=St.some(Ft=>Ft.isFetching),rn=St.filter(Ft=>Ft.isFetching),Ut=Ht&&rn.length>0&&rn.every(Ft=>!!Ft.data);return{isStepTimesFetching:Ht,isStepTimesRefetching:Ut}},[j,le,ce,X,ie,fe,Q,ue,he,se,Ce,de,Me,Te,Pe,oe,Ve,He,ze,Ge,ae]),{stepTimesByRun:we,firstStepTimesByRun:_e}=w.useMemo(()=>{if(!j)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const St=[le,ce,X,ie,fe,Q,ue,he,se,Ce,de,Me,Te,Pe,oe,Ve,He,ze,Ge,ae],Ht=new Map,rn=new Map;return t.forEach((Ut,Ft)=>{if(Ft>=20)return;const Kt=St[Ft].data;if(!Kt||Kt.first_step_time===null||Kt.first_step_time===void 0||!Kt.step_times||Kt.step_times.length===0)return;const dn=new Map;Kt.step_times.forEach(Rt=>{typeof Rt.time=="number"&&dn.set(Rt.step,Rt.time)}),dn.size>0&&(Ht.set(Ut.runPath,dn),rn.set(Ut.runPath,Kt.first_step_time))}),{stepTimesByRun:Ht,firstStepTimesByRun:rn}},[t,j,le,ce,X,ie,fe,Q,ue,he,se,Ce,de,Me,Te,Pe,oe,Ve,He,ze,Ge,ae]),ve={xAxisMode:p,stepTimesByRun:we,firstStepTimesByRun:_e,isStepTimesFetching:Z,isStepTimesRefetching:ge,scrollRoot:m,maxStepLimit:n,maxTimeLimit:r},Ue=w.useMemo(()=>Object.keys(f),[f]),Se=w.useCallback(St=>{_(Ht=>({...Ht,[St]:!(Ht[St]??!0)}))},[]),ke=w.useCallback(St=>{L(Ht=>({...Ht,[St]:!(Ht[St]??!0)}))},[]),qe=x.length>0;return d.jsxs("div",{className:"-mt-3",children:[Ue.map((St,Ht)=>{const rn=b[St]??!0,Ut=f[St]??{},Ft=Object.entries(Ut);return d.jsxs("div",{children:[Ht>0&&d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:rn,onOpenChange:()=>Se(St),children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!rn&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:D4(St)})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"space-y-4 mt-3 mb-4",children:Ft.map(([Bt,Kt])=>d.jsxs("div",{children:[Bt&&d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:D4(Bt)}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Kt.map(dn=>d.jsx(er,{runs:t,shouldPoll:e,metricName:dn,label:D4(dn),showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve},dn))})]},Bt))})})]})]},St)}),Ue.length>0&&d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:S,onOpenChange:M,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!S&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:Y.reward.title})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Y.reward.prefixes.map(St=>d.jsx(Tg,{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"?d.jsx(er,{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))})})]}),Y.samples_metrics&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:C,onOpenChange:A,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!C&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:Y.samples_metrics.title})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Y.samples_metrics.prefixes.map(St=>d.jsx(Tg,{runs:t,shouldPoll:e,prefix:St.prefix,label:St.label,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve,extraCharts:d.jsx(er,{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))})})]})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:N,onOpenChange:P,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!N&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:Y.advantage.title})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Y.advantage.prefixes.map(St=>d.jsx(Tg,{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&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:k,onOpenChange:O,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!k&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Evals"})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"mt-3 mb-4 space-y-4",children:x.map((St,Ht)=>{const rn=St.eval_name,Ut=St.available_rollout_metric_names,Ft=R[rn]??!0;return d.jsxs("div",{children:[Ht>0&&d.jsx("div",{className:"border-t border-gray-100 my-3"}),d.jsxs(Di,{open:Ft,onOpenChange:()=>ke(rn),children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-3.5 w-3.5 text-muted-foreground transition-transform",!Ft&&"-rotate-90")}),d.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:rn})]})})}),d.jsx(Ii,{children:d.jsxs("div",{className:"space-y-6 mt-3",children:[Ut.map(Bt=>d.jsx(P4,{runs:t,shouldPoll:e,evalName:rn,prefix:`reward_${Bt}`,label:D4(Bt),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},`${rn}-reward_${Bt}`)),d.jsx(P4,{runs:t,shouldPoll:e,evalName:rn,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}),d.jsx(P4,{runs:t,shouldPoll:e,evalName:rn,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}),d.jsx(P4,{runs:t,shouldPoll:e,evalName:rn,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})]})})]})]},rn)})})})]})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:B,onOpenChange:V,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!B&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:Y.rollouts.title})]})})}),d.jsx(Ii,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[Y.rollouts.prefixes.map(St=>d.jsx(Tg,{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)),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"General"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ve}),d.jsx(er,{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}),d.jsx(er,{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})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Off-Policy Steps"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"off_policy_steps_mean",label:"Off-Policy Steps (Mean)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{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?d.jsx(e5,{runPath:St.runPath,metricType:"off_policy_steps",label:"Off-Policy Steps (Dist. Over Time)",shouldPoll:e,scrollRoot:m}):null})()]})]})]})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:W,onOpenChange:G,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!W&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Discarded Rollouts"})]})})}),d.jsx(Ii,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Discarded Rollouts General"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_count",label:"Discarded Count",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_pct",label:"Discarded Zero Advantage %",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_max_async_pct",label:"Discarded Max Async %",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_stop_reason_length_pct",label:"Discarded % Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_group_length_gini_mean",label:"Discarded Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_group_length_max_median_ratio_mean",label:"Discarded Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Zero Advantage Breakdown"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_zero_pct",label:"Discarded Zero Advantage (All Reward = 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_positive_pct",label:"Discarded Zero Advantage (All Reward > 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_mean_reward",label:"Discarded Zero Advantage Mean Reward",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Canceled"}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:d.jsx(er,{runs:t,shouldPoll:e,metricName:"canceled_count",label:"Canceled Count",showEma:i,emaSpan:s,hoveredRunId:o,...ve})})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Off-Policy Steps"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_off_policy_steps_mean",label:"Discarded Off-Policy Steps (Mean)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"discarded_off_policy_steps_std",label:"Discarded Off-Policy Steps (Std)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),(()=>{const St=t.find(Ht=>Ht.isSelected)??t[0];return St?d.jsx(e5,{runPath:St.runPath,metricType:"discarded_off_policy_steps",label:"Discarded Off-Policy Steps (Dist. Over Time)",shouldPoll:e,scrollRoot:m}):null})()]})]}),d.jsx(Tg,{runs:t,shouldPoll:e,prefix:"discarded_length_prompt",label:"Discarded Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(Tg,{runs:t,shouldPoll:e,prefix:"discarded_length_completion",label:"Discarded Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(Tg,{runs:t,shouldPoll:e,prefix:"discarded_length_sum",label:"Discarded Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:ee,onOpenChange:H,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!ee&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Timeline Trainer"})]})})}),d.jsx(Ii,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Full Step (Total Time)"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_step_total",label:"Time per Step",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_step_active",label:"Time per Step Active (Excl. Wait)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_microbatch_count",label:"Microbatches per Step",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_forward_total",label:"Timing Forward",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_backward_total",label:"Timing Backward",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_total",label:"Timing Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_total",label:"Timing Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_total",label:"Timing Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_total",label:"Timing Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_total",label:"Timing Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_waiting_for_data",label:"Timing Waiting for Data",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_trainer_total",label:"Timing Weight Broadcast (Trainer)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_inference_total",label:"Timing Weight Broadcast (Inference)",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Microbatch (Mean Time per Microbatch)"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_forward_microbatch_mean",label:"Microbatch Timing Forward",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_backward_microbatch_mean",label:"Microbatch Timing Backward",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_microbatch_mean",label:"Microbatch Timing Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_microbatch_mean",label:"Microbatch Timing Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_microbatch_mean",label:"Microbatch Timing Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_microbatch_mean",label:"Microbatch Timing Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_microbatch_mean",label:"Microbatch Timing Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]})]})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:q,onOpenChange:J,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!q&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Timeline Inference"})]})})}),d.jsx(Ii,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Batch & Averages"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_save_batch_total",label:"Batch Completion (Save Batch)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_avg_inference_time",label:"Avg Generation Time",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_avg_compute_reward_time",label:"Avg Compute Reward Time",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Time Breakdown (% of Step Time)"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_generation_normal_pct",label:"Inference % Generation (Normal)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_generation_discarded_pct",label:"Inference % Generation (Discarded)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_generation_canceled_pct",label:"Inference % Generation (Canceled)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_generation_all_pct",label:"Inference % Generation (All)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_normal_pct",label:"Inference % Compute Reward (Normal)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_discarded_pct",label:"Inference % Compute Reward (Discarded)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_canceled_pct",label:"Inference % Compute Reward (Canceled)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_all_pct",label:"Inference % Compute Reward (All)",showEma:i,emaSpan:s,hoveredRunId:o,...ve}),d.jsx(er,{runs:t,shouldPoll:e,metricName:"timing_idle_pct",label:"Inference % Idle Time",showEma:i,emaSpan:s,hoveredRunId:o,...ve})]})]})]})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:K,onOpenChange:ne,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!K&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Inference Performance"})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"mt-3 mb-4",children:t[0]&&d.jsx(T0e,{runs:t,shouldPoll:e,hoveredRunId:o,scrollRoot:m})})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:U,onOpenChange:z,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!U&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Trainer Performance"})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"mt-3 mb-4",children:t[0]&&d.jsx(N0e,{runs:t,shouldPoll:e,hoveredRunId:o,scrollRoot:m})})})]})]})}const J2=100;function _0e(t,e,n){const r=t.length;if(r<=J2)return{steps:t,counts:e};const i=Math.ceil(r/J2),s=[],o=[],a=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),f=Math.floor((l+c-1)/2);s.push(t[f]);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 e5({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,shouldPoll:s,scrollRoot:o=null,headerPrefix:a,headerSuffix:l}){const c=qn(as),{isFullscreen:f,toggleFullscreen:p,fullscreenPortal:m}=O0(),x=w.useRef(null),b=w.useRef(null),_=w.useRef(null),S=w.useRef(null),M=w.useRef(null),[C,A]=w.useState(0),P=j0(x,{root:o,threshold:0})||f,{data:k,isFetching:O,isRefetching:R}=mW(t,e,P&&!!t&&!!e,s),L=k&&k.steps.length>0&&k.bin_edges.length>0,B=L&&k.steps.length>J2,V=w.useMemo(()=>!L||!k?null:B?_0e(k.steps,k.counts,k.bin_edges):{steps:k.steps,counts:k.counts},[L,k,B]),W=w.useCallback(K=>K==null?"N/A":i?Math.round(K).toLocaleString():vu(K),[i]),G=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]),ee=w.useCallback(()=>{const K={top:8,right:8,bottom:24,left:40};if(!_.current||!k)return K;const ne=_.current.getContext("2d");if(!ne)return K;const U="10px system-ui, sans-serif",z=5;let Y=0;ne.save(),ne.setTransform(1,0,0,1,0,0),ne.font=U;for(let j=0;j<z;j++){const le=(k.global_min??0)+j/(z-1)*((k.global_max??0)-(k.global_min??0)),ce=G(le);Y=Math.max(Y,ne.measureText(ce).width)}return ne.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(Y)+12)}},[k,G]);w.useEffect(()=>{if(!b.current||!_.current||!L||!k||!V)return;const K=b.current,ne=_.current,U=ne.getContext("2d");if(!U)return;const z=K.clientWidth,Y=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)",ce="10px system-ui, sans-serif",X=window.devicePixelRatio||1;ne.width=z*X,ne.height=Y*X,ne.style.width=`${z}px`,ne.style.height=`${Y}px`,U.scale(X,X),U.font=ce,U.clearRect(0,0,z,Y);const ie=ee(),fe=z-ie.left-ie.right,Q=Y-ie.top-ie.bottom,ue=V.steps,he=k.bin_edges,se=V.counts,Ce=ue.length,de=he.length-1;if(Ce===0||de===0)return;let Me=0;for(const ae of se)for(const Z of ae)Z>Me&&(Me=Z);const Te=Math.min(5,Ce),Pe=5,oe=fe/Math.max(Ce,1),Ve=ae=>ie.left+(ae+.5)*oe,He=ae=>{const Z=(k.global_max??1)-(k.global_min??0),ge=(ae-(k.global_min??0))/(Z||1);return ie.top+Q-ge*Q},ze=ae=>ae===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(ae/Me)*.75})`;U.strokeStyle=le,U.lineWidth=1;for(let ae=0;ae<Te;ae++){const Z=Math.floor(ae/Math.max(Te-1,1)*(Ce-1)),ge=Ve(Z);U.beginPath(),U.moveTo(ge,ie.top),U.lineTo(ge,Y-ie.bottom),U.stroke()}for(let ae=0;ae<Pe;ae++){const Z=(k.global_min??0)+ae/(Pe-1)*((k.global_max??0)-(k.global_min??0)),ge=He(Z);U.beginPath(),U.moveTo(ie.left,ge),U.lineTo(z-ie.right,ge),U.stroke()}const Ge=oe;for(let ae=0;ae<Ce;ae++){const Z=ie.left+ae*oe,ge=se[ae];for(let we=0;we<de;we++){const _e=ge[we];if(_e===0)continue;const ve=he[we+1],Ue=he[we],Se=He(ve),ke=He(Ue),qe=Math.max(1,ke-Se);U.fillStyle=ze(_e),U.fillRect(Z,Se,Ge,qe)}}if(r&&(k.global_min??0)<0&&(k.global_max??0)>0){const ae=He(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(ie.left,ae),U.lineTo(z-ie.right,ae),U.stroke(),U.setLineDash([])}U.strokeStyle=j,U.lineWidth=1,U.beginPath(),U.moveTo(ie.left,Y-ie.bottom),U.lineTo(z-ie.right,Y-ie.bottom),U.stroke(),U.beginPath(),U.moveTo(ie.left,ie.top),U.lineTo(ie.left,Y-ie.bottom),U.stroke(),U.fillStyle=j,U.font=ce,U.textAlign="center";for(let ae=0;ae<Te;ae++){const Z=Math.floor(ae/Math.max(Te-1,1)*(Ce-1)),ge=ue[Z],we=Ve(Z),_e=ge>=1e3?`${(ge/1e3).toFixed(0)}k`:ge.toString();U.fillText(_e,we,Y-6)}U.textAlign="right",U.textBaseline="middle";for(let ae=0;ae<Pe;ae++){const Z=(k.global_min??0)+ae/(Pe-1)*((k.global_max??0)-(k.global_min??0)),ge=He(Z);U.fillText(G(Z),ie.left-4,ge)}},[k,V,L,r,G,ee,c,C,f]),w.useEffect(()=>{if(!b.current)return;const K=b.current,ne=new ResizeObserver(()=>{A(U=>U+1)});return ne.observe(K),()=>{ne.disconnect()}},[]);const H=w.useCallback(K=>{var _e;if(!k||!V||!S.current||!_.current||!b.current)return;const ne=_.current.getBoundingClientRect(),U=K.clientX-ne.left,z=K.clientY-ne.top,Y=b.current.clientWidth,j=b.current.clientHeight||200,le=ee(),ce=Y-le.left-le.right,X=j-le.top-le.bottom;if(ce<=0||X<=0){M.current&&(M.current.style.display="none");return}if(U<le.left||U>Y-le.right||z<le.top||z>j-le.bottom){S.current.style.display="none",M.current&&(M.current.style.display="none");return}const ie=(U-le.left)/ce,fe=Math.min(V.steps.length-1,Math.max(0,Math.round(ie*(V.steps.length-1)))),Q=V.steps[fe];if(M.current){const ve=ce/Math.max(V.steps.length,1),Ue=le.left+(fe+.5)*ve;M.current.style.display="block",M.current.style.left=`${Ue}px`,M.current.style.top=`${le.top}px`,M.current.style.bottom=`${le.bottom}px`}const ue=1-(z-le.top)/X,he=k.bin_edges.length-1,se=Math.min(he-1,Math.max(0,Math.floor(ue*he))),Ce=k.bin_edges[se],de=k.bin_edges[se+1],Me=((_e=V.counts[fe])==null?void 0:_e[se])??0,Pe=(V.counts[fe]??[]).reduce((ve,Ue)=>ve+Ue,0),oe=Pe>0?(Me/Pe*100).toFixed(1):"0.0",He=B&&k.steps.length>J2?" (aggregated)":"";S.current.innerHTML=`
        <div class="font-medium mb-1">Step ${Q.toLocaleString()}${He}</div>
        <div class="text-muted-foreground">Range: ${W(Ce)} to ${W(de)}</div>
        <div class="text-muted-foreground">Count: ${Me.toLocaleString()} (${oe}%)</div>
      `,S.current.style.display="block",S.current.style.left="0px",S.current.style.top="0px";const ze=S.current.getBoundingClientRect(),Ge=K.clientX;let ae=Ge;ae+ze.width+20>window.innerWidth&&(ae=Ge-ze.width);const Z=Math.max(4,window.innerWidth-ze.width-4);ae=Math.min(Math.max(4,ae),Z);const ge=b.current.getBoundingClientRect();let we=ge.top-ze.height+20;we<4&&(we=ge.top+8),S.current.style.left=`${ae-ze.left}px`,S.current.style.top=`${we-ze.top}px`},[k,V,W,ee,B]),q=w.useCallback(()=>{S.current&&(S.current.style.display="none"),M.current&&(M.current.style.display="none")},[]),J=O&&!R;return m(d.jsxs("div",{ref:x,className:bt("group/chart bg-background",f?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!f&&J&&"opacity-50"),children:[d.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[!f&&a,d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",f?"text-sm":"text-xs"),title:n,children:n})}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsx(L0,{isFullscreen:f,onClick:p}),!f&&l]})]}),L?d.jsxs("div",{className:bt("relative bg-background rounded",f?"flex-1 min-h-0":"h-[200px]"),ref:b,children:[d.jsx("canvas",{className:"block w-full h-full max-w-full",ref:_,onMouseMove:H,onMouseLeave:q}),d.jsx("div",{ref:M,className:"absolute z-[2] border-l border-dashed border-gray-500/70 pointer-events-none",style:{display:"none"}}),d.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"}}),R&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:bt("flex items-center justify-center text-muted-foreground text-xs rounded",f?"flex-1 min-h-0":"h-[200px]"),children:O?"Loading...":"No data"})]}))}function S0e(t,e,n,r,i,s){const o=w.useMemo(()=>t.slice(0,20).map(c=>c.runPath).filter(Boolean),[t]),a=Fde(o,e,n?[n]:[],i&&o.length>0&&!!n,r,s);return{metricsByRunPath:w.useMemo(()=>{var f,p;const c=new Map;return(p=(f=a.data)==null?void 0:f.runs)==null||p.forEach(m=>{c.set(m.run_path,m.metrics??[])}),c},[a.data]),isFetching:a.isFetching,isRefetching:a.isFetching&&!!a.data}}function G$({runs:t,shouldPoll:e,evalName:n,metricName:r,label:i,unit:s,showZeroLine:o,statType:a,isTokenMetric:l,showEma:c=!1,emaSpan:f=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:P,availableEnvs:k,filterKey:O}){const R=qn(as),{isFullscreen:L,toggleFullscreen:B,fullscreenPortal:V}=O0(),W=w.useRef(null),G=w.useRef(null),ee=w.useRef(null),H=w.useRef(null),[q,J]=fn(aW),K=w.useMemo(()=>`eval-metric-${n}-${r}`,[n,r]),ne=w.useRef(!1),U=w.useRef(!1);w.useEffect(()=>{const Ae=Re=>{(Re.key==="Control"||Re.key==="Meta")&&(U.current=!0)},Xe=Re=>{(Re.key==="Control"||Re.key==="Meta")&&(U.current=!1,J(null))};return window.addEventListener("keydown",Ae),window.addEventListener("keyup",Xe),()=>{window.removeEventListener("keydown",Ae),window.removeEventListener("keyup",Xe)}},[J]);const z=O??`eval/${n}/${r}`,[Y,j]=fn(Q7),ce=D8.has(r),X=Y[z],ie=(X==null?void 0:X.ignoreOutliers)??!1,fe=(X==null?void 0:X.ignoreFirstStep)??ce,Q=(X==null?void 0:X.minY)??null,ue=(X==null?void 0:X.maxY)??null,he=(X==null?void 0:X.tagFilters)??{},se=(X==null?void 0:X.envFilters)??[],Ce=Object.keys(he).length>0,de=se.length>0,Me=w.useCallback(Ae=>{j(Xe=>{const Re={ignoreOutliers:!1,ignoreFirstStep:ce,minY:null,maxY:null,tagFilters:{},envFilters:[]},Be=Xe[z]??Re,ot=Ae(Be);if(ot.ignoreOutliers===Re.ignoreOutliers&&ot.ignoreFirstStep===Re.ignoreFirstStep&&ot.minY===Re.minY&&ot.maxY===Re.maxY&&Object.keys(ot.tagFilters??{}).length===0&&(ot.envFilters??[]).length===0){if(!Object.prototype.hasOwnProperty.call(Xe,z))return Xe;const Nt={...Xe};return delete Nt[z],Nt}return{...Xe,[z]:ot}})},[z,j,ce]),Te=w.useCallback(Ae=>{Me(Xe=>({...Xe,ignoreOutliers:Ae}))},[Me]),Pe=w.useCallback(Ae=>{Me(Xe=>({...Xe,ignoreFirstStep:Ae}))},[Me]),oe=w.useCallback(Ae=>{Me(Xe=>({...Xe,minY:Ae}))},[Me]),Ve=w.useCallback(Ae=>{Me(Xe=>({...Xe,maxY:Ae}))},[Me]),He=w.useCallback((Ae,Xe)=>{Me(Re=>{const Be={...Re.tagFilters??{}},ot=Be[Ae]??[];if(ot.includes(Xe)){const dt=ot.filter(Nt=>Nt!==Xe);dt.length===0?delete Be[Ae]:Be[Ae]=dt}else Be[Ae]=[...ot,Xe];return{...Re,tagFilters:Be}})},[Me]),ze=w.useCallback(Ae=>{Me(Xe=>{const Re=[...Xe.envFilters??[]],Be=Re.indexOf(Ae);return Be>=0?Re.splice(Be,1):Re.push(Ae),{...Xe,envFilters:Re}})},[Me]),ae=j0(W,{root:M,threshold:0})||L,Z=w.useMemo(()=>{const Ae=t.filter(Re=>!Re.isSelected),Xe=t.filter(Re=>Re.isSelected);return[...Ae,...Xe]},[t]),ge=w.useMemo(()=>Z.slice(0,20),[Z]),we=w.useMemo(()=>{const Ae=new Map;return ge.forEach((Xe,Re)=>{Ae.set(Xe.runPath,Re)}),Ae},[ge]),{metricsByRunPath:_e,isFetching:ve,isRefetching:Ue}=S0e(t,n,r,e,ae,se),{uplotData:Se,seriesConfig:ke,isFetching:qe,isRefetching:Je,hasData:nt,timeToStepByRun:tt,outlierBounds:be}=w.useMemo(()=>{const Ae=new Set,Xe=new Map,Re=new Map,Be=new Map,ot=m==="time"&&!!x&&!!b,dt=ve;Z.forEach((Bt,Kt)=>{if(Kt>=20)return;const dn=_e.get(Bt.runPath)??[],Rt=new Map;if(dn.forEach(Pt=>{Ae.add(Pt.step),Rt.set(Pt.step,Pt.value)}),Xe.set(Kt,Rt),ot){const Pt=x==null?void 0:x.get(Bt.runPath),Lt=b==null?void 0:b.get(Bt.runPath);if(Pt&&Lt!==void 0){const ln=new Map,It=new Map;Pt.forEach((Oe,gt)=>{const _t=Oe-Lt;ln.set(gt,_t),It.set(_t,gt)}),Re.set(Kt,ln),Be.set(Kt,It)}}});const Nt=()=>!(!dt&&!_||dt&&!Ue||_&&!S);if(Ae.size===0)return{uplotData:null,seriesConfig:[],isFetching:dt||_,isRefetching:Nt(),hasData:!1,timeToStepByRun:Be,outlierBounds:null};let Dt=Array.from(Ae).sort((Bt,Kt)=>Bt-Kt);C!=null&&!ot&&(Dt=Dt.filter(Bt=>Bt<=C));let St=Dt;if(ot){const Bt=new Set;if(Xe.forEach((dn,Rt)=>{const Pt=Re.get(Rt);Pt&&dn.forEach((Lt,ln)=>{const It=Pt.get(ln);It!==void 0&&Bt.add(It)})}),Bt.size===0)return{uplotData:null,seriesConfig:[],isFetching:dt||_,isRefetching:Nt(),hasData:!1,timeToStepByRun:Be,outlierBounds:null};let Kt=Array.from(Bt).sort((dn,Rt)=>dn-Rt);A!=null&&(Kt=Kt.filter(dn=>dn<=A)),St=Kt}let Ht=null;if(ie){const Bt=[];Xe.forEach(Kt=>{Kt.forEach(dn=>{Bt.push(dn)})}),Ht=gC(Bt)}const rn=new Float64Array(St),Ut=[{label:ot?"Time (s)":"Step"}],Ft=[rn];return Z.forEach((Bt,Kt)=>{if(Kt>=20)return;const dn=Xe.get(Kt)||new Map;let Rt;if(ot){const It=Re.get(Kt),Oe=new Map;It&&dn.forEach((gt,_t)=>{const Vt=It.get(_t);Vt!==void 0&&Oe.set(Vt,gt)}),Rt=St.map(gt=>Oe.get(gt)??null)}else Rt=Dt.map(It=>dn.get(It)??null);const Pt=p===Bt.runPath,ln=p!==null&&!Pt?.1:c?.3:1;Ft.push(Rt),Ut.push({label:wp(Bt),stroke:Bt.color,width:1,alpha:ln,spanGaps:!0,points:{show:!1}})}),c&&Z.forEach((Bt,Kt)=>{if(Kt>=20)return;const dn=Xe.get(Kt)||new Map,Rt=2/(f+1);let Pt=null,Lt;if(ot){const gt=Re.get(Kt),_t=new Map;Dt.forEach(Vt=>{const vn=dn.get(Vt);if(vn!==void 0){Pt=Pt===null?vn:Rt*vn+(1-Rt)*Pt;const ye=gt==null?void 0:gt.get(Vt);ye!==void 0&&Pt!==null&&_t.set(ye,Pt)}}),Lt=St.map(Vt=>_t.get(Vt)??null)}else{const gt=[];Dt.forEach(_t=>{const Vt=dn.get(_t);Vt!==void 0?(Pt=Pt===null?Vt:Rt*Vt+(1-Rt)*Pt,gt.push(Pt)):gt.push(null)}),Lt=gt}const ln=p===Bt.runPath,Oe=p!==null&&!ln?.1:1;Ft.push(Lt),Ut.push({label:`${wp(Bt)} (EMA)`,stroke:Bt.color,width:1.5,alpha:Oe,spanGaps:!0,points:{show:!1}})}),{uplotData:Ft,seriesConfig:Ut,isFetching:dt||_,isRefetching:Nt(),hasData:!0,timeToStepByRun:Be,outlierBounds:Ht}},[Z,_e,ve,Ue,c,f,p,m,x,b,_,S,C,A,ie]),Le=a||r.split("_").pop()||"",Ze=m==="time",Ee=w.useCallback(Ae=>Ae==null?"N/A":l&&(Le==="min"||Le==="max")?Math.round(Ae).toLocaleString():vu(Ae),[l,Le]),Ye=w.useCallback(Ae=>Math.abs(Ae)>=1e3?`${parseFloat((Ae/1e3).toFixed(1))}k`:l?Le==="min"||Le==="max"?Math.round(Ae).toString():String(parseFloat(Ae.toFixed(1))):Number.isInteger(Ae)?Ae.toLocaleString():Math.abs(Ae)<.01&&Ae!==0?Ae.toExponential(1):String(parseFloat(Ae.toFixed(2))),[l,Le]),it=w.useCallback(Ae=>Ze?yu(Ae):Ae>=1e3?`${(Ae/1e3).toFixed(0)}k`:Ae.toString(),[Ze]);w.useEffect(()=>{if(!G.current||!Se||!nt)return;const Ae=G.current,Xe=Ae.clientWidth,Re=Ae.clientHeight||200;let Be=1/0,ot=-1/0;for(let Pt=1;Pt<Se.length;Pt++){const Lt=Se[Pt];for(let ln=0;ln<Lt.length;ln++){if(fe&&ln===0)continue;const It=Lt[ln];It!=null&&(ie&&be?It>=be.lower&&It<=be.upper&&(It<Be&&(Be=It),It>ot&&(ot=It)):(It<Be&&(Be=It),It>ot&&(ot=It)))}}Be===1/0&&be&&(Be=be.lower,ot=be.upper);const dt=ot-Be,Nt=Math.max(Math.abs(ot),Math.abs(Be)),Dt=Math.max(Nt*.05,1e-10),St=Math.max(dt*.1,Dt);let Ht,rn;o?(Ht=Math.min(Be-St,0),rn=Math.max(ot+St,0)):(Ht=Be-St,rn=ot+St),Q!==null&&(Ht=Q),ue!==null&&(rn=ue);const Ut=R?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Ft=R?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Kt={width:Xe,height:Re,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,rn]}},axes:[{stroke:Ft,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:(Pt,Lt)=>Lt.map(it)},{stroke:Ft,grid:{stroke:Ut,width:1},ticks:{stroke:Ut,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Pt,Lt)=>{if(!Lt||Lt.length===0)return 40;const ln=Math.max(...Lt.map(It=>It.length));return Math.max(40,ln*7+14)},values:(Pt,Lt)=>Lt.map(Ye)}],series:ke,hooks:{draw:[Pt=>{var gt,_t;if(!Se)return;const Lt=Se[0],ln=Math.min(Z.length,20),It=Pt.series.length,Oe=Pt.ctx;Oe.save();for(let Vt=1;Vt<It;Vt++){const vn=Se[Vt];if(!vn)continue;let ye=-1;for(let Gt=vn.length-1;Gt>=0;Gt--)if(vn[Gt]!==null&&vn[Gt]!==void 0){ye=Gt;break}if(ye===-1)continue;const et=Lt[ye],xt=vn[ye];if(et===void 0||xt===void 0||xt===null)continue;const vt=Pt.valToPos(Number(et),"x",!0),ut=Pt.valToPos(Number(xt),"y",!0);if(!Number.isFinite(vt)||!Number.isFinite(ut))continue;const qt=Pt.series[Vt],en=typeof(qt==null?void 0:qt.alpha)=="number"?qt.alpha:1;let Qt=typeof(qt==null?void 0:qt.stroke)=="string"?qt.stroke:void 0;if(!Qt){const Gt=Vt-1;if(Gt<ln)Qt=(gt=Z[Gt])==null?void 0:gt.color;else if(c){const hn=Gt-ln;hn>=0&&hn<ln&&(Qt=(_t=Z[hn])==null?void 0:_t.color)}}Qt&&(Oe.globalAlpha=en,Oe.fillStyle=Qt,Oe.beginPath(),Oe.arc(vt,ut,4,0,Math.PI*2),Oe.fill())}Oe.restore()}],setCursor:[Pt=>{if(!H.current)return;const{left:Lt,top:ln,idx:It}=Pt.cursor;if(It==null||Lt===void 0||ln===void 0||Lt<0){H.current.style.display="none";return}const Oe=Se[0][It];if(Oe===void 0){H.current.style.display="none";return}U.current&&!ne.current&&J({xValue:Number(Oe),sourceChartId:K});let _t=`<div class="font-medium mb-1">${Ze?`Time ${B$(Number(Oe))}`:`Step ${Number(Oe).toLocaleString()}`}</div>`;const Vt=ge.length;t.forEach(vt=>{var hn;const ut=we.get(vt.runPath);if(ut===void 0)return;const qt=ut+1,en=Se[qt];if(!en)return;const Qt=en[It];let Gt;if(c){const Sn=Vt+ut+1;Gt=(hn=Se[Sn])==null?void 0:hn[It]}Qt!=null&&(_t+=`
                <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>${Ow(vt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${c?.7:1}">${Ee(Qt)}${s?` ${s}`:""}</span>
                    ${c&&Gt!==void 0&&Gt!==null?`<span class="text-muted-foreground">(EMA: ${Ee(Gt)})</span>`:""}
                  </div>
                </div>
              `)}),H.current.innerHTML=_t,H.current.style.display="block";const vn=G.current.getBoundingClientRect(),ye=H.current.getBoundingClientRect();let et=vn.left+Lt+15;et+ye.width+20>window.innerWidth&&(et=vn.left+Lt-ye.width-15+Pt.bbox.left),et=Math.max(4,et);let xt=vn.top-ye.height+20;xt<4&&(xt=vn.top+8),H.current.style.left=`${et}px`,H.current.style.top=`${xt}px`}]}};ee.current&&ee.current.destroy();const dn=new ss(Kt,Se,Ae);ee.current=dn;const Rt=new ResizeObserver(Pt=>{for(const Lt of Pt){const{width:ln,height:It}=Lt.contentRect;dn&&ln>0&&It>0&&dn.setSize({width:ln,height:It})}});return Rt.observe(Ae),()=>{Rt.disconnect(),dn.destroy(),ee.current=null}},[Se,ke,nt,it,Ye,Ee,Ze,tt,Z,p,c,o,s,t,ge,we,K,J,ie,fe,be,Q,ue,R,L]),w.useEffect(()=>{if(!q){H.current&&(H.current.style.display="none");return}if(q.sourceChartId===K||!ee.current||!Se)return;const Ae=ee.current,Xe=Se[0];if(!Xe||Xe.length===0)return;const Re=q.xValue;let Be=0,ot=1/0;for(let Nt=0;Nt<Xe.length;Nt++){const Dt=Math.abs(Number(Xe[Nt])-Re);Dt<ot&&(ot=Dt,Be=Nt)}const dt=Ae.valToPos(Number(Xe[Be]),"x");dt>=0&&dt<=Ae.width&&(ne.current=!0,Ae.setCursor({left:dt,top:0}),ne.current=!1)},[q,K,Se]);const mt=w.useCallback(()=>{H.current&&(H.current.style.display="none"),(q==null?void 0:q.sourceChartId)===K&&J(null)},[q,K,J]),ft=qe&&!Je,Qe=i||(Le?`${Le.charAt(0).toUpperCase()}${Le.slice(1)}`:r);return V(d.jsxs("div",{ref:W,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&&ft&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!L&&N,d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",L?"text-sm":"text-xs"),title:r,children:Qe})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:ie,onCheckedChange:Te,children:"Ignore Outliers"}),d.jsx(ur,{checked:fe,onCheckedChange:Pe,children:"Ignore First Step"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:Q??"",onChange:Ae=>{const Xe=Ae.target.value;oe(Xe===""?null:Number(Xe))},onClick:Ae=>Ae.stopPropagation(),onKeyDown:Ae=>Ae.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:ue??"",onChange:Ae=>{const Xe=Ae.target.value;Ve(Xe===""?null:Number(Xe))},onClick:Ae=>Ae.stopPropagation(),onKeyDown:Ae=>Ae.stopPropagation()})]}),k&&k.length>1&&d.jsxs(d.Fragment,{children:[d.jsx(Ds,{}),d.jsx(l0,{className:"text-[10px] text-muted-foreground",children:"Filter by Environment"}),k.map(Ae=>d.jsx(ur,{checked:se.includes(Ae),onCheckedChange:()=>ze(Ae),children:Ae},Ae))]})]})]}),d.jsx(L0,{isFullscreen:L,onClick:B}),!L&&P]})]}),(ie||fe||Q!==null||ue!==null||Ce||de)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[ie&&d.jsx(rs,{label:"Ignore Outliers",onRemove:()=>Te(!1)}),fe&&d.jsx(rs,{label:"Ignore First Step",onRemove:()=>Pe(!1)}),Q!==null&&d.jsx(rs,{label:`Min Y: ${Q}`,onRemove:()=>oe(null)}),ue!==null&&d.jsx(rs,{label:`Max Y: ${ue}`,onRemove:()=>Ve(null)}),se.map(Ae=>d.jsx(rs,{label:`env: ${Ae}`,onRemove:()=>ze(Ae)},`env:${Ae}`)),Object.entries(he).map(([Ae,Xe])=>Xe.map(Re=>d.jsx(rs,{label:`${Ae}: ${Re}`,onRemove:()=>He(Ae,Re)},`${Ae}:${Re}`)))]})]}),nt?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:G,onMouseLeave:mt,children:[d.jsx("div",{ref:H,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&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.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 P4({runs:t,shouldPoll:e,evalName:n,prefix:r,label:i,unit:s,showZeroLine:o,isTokenMetric:a,showEma:l,emaSpan:c,hoveredRunId:f,xAxisMode:p,stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:S,maxStepLimit:M,maxTimeLimit:C,availableEnvs:A}){return d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:i}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:H$.map(N=>d.jsx(G$,{runs:t,shouldPoll:e,evalName:n,metricName:`${r}_${N}`,label:`${i} ${V$[N]}`,unit:s,showZeroLine:o,statType:N,isTokenMetric:a,showEma:l,emaSpan:c,hoveredRunId:f,xAxisMode:p,stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:S,maxStepLimit:M,maxTimeLimit:C,availableEnvs:A},`${n}-${r}_${N}`))})]})}function Tg({runs:t,shouldPoll:e,prefix:n,label:r,unit:i,showZeroLine:s,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:f,stepTimesByRun:p,firstStepTimesByRun:m,isStepTimesFetching:x,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:S,maxTimeLimit:M,extraCharts:C,hideGroupLabel:A,availableSampleTags:N,availableEnvs:P}){const k=t.find(O=>O.isSelected)??t[0];return d.jsxs("div",{children:[!A&&d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:r}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[H$.map(O=>d.jsx(er,{runs:t,shouldPoll:e,metricName:`${n}_${O}`,label:`${r} ${V$[O]}`,unit:i,showZeroLine:s,statType:O,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:f,stepTimesByRun:p,firstStepTimesByRun:m,isStepTimesFetching:x,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:S,maxTimeLimit:M,availableSampleTags:N,availableEnvs:P},`${n}_${O}`)),C,k&&d.jsx(e5,{runPath:k.runPath,metricType:n,label:`${r} (Dist. Over Time)`,showZeroLine:s,isTokenMetric:o,shouldPoll:e,scrollRoot:_})]})]})}function w0e(t,e,n,r,i,s){const o=w.useMemo(()=>t.slice(0,20).map(f=>f.runPath).filter(Boolean),[t]),a=w.useMemo(()=>e?[e]:[],[e]),l=jde(o,a,r&&o.length>0&&a.length>0,n,i,s);return{metricsByRunPath:w.useMemo(()=>{var p,m;const f=new Map;return(m=(p=l.data)==null?void 0:p.runs)==null||m.forEach(x=>{f.set(x.run_path,x.metrics??[])}),f},[l.data]),isFetching:l.isFetching,isRefetching:l.isFetching&&!!l.data}}function er({runs:t,shouldPoll:e,metricName:n,label:r,unit:i,showZeroLine:s,statType:o,isTokenMetric:a,showEma:l=!1,emaSpan:c=10,hoveredRunId:f=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:P,availableSampleTags:k,availableEnvs:O,filterKey:R}){const L=qn(as),{isFullscreen:B,toggleFullscreen:V,fullscreenPortal:W}=O0(),G=w.useRef(null),ee=w.useRef(null),H=w.useRef(null),q=w.useRef(null),[J,K]=fn(aW),[ne,U]=fn(Q7),z=w.useMemo(()=>`metric-${n}`,[n]),Y=w.useRef(!1),j=w.useRef(!1);w.useEffect(()=>{const Be=dt=>{(dt.key==="Control"||dt.key==="Meta")&&(j.current=!0)},ot=dt=>{(dt.key==="Control"||dt.key==="Meta")&&(j.current=!1,K(null))};return window.addEventListener("keydown",Be),window.addEventListener("keyup",ot),()=>{window.removeEventListener("keydown",Be),window.removeEventListener("keyup",ot)}},[K]);const le=R??n,ce=M??!1,ie=D8.has(n),fe=ne[le],Q=(fe==null?void 0:fe.ignoreOutliers)??ce,ue=(fe==null?void 0:fe.ignoreFirstStep)??ie,he=(fe==null?void 0:fe.minY)??null,se=(fe==null?void 0:fe.maxY)??null,Ce=(fe==null?void 0:fe.tagFilters)??{},de=(fe==null?void 0:fe.envFilters)??[],Me=w.useCallback(Be=>{U(ot=>{const dt={ignoreOutliers:ce,ignoreFirstStep:ie,minY:null,maxY:null,tagFilters:{},envFilters:[]},Nt=ot[le]??dt,Dt=Be(Nt);if(Dt.ignoreOutliers===dt.ignoreOutliers&&Dt.ignoreFirstStep===dt.ignoreFirstStep&&Dt.minY===dt.minY&&Dt.maxY===dt.maxY&&Object.keys(Dt.tagFilters??{}).length===0&&(Dt.envFilters??[]).length===0){if(!Object.prototype.hasOwnProperty.call(ot,le))return ot;const Ht={...ot};return delete Ht[le],Ht}return{...ot,[le]:Dt}})},[le,U,ce,ie]),Te=w.useCallback(Be=>{Me(ot=>({...ot,ignoreOutliers:Be}))},[Me]),Pe=w.useCallback(Be=>{Me(ot=>({...ot,ignoreFirstStep:Be}))},[Me]),oe=w.useCallback(Be=>{Me(ot=>({...ot,minY:Be}))},[Me]),Ve=w.useCallback(Be=>{Me(ot=>({...ot,maxY:Be}))},[Me]),He=w.useCallback((Be,ot)=>{Me(dt=>{const Nt={...dt.tagFilters??{}},Dt=Nt[Be]??[];if(Dt.includes(ot)){const St=Dt.filter(Ht=>Ht!==ot);St.length===0?delete Nt[Be]:Nt[Be]=St}else Nt[Be]=[...Dt,ot];return{...dt,tagFilters:Nt}})},[Me]),ze=w.useCallback(Be=>{Me(ot=>{const dt=[...ot.envFilters??[]],Nt=dt.indexOf(Be);return Nt>=0?dt.splice(Nt,1):dt.push(Be),{...ot,envFilters:dt}})},[Me]),Ge=Object.keys(Ce).length>0,ae=de.length>0,ge=j0(G,{root:S,threshold:0})||B,we=w.useMemo(()=>{const Be=t.filter(dt=>!dt.isSelected),ot=t.filter(dt=>dt.isSelected);return[...Be,...ot]},[t]),_e=w.useMemo(()=>we.slice(0,20),[we]),ve=w.useMemo(()=>{const Be=new Map;return _e.forEach((ot,dt)=>{Be.set(ot.runPath,dt)}),Be},[_e]),{metricsByRunPath:Ue,isFetching:Se,isRefetching:ke}=w0e(t,n,e,ge,Ce,de),{uplotData:qe,seriesConfig:Je,isFetching:nt,isRefetching:tt,hasData:be,timeToStepByRun:Le,outlierBounds:Ze}=w.useMemo(()=>{const Be=new Set,ot=new Map,dt=new Map,Nt=new Map,Dt=p==="time"&&!!m&&!!x,St=Se;we.forEach((Pt,Lt)=>{if(Lt>=20)return;const ln=Ue.get(Pt.runPath)??[],It=new Map,Oe=f0e.has(n);if(ln.forEach(gt=>{Oe&&gt.value===0||(Be.add(gt.step),It.set(gt.step,gt.value))}),ot.set(Lt,It),Dt){const gt=m==null?void 0:m.get(Pt.runPath),_t=x==null?void 0:x.get(Pt.runPath);if(gt&&_t!==void 0){const Vt=new Map,vn=new Map;gt.forEach((ye,et)=>{const xt=ye-_t;Vt.set(et,xt),vn.set(xt,et)}),dt.set(Lt,Vt),Nt.set(Lt,vn)}}});const Ht=()=>!(!St&&!b||St&&!ke||b&&!_);if(Be.size===0)return{uplotData:null,seriesConfig:[],isFetching:St||b,isRefetching:Ht(),hasData:!1,timeToStepByRun:Nt,outlierBounds:null,minStep:null};const rn=Math.min(...Array.from(Be));let Ut=Array.from(Be).sort((Pt,Lt)=>Pt-Lt);C!=null&&!Dt&&(Ut=Ut.filter(Pt=>Pt<=C));let Ft=Ut;if(Dt){const Pt=new Set;if(ot.forEach((ln,It)=>{const Oe=dt.get(It);Oe&&ln.forEach((gt,_t)=>{const Vt=Oe.get(_t);Vt!==void 0&&Pt.add(Vt)})}),Pt.size===0)return{uplotData:null,seriesConfig:[],isFetching:St||b,isRefetching:Ht(),hasData:!1,timeToStepByRun:Nt,outlierBounds:null,minStep:null};let Lt=Array.from(Pt).sort((ln,It)=>ln-It);A!=null&&(Lt=Lt.filter(ln=>ln<=A)),Ft=Lt}let Bt=null;if(Q){const Pt=[];ot.forEach(Lt=>{Lt.forEach(ln=>{Pt.push(ln)})}),Bt=gC(Pt)}const Kt=new Float64Array(Ft),dn=[{label:Dt?"Time (s)":"Step"}],Rt=[Kt];return we.forEach((Pt,Lt)=>{if(Lt>=20)return;const ln=ot.get(Lt)||new Map;let It;if(Dt){const Vt=dt.get(Lt),vn=new Map;Vt&&ln.forEach((ye,et)=>{const xt=Vt.get(et);xt!==void 0&&vn.set(xt,ye)}),It=Ft.map(ye=>vn.get(ye)??null)}else It=Ut.map(Vt=>ln.get(Vt)??null);const Oe=f===Pt.runPath,gt=f!==null;let _t;gt&&!Oe?_t=.1:_t=l?.3:1,Rt.push(It),dn.push({label:wp(Pt),stroke:Pt.color,width:1,alpha:_t,spanGaps:!0,points:{show:!1}})}),l&&we.forEach((Pt,Lt)=>{if(Lt>=20)return;const ln=ot.get(Lt)||new Map,It=2/(c+1);let Oe=null,gt;if(Dt){const ye=dt.get(Lt),et=new Map;Ut.forEach(xt=>{const vt=ln.get(xt);if(vt!==void 0){!(Bt&&(vt<Bt.lower||vt>Bt.upper))&&!(ue&&xt===rn)&&(Oe=Oe===null?vt:It*vt+(1-It)*Oe);const en=ye==null?void 0:ye.get(xt);en!==void 0&&Oe!==null&&et.set(en,Oe)}}),gt=Ft.map(xt=>et.get(xt)??null)}else{const ye=[];Ut.forEach(et=>{const xt=ln.get(et);xt!==void 0?(!(Bt&&(xt<Bt.lower||xt>Bt.upper))&&!(ue&&et===rn)&&(Oe===null?Oe=xt:Oe=It*xt+(1-It)*Oe),ye.push(Oe)):ye.push(null)}),gt=ye}const _t=f===Pt.runPath,Vt=f!==null;let vn;Vt&&!_t?vn=.1:vn=1,Rt.push(gt),dn.push({label:`${wp(Pt)} (EMA)`,stroke:Pt.color,width:1.5,alpha:vn,spanGaps:!0,points:{show:!1}})}),{uplotData:Rt,seriesConfig:dn,isFetching:St||b,isRefetching:Ht(),hasData:!0,timeToStepByRun:Nt,outlierBounds:Bt,minStep:rn}},[we,Ue,Se,ke,l,c,f,p,m,x,b,_,Q,ue,C,A]),Ee=o||n.split("_").pop()||"",Ye=p==="time",it=n.startsWith("timing_")&&n!=="timing_microbatch_count"&&!n.endsWith("_pct"),mt=w.useCallback(Be=>Be==null?"N/A":a&&(Ee==="min"||Ee==="max")?Math.round(Be).toLocaleString():vu(Be),[a,Ee]),ft=w.useCallback(Be=>it?yu(Be):Math.abs(Be)>=1e3?`${parseFloat((Be/1e3).toFixed(1))}k`:a?Ee==="min"||Ee==="max"?Math.round(Be).toString():String(parseFloat(Be.toFixed(1))):Number.isInteger(Be)?Be.toLocaleString():Math.abs(Be)<.01&&Be!==0?Be.toExponential(1):String(parseFloat(Be.toFixed(2))),[a,it,Ee]),Qe=w.useCallback(Be=>Ye?yu(Be):Be>=1e3?`${(Be/1e3).toFixed(0)}k`:Be.toString(),[Ye]);w.useEffect(()=>{if(!ee.current||!qe||!be)return;const Be=ee.current,ot=Be.clientWidth,dt=Be.clientHeight||200;let Nt=1/0,Dt=-1/0;for(let It=1;It<qe.length;It++){const Oe=qe[It];for(let gt=0;gt<Oe.length;gt++){if(ue&&gt===0)continue;const _t=Oe[gt];_t!=null&&(Q&&Ze?_t>=Ze.lower&&_t<=Ze.upper&&(_t<Nt&&(Nt=_t),_t>Dt&&(Dt=_t)):(_t<Nt&&(Nt=_t),_t>Dt&&(Dt=_t)))}}Nt===1/0&&Ze&&(Nt=Ze.lower,Dt=Ze.upper);const St=Dt-Nt,Ht=Math.max(Math.abs(Dt),Math.abs(Nt)),rn=Math.max(Ht*.05,1e-10),Ut=Math.max(St*.1,rn);let Ft,Bt;s?(Ft=Math.min(Nt-Ut,0),Bt=Math.max(Dt+Ut,0)):(Ft=Nt-Ut,Bt=Dt+Ut),he!==null&&(Ft=he),se!==null&&(Bt=se);const Kt=L?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",dn=L?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Pt={width:ot,height:dt,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Ft,Bt]}},axes:[{stroke:dn,grid:{stroke:Kt,width:1},ticks:{stroke:Kt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(It,Oe)=>Oe.map(Qe)},{stroke:dn,grid:{stroke:Kt,width:1},ticks:{stroke:Kt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(It,Oe)=>{if(!Oe||Oe.length===0)return 40;const gt=Math.max(...Oe.map(_t=>_t.length));return Math.max(40,gt*7+14)},values:(It,Oe)=>Oe.map(ft)}],series:Je,hooks:{draw:[It=>{var vn,ye;if(!qe)return;const Oe=qe[0],gt=Math.min(we.length,20),_t=It.series.length,Vt=It.ctx;Vt.save();for(let et=1;et<_t;et++){const xt=qe[et];if(!xt)continue;let vt=-1;for(let Nn=xt.length-1;Nn>=0;Nn--){const nn=xt[Nn];if(nn!=null){vt=Nn;break}}if(vt===-1)continue;const ut=Oe[vt],qt=xt[vt];if(ut===void 0||qt===void 0||qt===null)continue;const en=It.valToPos(Number(ut),"x",!0),Qt=It.valToPos(Number(qt),"y",!0);if(!Number.isFinite(en)||!Number.isFinite(Qt))continue;const Gt=It.series[et],hn=typeof(Gt==null?void 0:Gt.alpha)=="number"?Gt.alpha:1;let Sn=typeof(Gt==null?void 0:Gt.stroke)=="string"?Gt.stroke:void 0;if(!Sn){const Nn=et-1;if(Nn<gt)Sn=(vn=we[Nn])==null?void 0:vn.color;else if(l){const nn=Nn-gt;nn>=0&&nn<gt&&(Sn=(ye=we[nn])==null?void 0:ye.color)}}Sn&&(Vt.globalAlpha=hn,Vt.fillStyle=Sn,Vt.beginPath(),Vt.arc(en,Qt,4,0,Math.PI*2),Vt.fill())}Vt.restore()}],setCursor:[It=>{if(!q.current)return;const{left:Oe,top:gt,idx:_t}=It.cursor;if(_t==null||Oe===void 0||gt===void 0||Oe<0){q.current.style.display="none";return}const Vt=qe[0][_t];if(Vt===void 0){q.current.style.display="none";return}j.current&&!Y.current&&K({xValue:Number(Vt),sourceChartId:z});const vn=(()=>{var Gn,vr;if(!Ye||!Le)return null;const hn=Number(Vt);if(f){const sr=we.findIndex(Yn=>Yn.runPath===f);if(sr>=0){const Yn=(Gn=Le.get(sr))==null?void 0:Gn.get(hn);if(Yn!==void 0)return Yn}}const Sn=we.findIndex(sr=>sr.isSelected);if(Sn>=0){const sr=(vr=Le.get(Sn))==null?void 0:vr.get(hn);if(sr!==void 0)return sr}let Nn=null;const nn=new Set;return we.forEach((sr,Yn)=>{var un;const fr=(un=Le.get(Yn))==null?void 0:un.get(hn);fr!==void 0&&(nn.add(fr),Nn===null&&(Nn=fr))}),nn.size===1,Nn})();let et=`<div class="font-medium mb-1">${Ye?`Time ${B$(Number(Vt))}${vn!==null?` <span class="text-muted-foreground">(Step ${Number(vn).toLocaleString()})</span>`:""}`:`Step ${Number(Vt).toLocaleString()}`}</div>`;const xt=_e.length,vt=qe[0],ut=(()=>{if(!Ye)return null;const hn=It.scales.x,Sn=Number(hn.min),Nn=Number(hn.max);if(!Number.isFinite(Sn)||!Number.isFinite(Nn))return null;const nn=Math.abs(Nn-Sn);if(nn<=0)return null;const Gn=Math.max(1,It.bbox.width);return nn*m0e/Gn})();t.forEach(hn=>{const Sn=ve.get(hn.runPath);if(Sn===void 0)return;const Nn=Sn+1,nn=qe[Nn];if(!nn)return;const Gn=Ye?g0e(nn,vt,_t,ut):_t;if(Gn===null)return;const vr=nn[Gn];let sr;if(l){const Yn=xt+Sn+1,fr=qe[Yn];sr=fr==null?void 0:fr[Gn]}vr!=null&&(et+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${hn.color}"></div>
                    <span>${Ow(hn)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${l?.7:1}">${it?Ak(vr):`${mt(vr)}${i?` ${i}`:""}`}</span>
                    ${l&&sr!==void 0&&sr!==null?`<span class="text-muted-foreground">(EMA: ${it?Ak(sr):mt(sr)})</span>`:""}
                  </div>
                </div>
              `)}),q.current.innerHTML=et,q.current.style.display="block";const qt=ee.current.getBoundingClientRect(),en=q.current.getBoundingClientRect();let Qt=qt.left+Oe+15;Qt+en.width+20>window.innerWidth&&(Qt=qt.left+Oe-en.width-15+It.bbox.left),Qt=Math.max(4,Qt);let Gt=qt.top-en.height+20;Gt<4&&(Gt=qt.top+8),q.current.style.left=`${Qt}px`,q.current.style.top=`${Gt}px`}]}};H.current&&H.current.destroy();const Lt=new ss(Pt,qe,Be);H.current=Lt;const ln=new ResizeObserver(It=>{for(const Oe of It){const{width:gt,height:_t}=Oe.contentRect;Lt&&gt>0&&_t>0&&Lt.setSize({width:gt,height:_t})}});return ln.observe(Be),()=>{ln.disconnect(),Lt.destroy(),H.current=null}},[qe,Je,be,Qe,ft,mt,Ye,Le,we,f,l,s,i,Q,Ze,ue,he,se,t,_e,ve,z,it,K,L,B]),w.useEffect(()=>{if(!J){q.current&&(q.current.style.display="none");return}if(J.sourceChartId===z||!H.current||!qe)return;const Be=H.current,ot=qe[0];if(!ot||ot.length===0)return;const dt=J.xValue;let Nt=0,Dt=1/0;for(let Ht=0;Ht<ot.length;Ht++){const rn=Math.abs(Number(ot[Ht])-dt);rn<Dt&&(Dt=rn,Nt=Ht)}const St=Be.valToPos(Number(ot[Nt]),"x");St>=0&&St<=Be.width&&(Y.current=!0,Be.setCursor({left:St,top:0}),Y.current=!1)},[J,z,qe]);const Ae=w.useCallback(()=>{q.current&&(q.current.style.display="none"),(J==null?void 0:J.sourceChartId)===z&&K(null)},[J,z,K]),Xe=nt&&!tt,Re=r||(Ee?`${Ee.charAt(0).toUpperCase()}${Ee.slice(1)}`:n);return W(d.jsxs("div",{ref:G,className:bt("group/chart flex flex-col bg-background",B?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!B&&Xe&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!B&&N,d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",B?"text-sm":"text-xs"),title:n,children:Re})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:Q,onCheckedChange:Te,children:"Ignore Outliers"}),d.jsx(ur,{checked:ue,onCheckedChange:Pe,children:"Ignore First Step"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:he??"",onChange:Be=>{const ot=Be.target.value;oe(ot===""?null:Number(ot))},onClick:Be=>Be.stopPropagation(),onKeyDown:Be=>Be.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:se??"",onChange:Be=>{const ot=Be.target.value;Ve(ot===""?null:Number(ot))},onClick:Be=>Be.stopPropagation(),onKeyDown:Be=>Be.stopPropagation()})]}),O&&O.length>1&&d.jsxs(d.Fragment,{children:[d.jsx(Ds,{}),d.jsx(l0,{className:"text-[10px] text-muted-foreground",children:"Filter by Environment"}),O.map(Be=>d.jsx(ur,{checked:de.includes(Be),onCheckedChange:()=>ze(Be),children:Be},Be))]}),k&&Object.keys(k).length>0&&d.jsxs(d.Fragment,{children:[d.jsx(Ds,{}),d.jsx(l0,{className:"text-[10px] text-muted-foreground",children:"Filter by Tag"}),Object.entries(k).map(([Be,ot])=>{var dt;return d.jsxs(fde,{children:[d.jsxs(hde,{className:"text-xs",children:[Be,(dt=Ce[Be])!=null&&dt.length?d.jsxs("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",Ce[Be].length,")"]}):null]}),d.jsx(pde,{className:"max-h-[300px] overflow-y-auto",children:ot.map(Nt=>d.jsx(ur,{checked:(Ce[Be]??[]).includes(Nt),onCheckedChange:()=>He(Be,Nt),children:Nt},Nt))})]},Be)})]})]})]}),d.jsx(L0,{isFullscreen:B,onClick:V}),!B&&P]})]}),(Q||ue||he!==null||se!==null||Ge||ae)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[Q&&d.jsx(rs,{label:"Ignore Outliers",onRemove:()=>Te(!1)}),ue&&d.jsx(rs,{label:"Ignore First Step",onRemove:()=>Pe(!1)}),he!==null&&d.jsx(rs,{label:`Min Y: ${he}`,onRemove:()=>oe(null)}),se!==null&&d.jsx(rs,{label:`Max Y: ${se}`,onRemove:()=>Ve(null)}),de.map(Be=>d.jsx(rs,{label:`env: ${Be}`,onRemove:()=>ze(Be)},`env:${Be}`)),Object.entries(Ce).map(([Be,ot])=>ot.map(dt=>d.jsx(rs,{label:`${Be}: ${dt}`,onRemove:()=>He(Be,dt)},`${Be}:${dt}`)))]})]}),be?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:ee,onMouseLeave:Ae,children:[d.jsx("div",{ref:q,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"}}),tt&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:nt?"Loading...":"No data"})]}))}function Lw(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 M0e=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 Ul({runs:t,shouldPoll:e,inferenceMetricType:n,label:r,hoveredRunId:i=null,scrollRoot:s=null,headerPrefix:o,headerSuffix:a}){var Pe,oe,Ve,He,ze,Ge,ae,Z,ge,we;const l=qn(as),{isFullscreen:c,toggleFullscreen:f,fullscreenPortal:p}=O0(),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,P]=w.useState(!1),[k,O]=w.useState(60),[R,L]=w.useState(Vs(60)),B=w.useCallback(_e=>{const ve=Lw(_e);ve!==null&&ve>=1?(O(ve),L(Vs(ve))):L(Vs(k))},[k]),W=j0(m,{root:s,threshold:0})||c,G=M0e.has(n),ee=w.useMemo(()=>{const _e=t.filter(Ue=>!Ue.isSelected),ve=t.filter(Ue=>Ue.isSelected);return[..._e,...ve]},[t]),H=w.useMemo(()=>ee.slice(0,20),[ee]),q=Zu(((Pe=H[0])==null?void 0:Pe.runPath)??"",W&&!!H[0],e,k),J=Zu(((oe=H[1])==null?void 0:oe.runPath)??"",W&&!!H[1],e,k),K=Zu(((Ve=H[2])==null?void 0:Ve.runPath)??"",W&&!!H[2],e,k),ne=Zu(((He=H[3])==null?void 0:He.runPath)??"",W&&!!H[3],e,k),U=Zu(((ze=H[4])==null?void 0:ze.runPath)??"",W&&!!H[4],e,k),z=Zu(((Ge=H[5])==null?void 0:Ge.runPath)??"",W&&!!H[5],e,k),Y=Zu(((ae=H[6])==null?void 0:ae.runPath)??"",W&&!!H[6],e,k),j=Zu(((Z=H[7])==null?void 0:Z.runPath)??"",W&&!!H[7],e,k),le=Zu(((ge=H[8])==null?void 0:ge.runPath)??"",W&&!!H[8],e,k),ce=Zu(((we=H[9])==null?void 0:we.runPath)??"",W&&!!H[9],e,k),X=w.useMemo(()=>[q,J,K,ne,U,z,Y,j,le,ce],[q,J,K,ne,U,z,Y,j,le,ce]),ie=X.some((_e,ve)=>ve<H.length&&_e.isFetching),fe=ie&&X.filter((_e,ve)=>ve<H.length&&_e.isFetching).every(_e=>!!_e.data),{uplotData:Q,seriesConfig:ue,hasData:he,outlierBounds:se}=w.useMemo(()=>{const _e=new Map,ve=new Set;let Ue=!1;if(H.forEach((tt,be)=>{if(be>=10)return;const Le=X[be].data;if(!Le||Le.first_time===null)return;const Ze=Le.first_time,Ee=Le[n];if(!Ee||Ee.length===0)return;let Ye=null;if(C){const mt=Le.step_times??[];mt.length>0&&(Ye=mt[0].time-Ze)}Ue=!0;const it=new Map;if(Ee.forEach(mt=>{const ft=G?mt.value:mt.count;if(ft!=null){if(G&&ft===0)return;const Qe=mt.time-Ze;if(C&&Ye!==null&&Qe<Ye)return;it.set(Qe,ft),ve.add(Qe)}}),!N&&Ee.length>0){const mt=Le.last_time;if(mt!=null){const ft=Ee[Ee.length-1].time;if(ft+k>mt){const Qe=ft-Ze;it.delete(Qe),ve.delete(Qe)}}}if(!G&&it.size>0){const mt=Array.from(it.keys()),ft=Math.min(...mt),Qe=Math.max(...mt);for(let Ae=ft+k;Ae<Qe;Ae+=k)it.has(Ae)||(it.set(Ae,0),ve.add(Ae))}_e.set(be,it)}),!Ue||ve.size===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};let Se=null;if(S){const tt=[];_e.forEach(be=>{be.forEach(Le=>tt.push(Le))}),Se=gC(tt)}const ke=Array.from(ve).sort((tt,be)=>tt-be),qe=new Float64Array(ke),Je=[{label:"Time (s)"}],nt=[qe];return H.forEach((tt,be)=>{if(be>=10)return;const Le=_e.get(be),Ze=ke.map(mt=>(Le==null?void 0:Le.get(mt))??null),Ee=i===tt.runPath,it=i!==null&&!Ee?.1:1;nt.push(Ze),Je.push({label:wp(tt),stroke:tt.color,width:1,alpha:it,spanGaps:!0,points:{show:!1}})}),{uplotData:nt,seriesConfig:Je,hasData:!0,outlierBounds:Se}},[H,X,n,i,G,S,C,N,k]),Ce=w.useCallback(_e=>_e==null?"N/A":G?Ak(_e):vu(_e),[G]),de=w.useCallback(_e=>G?yu(_e):Math.abs(_e)>=1e3?`${parseFloat((_e/1e3).toFixed(1))}k`:Number.isInteger(_e)?_e.toLocaleString():String(parseFloat(_e.toFixed(2))),[G]);w.useEffect(()=>{if(!x.current||!Q||!he)return;const _e=x.current,ve=_e.clientWidth,Ue=_e.clientHeight||200;let Se=1/0,ke=-1/0;for(let Qe=1;Qe<Q.length;Qe++){const Ae=Q[Qe];for(let Xe=0;Xe<Ae.length;Xe++){const Re=Ae[Xe];Re!=null&&Number.isFinite(Re)&&(S&&se?Re>=se.lower&&Re<=se.upper&&(Re<Se&&(Se=Re),Re>ke&&(ke=Re)):(Re<Se&&(Se=Re),Re>ke&&(ke=Re)))}}Se===1/0&&se&&(Se=se.lower,ke=se.upper),Se===1/0&&(Se=0,ke=1);const qe=ke-Se,Je=Math.max(Math.abs(ke),Math.abs(Se)),nt=Math.max(Je*.05,1e-10),tt=Math.max(qe*.1,nt),be=Se-tt,Le=ke+tt,Ze=l?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Ee=l?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",it={width:ve,height:Ue,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[be,Le]}},axes:[{stroke:Ee,grid:{stroke:Ze,width:1},ticks:{stroke:Ze,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Qe,Ae)=>Ae.map(Xe=>yu(Xe))},{stroke:Ee,grid:{stroke:Ze,width:1},ticks:{stroke:Ze,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Qe,Ae)=>{if(!Ae||Ae.length===0)return 40;const Xe=Math.max(...Ae.map(Re=>Re.length));return Math.max(40,Xe*7+14)},values:(Qe,Ae)=>Ae.map(de)}],series:ue,hooks:{draw:[Qe=>{var Xe;if(!Q)return;const Ae=Qe.ctx;Ae.save();for(let Re=1;Re<Qe.series.length;Re++){const Be=Q[Re];if(!Be)continue;let ot=-1;for(let Ft=Be.length-1;Ft>=0;Ft--)if(Be[Ft]!==null&&Be[Ft]!==void 0){ot=Ft;break}if(ot===-1)continue;const dt=Q[0][ot],Nt=Be[ot];if(dt===void 0||Nt===void 0||Nt===null)continue;const Dt=Qe.valToPos(Number(dt),"x",!0),St=Qe.valToPos(Number(Nt),"y",!0);if(!Number.isFinite(Dt)||!Number.isFinite(St))continue;const Ht=Qe.series[Re],rn=typeof(Ht==null?void 0:Ht.alpha)=="number"?Ht.alpha:1,Ut=typeof(Ht==null?void 0:Ht.stroke)=="string"?Ht.stroke:(Xe=ee[Re-1])==null?void 0:Xe.color;Ut&&(Ae.globalAlpha=rn,Ae.fillStyle=Ut,Ae.beginPath(),Ae.arc(Dt,St,4,0,Math.PI*2),Ae.fill())}Ae.restore()}],setCursor:[Qe=>{if(!_.current||!Q)return;const{left:Ae,top:Xe,idx:Re}=Qe.cursor;if(Re==null||Ae===void 0||Xe===void 0||Ae<0){_.current.style.display="none";return}const Be=Q[0][Re];if(Be===void 0){_.current.style.display="none";return}let dt=`<div class="font-medium mb-1">${`Time ${Vs(Number(Be))}`}</div>`;t.forEach(rn=>{const Ut=H.findIndex(dn=>dn.runPath===rn.runPath);if(Ut===-1)return;const Ft=Ut+1,Bt=Q[Ft];if(!Bt)return;const Kt=Bt[Re];Kt!=null&&(dt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${rn.color}"></div>
                    <span>${Ow(rn)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium">${Ce(Kt)}</span>
                  </div>
                </div>
              `)}),_.current.innerHTML=dt,_.current.style.display="block";const Nt=x.current.getBoundingClientRect(),Dt=_.current.getBoundingClientRect();let St=Nt.left+Ae+15;St+Dt.width+20>window.innerWidth&&(St=Nt.left+Ae-Dt.width-15+Qe.bbox.left),St=Math.max(4,St);let Ht=Nt.top-Dt.height+20;Ht<4&&(Ht=Nt.top+8),_.current.style.left=`${St}px`,_.current.style.top=`${Ht}px`}]}};b.current&&b.current.destroy();const mt=new ss(it,Q,_e);b.current=mt;const ft=new ResizeObserver(Qe=>{for(const Ae of Qe){const{width:Xe,height:Re}=Ae.contentRect;mt&&Xe>0&&Re>0&&mt.setSize({width:Xe,height:Re})}});return ft.observe(_e),()=>{ft.disconnect(),mt.destroy(),b.current=null}},[Q,ue,he,S,se,l,ee,t,H,i,Ce,de,k,c]);const Me=w.useCallback(()=>{_.current&&(_.current.style.display="none")},[]),Te=ie&&!fe;return p(d.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&&Te&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!c&&o,d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",c?"text-sm":"text-xs"),title:r,children:r})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:S,onCheckedChange:M,children:"Ignore Outliers"}),d.jsx(ur,{checked:C,onCheckedChange:A,children:"Ignore First Step"}),d.jsx(ur,{checked:N,onCheckedChange:P,children:"Show Unfinished Intervals"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.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:_e=>L(_e.target.value),onBlur:_e=>B(_e.target.value),onKeyDown:_e=>{_e.stopPropagation(),_e.key==="Enter"&&B(_e.currentTarget.value)},onClick:_e=>_e.stopPropagation()})]})]})]}),d.jsx(L0,{isFullscreen:c,onClick:f}),!c&&a]})]}),(S||C||N)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[S&&d.jsx(rs,{label:"Ignoring Outliers",onRemove:()=>M(!1)}),C&&d.jsx(rs,{label:"Ignoring First Step",onRemove:()=>A(!1)}),N&&d.jsx(rs,{label:"Showing Unfinished Intervals",onRemove:()=>P(!1)})]})]}),he?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:x,onMouseLeave:Me,children:[d.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"}}),fe&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:ie?"Loading...":"No data"})]}))}function T0e({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null}){const i={runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r};return d.jsxs("div",{children:[d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-1",children:"Breakdown (Area)"}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsx($k,{runs:t,shouldPoll:e,scrollRoot:r,label:"Inference Idle vs Working",categories:["idle","working"]}),d.jsx($k,{runs:t,shouldPoll:e,scrollRoot:r,label:"Inference Idle vs Generating vs Weight Sync",categories:["idle","generating","weight_broadcast"]}),d.jsx(K$,{runs:t,shouldPoll:e,scrollRoot:r,label:"Inference Kept vs Discarded vs Canceled",categories:["kept","discarded","canceled"]})]}),d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"Requests Count"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(Ul,{inferenceMetricType:"inference_calls",label:"Inference Calls",...i}),d.jsx(Ul,{inferenceMetricType:"requests_done",label:"Requests Done",...i}),d.jsx(Ul,{inferenceMetricType:"rollouts_group_done",label:"Rollouts Group Done",...i}),d.jsx(Ul,{inferenceMetricType:"rollouts_group_done_kept",label:"Rollouts Group Done Kept",...i}),d.jsx(Ul,{inferenceMetricType:"rollouts_group_done_discarded",label:"Rollouts Group Done Discarded",...i}),d.jsx(Ul,{inferenceMetricType:"rollouts_group_done_canceled",label:"Rollouts Group Done Canceled",...i})]}),d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"Latency"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(Ul,{inferenceMetricType:"avg_time_queue",label:"Avg Queue Time",...i}),d.jsx(Ul,{inferenceMetricType:"avg_time_ttft",label:"Avg Time to First Token",...i}),d.jsx(Ul,{inferenceMetricType:"avg_time_prefill",label:"Avg Prefill Time",...i}),d.jsx(Ul,{inferenceMetricType:"avg_time_decode",label:"Avg Decode Time",...i}),d.jsx(Ul,{inferenceMetricType:"avg_time_inference",label:"Avg Inference Time",...i}),d.jsx(Ul,{inferenceMetricType:"avg_time_e2e",label:"Avg E2E Latency",...i}),d.jsx(Ul,{inferenceMetricType:"avg_time_generation",label:"Avg Generation Duration",...i}),d.jsx(Ul,{inferenceMetricType:"avg_time_compute_reward",label:"Avg Compute Reward Time",...i})]})]})}function W$({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null,inferenceMetricType:i,label:s,headerPrefix:o,headerSuffix:a}){return d.jsx(Ul,{runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r,inferenceMetricType:i,label:s,headerPrefix:o,headerSuffix:a})}const $$=[{key:"inference_area_kept_vs_discarded_vs_canceled",label:"Inference Kept vs Discarded vs Canceled",categories:["kept","discarded","canceled"]}];function q$({runs:t,shouldPoll:e,scrollRoot:n=null,label:r,categories:i,headerPrefix:s,headerSuffix:o}){return d.jsx(K$,{runs:t,shouldPoll:e,scrollRoot:n,label:r,categories:i,headerPrefix:s,headerSuffix:o})}const X$=[{key:"inference_util_idle_vs_working",label:"Inference Idle vs Working",categories:["idle","working"]},{key:"inference_util_idle_vs_generating_vs_weight_sync",label:"Inference Idle vs Generating vs Weight Sync",categories:["idle","generating","weight_broadcast"]}];function $k({runs:t,shouldPoll:e,label:n,categories:r,scrollRoot:i=null,headerPrefix:s,headerSuffix:o}){const a=qn(as),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:f}=O0(),p=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),[_,S]=w.useState(!0),[M,C]=w.useState(!1),[A,N]=w.useState(60),[P,k]=w.useState(Vs(60)),[O,R]=w.useState(null),[L,B]=w.useState([]),V=w.useCallback(Q=>{B(ue=>ue.includes(Q)?ue.filter(se=>se!==Q):[...ue,Q])},[]),W=w.useCallback(Q=>{const ue=Lw(Q);ue!==null&&ue>=1?(N(ue),k(Vs(ue))):k(Vs(A))},[A]),ee=j0(p,{root:i,threshold:0})||l,H=t.find(Q=>Q.isSelected)??t[0],q=Zu((H==null?void 0:H.runPath)??"",ee&&!!H,e,A),J=q.isFetching,K=J&&!!q.data,{filteredBuckets:ne,activeCategories:U,runFirstTime:z}=w.useMemo(()=>{const Q=q.data;if(!Q||Q.first_time===null||!Q.utilization_buckets||Q.utilization_buckets.length===0)return{filteredBuckets:[],activeCategories:[],runFirstTime:0};const ue=Q.first_time;let he=Q.utilization_buckets;if(_){const Ce=Q.step_times??[];if(Ce.length>0){const de=Ce[0].time-ue;he=he.filter(Me=>Me.time-ue>=de)}}!M&&he.length>0&&Q.last_time!==null&&Q.last_time!==void 0&&he[he.length-1].time+A>Q.last_time&&(he=he.slice(0,-1));const se=r.filter(Ce=>he.some(de=>{const Me=de[Ce];return Me!==void 0&&Me>0}));return{filteredBuckets:he,activeCategories:se,runFirstTime:ue}},[q.data,r,_,M,A]),Y=w.useMemo(()=>{const Q=L.filter(ue=>U.includes(ue));return Q.length>0&&Q.length<U.length?new Set(Q):O&&U.includes(O)?new Set([O]):null},[L,O,U]),{uplotData:j,seriesConfig:le,bandsConfig:ce,hasData:X}=w.useMemo(()=>{if(ne.length===0||U.length===0)return{uplotData:null,seriesConfig:[],bandsConfig:[],hasData:!1};const Q=new Float64Array(ne.map(de=>de.time-z)),ue=[{label:"Time (s)"}],he=[Q],se=[],Ce=new Array(ne.length).fill(0);return U.forEach((de,Me)=>{const Te=ne.map((ze,Ge)=>{const ae=ze[de]??0;return Ce[Ge]+=ae,Ce[Ge]}),Pe=Y!==null&&!Y.has(de),oe=P1(de,a),Ve=Pe?ad(oe,.15):ad(oe,.6),He=Pe?ad(oe,.25):oe;he.push(Te),ue.push({label:px(de),stroke:He,width:0,fill:Me===0?Ve:void 0,points:{show:!1}}),Me>0&&se.push({series:[Me+1,Me],fill:Ve})}),{uplotData:he,seriesConfig:ue,bandsConfig:se,hasData:!0}},[ne,U,z,Y,a]);w.useEffect(()=>{if(!m.current||!j||!X)return;const Q=m.current,ue=Q.clientWidth,he=Q.clientHeight||200,se=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Ce=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",de={width:ue,height:he,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{auto:!1,range:[0,100]}},axes:[{stroke:Ce,grid:{stroke:se,width:1},ticks:{stroke:se,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Pe,oe)=>oe.map(Ve=>yu(Ve))},{stroke:Ce,grid:{stroke:se,width:1},ticks:{stroke:se,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Pe,oe)=>oe.map(Ve=>`${parseFloat(Ve.toFixed(0))}%`)}],series:le,bands:ce,hooks:{setCursor:[Pe=>{if(!b.current||!j)return;const{left:oe,top:Ve,idx:He}=Pe.cursor;if(He==null||oe===void 0||Ve===void 0||oe<0){b.current.style.display="none";return}const ze=j[0][He];if(ze===void 0){b.current.style.display="none";return}let ae=`<div class="font-medium mb-1">${`Time ${Vs(Number(ze))}`}</div>`,Z=0;U.forEach((Ue,Se)=>{const ke=j[Se+1][He],qe=ke-Z;if(Z=ke,qe<=0)return;const Je=P1(Ue,a);ae+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Je}"></div>
                  <span>${px(Ue)}</span>
                  <span class="font-medium ml-auto">${parseFloat(qe.toFixed(2))}%</span>
                </div>
              `}),b.current.innerHTML=ae,b.current.style.display="block";const ge=m.current.getBoundingClientRect(),we=b.current.getBoundingClientRect();let _e=ge.left+oe+15;_e+we.width+20>window.innerWidth&&(_e=ge.left+oe-we.width-15+Pe.bbox.left),_e=Math.max(4,_e);let ve=ge.top-we.height+20;ve<4&&(ve=ge.top+8),b.current.style.left=`${_e}px`,b.current.style.top=`${ve}px`}]}};x.current&&x.current.destroy();const Me=new ss(de,j,Q);x.current=Me;const Te=new ResizeObserver(Pe=>{for(const oe of Pe){const{width:Ve,height:He}=oe.contentRect;Me&&Ve>0&&He>0&&Me.setSize({width:Ve,height:He})}});return Te.observe(Q),()=>{Te.disconnect(),Me.destroy(),x.current=null}},[j,le,ce,X,a,U,A,l]);const ie=w.useCallback(()=>{b.current&&(b.current.style.display="none")},[]),fe=J&&!K;return f(d.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&&fe&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!l&&s,d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",l?"text-sm":"text-xs"),title:n,children:n})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:_,onCheckedChange:S,children:"Ignore First Step"}),d.jsx(ur,{checked:M,onCheckedChange:C,children:"Show Unfinished Intervals"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.jsx("input",{type:"text",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"1m",value:P,onChange:Q=>k(Q.target.value),onBlur:Q=>W(Q.target.value),onKeyDown:Q=>{Q.stopPropagation(),Q.key==="Enter"&&W(Q.currentTarget.value)},onClick:Q=>Q.stopPropagation()})]})]})]}),d.jsx(L0,{isFullscreen:l,onClick:c}),!l&&o]})]}),(_||M)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[_&&d.jsx(rs,{label:"Ignoring First Step",onRemove:()=>S(!1)}),M&&d.jsx(rs,{label:"Showing Unfinished Intervals",onRemove:()=>C(!1)})]}),X&&U.length>0&&d.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-1.5",children:U.map(Q=>{const ue=!!(Y!=null&&Y.has(Q)),he=!!Y&&Y.size>0&&!ue,se=P1(Q,a);return d.jsxs("div",{className:bt("flex items-center gap-1 select-none transition-opacity duration-150 cursor-pointer",ue&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:he?.3:1},onPointerEnter:()=>R(Q),onPointerLeave:()=>R(null),onClick:()=>V(Q),children:[d.jsx("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:he?ad(se,.25):se}}),d.jsx("span",{className:"text-[10px] text-muted-foreground",children:px(Q)})]},Q)})})]}),X?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:m,onMouseLeave:ie,children:[d.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"}}),K&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:J?"Loading...":"No data"})]}))}function Y$({runs:t,shouldPoll:e,scrollRoot:n=null,label:r,categories:i,headerPrefix:s,headerSuffix:o}){return d.jsx($k,{runs:t,shouldPoll:e,scrollRoot:n,label:r,categories:i,headerPrefix:s,headerSuffix:o})}const C0e={idle:"Idle",working:"Working",generating:"Generating",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 px(t){return C0e[t]||t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function V_({runs:t,shouldPoll:e,trainerMetricType:n,label:r,hoveredRunId:i=null,scrollRoot:s=null,headerPrefix:o,headerSuffix:a}){var he,se,Ce,de,Me,Te,Pe,oe,Ve,He;const l=qn(as),{isFullscreen:c,toggleFullscreen:f,fullscreenPortal:p}=O0(),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),_=w.useRef(null),[S,M]=w.useState(!0),[C,A]=w.useState(!1),[N,P]=w.useState(60),[k,O]=w.useState(Vs(60)),R=w.useCallback(ze=>{const Ge=Lw(ze);Ge!==null&&Ge>=1?(P(Ge),O(Vs(Ge))):O(Vs(N))},[N]),B=j0(m,{root:s,threshold:0})||c,V=w.useMemo(()=>{const ze=t.filter(ae=>!ae.isSelected),Ge=t.filter(ae=>ae.isSelected);return[...ze,...Ge]},[t]),W=w.useMemo(()=>V.slice(0,20),[V]),G=Qu(((he=W[0])==null?void 0:he.runPath)??"",B&&!!W[0],e,N),ee=Qu(((se=W[1])==null?void 0:se.runPath)??"",B&&!!W[1],e,N),H=Qu(((Ce=W[2])==null?void 0:Ce.runPath)??"",B&&!!W[2],e,N),q=Qu(((de=W[3])==null?void 0:de.runPath)??"",B&&!!W[3],e,N),J=Qu(((Me=W[4])==null?void 0:Me.runPath)??"",B&&!!W[4],e,N),K=Qu(((Te=W[5])==null?void 0:Te.runPath)??"",B&&!!W[5],e,N),ne=Qu(((Pe=W[6])==null?void 0:Pe.runPath)??"",B&&!!W[6],e,N),U=Qu(((oe=W[7])==null?void 0:oe.runPath)??"",B&&!!W[7],e,N),z=Qu(((Ve=W[8])==null?void 0:Ve.runPath)??"",B&&!!W[8],e,N),Y=Qu(((He=W[9])==null?void 0:He.runPath)??"",B&&!!W[9],e,N),j=w.useMemo(()=>[G,ee,H,q,J,K,ne,U,z,Y],[G,ee,H,q,J,K,ne,U,z,Y]),le=j.some((ze,Ge)=>Ge<W.length&&ze.isFetching),ce=le&&j.filter((ze,Ge)=>Ge<W.length&&ze.isFetching).every(ze=>!!ze.data),{uplotData:X,seriesConfig:ie,hasData:fe}=w.useMemo(()=>{const ze=new Map,Ge=new Set;let ae=!1;if(W.forEach((ve,Ue)=>{if(Ue>=10)return;const Se=j[Ue].data;if(!Se||Se.first_time===null)return;const ke=Se.first_time,qe=Se.buckets;if(!qe||qe.length===0)return;let Je=null;if(S){const tt=Se.step_times??[];tt.length>0&&(Je=tt[0].time-ke)}ae=!0;const nt=new Map;if(qe.forEach(tt=>{const be=tt[n];if(be!=null){const Le=tt.time-ke;if(S&&Je!==null&&Le<Je)return;nt.set(Le,be),Ge.add(Le)}}),!C&&qe.length>0){const tt=Se.last_time;if(tt!=null){const be=qe[qe.length-1].time;if(be+N>tt){const Le=be-ke;nt.delete(Le),Ge.delete(Le)}}}ze.set(Ue,nt)}),!ae||Ge.size===0)return{uplotData:null,seriesConfig:[],hasData:!1};const Z=Array.from(Ge).sort((ve,Ue)=>ve-Ue),ge=new Float64Array(Z),we=[{label:"Time (s)"}],_e=[ge];return W.forEach((ve,Ue)=>{if(Ue>=10)return;const Se=ze.get(Ue),ke=Z.map(tt=>(Se==null?void 0:Se.get(tt))??null),qe=i===ve.runPath,nt=i!==null&&!qe?.1:1;_e.push(ke),we.push({label:wp(ve),stroke:ve.color,width:1,alpha:nt,spanGaps:!0,points:{show:!1}})}),{uplotData:_e,seriesConfig:we,hasData:!0}},[W,j,n,i,S,C,N]);w.useEffect(()=>{if(!x.current||!X||!fe)return;const ze=x.current,Ge=ze.clientWidth,ae=ze.clientHeight||200,Z=l?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ge=l?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",we={width:Ge,height:ae,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{auto:!0}},axes:[{stroke:ge,grid:{stroke:Z,width:1},ticks:{stroke:Z,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Ue,Se)=>Se.map(ke=>yu(ke))},{stroke:ge,grid:{stroke:Z,width:1},ticks:{stroke:Z,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Ue,Se)=>Se.map(ke=>`${parseFloat(ke.toFixed(1))}%`)}],series:ie,hooks:{draw:[Ue=>{var ke;if(!X)return;const Se=Ue.ctx;Se.save();for(let qe=1;qe<Ue.series.length;qe++){const Je=X[qe];if(!Je)continue;let nt=-1;for(let mt=Je.length-1;mt>=0;mt--)if(Je[mt]!==null&&Je[mt]!==void 0){nt=mt;break}if(nt===-1)continue;const tt=X[0][nt],be=Je[nt];if(tt===void 0||be===void 0||be===null)continue;const Le=Ue.valToPos(Number(tt),"x",!0),Ze=Ue.valToPos(Number(be),"y",!0);if(!Number.isFinite(Le)||!Number.isFinite(Ze))continue;const Ee=Ue.series[qe],Ye=typeof(Ee==null?void 0:Ee.alpha)=="number"?Ee.alpha:1,it=typeof(Ee==null?void 0:Ee.stroke)=="string"?Ee.stroke:(ke=V[qe-1])==null?void 0:ke.color;it&&(Se.globalAlpha=Ye,Se.fillStyle=it,Se.beginPath(),Se.arc(Le,Ze,4,0,Math.PI*2),Se.fill())}Se.restore()}],setCursor:[Ue=>{if(!_.current||!X)return;const{left:Se,top:ke,idx:qe}=Ue.cursor;if(qe==null||Se===void 0||ke===void 0||Se<0){_.current.style.display="none";return}const Je=X[0][qe];if(Je===void 0){_.current.style.display="none";return}let tt=`<div class="font-medium mb-1">${`Time ${Vs(Number(Je))}`}</div>`;t.forEach(Ye=>{const it=W.findIndex(Ae=>Ae.runPath===Ye.runPath);if(it===-1)return;const mt=it+1,ft=X[mt];if(!ft)return;const Qe=ft[qe];Qe!=null&&(tt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Ye.color}"></div>
                    <span>${Ow(Ye)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium">${parseFloat(Qe.toFixed(2))}%</span>
                  </div>
                </div>
              `)}),_.current.innerHTML=tt,_.current.style.display="block";const be=x.current.getBoundingClientRect(),Le=_.current.getBoundingClientRect();let Ze=be.left+Se+15;Ze+Le.width+20>window.innerWidth&&(Ze=be.left+Se-Le.width-15+Ue.bbox.left),Ze=Math.max(4,Ze);let Ee=be.top-Le.height+20;Ee<4&&(Ee=be.top+8),_.current.style.left=`${Ze}px`,_.current.style.top=`${Ee}px`}]}};b.current&&b.current.destroy();const _e=new ss(we,X,ze);b.current=_e;const ve=new ResizeObserver(Ue=>{for(const Se of Ue){const{width:ke,height:qe}=Se.contentRect;_e&&ke>0&&qe>0&&_e.setSize({width:ke,height:qe})}});return ve.observe(ze),()=>{ve.disconnect(),_e.destroy(),b.current=null}},[X,ie,fe,l,V,t,W,i,N,c]);const Q=w.useCallback(()=>{_.current&&(_.current.style.display="none")},[]),ue=le&&!ce;return p(d.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&&ue&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!c&&o,d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",c?"text-sm":"text-xs"),title:r,children:r})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:S,onCheckedChange:M,children:"Ignore First Step"}),d.jsx(ur,{checked:C,onCheckedChange:A,children:"Show Unfinished Intervals"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.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:k,onChange:ze=>O(ze.target.value),onBlur:ze=>R(ze.target.value),onKeyDown:ze=>{ze.stopPropagation(),ze.key==="Enter"&&R(ze.currentTarget.value)},onClick:ze=>ze.stopPropagation()})]})]})]}),d.jsx(L0,{isFullscreen:c,onClick:f}),!c&&a]})]}),(S||C)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[S&&d.jsx(rs,{label:"Ignoring First Step",onRemove:()=>M(!1)}),C&&d.jsx(rs,{label:"Showing Unfinished Intervals",onRemove:()=>A(!1)})]})]}),fe?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:x,onMouseLeave:Q,children:[d.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"}}),ce&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:le?"Loading...":"No data"})]}))}const qk=["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 P1(t,e){return t==="idle"?e?r8:kS:t==="working"?"#3b82f6":t==="working_except_weight_sync"||t==="training"||t==="generating"?"#6366f1":z_[t]||"#6b7280"}function ad(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 E0e={kept:"Kept",discarded:"Discarded",canceled:"Canceled"};function VA(t){return E0e[t]||t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function GA(t,e){return t==="kept"?Y_:t==="discarded"?e?JT:QT:t==="canceled"?e?NS:eC:tC}const A0e={kept:"rollouts_group_done_kept",discarded:"rollouts_group_done_discarded",canceled:"rollouts_group_done_canceled"};function K$({runs:t,shouldPoll:e,label:n,categories:r,scrollRoot:i=null,headerPrefix:s,headerSuffix:o}){const a=qn(as),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:f}=O0(),p=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),[_,S]=w.useState(!0),[M,C]=w.useState(!1),[A,N]=w.useState(60),[P,k]=w.useState(Vs(60)),[O,R]=w.useState(null),[L,B]=w.useState([]),V=w.useCallback(Q=>{B(ue=>ue.includes(Q)?ue.filter(se=>se!==Q):[...ue,Q])},[]),W=w.useCallback(Q=>{const ue=Lw(Q);ue!==null&&ue>=1?(N(ue),k(Vs(ue))):k(Vs(A))},[A]),ee=j0(p,{root:i,threshold:0})||l,H=t.find(Q=>Q.isSelected)??t[0],q=Zu((H==null?void 0:H.runPath)??"",ee&&!!H,e,A),J=q.isFetching,K=J&&!!q.data,{filteredBuckets:ne,activeCategories:U,runFirstTime:z}=w.useMemo(()=>{const Q=q.data;if(!Q||Q.first_time===null)return{filteredBuckets:[],activeCategories:[],runFirstTime:0};const ue=Q.first_time,he=new Map;for(const de of r){const Me=A0e[de];if(!Me)continue;const Te=Q[Me];if(Te)for(const Pe of Te)he.has(Pe.time)||he.set(Pe.time,{time:Pe.time}),he.get(Pe.time)[de]=Pe.count}let se=[...he.values()].sort((de,Me)=>de.time-Me.time).map(de=>{const Me=r.reduce((Pe,oe)=>Pe+(de[oe]??0),0),Te={time:de.time};for(const Pe of r)Te[Pe]=Me>0?(de[Pe]??0)/Me*100:0;return Te});if(_){const de=Q.step_times??[];if(de.length>0){const Me=de[0].time-ue;se=se.filter(Te=>Te.time-ue>=Me)}}!M&&se.length>0&&Q.last_time!==null&&Q.last_time!==void 0&&se[se.length-1].time+A>Q.last_time&&(se=se.slice(0,-1));const Ce=r.filter(de=>se.some(Me=>Me[de]!==void 0&&Me[de]>0));return{filteredBuckets:se,activeCategories:Ce,runFirstTime:ue}},[q.data,r,_,M,A]),Y=w.useMemo(()=>{const Q=L.filter(ue=>U.includes(ue));return Q.length>0&&Q.length<U.length?new Set(Q):O&&U.includes(O)?new Set([O]):null},[L,O,U]),{uplotData:j,seriesConfig:le,bandsConfig:ce,hasData:X}=w.useMemo(()=>{if(ne.length===0||U.length===0)return{uplotData:null,seriesConfig:[],bandsConfig:[],hasData:!1};const Q=new Float64Array(ne.map(de=>de.time-z)),ue=[{label:"Time (s)"}],he=[Q],se=[],Ce=new Array(ne.length).fill(0);return U.forEach((de,Me)=>{const Te=ne.map((ze,Ge)=>{const ae=ze[de]??0;return Ce[Ge]+=ae,Ce[Ge]}),Pe=Y!==null&&!Y.has(de),oe=GA(de,a),Ve=Pe?ad(oe,.15):ad(oe,.6),He=Pe?ad(oe,.25):oe;he.push(Te),ue.push({label:VA(de),stroke:He,width:0,fill:Me===0?Ve:void 0,points:{show:!1}}),Me>0&&se.push({series:[Me+1,Me],fill:Ve})}),{uplotData:he,seriesConfig:ue,bandsConfig:se,hasData:!0}},[ne,U,z,Y,a]);w.useEffect(()=>{if(!m.current||!j||!X)return;const Q=m.current,ue=Q.clientWidth,he=Q.clientHeight||200,se=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Ce=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",de={width:ue,height:he,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{auto:!1,range:[0,100]}},axes:[{stroke:Ce,grid:{stroke:se,width:1},ticks:{stroke:se,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Pe,oe)=>oe.map(Ve=>yu(Ve))},{stroke:Ce,grid:{stroke:se,width:1},ticks:{stroke:se,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Pe,oe)=>oe.map(Ve=>`${parseFloat(Ve.toFixed(0))}%`)}],series:le,bands:ce,hooks:{setCursor:[Pe=>{if(!b.current||!j)return;const{left:oe,top:Ve,idx:He}=Pe.cursor;if(He==null||oe===void 0||Ve===void 0||oe<0){b.current.style.display="none";return}const ze=j[0][He];if(ze===void 0){b.current.style.display="none";return}let ae=`<div class="font-medium mb-1">${`Time ${Vs(Number(ze))}`}</div>`,Z=0;U.forEach((Ue,Se)=>{const ke=j[Se+1][He],qe=ke-Z;if(Z=ke,qe<=0)return;const Je=GA(Ue,a);ae+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Je}"></div>
                  <span>${VA(Ue)}</span>
                  <span class="font-medium ml-auto">${parseFloat(qe.toFixed(2))}%</span>
                </div>
              `}),b.current.innerHTML=ae,b.current.style.display="block";const ge=m.current.getBoundingClientRect(),we=b.current.getBoundingClientRect();let _e=ge.left+oe+15;_e+we.width+20>window.innerWidth&&(_e=ge.left+oe-we.width-15+Pe.bbox.left),_e=Math.max(4,_e);let ve=ge.top-we.height+20;ve<4&&(ve=ge.top+8),b.current.style.left=`${_e}px`,b.current.style.top=`${ve}px`}]}};x.current&&x.current.destroy();const Me=new ss(de,j,Q);x.current=Me;const Te=new ResizeObserver(Pe=>{for(const oe of Pe){const{width:Ve,height:He}=oe.contentRect;Me&&Ve>0&&He>0&&Me.setSize({width:Ve,height:He})}});return Te.observe(Q),()=>{Te.disconnect(),Me.destroy(),x.current=null}},[j,le,ce,X,a,U,A,l]);const ie=w.useCallback(()=>{b.current&&(b.current.style.display="none")},[]),fe=J&&!K;return f(d.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&&fe&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!l&&s,d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",l?"text-sm":"text-xs"),title:n,children:n})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:_,onCheckedChange:S,children:"Ignore First Step"}),d.jsx(ur,{checked:M,onCheckedChange:C,children:"Show Unfinished Intervals"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.jsx("input",{type:"text",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"1m",value:P,onChange:Q=>k(Q.target.value),onBlur:Q=>W(Q.target.value),onKeyDown:Q=>{Q.stopPropagation(),Q.key==="Enter"&&W(Q.currentTarget.value)},onClick:Q=>Q.stopPropagation()})]})]})]}),d.jsx(L0,{isFullscreen:l,onClick:c}),!l&&o]})]}),(_||M)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[_&&d.jsx(rs,{label:"Ignoring First Step",onRemove:()=>S(!1)}),M&&d.jsx(rs,{label:"Showing Unfinished Intervals",onRemove:()=>C(!1)})]}),X&&U.length>0&&d.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-1.5",children:U.map(Q=>{const ue=!!(Y!=null&&Y.has(Q)),he=!!Y&&Y.size>0&&!ue,se=GA(Q,a);return d.jsxs("div",{className:bt("flex items-center gap-1 select-none transition-opacity duration-150 cursor-pointer",ue&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:he?.3:1},onPointerEnter:()=>R(Q),onPointerLeave:()=>R(null),onClick:()=>V(Q),children:[d.jsx("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:he?ad(se,.25):se}}),d.jsx("span",{className:"text-[10px] text-muted-foreground",children:VA(Q)})]},Q)})})]}),X?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:m,onMouseLeave:ie,children:[d.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"}}),K&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:J?"Loading...":"No data"})]}))}function l2({runs:t,shouldPoll:e,label:n,categories:r,scrollRoot:i=null,headerPrefix:s,headerSuffix:o}){const a=qn(as),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:f}=O0(),p=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),[_,S]=w.useState(!0),[M,C]=w.useState(!1),[A,N]=w.useState(60),[P,k]=w.useState(Vs(60)),[O,R]=w.useState(null),[L,B]=w.useState([]),V=w.useCallback(Q=>{B(ue=>ue.includes(Q)?ue.filter(Ce=>Ce!==Q):[...ue,Q])},[]),W=w.useCallback(Q=>{const ue=Lw(Q);ue!==null&&ue>=1?(N(ue),k(Vs(ue))):k(Vs(A))},[A]),ee=j0(p,{root:i,threshold:0})||l,H=t.find(Q=>Q.isSelected)??t[0],q=Qu((H==null?void 0:H.runPath)??"",ee&&!!H,e,A),J=q.isFetching,K=J&&!!q.data,{filteredBuckets:ne,activeCategories:U,runFirstTime:z}=w.useMemo(()=>{const Q=q.data;if(!Q||Q.first_time===null||!Q.buckets||Q.buckets.length===0)return{filteredBuckets:[],activeCategories:[],runFirstTime:0};const ue=Q.first_time;let he=Q.buckets;if(_){const Ce=Q.step_times??[];if(Ce.length>0){const de=Ce[0].time-ue;he=he.filter(Me=>Me.time-ue>=de)}}!M&&he.length>0&&Q.last_time!==null&&Q.last_time!==void 0&&he[he.length-1].time+A>Q.last_time&&(he=he.slice(0,-1));const se=r.filter(Ce=>he.some(de=>{const Me=de[Ce];return Me!==void 0&&Me>0}));return{filteredBuckets:he,activeCategories:se,runFirstTime:ue}},[q.data,r,_,M,A]),Y=w.useMemo(()=>{const Q=L.filter(ue=>U.includes(ue));return Q.length>0&&Q.length<U.length?new Set(Q):O&&U.includes(O)?new Set([O]):null},[L,O,U]),{uplotData:j,seriesConfig:le,bandsConfig:ce,hasData:X}=w.useMemo(()=>{if(ne.length===0||U.length===0)return{uplotData:null,seriesConfig:[],bandsConfig:[],hasData:!1};const Q=new Float64Array(ne.map(de=>de.time-z)),ue=[{label:"Time (s)"}],he=[Q],se=[],Ce=new Array(ne.length).fill(0);return U.forEach((de,Me)=>{const Te=ne.map((ze,Ge)=>{const ae=ze[de]??0;return Ce[Ge]+=ae,Ce[Ge]}),Pe=Y!==null&&!Y.has(de),oe=P1(de,a),Ve=Pe?ad(oe,.15):ad(oe,.6),He=Pe?ad(oe,.25):oe;he.push(Te),ue.push({label:px(de),stroke:He,width:0,fill:Me===0?Ve:void 0,points:{show:!1}}),Me>0&&se.push({series:[Me+1,Me],fill:Ve})}),{uplotData:he,seriesConfig:ue,bandsConfig:se,hasData:!0}},[ne,U,z,Y,a]);w.useEffect(()=>{if(!m.current||!j||!X)return;const Q=m.current,ue=Q.clientWidth,he=Q.clientHeight||200,se=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Ce=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",de={width:ue,height:he,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{auto:!1,range:[0,100]}},axes:[{stroke:Ce,grid:{stroke:se,width:1},ticks:{stroke:se,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Pe,oe)=>oe.map(Ve=>yu(Ve))},{stroke:Ce,grid:{stroke:se,width:1},ticks:{stroke:se,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Pe,oe)=>oe.map(Ve=>`${parseFloat(Ve.toFixed(0))}%`)}],series:le,bands:ce,hooks:{setCursor:[Pe=>{if(!b.current||!j)return;const{left:oe,top:Ve,idx:He}=Pe.cursor;if(He==null||oe===void 0||Ve===void 0||oe<0){b.current.style.display="none";return}const ze=j[0][He];if(ze===void 0){b.current.style.display="none";return}let ae=`<div class="font-medium mb-1">${`Time ${Vs(Number(ze))}`}</div>`,Z=0;U.forEach((Ue,Se)=>{const ke=j[Se+1][He],qe=ke-Z;if(Z=ke,qe<=0)return;const Je=P1(Ue,a);ae+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Je}"></div>
                  <span>${px(Ue)}</span>
                  <span class="font-medium ml-auto">${parseFloat(qe.toFixed(2))}%</span>
                </div>
              `}),b.current.innerHTML=ae,b.current.style.display="block";const ge=m.current.getBoundingClientRect(),we=b.current.getBoundingClientRect();let _e=ge.left+oe+15;_e+we.width+20>window.innerWidth&&(_e=ge.left+oe-we.width-15+Pe.bbox.left),_e=Math.max(4,_e);let ve=ge.top-we.height+20;ve<4&&(ve=ge.top+8),b.current.style.left=`${_e}px`,b.current.style.top=`${ve}px`}]}};x.current&&x.current.destroy();const Me=new ss(de,j,Q);x.current=Me;const Te=new ResizeObserver(Pe=>{for(const oe of Pe){const{width:Ve,height:He}=oe.contentRect;Me&&Ve>0&&He>0&&Me.setSize({width:Ve,height:He})}});return Te.observe(Q),()=>{Te.disconnect(),Me.destroy(),x.current=null}},[j,le,ce,X,a,U,A,l]);const ie=w.useCallback(()=>{b.current&&(b.current.style.display="none")},[]),fe=J&&!K;return f(d.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&&fe&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!l&&s,d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",l?"text-sm":"text-xs"),title:n,children:n})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:_,onCheckedChange:S,children:"Ignore First Step"}),d.jsx(ur,{checked:M,onCheckedChange:C,children:"Show Unfinished Intervals"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.jsx("input",{type:"text",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"1m",value:P,onChange:Q=>k(Q.target.value),onBlur:Q=>W(Q.target.value),onKeyDown:Q=>{Q.stopPropagation(),Q.key==="Enter"&&W(Q.currentTarget.value)},onClick:Q=>Q.stopPropagation()})]})]})]}),d.jsx(L0,{isFullscreen:l,onClick:c}),!l&&o]})]}),(_||M)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[_&&d.jsx(rs,{label:"Ignoring First Step",onRemove:()=>S(!1)}),M&&d.jsx(rs,{label:"Showing Unfinished Intervals",onRemove:()=>C(!1)})]}),X&&U.length>0&&d.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-1.5",children:U.map(Q=>{const ue=!!(Y!=null&&Y.has(Q)),he=!!Y&&Y.size>0&&!ue,se=P1(Q,a);return d.jsxs("div",{className:bt("flex items-center gap-1 select-none transition-opacity duration-150 cursor-pointer",ue&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:he?.3:1},onPointerEnter:()=>R(Q),onPointerLeave:()=>R(null),onClick:()=>V(Q),children:[d.jsx("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:he?ad(se,.25):se}}),d.jsx("span",{className:"text-[10px] text-muted-foreground",children:px(Q)})]},Q)})})]}),X?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:m,onMouseLeave:ie,children:[d.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"}}),K&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:J?"Loading...":"No data"})]}))}function N0e({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(f=>f.isSelected)??t[0],a=((c=Qu((s==null?void 0:s.runPath)??"",!!s,e).data)==null?void 0:c.event_types)??[],l=w.useMemo(()=>{const f=qk.filter(m=>a.includes(m)||m==="idle"),p=a.filter(m=>!qk.includes(m));return[...f,...p]},[a]);return d.jsxs("div",{children:[d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-1",children:"Time Breakdown (Area)"}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsx(l2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Trainer Idle vs Working",categories:["idle","working"]}),d.jsx(l2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Trainer Idle vs Training vs Weight Sync",categories:["idle","training","weight_broadcast"]}),d.jsx(l2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Trainer Time Detailed Breakdown",categories:l})]}),d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"% Time per Category"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(V_,{trainerMetricType:"idle",label:"Trainer % Idle",...i}),d.jsx(V_,{trainerMetricType:"working",label:"Trainer % Working",...i}),d.jsx(V_,{trainerMetricType:"working_except_weight_sync",label:"Trainer % Working (excl. Weight Sync)",...i}),a.map(f=>d.jsx(V_,{trainerMetricType:f,label:`Trainer % ${px(f)}`,...i},f))]})]})}function Z$({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null,trainerMetricType:i,label:s,headerPrefix:o,headerSuffix:a}){return d.jsx(V_,{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:"Trainer Idle vs Working",categories:["idle","working"]},{key:"trainer_area_idle_vs_training_vs_weight_sync",label:"Trainer Idle vs Training vs Weight Sync",categories:["idle","training","weight_broadcast"]},{key:"trainer_area_detailed",label:"Trainer Time Detailed Breakdown",categories:[...qk]}];function J$({runs:t,shouldPoll:e,scrollRoot:n=null,label:r,categories:i,headerPrefix:s,headerSuffix:o}){return d.jsx(l2,{runs:t,shouldPoll:e,scrollRoot:n,label:r,categories:i,headerPrefix:s,headerSuffix:o})}const Cg=["mean","std","min","max"],Eg={mean:"Mean",std:"Std",min:"Min",max:"Max"};function t5(){return Math.random().toString(36).slice(2,10)}function x1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function eq(t,e,n){const r=[];for(const[i,s]of Object.entries(t)){const o=x1(i);for(const[a,l]of Object.entries(s)){const c=a?x1(a):void 0;for(const f of l)r.push({section:o,group:c,metricKey:f,label:x1(f),plotType:"step_metric",simple:!0})}}for(const i of Cg)r.push({section:"Reward",metricKey:`reward_sum_${i}`,label:`Reward ${Eg[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=x1(i);for(const o of Cg)r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_${o}`,label:`${s} ${Eg[o]}`,plotType:"step_metric"});r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_gini_mean`,label:`${s} Sparsity (Gini)`,plotType:"step_metric",simple:!0}),r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_distribution_over_time`,label:`${s} Dist. Over Time`,plotType:"distribution_over_time",distMetricType:`reward_${i}`})}for(const i of Cg)r.push({section:"Advantage",metricKey:`advantage_${i}`,label:`Advantage ${Eg[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=x1(o);for(const l of Cg)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`reward_${o}_${l}`,label:`${s} ${a} ${Eg[l]}`,plotType:"eval_metric",evalName:s})}for(const o of["length_completion","length_prompt","length_sum"]){const a=o==="length_completion"?"Tokens Completion":o==="length_prompt"?"Tokens Prompt":"Tokens Total";for(const l of Cg)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`${o}_${l}`,label:`${s} ${a} ${Eg[l]}`,plotType:"eval_metric",evalName:s})}}for(const i of["length_prompt","length_completion","length_sum"]){const s=i==="length_prompt"?"Tokens Prompt":i==="length_completion"?"Tokens Completion":"Tokens Total";for(const o of Cg)r.push({section:"Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${Eg[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:"Discarded Zero Advantage %"},{key:"discarded_max_async_pct",label:"Discarded Max Async %"},{key:"discarded_stop_reason_length_pct",label:"Discarded % Stop Reason = Length"},{key:"discarded_group_length_gini_mean",label:"Discarded Group Completion Length Gini"},{key:"discarded_group_length_max_median_ratio_mean",label:"Discarded Group Completion Length Max/Median"},{key:"discarded_zero_advantage_all_zero_pct",label:"Discarded Zero Adv (All Reward = 0) %"},{key:"discarded_zero_advantage_all_positive_pct",label:"Discarded Zero Adv (All Reward > 0) %"},{key:"discarded_zero_advantage_mean_reward",label:"Discarded 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:"Discarded 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:"Discarded 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:"Discarded 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 Cg)r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${Eg[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:"Inference % Generation (Normal)"},{key:"timing_generation_discarded_pct",label:"Inference % Generation (Discarded)"},{key:"timing_generation_canceled_pct",label:"Inference % Generation (Canceled)"},{key:"timing_generation_all_pct",label:"Inference % Generation (All)"},{key:"timing_compute_reward_normal_pct",label:"Inference % Compute Reward (Normal)"},{key:"timing_compute_reward_discarded_pct",label:"Inference % Compute Reward (Discarded)"},{key:"timing_compute_reward_canceled_pct",label:"Inference % Compute Reward (Canceled)"},{key:"timing_compute_reward_all_pct",label:"Inference % Compute Reward (All)"},{key:"timing_idle_pct",label:"Inference % 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 X$)r.push({section:"Inference Performance",group:"Breakdown (Area)",metricKey:i.key,label:i.label,plotType:"inference_utilization_area",inferenceAreaCategories:[...i.categories]});for(const i of $$)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:"Trainer % Idle",trainerMetricType:"idle"},{key:"trainer_perf_working",label:"Trainer % Working",trainerMetricType:"working"},{key:"trainer_perf_working_except_weight_sync",label:"Trainer % 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:"Trainer % Forward",trainerMetricType:"forward"},{key:"trainer_perf_backward",label:"Trainer % Backward",trainerMetricType:"backward"},{key:"trainer_perf_optimizer",label:"Trainer % Optimizer",trainerMetricType:"optimizer"},{key:"trainer_perf_loss_computation",label:"Trainer % Loss Computation",trainerMetricType:"loss_computation"},{key:"trainer_perf_weight_broadcast",label:"Trainer % Weight Sync",trainerMetricType:"weight_broadcast"},{key:"trainer_perf_data_wait",label:"Trainer % Data Wait",trainerMetricType:"data_wait"},{key:"trainer_perf_grad_clip",label:"Trainer % Grad Clip",trainerMetricType:"grad_clip"},{key:"trainer_perf_grad_norm",label:"Trainer % Grad Norm",trainerMetricType:"grad_norm"},{key:"trainer_perf_data_to_device",label:"Trainer % Data to Device",trainerMetricType:"data_to_device"},{key:"trainer_perf_prepare_tensors",label:"Trainer % Prepare Tensors",trainerMetricType:"prepare_tensors"},{key:"trainer_perf_compute_entropy",label:"Trainer % Compute Entropy",trainerMetricType:"compute_entropy"},{key:"trainer_perf_compute_kl",label:"Trainer % Compute KL",trainerMetricType:"compute_kl"},{key:"trainer_perf_checkpoint",label:"Trainer % 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 $O(t){await fetch(`${Xn}/custom-metrics-layout`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:t})})}async function qO(t,e){await fetch(`${Xn}/custom-metrics-templates/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:e})})}function n5({open:t,onOpenChange:e,title:n,existingNames:r,initialValue:i="",onSubmit:s}){const[o,a]=w.useState(i),[l,c]=w.useState(""),f=w.useRef(null),p=x=>{x&&(a(i),c(""),setTimeout(()=>{var b;return(b=f.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 d.jsx(su,{open:t,onOpenChange:p,children:d.jsxs(ou,{className:"sm:max-w-[340px]",children:[d.jsx(Dc,{children:d.jsx(Pc,{children:n})}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Jd,{ref:f,value:o,onChange:x=>{a(x.target.value),c("")},onKeyDown:x=>{x.key==="Enter"&&m()},placeholder:"Name..."}),l&&d.jsx("p",{className:"text-xs text-destructive",children:l})]}),d.jsx(AS,{children:d.jsx(wn,{size:"sm",onClick:m,children:i?"Rename":"Create"})})]})})}function XO(t){return`${t.plotType}|${t.evalName||""}|${t.metricKey}`}function Sy({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=XO(x);m.set(b,(m.get(b)??0)+1)}return m},[r]),[a,l]=w.useState(!1),[c,f]=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 d.jsxs(YT,{open:a,onOpenChange:l,children:[d.jsx(KT,{asChild:!0,children:i}),d.jsxs(ZT,{align:"start",className:"w-[320px] p-0",onClick:m=>m.stopPropagation(),children:[d.jsx("div",{className:"p-2 border-b",children:d.jsx(Jd,{value:c,onChange:m=>f(m.target.value),placeholder:"Search metrics...",className:"h-7 text-xs"})}),d.jsxs("div",{className:"max-h-[50vh] overflow-y-auto p-1.5",children:[p.length===0&&d.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No metrics found"}),p.map(m=>d.jsxs("div",{className:"mb-2",children:[d.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=>d.jsxs("div",{children:[x.group&&d.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(XO(b))??0,S=_>0;return d.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),f(""))},children:[d.jsx("span",{className:"flex-1",children:b.label}),s?_>0&&d.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:_}):S&&d.jsx(D0,{className:"h-3 w-3 text-muted-foreground shrink-0"})]},`${b.plotType}-${b.evalName||""}-${b.metricKey}`)})]},`${m.section}-${x.group}`))]},m.section))]})]})]})}function tq({open:t,onOpenChange:e,title:n,description:r,onConfirm:i}){return d.jsx(L2,{open:t,onOpenChange:e,children:d.jsxs(j2,{children:[d.jsxs(z2,{children:[d.jsx(U2,{children:n}),d.jsx(B2,{children:r})]}),d.jsxs(F2,{children:[d.jsx(V2,{children:"Cancel"}),d.jsx(H2,{variant:"destructive",onClick:i,children:"Delete"})]})]})})}function P8({plot:t,onRemove:e,chartProps:n}){const{attributes:r,listeners:i,setNodeRef:s,transform:o,transition:a,isDragging:l}=aC({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},f=t.label||x1(t.metricKey),p=d.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:d.jsx(WT,{className:"h-3 w-3 text-muted-foreground"})}),m=d.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:d.jsx(Na,{className:"h-3 w-3"})});return d.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?d.jsx(e5,{runPath:x.runPath,metricType:t.distMetricType,label:f,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,headerPrefix:p,headerSuffix:m}):null})():t.plotType==="inference_performance"&&t.inferenceMetricType?d.jsx(W$,{runs:n.runs,shouldPoll:n.shouldPoll,hoveredRunId:n.hoveredRunId,scrollRoot:n.scrollRoot,inferenceMetricType:t.inferenceMetricType,label:f,headerPrefix:p,headerSuffix:m}):t.plotType==="inference_performance_area"&&t.inferenceAreaCategories?d.jsx(q$,{runs:n.runs,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,label:f,categories:t.inferenceAreaCategories,headerPrefix:p,headerSuffix:m}):t.plotType==="inference_utilization_area"&&t.inferenceAreaCategories?d.jsx(Y$,{runs:n.runs,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,label:f,categories:t.inferenceAreaCategories,headerPrefix:p,headerSuffix:m}):t.plotType==="trainer_performance"&&t.trainerMetricType?d.jsx(Z$,{runs:n.runs,shouldPoll:n.shouldPoll,hoveredRunId:n.hoveredRunId,scrollRoot:n.scrollRoot,trainerMetricType:t.trainerMetricType,label:f,headerPrefix:p,headerSuffix:m}):t.plotType==="trainer_performance_area"&&t.trainerAreaCategories?d.jsx(J$,{runs:n.runs,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,label:f,categories:t.trainerAreaCategories,headerPrefix:p,headerSuffix:m}):t.plotType==="eval_metric"&&t.evalName?d.jsx(G$,{runs:n.runs,shouldPoll:n.shouldPoll,evalName:t.evalName,metricName:t.metricKey,label:f,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}):d.jsx(er,{runs:n.runs,shouldPoll:n.shouldPoll,metricName:t.metricKey,label:f,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 k0e({group:t,catalog:e,groupNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=w.useState(!0),[l,c]=w.useState(!1),[f,p]=w.useState(!1),[m,x]=w.useState(!1),{attributes:b,listeners:_,setNodeRef:S,transform:M,transition:C,isDragging:A}=aC({id:t.id}),N={transform:dy.Transform.toString(M),transition:C,opacity:A?.4:1},P=B=>{const V={id:t5(),metricKey:B.metricKey,label:B.label,plotType:B.plotType,evalName:B.evalName,distMetricType:B.distMetricType,inferenceMetricType:B.inferenceMetricType,inferenceAreaCategories:B.inferenceAreaCategories,trainerMetricType:B.trainerMetricType,trainerAreaCategories:B.trainerAreaCategories};r({...t,plots:[...t.plots,V]})},k=B=>{r({...t,plots:t.plots.filter(V=>V.id!==B)})},O=B=>{r({...t,name:B})},R=fy(od(d0,{activationConstraint:{distance:5}}),od(u0,{coordinateGetter:gy})),L=B=>{const{active:V,over:W}=B;if(!W||V.id===W.id)return;const G=t.plots.findIndex(H=>H.id===V.id),ee=t.plots.findIndex(H=>H.id===W.id);G===-1||ee===-1||r({...t,plots:f0(t.plots,G,ee)})};return d.jsxs("div",{ref:S,style:N,children:[d.jsxs(Di,{open:o,onOpenChange:a,children:[d.jsxs("div",{className:"flex items-center gap-1 h-8",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[d.jsx(Pi,{asChild:!0,children:d.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:[d.jsx(kr,{className:bt("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",!o&&"-rotate-90")}),d.jsx("h4",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:t.name})]})}),d.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:d.jsx(WT,{className:"h-3.5 w-3.5 text-muted-foreground"})}),d.jsxs("div",{className:bt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[d.jsx(Sy,{catalog:e,onSelect:P,existingPlots:t.plots,allowDuplicates:!0,children:d.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:[d.jsx(pp,{className:"h-3 w-3"}),"New Plot"]})}),d.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:d.jsx(cW,{className:"h-3 w-3 text-muted-foreground"})}),d.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:d.jsx(Na,{className:"h-3 w-3 text-muted-foreground"})})]})]}),d.jsx(Ii,{children:d.jsx(py,{sensors:R,collisionDetection:hy,onDragEnd:L,children:d.jsx(my,{items:t.plots.map(B=>B.id),strategy:Iw,children:d.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(B=>d.jsx(P8,{plot:B,onRemove:()=>k(B.id),chartProps:s},B.id)),t.plots.length===0&&d.jsx(Sy,{catalog:e,onSelect:P,existingPlots:t.plots,allowDuplicates:!0,children:d.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:[d.jsx(pp,{className:"h-3.5 w-3.5"}),"Add a plot"]})})]})})})})]}),d.jsx(n5,{open:f,onOpenChange:p,title:"Rename Group",existingNames:n.filter(B=>B!==t.name),onSubmit:O,initialValue:t.name}),d.jsx(tq,{open:m,onOpenChange:x,title:"Delete Group",description:`Delete "${t.name}" and all its plots?`,onConfirm:i})]})}function R0e({section:t,catalog:e,allSectionNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=w.useState(!0),[l,c]=w.useState(!1),[f,p]=w.useState(!1),[m,x]=w.useState(!1),[b,_]=w.useState(!1),{attributes:S,listeners:M,setNodeRef:C,transform:A,transition:N,isDragging:P}=aC({id:t.id}),k={transform:dy.Transform.toString(A),transition:N,opacity:P?.4:1},O=t.groups.map(K=>K.name),R=K=>{const ne={id:t5(),name:K,plots:[]};r({...t,groups:[...t.groups,ne]})},L=(K,ne)=>{r({...t,groups:t.groups.map(U=>U.id===K?ne:U)})},B=K=>{r({...t,groups:t.groups.filter(ne=>ne.id!==K)})},V=K=>{const ne={id:t5(),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,ne]})},W=K=>{r({...t,plots:t.plots.filter(ne=>ne.id!==K)})},G=K=>{r({...t,name:K})},ee=fy(od(d0,{activationConstraint:{distance:5}}),od(u0,{coordinateGetter:gy})),H=K=>{const{active:ne,over:U}=K;if(!U||ne.id===U.id)return;const z=t.groups.findIndex(j=>j.id===ne.id),Y=t.groups.findIndex(j=>j.id===U.id);z===-1||Y===-1||r({...t,groups:f0(t.groups,z,Y)})},q=fy(od(d0,{activationConstraint:{distance:5}}),od(u0,{coordinateGetter:gy})),J=K=>{const{active:ne,over:U}=K;if(!U||ne.id===U.id)return;const z=t.plots.findIndex(j=>j.id===ne.id),Y=t.plots.findIndex(j=>j.id===U.id);z===-1||Y===-1||r({...t,plots:f0(t.plots,z,Y)})};return d.jsxs("div",{ref:C,style:k,children:[d.jsxs(Di,{open:o,onOpenChange:a,children:[d.jsxs("div",{className:"flex items-center gap-1.5 h-9",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[d.jsx(Pi,{asChild:!0,children:d.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:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform shrink-0",!o&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:t.name})]})}),d.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:d.jsx(WT,{className:"h-4 w-4 text-muted-foreground"})}),d.jsxs("div",{className:bt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[d.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:[d.jsx(pp,{className:"h-3 w-3"}),"New Group"]}),d.jsx(Sy,{catalog:e,onSelect:V,existingPlots:t.plots,allowDuplicates:!0,children:d.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:[d.jsx(pp,{className:"h-3 w-3"}),"New Plot"]})}),d.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:d.jsx(cW,{className:"h-3.5 w-3.5 text-muted-foreground"})}),d.jsx("button",{onClick:()=>_(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:d.jsx(Na,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),d.jsxs(Ii,{children:[t.plots.length>0&&d.jsx(py,{sensors:q,collisionDetection:hy,onDragEnd:J,children:d.jsx(my,{items:t.plots.map(K=>K.id),strategy:Iw,children:d.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=>d.jsx(P8,{plot:K,onRemove:()=>W(K.id),chartProps:s},K.id))})})}),d.jsx(py,{sensors:ee,collisionDetection:hy,onDragEnd:H,children:d.jsx(my,{items:t.groups.map(K=>K.id),strategy:m8,children:d.jsx("div",{className:"space-y-2",children:t.groups.map(K=>d.jsx(k0e,{group:K,catalog:e,groupNames:O,onUpdate:ne=>L(K.id,ne),onRemove:()=>B(K.id),chartProps:s},K.id))})})}),t.plots.length===0&&t.groups.length===0&&d.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[d.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"No plots yet. Add a group or a plot."}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(wn,{size:"sm",variant:"outline",onClick:()=>p(!0),children:[d.jsx(pp,{className:"h-3.5 w-3.5 mr-1"}),"New Group"]}),d.jsx(Sy,{catalog:e,onSelect:V,existingPlots:t.plots,allowDuplicates:!0,children:d.jsxs(wn,{size:"sm",variant:"outline",children:[d.jsx(pp,{className:"h-3.5 w-3.5 mr-1"}),"New Plot"]})})]})]})]})]}),d.jsx(n5,{open:f,onOpenChange:p,title:"New Group",existingNames:O,onSubmit:R}),d.jsx(n5,{open:m,onOpenChange:x,title:"Rename Section",existingNames:n.filter(K=>K!==t.name),onSubmit:G,initialValue:t.name}),d.jsx(tq,{open:b,onOpenChange:_,title:"Delete Section",description:`Delete "${t.name}" and all its groups and plots?`,onConfirm:i})]})}function D0e({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,availableRewardNames:s,customMetricSections:o,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:f,evalsList:p,newSectionTrigger:m,availableSampleTags:x,availableEnvs:b,activeTemplateId:_,layoutSnapshotTrigger:S,onLayoutSnapshot:M}){var be,Le,Ze,Ee,Ye,it,mt,ft,Qe,Ae,Xe,Re,Be,ot,dt,Nt,Dt,St,Ht,rn;const C=M0(),{data:A,isLoading:N}=gW(),{data:P}=Hde(_),[k,O]=w.useState({sections:[]}),[R,L]=w.useState(!1),[B,V]=w.useState(!1),[W,G]=w.useState(void 0);_!==W?_===null?A&&(G(null),O(A.layout??{sections:[]})):P&&P.id===_&&(G(_),O(P.layout??{sections:[]})):!B&&_===null&&A&&(V(!0),G(null),A.layout&&O(A.layout));const[ee,H]=w.useState(m);m!==ee&&(H(m),L(!0));const[q,J]=w.useState(S);S!==q&&(J(S),M(k));const K=w.useRef(null),ne=w.useRef(null),U=w.useRef(_);U.current=_;const z=w.useCallback(Ut=>{O(Ut);const Ft=U.current;Ft===null?C.setQueryData(["custom-metrics-layout"],{layout:Ut}):C.setQueryData(["custom-metrics-template",Ft],Bt=>Bt&&{...Bt,layout:Ut}),ne.current=Ut,K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{if(ne.current){const Bt=ne.current;ne.current=null;const Kt=U.current;Kt===null?await $O(Bt):await qO(Kt,Bt)}},500)},[C]);w.useEffect(()=>()=>{if(K.current&&clearTimeout(K.current),ne.current){const Ut=ne.current;ne.current=null;const Ft=U.current;Ft===null?$O(Ut):qO(Ft,Ut)}},[]);const Y=w.useMemo(()=>eq(o,s,p),[o,s,p]),j=a==="time",le=Vr(((be=t[0])==null?void 0:be.runPath)||"",j&&!!t[0],e),ce=Vr(((Le=t[1])==null?void 0:Le.runPath)||"",j&&!!t[1],e),X=Vr(((Ze=t[2])==null?void 0:Ze.runPath)||"",j&&!!t[2],e),ie=Vr(((Ee=t[3])==null?void 0:Ee.runPath)||"",j&&!!t[3],e),fe=Vr(((Ye=t[4])==null?void 0:Ye.runPath)||"",j&&!!t[4],e),Q=Vr(((it=t[5])==null?void 0:it.runPath)||"",j&&!!t[5],e),ue=Vr(((mt=t[6])==null?void 0:mt.runPath)||"",j&&!!t[6],e),he=Vr(((ft=t[7])==null?void 0:ft.runPath)||"",j&&!!t[7],e),se=Vr(((Qe=t[8])==null?void 0:Qe.runPath)||"",j&&!!t[8],e),Ce=Vr(((Ae=t[9])==null?void 0:Ae.runPath)||"",j&&!!t[9],e),de=Vr(((Xe=t[10])==null?void 0:Xe.runPath)||"",j&&!!t[10],e),Me=Vr(((Re=t[11])==null?void 0:Re.runPath)||"",j&&!!t[11],e),Te=Vr(((Be=t[12])==null?void 0:Be.runPath)||"",j&&!!t[12],e),Pe=Vr(((ot=t[13])==null?void 0:ot.runPath)||"",j&&!!t[13],e),oe=Vr(((dt=t[14])==null?void 0:dt.runPath)||"",j&&!!t[14],e),Ve=Vr(((Nt=t[15])==null?void 0:Nt.runPath)||"",j&&!!t[15],e),He=Vr(((Dt=t[16])==null?void 0:Dt.runPath)||"",j&&!!t[16],e),ze=Vr(((St=t[17])==null?void 0:St.runPath)||"",j&&!!t[17],e),Ge=Vr(((Ht=t[18])==null?void 0:Ht.runPath)||"",j&&!!t[18],e),ae=Vr(((rn=t[19])==null?void 0:rn.runPath)||"",j&&!!t[19],e),Z=w.useMemo(()=>[le,ce,X,ie,fe,Q,ue,he,se,Ce,de,Me,Te,Pe,oe,Ve,He,ze,Ge,ae],[le,ce,X,ie,fe,Q,ue,he,se,Ce,de,Me,Te,Pe,oe,Ve,He,ze,Ge,ae]),{isStepTimesFetching:ge,isStepTimesRefetching:we}=w.useMemo(()=>{if(!j)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const Ut=Z.some(Kt=>Kt.isFetching),Ft=Z.filter(Kt=>Kt.isFetching),Bt=Ut&&Ft.length>0&&Ft.every(Kt=>!!Kt.data);return{isStepTimesFetching:Ut,isStepTimesRefetching:Bt}},[j,Z]),{stepTimesByRun:_e,firstStepTimesByRun:ve}=w.useMemo(()=>{if(!j)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const Ut=new Map,Ft=new Map;return t.forEach((Bt,Kt)=>{if(Kt>=20)return;const Rt=Z[Kt].data;if(!Rt||Rt.first_step_time===null||Rt.first_step_time===void 0||!Rt.step_times||Rt.step_times.length===0)return;const Pt=new Map;Rt.step_times.forEach(Lt=>{typeof Lt.time=="number"&&Pt.set(Lt.step,Lt.time)}),Pt.size>0&&(Ut.set(Bt.runPath,Pt),Ft.set(Bt.runPath,Rt.first_step_time))}),{stepTimesByRun:Ut,firstStepTimesByRun:Ft}},[t,j,Z]),Ue=w.useMemo(()=>({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:f,stepTimesByRun:_e,firstStepTimesByRun:ve,isStepTimesFetching:ge,isStepTimesRefetching:we,availableSampleTags:x,availableEnvs:b}),[t,e,n,r,i,a,l,c,f,_e,ve,ge,we,x,b]),Se=k.sections.map(Ut=>Ut.name),ke=Ut=>{const Ft={id:t5(),name:Ut,groups:[],plots:[]};z({sections:[...k.sections,Ft]})},qe=(Ut,Ft)=>{z({sections:k.sections.map(Bt=>Bt.id===Ut?Ft:Bt)})},Je=Ut=>{z({sections:k.sections.filter(Ft=>Ft.id!==Ut)})},nt=fy(od(d0,{activationConstraint:{distance:8}}),od(u0,{coordinateGetter:gy})),tt=Ut=>{const{active:Ft,over:Bt}=Ut;if(!Bt||Ft.id===Bt.id)return;const Kt=k.sections.findIndex(Rt=>Rt.id===Ft.id),dn=k.sections.findIndex(Rt=>Rt.id===Bt.id);Kt===-1||dn===-1||z({sections:f0(k.sections,Kt,dn)})};return d.jsxs("div",{className:"-mt-3",children:[d.jsx(py,{sensors:nt,collisionDetection:hy,onDragEnd:tt,children:d.jsx(my,{items:k.sections.map(Ut=>Ut.id),strategy:m8,children:k.sections.map((Ut,Ft)=>d.jsxs("div",{children:[Ft>0&&d.jsx("div",{className:"border-t border-gray-200 my-3"}),d.jsx(R0e,{section:Ut,catalog:Y,allSectionNames:Se,onUpdate:Bt=>qe(Ut.id,Bt),onRemove:()=>Je(Ut.id),chartProps:Ue})]},Ut.id))})}),k.sections.length===0&&N&&d.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:[d.jsx(Sl,{className:"h-4 w-4 animate-spin mr-2"}),d.jsx("span",{className:"text-sm",children:"Loading..."})]}),k.sections.length===0&&!N&&d.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[d.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No custom sections yet. Create one to start building your dashboard."}),d.jsxs(wn,{size:"sm",variant:"outline",onClick:()=>L(!0),children:[d.jsx(pp,{className:"h-3.5 w-3.5 mr-1"}),"New Section"]})]}),d.jsx(n5,{open:R,onOpenChange:L,title:"New Section",existingNames:Se,onSubmit:ke})]})}const YO=100;function nq({current:t,total:e,fillClassName:n,activeBorderClassName:r}){const i=e/YO;return d.jsx("div",{className:"flex gap-[2px]",children:Array.from({length:YO}).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 f=c>0&&r?r:"border-muted-foreground/50";return d.jsx("div",{className:`relative flex-1 h-8 border ${f} rounded-[2px] overflow-hidden bg-background`,children:c>0&&d.jsx("div",{className:`absolute top-0 left-0 bottom-0 transition-all duration-200 ${n}`,style:{width:`${c*100}%`}})},o)})})}function KO(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 P0e(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 I0e(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 O0e(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 m_(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 L0e(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 f=l/c,p=n-e;return f*p}function j0e({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 d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),d.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[d.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[o.toFixed(2),"%"]}),d.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[i," / ",e," Steps"]}),n!==null&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),d.jsx("span",{className:"text-sm text-muted-foreground tabular-nums",children:KO(n)})]}),r!==null&&r>0&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),d.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:["ETA: ",KO(r)]})]})]}),d.jsx(nq,{current:i,total:e,fillClassName:"bg-foreground",activeBorderClassName:"border-foreground"})]})}function z0e({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 d.jsxs("div",{className:"space-y-1.5",children:[d.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["Trainer Bucket",n!==null?` (Step ${n})`:"",o>0&&d.jsxs("span",{className:"ml-2 font-normal",children:["· ",o," batch",o!==1?"es":""," waiting for trainer"," · ",d.jsxs("span",{className:"tabular-nums",children:["steps ",r.join(", ")]})]})]}),d.jsxs("div",{className:"flex items-baseline gap-1.5",children:[d.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[s.toFixed(2),"%"]}),d.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[t," / ",e," Groups"]})]}),d.jsx(nq,{current:t,total:e,fillClassName:"bg-muted-foreground/40"})]})}function F0e(){var Se,ke,qe,Je,nt,tt,be,Le;const t=qn(bl),e=qn(jT),n=qn(UT),r=sd(KG),i=sd(ZG),[s,o]=w.useState(!0),[a,l]=w.useState(!0),[c,f]=w.useState("custom"),[p,m]=w.useState(0),[x,b]=w.useState(0),[_,S]=fn(ace),[M,C]=fn(lce),[A,N]=w.useState(String(M)),[P,k]=fn(cce),[O,R]=fn(QG),[L,B]=fn(JG),[V,W]=fn(dce),[G,ee]=w.useState(!1),[H,q]=w.useState(""),[J,K]=w.useState(!1),ne=M0(),U=P?n:null,{data:z,isLoading:Y,error:j}=_h(t||"",!!t,!0),{data:le}=P0(),ce=w.useMemo(()=>{const Ze=new Set(e);return t&&Ze.add(t),Array.from(Ze)},[t,e]),X=w.useMemo(()=>{const Ze=(le==null?void 0:le.runs)||[],Ee=new Set(ce);return Ze.filter(Ye=>Ee.has(Ye.run_id)).map(Ye=>({runPath:Ye.run_id,runName:Ye.name,color:Ye.color,isSelected:Ye.run_id===t}))},[t,ce,le==null?void 0:le.runs]);w.useEffect(()=>{z&&(r(z.is_tracking),i(z.is_syncing))},[z,r,i]);const ie=typeof((Se=z==null?void 0:z.config)==null?void 0:Se.number_of_steps)=="number"?z.config.number_of_steps:null,fe=typeof((ke=z==null?void 0:z.config)==null?void 0:ke.prompts_batch_size_for_trainer)=="number"?z.config.prompts_batch_size_for_trainer:typeof((qe=z==null?void 0:z.config)==null?void 0:qe.batch_size_for_trainer)=="number"?z.config.batch_size_for_trainer:null,Q=(Je=z==null?void 0:z.summary)!=null&&Je.steps&&typeof z.summary.steps=="object"?z.summary.steps:null,ue=m_((nt=z==null?void 0:z.summary)==null?void 0:nt["steps/last_training_step"])??m_(Q==null?void 0:Q.last_training_step)??m_((tt=z==null?void 0:z.trainer_info)==null?void 0:tt.last_training_step)??m_((be=z==null?void 0:z.rollout_info)==null?void 0:be.last_training_step)??m_(z==null?void 0:z.last_rollout_step)??-1,he=z==null?void 0:z.trainer_bucket_info,{customMetricSections:se,availableRewardNames:Ce,evalsList:de,availableSampleTags:Me,availableEnvs:Te,totalSteps:Pe}=a8(ce),oe=w.useMemo(()=>eq(se,Ce,de),[se,Ce,de]),Ve=w.useMemo(()=>{if(P)return X;const Ze=X.find(Ee=>Ee.isSelected);return Ze?[Ze]:X.slice(0,1)},[P,X]),He=fy(od(d0,{activationConstraint:{distance:5}}),od(u0,{coordinateGetter:gy})),ze=w.useCallback(Ze=>{const{active:Ee,over:Ye}=Ze;!Ye||Ee.id===Ye.id||W(it=>{const mt=it.findIndex(Qe=>Qe.id===Ee.id),ft=it.findIndex(Qe=>Qe.id===Ye.id);return mt===-1||ft===-1?it:f0(it,mt,ft)})},[W]),Ge=w.useMemo(()=>({runs:Ve,shouldPoll:!0,showEma:_,emaSpan:M,hoveredRunId:U,xAxisMode:"step",scrollRoot:null,availableSampleTags:Me,availableEnvs:Te}),[Ve,_,M,U,Me,Te]),ae=w.useMemo(()=>!t||!(le!=null&&le.runs)?null:le.runs.find(Ze=>Ze.run_id===t)??null,[t,le]);w.useEffect(()=>{ee(!1)},[t]);const Z=((Le=ae==null?void 0:ae.state)==null?void 0:Le.toLowerCase())==="running",ge=P0e((ae==null?void 0:ae.created_at)??null,Z),we=w.useMemo(()=>{var Ye,it,mt;if(Z)return null;const Ze=(Ye=z==null?void 0:z.summary)==null?void 0:Ye._runtime;if(typeof Ze=="number")return Ze;const Ee=(mt=(it=z==null?void 0:z.summary)==null?void 0:it._wandb)==null?void 0:mt.runtime;return typeof Ee=="number"?Ee:null},[Z,z==null?void 0:z.summary]),_e=Z?ge:we,{data:ve}=pW(t||"","timing_step_total",!!t&&!!ie&&ue>0,!0),Ue=w.useMemo(()=>{if(!(ve!=null&&ve.metrics)||!ie||ue<=0)return null;const Ze=ve.metrics.filter(it=>it.metric_name==="timing_step_total").map(it=>({step:it.step,value:it.value}));if(Ze.length===0)return null;const Ee=Math.min(...Ze.map(it=>it.step)),Ye=Ze.filter(it=>it.step!==Ee);return L0e(Ye,ue,ie)},[ve,ie,ue]);return t?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:d.jsx("div",{className:"py-2.5 px-6",children:d.jsx("div",{className:"max-w-7xl mx-auto flex items-center gap-2.5 h-7",children:ae&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:ae.color}}),d.jsx("span",{className:"text-sm font-semibold truncate",children:ae.name||ae.run_id.split("/").pop()}),d.jsx("span",{className:"text-sm text-muted-foreground truncate",children:ae.run_id}),ae.created_at&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),d.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums whitespace-nowrap",children:["Created at ",I0e(ae.created_at)]})]})]})})})}),d.jsx("div",{className:O||L?"flex-1 min-h-0 overflow-hidden":"flex-1 overflow-auto p-6",children:O?d.jsx(mpe,{runPath:t,onBack:()=>R(!1)},t):L?d.jsx(gpe,{runPath:t,onBack:()=>B(!1)},`logs-${t}`):d.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[Y?d.jsxs("div",{className:"space-y-3",children:[d.jsx(ap,{className:"h-4 w-32"}),d.jsx(ap,{className:"h-8 w-64"}),d.jsx(ap,{className:"h-8 w-full"})]}):j?d.jsx(dd,{className:"border-destructive",children:d.jsx(ch,{className:"pt-6",children:d.jsx("p",{className:"text-destructive",children:"Failed to load run summary. Make sure the run has been synced."})})}):d.jsxs("div",{className:"space-y-5",children:[ie!==null?d.jsx(j0e,{currentStep:ue,totalSteps:ie,runtimeSeconds:_e??null,estimatedSecondsToFinish:Ue}):d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),d.jsx("div",{className:"flex items-baseline gap-1.5",children:d.jsx("span",{className:"text-sm text-muted-foreground",children:"Waiting for data…"})})]}),fe!==null&&he&&d.jsx(z0e,{groupsDone:he.groups_done,totalGroups:fe,step:he.step,waitingBuckets:z==null?void 0:z.waiting_buckets})]}),Pe>0&&X.length>0&&d.jsx("div",{children:s?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>o(!1),children:"Hide Plots"}),d.jsx(IS,{label:"EMA",variant:"selecting",size:"sm",enabled:_,onEnabledChange:S,value:A,onValueChange:N,onValueCommit:Ze=>{const Ee=parseInt(Ze,10);!isNaN(Ee)&&Ee>=2&&Ee<=100?(C(Ee),N(Ee.toString())):N(M.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),d.jsx(R1,{variant:"selecting",size:"sm",pressed:P,onPressedChange:k,className:"text-xs px-2",children:"All selected runs"}),d.jsx(Sy,{catalog:oe,existingPlots:V,allowDuplicates:!0,onSelect:Ze=>{const Ee=Math.random().toString(36).slice(2,10);W(Ye=>[...Ye,{id:Ee,metricKey:Ze.metricKey,label:Ze.label,plotType:Ze.plotType,evalName:Ze.evalName,distMetricType:Ze.distMetricType,inferenceMetricType:Ze.inferenceMetricType,inferenceAreaCategories:Ze.inferenceAreaCategories,trainerMetricType:Ze.trainerMetricType,trainerAreaCategories:Ze.trainerAreaCategories}])},children:d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Plots"})})]}),d.jsx(py,{sensors:He,collisionDetection:hy,onDragEnd:ze,children:d.jsx(my,{items:V.map(Ze=>Ze.id),strategy:Iw,children:d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:V.map(Ze=>d.jsx(P8,{plot:Ze,onRemove:()=>W(Ee=>Ee.filter(Ye=>Ye.id!==Ze.id)),chartProps:Ge},Ze.id))})})})]}):d.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:[d.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:d.jsx("path",{d:"m6 9 6 6 6-6"})}),d.jsx("span",{className:"text-sm font-semibold",children:"Plots"})]})}),(z==null?void 0:z.config)&&(()=>{const{model:Ze,envNames:Ee}=O0e(z.config);return!Ze&&Ee.length===0?null:d.jsxs("div",{className:"flex items-center gap-3 text-sm mb-4",children:[Ze&&d.jsx("span",{className:"font-semibold",children:Ze}),Ee.map(Ye=>d.jsx("span",{className:"text-muted-foreground",children:Ye},Ye))]})})(),(z==null?void 0:z.config)&&Object.keys(z.config).length>0&&d.jsx("div",{children:a?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"}),z.custom_config&&d.jsxs(h0,{type:"single",value:c,onValueChange:Ze=>{Ze&&f(Ze)},variant:"outline",size:"sm",children:[d.jsx(Xa,{value:"custom",className:"text-xs px-3 h-7",children:"Custom"}),d.jsx(Xa,{value:"all",className:"text-xs px-3 h-7",children:"All"})]}),d.jsx(Jhe,{currentRunId:t,currentConfig:z.config}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{m(Ze=>Ze+1)},children:"Collapse All"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{b(Ze=>Ze+1)},children:"Expand All"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>R(!0),children:"Code"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>B(!0),children:"Logs"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>l(!1),children:"Hide Configs"})]}),d.jsx(bW,{config:c==="custom"&&z.custom_config?z.custom_config:z.config,collapseAllSignal:p,expandAllSignal:x})]}):d.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:[d.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:d.jsx("path",{d:"m6 9 6 6 6-6"})}),d.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"})]})}),ae&&d.jsxs("div",{className:"mt-4",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-semibold",children:"Notes"}),!G&&d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{q(ae.notes||""),ee(!0)},children:ae.notes?"Edit":"Add Notes"})]}),G?d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx("textarea",{className:"w-full h-[200px] rounded-md border border-input bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",value:H,onChange:Ze=>q(Ze.target.value),placeholder:"Add notes for this run…",autoFocus:!0}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(wn,{size:"sm",className:"h-7 px-3 text-xs",disabled:J,onClick:async()=>{K(!0);try{(await fetch(`${Xn}/update-notes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:ae.run_id,notes:H})})).ok&&(await ne.invalidateQueries({queryKey:["runs"]}),ee(!1))}finally{K(!1)}},children:J?"Saving…":"Save"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs",disabled:J,onClick:()=>ee(!1),children:"Cancel"})]})]}):ae.notes?d.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:ae.notes}):null]})]})})]}):d.jsx(I0,{description:"Select a run from the sidebar or add a new one to get started."})}const I4=Vs;function U0e(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 B0e(){const[t,e]=w.useState(null),n=w.useRef(0),[r,i]=fn(vce),s=qn(bl),o=qn(jT),a=qn(UT),[l,c]=fn(yce),[f,p]=w.useState(0),m=M0(),[x,b]=fn(bce),[_,S]=fn(_ce),{data:M}=Bde(),C=(M==null?void 0:M.templates)??[],[A,N]=w.useState(!1),[P,k]=w.useState(!1),[O,R]=w.useState("new"),[L,B]=w.useState(""),[V,W]=w.useState(!1),[G,ee]=w.useState(0),H=w.useRef(null),q=w.useRef(null),J=w.useCallback(Se=>{R(Se),B(Se==="rename"?_??"":""),Se==="new"?(q.current={sections:[]},k(!0)):Se==="duplicate"?(H.current=ke=>{H.current=null,q.current=ke,k(!0)},ee(ke=>ke+1)):k(!0)},[_]),K=w.useCallback(async()=>{const Se=L.trim();if(Se){if(O==="new"||O==="duplicate"){const ke=q.current??{sections:[]},qe=await fetch(`${Xn}/custom-metrics-templates`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Se,layout:ke})});if(qe.ok){const Je=await qe.json();b(Je.id),S(Je.name),m.invalidateQueries({queryKey:["custom-metrics-templates"]})}q.current=null}else O==="rename"&&x&&(await fetch(`${Xn}/custom-metrics-templates/${x}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Se})})).ok&&(S(Se),m.invalidateQueries({queryKey:["custom-metrics-templates"]}));k(!1)}},[L,O,x,b,S,m]),ne=w.useCallback(Se=>{Se===null?(b(null),S(null)):(b(Se.id),S(Se.name)),N(!1)},[b,S]),U=w.useCallback(async()=>{x&&(await fetch(`${Xn}/custom-metrics-templates/${x}`,{method:"DELETE"}),b(null),S(null),m.invalidateQueries({queryKey:["custom-metrics-templates"]}),W(!1))},[x,b,S,m]),[z,Y]=fn(fce),[j,le]=fn(hce),[ce,X]=w.useState(j.toString()),[ie,fe]=fn(pce),[Q,ue]=fn(mce),[he,se]=fn(gce),[Ce,de]=fn(xce),[Me,Te]=w.useState(he.toString()),[Pe,oe]=w.useState(I4(Ce));w.useEffect(()=>{Te(he.toString())},[he]),w.useEffect(()=>{oe(I4(Ce))},[Ce]),gW();const Ve=!0;w.useEffect(()=>{t&&(t.scrollTop=r,n.current=r)},[t]),w.useEffect(()=>{if(!t)return;const Se=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",Se,{passive:!0}),()=>{t.removeEventListener("scroll",Se),i(n.current)}},[t]);const{data:He}=P0(),ze=w.useMemo(()=>{const Se=(He==null?void 0:He.runs)||[],ke=new Set(o);return s&&ke.add(s),Se.filter(qe=>ke.has(qe.run_id)).map(qe=>({runPath:qe.run_id,runName:qe.name,color:qe.color,isSelected:qe.run_id===s}))},[s,o,He==null?void 0:He.runs]),Ge=w.useMemo(()=>{const Se=new Set(o);return s&&Se.add(s),Array.from(Se)},[s,o]),{customMetricSections:ae,availableRewardNames:Z,evalsList:ge,availableSampleTags:we,availableEnvs:_e,totalSteps:ve,error:Ue}=a8(Ge);return s?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center justify-start gap-2 h-7",children:[d.jsxs(h0,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:Se=>{Se&&c(Se)},children:[d.jsx(Xa,{value:"all",className:"text-xs px-2 py-1 h-7",children:"All"}),d.jsx(Xa,{value:"custom",className:"text-xs px-2 py-1 h-7",children:"Custom"})]}),l==="custom"&&d.jsxs(d.Fragment,{children:[d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>p(Se=>Se+1),children:[d.jsx(pp,{className:"h-3 w-3 mr-1"}),"New Section"]}),d.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",children:["Templates",_&&d.jsxs("span",{className:"ml-1 text-muted-foreground",children:["(",_,")"]})]})}),d.jsxs($s,{align:"start",children:[d.jsx(Yo,{onClick:()=>N(!0),children:"Load"}),d.jsx(Yo,{onClick:()=>J("new"),children:"New"}),d.jsx(Yo,{onClick:()=>J("duplicate"),children:"Duplicate"}),d.jsx(Ds,{}),d.jsx(Yo,{onClick:()=>J("rename"),disabled:!x,children:"Rename"}),d.jsx(Yo,{onClick:()=>W(!0),disabled:!x,className:"text-destructive focus:text-destructive",children:"Delete"})]})]})]}),d.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),d.jsxs(h0,{type:"single",variant:"outline",size:"sm",value:ie,onValueChange:Se=>{Se&&fe(Se)},children:[d.jsx(Xa,{value:"step",className:"text-xs px-2 py-1 h-7",children:"Step"}),d.jsx(Xa,{value:"time",className:"text-xs px-2 py-1 h-7",children:"Time"})]}),d.jsx(IS,{label:"EMA",variant:"selecting",size:"sm",enabled:z,onEnabledChange:Y,value:ce,onValueChange:X,onValueCommit:Se=>{const ke=parseInt(Se,10);!isNaN(ke)&&ke>=2&&ke<=100?(le(ke),X(ke.toString())):X(j.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),d.jsx(IS,{label:ie==="step"?"Max Step":"Max Time",variant:"selecting",size:"sm",enabled:Q,onEnabledChange:ue,value:ie==="step"?Me:Pe,inputType:ie==="step"?"number":"text",onValueChange:Se=>{ie==="step"?Te(Se):oe(Se)},onValueCommit:Se=>{if(ie==="step"){const ke=parseInt(Se,10);!isNaN(ke)&&ke>=1?(se(ke),Te(ke.toString())):Te(he.toString())}else{const ke=U0e(Se);ke!==null?(de(ke),oe(I4(ke))):oe(I4(Ce))}},inputMin:1,inputWidth:"w-16"})]})})}),d.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:d.jsxs("div",{className:"max-w-7xl mx-auto",children:[Ue&&d.jsx(dd,{className:"border-destructive mb-6",children:d.jsx(ch,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",Ue instanceof Error?Ue.message:"Unknown error"]})})}),l==="all"?d.jsx(b0e,{runs:ze,shouldPoll:Ve,totalSteps:ve,showEma:z,emaSpan:j,hoveredRunId:a,availableRewardNames:Z,customMetricSections:ae,xAxisMode:ie,scrollRoot:t,maxStep:Q&&ie==="step"?he:void 0,maxTime:Q&&ie==="time"?Ce:void 0,evalsList:ge,availableSampleTags:we,availableEnvs:_e}):d.jsx(D0e,{runs:ze,shouldPoll:Ve,showEma:z,emaSpan:j,hoveredRunId:a,availableRewardNames:Z,customMetricSections:ae,xAxisMode:ie,scrollRoot:t,maxStep:Q&&ie==="step"?he:void 0,maxTime:Q&&ie==="time"?Ce:void 0,evalsList:ge,availableSampleTags:we,availableEnvs:_e,newSectionTrigger:f,activeTemplateId:x,layoutSnapshotTrigger:G,onLayoutSnapshot:Se=>{H.current&&H.current(Se)}})]})}),d.jsx(su,{open:A,onOpenChange:N,children:d.jsxs(ou,{className:"sm:max-w-[400px]",children:[d.jsx(Dc,{children:d.jsx(Pc,{children:"Load Template"})}),d.jsxs("div",{className:"flex flex-col gap-1 max-h-[300px] overflow-y-auto",children:[d.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:()=>ne(null),children:"Default"}),C.map(Se=>d.jsx("button",{className:bt("text-left px-3 py-2 rounded-md text-sm hover:bg-accent transition-colors",x===Se.id&&"bg-accent font-medium"),onClick:()=>ne(Se),children:Se.name},Se.id)),C.length===0&&d.jsx("p",{className:"text-xs text-muted-foreground px-3 py-2",children:"No saved templates yet."})]})]})}),d.jsx(su,{open:P,onOpenChange:k,children:d.jsxs(ou,{className:"sm:max-w-[400px]",children:[d.jsx(Dc,{children:d.jsx(Pc,{children:O==="new"?"New Template":O==="duplicate"?"Duplicate Template":"Rename Template"})}),d.jsx(Jd,{placeholder:"Template name",value:L,onChange:Se=>B(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&L.trim()&&K()},autoFocus:!0}),d.jsxs(AS,{children:[d.jsx(wn,{variant:"outline",size:"sm",onClick:()=>k(!1),children:"Cancel"}),d.jsx(wn,{size:"sm",onClick:K,disabled:!L.trim(),children:O==="rename"?"Rename":"Create"})]})]})}),d.jsx(L2,{open:V,onOpenChange:W,children:d.jsxs(j2,{children:[d.jsxs(z2,{children:[d.jsx(U2,{children:"Delete Template"}),d.jsxs(B2,{children:["Are you sure you want to delete “",_,"”? This action cannot be undone."]})]}),d.jsxs(F2,{children:[d.jsx(V2,{children:"Cancel"}),d.jsx(H2,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]}):d.jsx(I0,{description:"Select a run from the sidebar to view training metrics."})}const O4=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],xC={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 H0e(t){const e=Math.abs(t);if(e>=60)return nC(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 yu(t)}const V0e=28;function G0e(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,f=l<t.length?t[l]:void 0,p=c!=null,m=f!=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 W0e(t){if(t.length<4)return null;const e=[...t].sort((c,f)=>c-f),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 d.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,d.jsx(Na,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function $0e(){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?ql.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function q0e({isFullscreen:t,onClick:e}){return d.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?d.jsx(qT,{className:"h-3 w-3"}):d.jsx($T,{className:"h-3 w-3"})})}function L4(t){return typeof t=="number"&&Number.isFinite(t)}function X0e(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 rq({metricName:t,data:e,gpuIndices:n,intervalStart:r,intervalEnd:i,variant:s="default",strokeColor:o,gpuDisplayNames:a,isLoading:l,seriesMode:c="gpu",showLegend:f,seriesRoles:p,activeSeriesKeys:m=null,xOffset:x=0,xAxisMode:b="elapsed",xAxisTicks:_="auto",isRefetching:S=!1}){const M=qn(as),{isFullscreen:C,toggleFullscreen:A,fullscreenPortal:N}=$0e(),P=w.useRef(null),k=w.useRef(null),O=w.useRef(null),[R,L]=w.useState(!1),[B,V]=w.useState(null),[W,G]=w.useState(null),ee=xC[t]||{label:t.replace(/_/g," "),unit:""},H=s==="timeline",q=b==="clock"&&_==="bounds",J=w.useMemo(()=>{if(c==="node_gpu"){const ie=new Map,fe=[...e].sort((Q,ue)=>{const he=L4(Q.node_id)?Q.node_id:Number.MAX_SAFE_INTEGER,se=L4(ue.node_id)?ue.node_id:Number.MAX_SAFE_INTEGER;return he!==se?he-se:Q.gpu_index-ue.gpu_index});for(const Q of fe){const ue=L4(Q.node_id)?Q.node_id:null,he=`${ue??"?"}:${Q.gpu_index}`;if(ie.has(he))continue;const se=ue===null?"Node ?":`Node ${ue}`,Ce=ie.size;ie.set(he,{key:he,label:`${se} GPU ${Q.gpu_index}`,stroke:o||O4[Ce%O4.length],gpuIndex:Q.gpu_index,nodeId:ue})}return Array.from(ie.values())}return(n.length>0?Array.from(new Set(n)).sort((ie,fe)=>ie-fe):Array.from(new Set(e.map(ie=>ie.gpu_index))).sort((ie,fe)=>ie-fe)).map(ie=>({key:`gpu:${ie}`,label:(a==null?void 0:a[ie])??`GPU ${ie}`,stroke:o||O4[ie%O4.length],gpuIndex:ie,nodeId:null}))},[c,e,n,a,o]),K=w.useMemo(()=>new Set(J.map(X=>X.key)),[J]),{uplotData:ne,seriesConfig:U,hasData:z,outlierBounds:Y}=w.useMemo(()=>{if(e.length===0||J.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const X={},ie=new Set,fe=[];for(const Ce of e){const de=c==="node_gpu"?`${L4(Ce.node_id)?Ce.node_id:"?"}:${Ce.gpu_index}`:`gpu:${Ce.gpu_index}`;K.has(de)&&(ie.add(Ce.timestamp),X[Ce.timestamp]||(X[Ce.timestamp]={}),X[Ce.timestamp][de]=Ce.value,fe.push(Ce.value))}const Q=Array.from(ie).sort((Ce,de)=>Ce-de);if(Q.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const ue=Q.map(Ce=>Ce-r),he=[{label:"Time"}],se=[ue];for(const Ce of J){const de=Q.map(Te=>{var Pe;return((Pe=X[Te])==null?void 0:Pe[Ce.key])??null}),Me=m!==null&&m.size>0&&!m.has(Ce.key);se.push(de),he.push({label:Ce.label,stroke:Me?X0e(Ce.stroke,.25):Ce.stroke,width:Me?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:se,seriesConfig:he,hasData:!0,outlierBounds:W0e(fe)}},[e,r,J,c,K,m]),j=f??(!H&&J.length>1),le=w.useCallback(X=>Math.abs(X)>=1e3?`${parseFloat((X/1e3).toFixed(1))}k`:Number.isInteger(X)?X.toLocaleString():Math.abs(X)<.01&&X!==0?X.toExponential(1):String(parseFloat(X.toFixed(2))),[]);w.useEffect(()=>{if(!P.current||!ne||!z)return;const X=P.current,ie=X.clientWidth,fe=200;let Q=Number.POSITIVE_INFINITY,ue=Number.NEGATIVE_INFINITY;for(let Ge=1;Ge<ne.length;Ge+=1){const ae=ne[Ge];for(let Z=0;Z<ae.length;Z+=1){const ge=ae[Z];ge!=null&&(R&&Y?ge>=Y.lower&&ge<=Y.upper&&(ge<Q&&(Q=ge),ge>ue&&(ue=ge)):(ge<Q&&(Q=ge),ge>ue&&(ue=ge)))}}Q===Number.POSITIVE_INFINITY&&Y&&(Q=Y.lower,ue=Y.upper);const he=ue-Q,se=Math.max(Math.abs(ue),Math.abs(Q)),Ce=Math.max(se*.05,1e-10),de=Math.max(he*.1,Ce),Me=[B!==null?B:Math.max(0,Q-de),W!==null?W:ue+de],Te=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)",Ve={width:ie,height:fe,padding:H?[0,0,0,0]:q?[4,24,0,4]:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!H,y:!1}},legend:{show:j},...H?{}:{select:{show:!0,left:0,top:0,width:0,height:0}},scales:{x:{time:!1,range:(Ge,ae,Z)=>{const ge=i-r;return ge>0?[0,ge]:[ae,Z]}},y:{range:Me}},axes:H?[{show:!1,size:0},{show:!1,size:0}]:[{stroke:Pe,grid:{stroke:Te,width:1},ticks:{stroke:Te,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:_==="bounds"?(Ge,ae,Z,ge)=>[Z,ge]:void 0,values:(Ge,ae)=>ae.map(Z=>b==="clock"?c0(r+Number(Z),i-r):yu(Number(Z)+x))},{stroke:Pe,grid:{stroke:Te,width:1},ticks:{stroke:Te,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Ge,ae)=>{if(!ae||ae.length===0)return 40;const Z=Math.max(...ae.map(ge=>ge.length));return Math.max(40,Z*7+14)},values:(Ge,ae)=>ae.map(le)}],series:U,hooks:{setCursor:[Ge=>{if(!O.current||!P.current)return;const{left:ae,idx:Z}=Ge.cursor;if(Z==null||ae===void 0||ae<0){O.current.style.display="none";return}const ge=ne[0][Z];if(ge===void 0){O.current.style.display="none";return}const we=ne[0],_e=(()=>{const Ee=Ge.scales.x,Ye=Number(Ee.min),it=Number(Ee.max);if(!Number.isFinite(Ye)||!Number.isFinite(it))return null;const mt=Math.abs(it-Ye);if(mt<=0)return null;const ft=Math.max(1,Ge.bbox.width);return mt*V0e/ft})(),ve=H0e(Number(ge)+x),Ue=r+Number(ge),Se=c0(Ue,i-r);let ke="";H||(ke+=`<div class="font-medium mb-1">${Se}</div>`,ke+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${ve}</div>`,ke+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Ue.toFixed(3)}</div>`);const qe=[];for(let Ee=0;Ee<J.length;Ee+=1){const Ye=J[Ee],it=ne[Ee+1],mt=G0e(it,we,Z,_e);if(mt===null)continue;const ft=it==null?void 0:it[mt];ft!=null&&qe.push({entry:Ye,formatted:vu(ft),role:(p==null?void 0:p[Ye.key])??null})}const Je=qe.length>0;if(qe.some(Ee=>Ee.role!==null)&&!H){const Ee={Trainer:0,Inference:1},Ye=[];for(const it of qe){const mt=it.role??"Other";Ye.includes(mt)||Ye.push(mt)}Ye.sort((it,mt)=>(Ee[it]??99)-(Ee[mt]??99));for(const it of Ye){ke+=`<div class="text-[10px] font-medium text-muted-foreground mt-1 mb-0.5">${it}</div>`;for(const mt of qe)(mt.role??"Other")===it&&(ke+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${mt.entry.stroke}"></div>
                      <span class="text-muted-foreground">${mt.entry.label}:</span>
                      <span class="font-medium">${mt.formatted} ${ee.unit}</span>
                    </div>
                  `)}}else for(const Ee of qe)H?ke+=`
                    <div class="flex items-center gap-2">
                      <span class="text-muted-foreground">${Ee.entry.label}:</span>
                      <span class="font-medium">${Ee.formatted} ${ee.unit}</span>
                    </div>
                  `:ke+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Ee.entry.stroke}"></div>
                      <span class="text-muted-foreground">${Ee.entry.label}:</span>
                      <span class="font-medium">${Ee.formatted} ${ee.unit}</span>
                    </div>
                  `;if(!Je){O.current.style.display="none";return}H&&(ke+=`<div class="text-muted-foreground mt-1">Time: ${ve}</div>`),O.current.innerHTML=ke,O.current.style.display="block";const tt=P.current.getBoundingClientRect(),be=O.current.getBoundingClientRect();let Le=tt.left+ae+15;Le+be.width+20>window.innerWidth&&(Le=tt.left+ae-be.width-15+Ge.bbox.left),Le=Math.max(4,Le);let Ze=tt.top-be.height+20;Ze<4&&(Ze=tt.top+8),O.current.style.left=`${Le}px`,O.current.style.top=`${Ze}px`}]}};k.current&&k.current.destroy();const He=new ss(Ve,ne,X);k.current=He;const ze=new ResizeObserver(Ge=>{for(const ae of Ge){const{width:Z,height:ge}=ae.contentRect;He&&Z>0&&ge>0&&He.setSize({width:Z,height:ge})}});return ze.observe(X),()=>{ze.disconnect(),He.destroy(),k.current=null}},[ne,z,U,t,r,i,x,b,_,q,H,ee.unit,j,J,p,le,R,Y,B,W,M,C]);const ce=w.useCallback(()=>{O.current&&(O.current.style.display="none")},[]);return!z&&H?d.jsx("div",{className:"h-[200px] bg-muted/30 rounded-lg border border-border/50 opacity-50 transition-opacity duration-200"}):N(d.jsxs("div",{className:bt("rounded-lg border transition-opacity",H?"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:[!H&&d.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h4",{className:bt("font-medium truncate",C?"text-sm":"text-xs"),title:t,children:ee.label}),R&&d.jsx(WA,{label:"Ignore Outliers",onRemove:()=>L(!1)}),B!==null&&d.jsx(WA,{label:`Min Y: ${B}`,onRemove:()=>V(null)}),W!==null&&d.jsx(WA,{label:`Max Y: ${W}`,onRemove:()=>G(null)})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:R,onCheckedChange:L,children:"Ignore Outliers"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:B??"",onChange:X=>{const ie=X.target.value;V(ie===""?null:Number(ie))},onClick:X=>X.stopPropagation(),onKeyDown:X=>X.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:W??"",onChange:X=>{const ie=X.target.value;G(ie===""?null:Number(ie))},onClick:X=>X.stopPropagation(),onKeyDown:X=>X.stopPropagation()})]})]})]}),d.jsx(q0e,{isFullscreen:C,onClick:A})]})]}),z?d.jsxs("div",{className:bt("relative bg-background rounded",C?"flex-1 min-h-0":"h-[200px]"),ref:P,onMouseLeave:ce,children:[!H&&S&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),d.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"}})]}):d.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 ${ee.label}`})]}))}function ZO(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 Y0e(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const K0e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Z0e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Q0e={};function QO(t,e){return(Q0e.jsx?Z0e:K0e).test(t)}const J0e=/[ \t\n\f\r]/g;function ege(t){return typeof t=="object"?t.type==="text"?JO(t.value):!1:JO(t)}function JO(t){return t.replace(J0e,"")===""}class jw{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}jw.prototype.normal={};jw.prototype.property={};jw.prototype.space=void 0;function iq(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new jw(n,r,e)}function LS(t){return t.toLowerCase()}class Uc{constructor(e,n){this.attribute=n,this.property=e}}Uc.prototype.attribute="";Uc.prototype.booleanish=!1;Uc.prototype.boolean=!1;Uc.prototype.commaOrSpaceSeparated=!1;Uc.prototype.commaSeparated=!1;Uc.prototype.defined=!1;Uc.prototype.mustUseProperty=!1;Uc.prototype.number=!1;Uc.prototype.overloadedBoolean=!1;Uc.prototype.property="";Uc.prototype.spaceSeparated=!1;Uc.prototype.space=void 0;let tge=0;const Fr=Fx(),Xo=Fx(),Xk=Fx(),xn=Fx(),ps=Fx(),I1=Fx(),tu=Fx();function Fx(){return 2**++tge}const Yk=Object.freeze(Object.defineProperty({__proto__:null,boolean:Fr,booleanish:Xo,commaOrSpaceSeparated:tu,commaSeparated:I1,number:xn,overloadedBoolean:Xk,spaceSeparated:ps},Symbol.toStringTag,{value:"Module"})),$A=Object.keys(Yk);class I8 extends Uc{constructor(e,n,r,i){let s=-1;if(super(e,n),eL(this,"space",i),typeof r=="number")for(;++s<$A.length;){const o=$A[s];eL(this,$A[s],(r&Yk[o])===Yk[o])}}}I8.prototype.defined=!0;function eL(t,e,n){n&&(t[e]=n)}function Ky(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new I8(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[LS(r)]=r,n[LS(s.attribute)]=r}return new jw(e,n,t.space)}const sq=Ky({properties:{ariaActiveDescendant:null,ariaAtomic:Xo,ariaAutoComplete:null,ariaBusy:Xo,ariaChecked:Xo,ariaColCount:xn,ariaColIndex:xn,ariaColSpan:xn,ariaControls:ps,ariaCurrent:null,ariaDescribedBy:ps,ariaDetails:null,ariaDisabled:Xo,ariaDropEffect:ps,ariaErrorMessage:null,ariaExpanded:Xo,ariaFlowTo:ps,ariaGrabbed:Xo,ariaHasPopup:null,ariaHidden:Xo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ps,ariaLevel:xn,ariaLive:null,ariaModal:Xo,ariaMultiLine:Xo,ariaMultiSelectable:Xo,ariaOrientation:null,ariaOwns:ps,ariaPlaceholder:null,ariaPosInSet:xn,ariaPressed:Xo,ariaReadOnly:Xo,ariaRelevant:null,ariaRequired:Xo,ariaRoleDescription:ps,ariaRowCount:xn,ariaRowIndex:xn,ariaRowSpan:xn,ariaSelected:Xo,ariaSetSize:xn,ariaSort:null,ariaValueMax:xn,ariaValueMin:xn,ariaValueNow:xn,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function oq(t,e){return e in t?t[e]:e}function aq(t,e){return oq(t,e.toLowerCase())}const nge=Ky({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:I1,acceptCharset:ps,accessKey:ps,action:null,allow:null,allowFullScreen:Fr,allowPaymentRequest:Fr,allowUserMedia:Fr,alt:null,as:null,async:Fr,autoCapitalize:null,autoComplete:ps,autoFocus:Fr,autoPlay:Fr,blocking:ps,capture:null,charSet:null,checked:Fr,cite:null,className:ps,cols:xn,colSpan:null,content:null,contentEditable:Xo,controls:Fr,controlsList:ps,coords:xn|I1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Fr,defer:Fr,dir:null,dirName:null,disabled:Fr,download:Xk,draggable:Xo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Fr,formTarget:null,headers:ps,height:xn,hidden:Xk,high:xn,href:null,hrefLang:null,htmlFor:ps,httpEquiv:ps,id:null,imageSizes:null,imageSrcSet:null,inert:Fr,inputMode:null,integrity:null,is:null,isMap:Fr,itemId:null,itemProp:ps,itemRef:ps,itemScope:Fr,itemType:ps,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Fr,low:xn,manifest:null,max:null,maxLength:xn,media:null,method:null,min:null,minLength:xn,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:xn,pattern:null,ping:ps,placeholder:null,playsInline:Fr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Fr,referrerPolicy:null,rel:ps,required:Fr,reversed:Fr,rows:xn,rowSpan:xn,sandbox:ps,scope:null,scoped:Fr,seamless:Fr,selected:Fr,shadowRootClonable:Fr,shadowRootDelegatesFocus:Fr,shadowRootMode:null,shape:null,size:xn,sizes:null,slot:null,span:xn,spellCheck:Xo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xn,step:null,style:null,tabIndex:xn,target:null,title:null,translate:null,type:null,typeMustMatch:Fr,useMap:null,value:Xo,width:xn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ps,axis:null,background:null,bgColor:null,border:xn,borderColor:null,bottomMargin:xn,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:xn,leftMargin:xn,link:null,longDesc:null,lowSrc:null,marginHeight:xn,marginWidth:xn,noResize:Fr,noHref:Fr,noShade:Fr,noWrap:Fr,object:null,profile:null,prompt:null,rev:null,rightMargin:xn,rules:null,scheme:null,scrolling:Xo,standby:null,summary:null,text:null,topMargin:xn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Fr,disableRemotePlayback:Fr,prefix:null,property:null,results:xn,security:null,unselectable:null},space:"html",transform:aq}),rge=Ky({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:tu,accentHeight:xn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xn,amplitude:xn,arabicForm:null,ascent:xn,attributeName:null,attributeType:null,azimuth:xn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xn,by:null,calcMode:null,capHeight:xn,className:ps,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:xn,diffuseConstant:xn,direction:null,display:null,dur:null,divisor:xn,dominantBaseline:null,download:Fr,dx:null,dy:null,edgeMode:null,editable:null,elevation:xn,enableBackground:null,end:null,event:null,exponent:xn,externalResourcesRequired:null,fill:null,fillOpacity:xn,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:I1,g2:I1,glyphName:I1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xn,horizOriginX:xn,horizOriginY:xn,id:null,ideographic:xn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xn,k:xn,k1:xn,k2:xn,k3:xn,k4:xn,kernelMatrix:tu,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xn,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:xn,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:xn,overlineThickness:xn,paintOrder:null,panose1:null,path:null,pathLength:xn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ps,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xn,pointsAtY:xn,pointsAtZ:xn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tu,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tu,rev:tu,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tu,requiredFeatures:tu,requiredFonts:tu,requiredFormats:tu,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:xn,specularExponent:xn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xn,strikethroughThickness:xn,string:null,stroke:null,strokeDashArray:tu,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xn,strokeOpacity:xn,strokeWidth:null,style:null,surfaceScale:xn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tu,tabIndex:xn,tableValues:null,target:null,targetX:xn,targetY:xn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tu,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xn,underlineThickness:xn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xn,values:null,vAlphabetic:xn,vMathematical:xn,vectorEffect:null,vHanging:xn,vIdeographic:xn,version:null,vertAdvY:xn,vertOriginX:xn,vertOriginY:xn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:oq}),lq=Ky({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()}}),cq=Ky({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:aq}),uq=Ky({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),ige={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"},sge=/[A-Z]/g,tL=/-[a-z]/g,oge=/^data[-\w.:]+$/i;function dq(t,e){const n=LS(e);let r=e,i=Uc;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&oge.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(tL,lge);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!tL.test(s)){let o=s.replace(sge,age);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=I8}return new i(r,e)}function age(t){return"-"+t.toLowerCase()}function lge(t){return t.charAt(1).toUpperCase()}const fq=iq([sq,nge,lq,cq,uq],"html"),vC=iq([sq,rge,lq,cq,uq],"svg");function nL(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function cge(t){return t.join(" ").trim()}var Hv={},qA,rL;function uge(){if(rL)return qA;rL=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="/",f="*",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(ee){var H=ee.match(e);H&&(C+=H.length);var q=ee.lastIndexOf(l);A=~q?ee.length-q:A+ee.length}function P(){var ee={line:C,column:A};return function(H){return H.position=new k(ee),L(),H}}function k(ee){this.start=ee,this.end={line:C,column:A},this.source=M.source}k.prototype.content=S;function O(ee){var H=new Error(M.source+":"+C+":"+A+": "+ee);if(H.reason=ee,H.filename=M.source,H.line=C,H.column=A,H.source=S,!M.silent)throw H}function R(ee){var H=ee.exec(S);if(H){var q=H[0];return N(q),S=S.slice(q.length),H}}function L(){R(n)}function B(ee){var H;for(ee=ee||[];H=V();)H!==!1&&ee.push(H);return ee}function V(){var ee=P();if(!(c!=S.charAt(0)||f!=S.charAt(1))){for(var H=2;p!=S.charAt(H)&&(f!=S.charAt(H)||c!=S.charAt(H+1));)++H;if(H+=2,p===S.charAt(H-1))return O("End of comment missing");var q=S.slice(2,H-2);return A+=2,N(q),S=S.slice(H),A+=2,ee({type:m,comment:q})}}function W(){var ee=P(),H=R(r);if(H){if(V(),!R(i))return O("property missing ':'");var q=R(s),J=ee({type:x,property:_(H[0].replace(t,p)),value:q?_(q[0].replace(t,p)):p});return R(o),J}}function G(){var ee=[];B(ee);for(var H;H=W();)H!==!1&&(ee.push(H),B(ee));return ee}return L(),G()}function _(S){return S?S.replace(a,p):p}return qA=b,qA}var iL;function dge(){if(iL)return Hv;iL=1;var t=Hv&&Hv.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Hv,"__esModule",{value:!0}),Hv.default=n;const e=t(uge());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:f}=l;a?i(c,f,l):f&&(s=s||{},s[c]=f)}),s}return Hv}var g_={},sL;function fge(){if(sL)return g_;sL=1,Object.defineProperty(g_,"__esModule",{value:!0}),g_.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,f){return f.toUpperCase()},a=function(c,f){return"".concat(f,"-")},l=function(c,f){return f===void 0&&(f={}),s(c)?c:(c=c.toLowerCase(),f.reactCompat?c=c.replace(i,a):c=c.replace(r,a),c.replace(e,o))};return g_.camelCase=l,g_}var x_,oL;function hge(){if(oL)return x_;oL=1;var t=x_&&x_.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(dge()),n=fge();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,x_=r,x_}var pge=hge();const mge=Oy(pge),hq=pq("end"),O8=pq("start");function pq(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 gge(t){const e=O8(t),n=hq(t);if(e&&n)return{start:e,end:n}}function nS(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?aL(t.position):"start"in t||"end"in t?aL(t):"line"in t||"column"in t?Kk(t):""}function Kk(t){return lL(t&&t.line)+":"+lL(t&&t.column)}function aL(t){return Kk(t&&t.start)+"-"+Kk(t&&t.end)}function lL(t){return t&&typeof t=="number"?t:1}class wl 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=nS(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}}wl.prototype.file="";wl.prototype.name="";wl.prototype.reason="";wl.prototype.message="";wl.prototype.stack="";wl.prototype.column=void 0;wl.prototype.line=void 0;wl.prototype.ancestors=void 0;wl.prototype.cause=void 0;wl.prototype.fatal=void 0;wl.prototype.place=void 0;wl.prototype.ruleId=void 0;wl.prototype.source=void 0;const L8={}.hasOwnProperty,xge=new Map,vge=/[A-Z]/g,yge=new Set(["table","tbody","thead","tfoot","tr"]),bge=new Set(["td","th"]),mq="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function _ge(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=Nge(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=Age(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"?vC:fq,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=gq(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function gq(t,e,n){if(e.type==="element")return Sge(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return wge(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Tge(t,e,n);if(e.type==="mdxjsEsm")return Mge(t,e);if(e.type==="root")return Cge(t,e,n);if(e.type==="text")return Ege(t,e)}function Sge(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=vC,t.schema=i),t.ancestors.push(e);const s=vq(t,e.tagName,!1),o=kge(t,e);let a=z8(t,e);return yge.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!ege(l):!0})),xq(t,o,s,e),j8(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function wge(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)}jS(t,e.position)}function Mge(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);jS(t,e.position)}function Tge(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=vC,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:vq(t,e.name,!0),o=Rge(t,e),a=z8(t,e);return xq(t,o,s,e),j8(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function Cge(t,e,n){const r={};return j8(r,z8(t,e)),t.create(e,t.Fragment,r,n)}function Ege(t,e){return e.value}function xq(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function j8(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Age(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 Nge(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=O8(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 kge(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&L8.call(e.properties,i)){const s=Dge(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&bge.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 Rge(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 jS(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 jS(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function z8(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:xge;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=gq(t,s,o);a!==void 0&&n.push(a)}return n}function Dge(t,e,n){const r=dq(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Y0e(n):cge(n)),r.property==="style"){let i=typeof n=="object"?n:Pge(t,String(n));return t.stylePropertyNameCase==="css"&&(i=Ige(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?ige[r.property]||r.property:r.attribute,n]}}function Pge(t,e){try{return mge(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new wl("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=mq+"#cannot-parse-style-attribute",i}}function vq(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=QO(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=QO(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return L8.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);jS(t)}function jS(t,e){const n=new wl("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=mq+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Ige(t){const e={};let n;for(n in t)L8.call(t,n)&&(e[Oge(n)]=t[n]);return e}function Oge(t){let e=t.replace(vge,Lge);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Lge(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"]},jge={};function zge(t,e){const n=jge,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return yq(t,r,i)}function yq(t,e,n){if(Fge(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 cL(t.children,e,n)}return Array.isArray(t)?cL(t,e,n):""}function cL(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=yq(t[i],e,n);return r.join("")}function Fge(t){return!!(t&&typeof t=="object")}const uL=document.createElement("i");function F8(t){const e="&"+t+";";uL.innerHTML=e;const n=uL.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function hh(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 id(t,e){return t.length>0?(hh(t,t.length,0,e),t):e}const dL={}.hasOwnProperty;function Uge(t){const e={};let n=-1;for(;++n<t.length;)Bge(e,t[n]);return e}function Bge(t,e){let n;for(n in e){const i=(dL.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){dL.call(i,o)||(i[o]=[]);const a=s[o];Hge(i[o],Array.isArray(a)?a:a?[a]:[])}}}function Hge(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);hh(t,0,0,r)}function bq(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 O1(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const th=z0(/[A-Za-z]/),lu=z0(/[\dA-Za-z]/),Vge=z0(/[#-'*+\--9=?A-Z^-~]/);function Zk(t){return t!==null&&(t<32||t===127)}const Qk=z0(/\d/),Gge=z0(/[\dA-Fa-f]/),Wge=z0(/[!-/:-@[-`{-~]/);function tr(t){return t!==null&&t<-2}function zc(t){return t!==null&&(t<0||t===32)}function Oi(t){return t===-2||t===-1||t===32}const $ge=z0(new RegExp("\\p{P}|\\p{S}","u")),qge=z0(/\s/);function z0(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Zy(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&lu(t.charCodeAt(n+1))&&lu(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 Xge={tokenize:Yge};function Yge(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 tr(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const Kge={tokenize:Zge},fL={tokenize:Qge};function Zge(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 P=N,k;for(;P--;)if(e.events[P][0]==="exit"&&e.events[P][1].type==="chunkFlow"){k=e.events[P][1].end;break}M(r);let O=N;for(;O<e.events.length;)e.events[O][1].end={...k},O++;return hh(e.events,P+1,0,e.events.slice(N)),e.events.length=O,c(A)}return a(A)}function c(A){if(r===n.length){if(!i)return m(A);if(i.currentConstruct&&i.currentConstruct.concrete)return b(A);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(fL,f,p)(A)}function f(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(fL,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 tr(A)?(t.consume(A),S(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(A),_)}function S(A,N){const P=e.sliceStream(A);if(N&&P.push(null),A.previous=s,s&&(s.next=A),s=A,i.defineSkip(A.start),i.write(P),e.parser.lazy[A.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const O=e.events.length;let R=O,L,B;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){if(L){B=e.events[R][1].end;break}L=!0}for(M(r),k=O;k<e.events.length;)e.events[k][1].end={...B},k++;hh(e.events,R+1,0,e.events.slice(O)),e.events.length=k}}function M(A){let N=n.length;for(;N-- >A;){const P=n[N];e.containerState=P[1],P[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 Qge(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 hL(t){if(t===null||zc(t)||qge(t))return 1;if($ge(t))return 2}function U8(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 Jk={name:"attention",resolveAll:Jge,tokenize:exe};function Jge(t,e){let n=-1,r,i,s,o,a,l,c,f;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};pL(p,-l),pL(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=id(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=id(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=id(c,U8(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=id(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,c=id(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,hh(t,r-1,n-r+3,c),n=r+c.length-f-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function exe(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=hL(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"),f=hL(l),p=!f||f===2&&i||n.includes(l),m=!i||i===2&&f||n.includes(r);return c._open=!!(s===42?p:p&&(i||!m)),c._close=!!(s===42?m:m&&(f||!p)),e(l)}}function pL(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const txe={name:"autolink",tokenize:nxe};function nxe(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 th(x)?(t.consume(x),o):x===64?n(x):c(x)}function o(x){return x===43||x===45||x===46||lu(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||lu(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||Zk(x)?n(x):(t.consume(x),l)}function c(x){return x===64?(t.consume(x),f):Vge(x)?(t.consume(x),c):n(x)}function f(x){return lu(x)?p(x):n(x)}function p(x){return x===46?(t.consume(x),r=0,f):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||lu(x))&&r++<63){const b=x===45?m:p;return t.consume(x),b}return n(x)}}const yC={partial:!0,tokenize:rxe};function rxe(t,e,n){return r;function r(s){return Oi(s)?Vi(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||tr(s)?e(s):n(s)}}const _q={continuation:{tokenize:sxe},exit:oxe,name:"blockQuote",tokenize:ixe};function ixe(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 sxe(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(_q,e,n)(o)}}function oxe(t){t.exit("blockQuote")}const Sq={name:"characterEscape",tokenize:axe};function axe(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 Wge(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const wq={name:"characterReference",tokenize:lxe};function lxe(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=lu,f(p))}function c(p){return p===88||p===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(p),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=Gge,f):(t.enter("characterReferenceValue"),s=7,o=Qk,f(p))}function f(p){if(p===59&&i){const m=t.exit("characterReferenceValue");return o===lu&&!F8(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),f):n(p)}}const mL={partial:!0,tokenize:uxe},gL={concrete:!0,name:"codeFenced",tokenize:cxe};function cxe(t,e,n){const r=this,i={partial:!0,tokenize:P};let s=0,o=0,a;return l;function l(k){return c(k)}function c(k){const O=r.events[r.events.length-1];return s=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,a=k,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),f(k)}function f(k){return k===a?(o++,t.consume(k),f):o<3?n(k):(t.exit("codeFencedFenceSequence"),Oi(k)?Vi(t,p,"whitespace")(k):p(k))}function p(k){return k===null||tr(k)?(t.exit("codeFencedFence"),r.interrupt?e(k):t.check(mL,_,N)(k)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||tr(k)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),p(k)):Oi(k)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Vi(t,x,"whitespace")(k)):k===96&&k===a?n(k):(t.consume(k),m)}function x(k){return k===null||tr(k)?p(k):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===null||tr(k)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),p(k)):k===96&&k===a?n(k):(t.consume(k),b)}function _(k){return t.attempt(i,N,S)(k)}function S(k){return t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),M}function M(k){return s>0&&Oi(k)?Vi(t,C,"linePrefix",s+1)(k):C(k)}function C(k){return k===null||tr(k)?t.check(mL,_,N)(k):(t.enter("codeFlowValue"),A(k))}function A(k){return k===null||tr(k)?(t.exit("codeFlowValue"),C(k)):(t.consume(k),A)}function N(k){return t.exit("codeFenced"),e(k)}function P(k,O,R){let L=0;return B;function B(H){return k.enter("lineEnding"),k.consume(H),k.exit("lineEnding"),V}function V(H){return k.enter("codeFencedFence"),Oi(H)?Vi(k,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):W(H)}function W(H){return H===a?(k.enter("codeFencedFenceSequence"),G(H)):R(H)}function G(H){return H===a?(L++,k.consume(H),G):L>=o?(k.exit("codeFencedFenceSequence"),Oi(H)?Vi(k,ee,"whitespace")(H):ee(H)):R(H)}function ee(H){return H===null||tr(H)?(k.exit("codeFencedFence"),O(H)):R(H)}}}function uxe(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:fxe},dxe={partial:!0,tokenize:hxe};function fxe(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 f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):tr(c)?t.attempt(dxe,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||tr(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function hxe(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):tr(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):tr(o)?i(o):n(o)}}const pxe={name:"codeText",previous:gxe,resolve:mxe,tokenize:xxe};function mxe(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 gxe(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xxe(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,f(p)):tr(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||tr(p)?(t.exit("codeTextData"),l(p)):(t.consume(p),c)}function f(p){return p===96?(t.consume(p),i++,f):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(p)):(s.type="codeTextData",c(p))}}class vxe{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&&v_(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),v_(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),v_(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);v_(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);v_(this.left,n.reverse())}}}function v_(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 Mq(t){const e={};let n=-1,r,i,s,o,a,l,c;const f=new vxe(t);for(;++n<f.length;){for(;n in e;)n=e[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.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,yxe(f,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=f.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(f.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={...f.get(i)[1].start},a=f.slice(i,n),a.unshift(r),f.splice(i,n-i+1,a))}}return hh(t,0,Number.POSITIVE_INFINITY,f.slice(0)),!c}function yxe(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 f,p,m=-1,x=n,b=0,_=0;const S=[_];for(;x;){for(;t.get(++i)[1]!==x;);s.push(i),x._tokenizer||(f=r.sliceStream(x),x.next||f.push(null),p&&o.defineSkip(x.start),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(f),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 bxe={resolve:Sxe,tokenize:wxe},_xe={partial:!0,tokenize:Mxe};function Sxe(t){return Mq(t),t}function wxe(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):tr(a)?t.check(_xe,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 Mxe(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||tr(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 Tq(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let f=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||Zk(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||tr(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!f&&(M===null||M===41||zc(M))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(M)):f<c&&M===40?(t.consume(M),f++,_):M===41?(t.consume(M),f--,_):M===null||M===32||M===40||Zk(M)?n(M):(t.consume(M),M===92?S:_)}function S(M){return M===40||M===41||M===92?(t.consume(M),_):_(M)}}function Cq(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),f}function f(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):tr(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===null||x===91||x===93||tr(x)||a++>999?(t.exit("chunkString"),f(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 Eq(t,e,n,r,i,s){let o;return a;function a(m){return m===34||m===39||m===40?(t.enter(r),t.enter(i),t.consume(m),t.exit(i),o=m===40?41:m,l):n(m)}function l(m){return m===o?(t.enter(i),t.consume(m),t.exit(i),t.exit(r),e):(t.enter(s),c(m))}function c(m){return m===o?(t.exit(s),l(o)):m===null?n(m):tr(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),Vi(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===o||m===null||tr(m)?(t.exit("chunkString"),c(m)):(t.consume(m),m===92?p:f)}function p(m){return m===o||m===92?(t.consume(m),f):f(m)}}function rS(t,e){let n;return r;function r(i){return tr(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 Txe={name:"definition",tokenize:Exe},Cxe={partial:!0,tokenize:Axe};function Exe(t,e,n){const r=this;let i;return s;function s(x){return t.enter("definition"),o(x)}function o(x){return Cq.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function a(x){return i=O1(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 zc(x)?rS(t,c)(x):c(x)}function c(x){return Tq(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return t.attempt(Cxe,p,p)(x)}function p(x){return Oi(x)?Vi(t,m,"whitespace")(x):m(x)}function m(x){return x===null||tr(x)?(t.exit("definition"),r.parser.defined.push(i),e(x)):n(x)}}function Axe(t,e,n){return r;function r(a){return zc(a)?rS(t,i)(a):n(a)}function i(a){return Eq(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||tr(a)?e(a):n(a)}}const Nxe={name:"hardBreakEscape",tokenize:kxe};function kxe(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return tr(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const Rxe={name:"headingAtx",resolve:Dxe,tokenize:Pxe};function Dxe(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"},hh(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function Pxe(t,e,n){let r=0;return i;function i(f){return t.enter("atxHeading"),s(f)}function s(f){return t.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&r++<6?(t.consume(f),o):f===null||zc(f)?(t.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(t.enter("atxHeadingSequence"),l(f)):f===null||tr(f)?(t.exit("atxHeading"),e(f)):Oi(f)?Vi(t,a,"whitespace")(f):(t.enter("atxHeadingText"),c(f))}function l(f){return f===35?(t.consume(f),l):(t.exit("atxHeadingSequence"),a(f))}function c(f){return f===null||f===35||zc(f)?(t.exit("atxHeadingText"),a(f)):(t.consume(f),c)}}const Ixe=["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"],xL=["pre","script","style","textarea"],Oxe={concrete:!0,name:"htmlFlow",resolveTo:zxe,tokenize:Fxe},Lxe={partial:!0,tokenize:Bxe},jxe={partial:!0,tokenize:Uxe};function zxe(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 Fxe(t,e,n){const r=this;let i,s,o,a,l;return c;function c(j){return f(j)}function f(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):th(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):th(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:W:b):n(j)}function _(j){return th(j)?(t.consume(j),o=String.fromCharCode(j),S):n(j)}function S(j){if(j===null||j===47||j===62||zc(j)){const le=j===47,ce=o.toLowerCase();return!le&&!s&&xL.includes(ce)?(i=1,r.interrupt?e(j):W(j)):Ixe.includes(o.toLowerCase())?(i=6,le?(t.consume(j),M):r.interrupt?e(j):W(j)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(j):s?C(j):A(j))}return j===45||lu(j)?(t.consume(j),o+=String.fromCharCode(j),S):n(j)}function M(j){return j===62?(t.consume(j),r.interrupt?e:W):n(j)}function C(j){return Oi(j)?(t.consume(j),C):B(j)}function A(j){return j===47?(t.consume(j),B):j===58||j===95||th(j)?(t.consume(j),N):Oi(j)?(t.consume(j),A):B(j)}function N(j){return j===45||j===46||j===58||j===95||lu(j)?(t.consume(j),N):P(j)}function P(j){return j===61?(t.consume(j),k):Oi(j)?(t.consume(j),P):A(j)}function k(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(t.consume(j),l=j,O):Oi(j)?(t.consume(j),k):R(j)}function O(j){return j===l?(t.consume(j),l=null,L):j===null||tr(j)?n(j):(t.consume(j),O)}function R(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||zc(j)?P(j):(t.consume(j),R)}function L(j){return j===47||j===62||Oi(j)?A(j):n(j)}function B(j){return j===62?(t.consume(j),V):n(j)}function V(j){return j===null||tr(j)?W(j):Oi(j)?(t.consume(j),V):n(j)}function W(j){return j===45&&i===2?(t.consume(j),q):j===60&&i===1?(t.consume(j),J):j===62&&i===4?(t.consume(j),z):j===63&&i===3?(t.consume(j),U):j===93&&i===5?(t.consume(j),ne):tr(j)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Lxe,Y,G)(j)):j===null||tr(j)?(t.exit("htmlFlowData"),G(j)):(t.consume(j),W)}function G(j){return t.check(jxe,ee,Y)(j)}function ee(j){return t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),H}function H(j){return j===null||tr(j)?G(j):(t.enter("htmlFlowData"),W(j))}function q(j){return j===45?(t.consume(j),U):W(j)}function J(j){return j===47?(t.consume(j),o="",K):W(j)}function K(j){if(j===62){const le=o.toLowerCase();return xL.includes(le)?(t.consume(j),z):W(j)}return th(j)&&o.length<8?(t.consume(j),o+=String.fromCharCode(j),K):W(j)}function ne(j){return j===93?(t.consume(j),U):W(j)}function U(j){return j===62?(t.consume(j),z):j===45&&i===2?(t.consume(j),U):W(j)}function z(j){return j===null||tr(j)?(t.exit("htmlFlowData"),Y(j)):(t.consume(j),z)}function Y(j){return t.exit("htmlFlow"),e(j)}}function Uxe(t,e,n){const r=this;return i;function i(o){return tr(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 Bxe(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(yC,e,n)}}const Hxe={name:"htmlText",tokenize:Vxe};function Vxe(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),P):U===63?(t.consume(U),A):th(U)?(t.consume(U),R):n(U)}function c(U){return U===45?(t.consume(U),f):U===91?(t.consume(U),s=0,b):th(U)?(t.consume(U),C):n(U)}function f(U){return U===45?(t.consume(U),x):n(U)}function p(U){return U===null?n(U):U===45?(t.consume(U),m):tr(U)?(o=p,J(U)):(t.consume(U),p)}function m(U){return U===45?(t.consume(U),x):p(U)}function x(U){return U===62?q(U):U===45?m(U):p(U)}function b(U){const z="CDATA[";return U===z.charCodeAt(s++)?(t.consume(U),s===z.length?_:b):n(U)}function _(U){return U===null?n(U):U===93?(t.consume(U),S):tr(U)?(o=_,J(U)):(t.consume(U),_)}function S(U){return U===93?(t.consume(U),M):_(U)}function M(U){return U===62?q(U):U===93?(t.consume(U),M):_(U)}function C(U){return U===null||U===62?q(U):tr(U)?(o=C,J(U)):(t.consume(U),C)}function A(U){return U===null?n(U):U===63?(t.consume(U),N):tr(U)?(o=A,J(U)):(t.consume(U),A)}function N(U){return U===62?q(U):A(U)}function P(U){return th(U)?(t.consume(U),k):n(U)}function k(U){return U===45||lu(U)?(t.consume(U),k):O(U)}function O(U){return tr(U)?(o=O,J(U)):Oi(U)?(t.consume(U),O):q(U)}function R(U){return U===45||lu(U)?(t.consume(U),R):U===47||U===62||zc(U)?L(U):n(U)}function L(U){return U===47?(t.consume(U),q):U===58||U===95||th(U)?(t.consume(U),B):tr(U)?(o=L,J(U)):Oi(U)?(t.consume(U),L):q(U)}function B(U){return U===45||U===46||U===58||U===95||lu(U)?(t.consume(U),B):V(U)}function V(U){return U===61?(t.consume(U),W):tr(U)?(o=V,J(U)):Oi(U)?(t.consume(U),V):L(U)}function W(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(t.consume(U),i=U,G):tr(U)?(o=W,J(U)):Oi(U)?(t.consume(U),W):(t.consume(U),ee)}function G(U){return U===i?(t.consume(U),i=void 0,H):U===null?n(U):tr(U)?(o=G,J(U)):(t.consume(U),G)}function ee(U){return U===null||U===34||U===39||U===60||U===61||U===96?n(U):U===47||U===62||zc(U)?L(U):(t.consume(U),ee)}function H(U){return U===47||U===62||zc(U)?L(U):n(U)}function q(U){return U===62?(t.consume(U),t.exit("htmlTextData"),t.exit("htmlText"),e):n(U)}function J(U){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(U),t.exit("lineEnding"),K}function K(U){return Oi(U)?Vi(t,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):ne(U)}function ne(U){return t.enter("htmlTextData"),o(U)}}const B8={name:"labelEnd",resolveAll:qxe,resolveTo:Xxe,tokenize:Yxe},Gxe={tokenize:Kxe},Wxe={tokenize:Zxe},$xe={tokenize:Qxe};function qxe(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&&hh(t,0,t.length,n),t}function Xxe(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}},f={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=id(a,t.slice(s+1,s+r+3)),a=id(a,[["enter",f,e]]),a=id(a,U8(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=id(a,[["exit",f,e],t[o-2],t[o-1],["exit",c,e]]),a=id(a,t.slice(o+1)),a=id(a,[["exit",l,e]]),hh(t,s,t.length,a),t}function Yxe(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(O1(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(Gxe,f,o?f:p)(m):m===91?t.attempt(Wxe,f,o?c:p)(m):o?f(m):p(m)}function c(m){return t.attempt($xe,f,p)(m)}function f(m){return e(m)}function p(m){return s._balanced=!0,n(m)}}function Kxe(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 zc(p)?rS(t,s)(p):s(p)}function s(p){return p===41?f(p):Tq(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return zc(p)?rS(t,l)(p):f(p)}function a(p){return n(p)}function l(p){return p===34||p===39||p===40?Eq(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):f(p)}function c(p){return zc(p)?rS(t,f)(p):f(p)}function f(p){return p===41?(t.enter("resourceMarker"),t.consume(p),t.exit("resourceMarker"),t.exit("resource"),e):n(p)}}function Zxe(t,e,n){const r=this;return i;function i(a){return Cq.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(O1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function Qxe(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 Jxe={name:"labelStartImage",resolveAll:B8.resolveAll,tokenize:eve};function eve(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 tve={name:"labelStartLink",resolveAll:B8.resolveAll,tokenize:nve};function nve(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:rve};function rve(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Vi(t,e,"linePrefix")}}const c2={name:"thematicBreak",tokenize:ive};function ive(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||tr(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 Cc={continuation:{tokenize:lve},exit:uve,name:"list",tokenize:ave},sve={partial:!0,tokenize:dve},ove={partial:!0,tokenize:cve};function ave(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:Qk(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(c2,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 Qk(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(yC,r.interrupt?n:f,t.attempt(sve,m,p))}function f(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 lve(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(yC,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(ove,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Vi(t,t.attempt(Cc,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function cve(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 uve(t){t.exit(this.containerState.type)}function dve(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 vL={name:"setextUnderline",resolveTo:fve,tokenize:hve};function fve(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 hve(t,e,n){const r=this;let i;return s;function s(c){let f=r.events.length,p;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){p=r.events[f][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||tr(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const pve={tokenize:mve};function mve(t){const e=this,n=t.attempt(yC,r,t.attempt(this.parser.constructs.flowInitial,i,Vi(t,t.attempt(this.parser.constructs.flow,i,t.attempt(bxe,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 gve={resolveAll:Nq()},xve=Aq("string"),vve=Aq("text");function Aq(t){return{resolveAll:Nq(t==="text"?yve: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(f){return c(f)?s(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),l}function l(f){return c(f)?(n.exit("data"),s(f)):(n.consume(f),l)}function c(f){if(f===null)return!0;const p=i[f];let m=-1;if(p)for(;++m<p.length;){const x=p[m];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function Nq(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function yve(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 bve={42:Cc,43:Cc,45:Cc,48:Cc,49:Cc,50:Cc,51:Cc,52:Cc,53:Cc,54:Cc,55:Cc,56:Cc,57:Cc,62:_q},_ve={91:Txe},Sve={[-2]:YA,[-1]:YA,32:YA},wve={35:Rxe,42:c2,45:[vL,c2],60:Oxe,61:vL,95:c2,96:gL,126:gL},Mve={38:wq,92:Sq},Tve={[-5]:KA,[-4]:KA,[-3]:KA,33:Jxe,38:wq,42:Jk,60:[txe,Hxe],91:tve,92:[Nxe,Sq],93:B8,95:Jk,96:pxe},Cve={null:[Jk,gve]},Eve={null:[42,95]},Ave={null:[]},Nve=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Eve,contentInitial:_ve,disable:Ave,document:bve,flow:wve,flowInitial:Sve,insideSpan:Cve,string:Mve,text:Tve},Symbol.toStringTag,{value:"Module"}));function kve(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:O(P),check:O(k),consume:C,enter:A,exit:N,interrupt:O(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:_,events:[],now:b,parser:t,previous:null,sliceSerialize:m,sliceStream:x,write:p};let f=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function p(V){return o=id(o,V),S(),o[o.length-1]!==null?[]:(R(e,0),c.events=U8(s,c.events,c),c.events)}function m(V,W){return Dve(x(V),W)}function x(V){return Rve(o,V)}function b(){const{_bufferIndex:V,_index:W,line:G,column:ee,offset:H}=r;return{_bufferIndex:V,_index:W,line:G,column:ee,offset:H}}function _(V){i[V.line]=V.column,B()}function S(){let V;for(;r._index<o.length;){const W=o[r._index];if(typeof W=="string")for(V=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===V&&r._bufferIndex<W.length;)M(W.charCodeAt(r._bufferIndex));else M(W)}}function M(V){f=f(V)}function C(V){tr(V)?(r.line++,r.column=1,r.offset+=V===-3?2:1,B()):V!==-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=V}function A(V,W){const G=W||{};return G.type=V,G.start=b(),c.events.push(["enter",G,c]),a.push(G),G}function N(V){const W=a.pop();return W.end=b(),c.events.push(["exit",W,c]),W}function P(V,W){R(V,W.from)}function k(V,W){W.restore()}function O(V,W){return G;function G(ee,H,q){let J,K,ne,U;return Array.isArray(ee)?Y(ee):"tokenize"in ee?Y([ee]):z(ee);function z(X){return ie;function ie(fe){const Q=fe!==null&&X[fe],ue=fe!==null&&X.null,he=[...Array.isArray(Q)?Q:Q?[Q]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return Y(he)(fe)}}function Y(X){return J=X,K=0,X.length===0?q:j(X[K])}function j(X){return ie;function ie(fe){return U=L(),ne=X,X.partial||(c.currentConstruct=X),X.name&&c.parser.constructs.disable.null.includes(X.name)?ce():X.tokenize.call(W?Object.assign(Object.create(c),W):c,l,le,ce)(fe)}}function le(X){return V(ne,U),H}function ce(X){return U.restore(),++K<J.length?j(J[K]):q}}}function R(V,W){V.resolveAll&&!s.includes(V)&&s.push(V),V.resolve&&hh(c.events,W,c.events.length-W,V.resolve(c.events.slice(W),c)),V.resolveTo&&(c.events=V.resolveTo(c.events,c))}function L(){const V=b(),W=c.previous,G=c.currentConstruct,ee=c.events.length,H=Array.from(a);return{from:ee,restore:q};function q(){r=V,c.previous=W,c.currentConstruct=G,c.events.length=ee,a=H,B()}}function B(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Rve(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 Dve(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 Pve(t){const r={constructs:Uge([Nve,...(t||{}).extensions||[]]),content:i(Xge),defined:[],document:i(Kge),flow:i(pve),lazy:{},string:i(xve),text:i(vve)};return r;function i(s){return o;function o(a){return kve(r,s,a)}}}function Ive(t){for(;!Mq(t););return t}const yL=/[\0\t\n\r]/g;function Ove(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let c,f,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(yL.lastIndex=p,c=yL.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(f=Math.ceil(t/4)*4,l.push(-2);t++<f;)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 Lve=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jve(t){return t.replace(Lve,zve)}function zve(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return bq(n.slice(s?2:1),s?16:10)}return F8(n)||t}const kq={}.hasOwnProperty;function Fve(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),Uve(n)(Ive(Pve(n).document().write(Ove()(t,e,!0))))}function Uve(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ve),autolinkProtocol:L,autolinkEmail:L,atxHeading:s(Me),blockQuote:s(ue),characterEscape:L,characterReference:L,codeFenced:s(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(he,o),codeText:s(se,o),codeTextData:L,data:L,codeFlowValue:L,definition:s(Ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(de),hardBreakEscape:s(Te),hardBreakTrailing:s(Te),htmlFlow:s(Pe,o),htmlFlowData:L,htmlText:s(Pe,o),htmlTextData:L,image:s(oe),label:o,link:s(Ve),listItem:s(ze),listItemValue:m,listOrdered:s(He,p),listUnordered:s(He),paragraph:s(Ge),reference:j,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Me),strong:s(ae),thematicBreak:s(ge)},exit:{atxHeading:l(),atxHeadingSequence:P,autolink:l(),autolinkEmail:Q,autolinkProtocol:fe,blockQuote:l(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:X,characterReference:ie,codeFenced:l(S),codeFencedFence:_,codeFencedFenceInfo:x,codeFencedFenceMeta:b,codeFlowValue:B,codeIndented:l(M),codeText:l(H),codeTextData:B,data:B,definition:l(),definitionDestinationString:N,definitionLabelString:C,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(W),hardBreakTrailing:l(W),htmlFlow:l(G),htmlFlowData:B,htmlText:l(ee),htmlTextData:B,image:l(J),label:ne,labelText:K,lineEnding:V,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:le,resourceDestinationString:U,resourceTitleString:z,resource:Y,setextHeading:l(R),setextHeadingLineSequence:O,setextHeadingText:k,strong:l(),thematicBreak:l()}};Rq(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(we){let _e={type:"root",children:[]};const ve={stack:[_e],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:f,data:n},Ue=[];let Se=-1;for(;++Se<we.length;)if(we[Se][1].type==="listOrdered"||we[Se][1].type==="listUnordered")if(we[Se][0]==="enter")Ue.push(Se);else{const ke=Ue.pop();Se=i(we,ke,Se)}for(Se=-1;++Se<we.length;){const ke=e[we[Se][0]];kq.call(ke,we[Se][1].type)&&ke[we[Se][1].type].call(Object.assign({sliceSerialize:we[Se][2].sliceSerialize},ve),we[Se][1])}if(ve.tokenStack.length>0){const ke=ve.tokenStack[ve.tokenStack.length-1];(ke[1]||bL).call(ve,void 0,ke[0])}for(_e.position={start:wm(we.length>0?we[0][1].start:{line:1,column:1,offset:0}),end:wm(we.length>0?we[we.length-2][1].end:{line:1,column:1,offset:0})},Se=-1;++Se<e.transforms.length;)_e=e.transforms[Se](_e)||_e;return _e}function i(we,_e,ve){let Ue=_e-1,Se=-1,ke=!1,qe,Je,nt,tt;for(;++Ue<=ve;){const be=we[Ue];switch(be[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{be[0]==="enter"?Se++:Se--,tt=void 0;break}case"lineEndingBlank":{be[0]==="enter"&&(qe&&!tt&&!Se&&!nt&&(nt=Ue),tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:tt=void 0}if(!Se&&be[0]==="enter"&&be[1].type==="listItemPrefix"||Se===-1&&be[0]==="exit"&&(be[1].type==="listUnordered"||be[1].type==="listOrdered")){if(qe){let Le=Ue;for(Je=void 0;Le--;){const Ze=we[Le];if(Ze[1].type==="lineEnding"||Ze[1].type==="lineEndingBlank"){if(Ze[0]==="exit")continue;Je&&(we[Je][1].type="lineEndingBlank",ke=!0),Ze[1].type="lineEnding",Je=Le}else if(!(Ze[1].type==="linePrefix"||Ze[1].type==="blockQuotePrefix"||Ze[1].type==="blockQuotePrefixWhitespace"||Ze[1].type==="blockQuoteMarker"||Ze[1].type==="listItemIndent"))break}nt&&(!Je||nt<Je)&&(qe._spread=!0),qe.end=Object.assign({},Je?we[Je][1].start:be[1].end),we.splice(Je||Ue,0,["exit",qe,be[2]]),Ue++,ve++}if(be[1].type==="listItemPrefix"){const Le={type:"listItem",_spread:!1,start:Object.assign({},be[1].start),end:void 0};qe=Le,we.splice(Ue,0,["enter",Le,be[2]]),Ue++,ve++,nt=void 0,tt=!0}}}return we[_e][1]._spread=ke,ve}function s(we,_e){return ve;function ve(Ue){a.call(this,we(Ue),Ue),_e&&_e.call(this,Ue)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(we,_e,ve){this.stack[this.stack.length-1].children.push(we),this.stack.push(we),this.tokenStack.push([_e,ve||void 0]),we.position={start:wm(_e.start),end:void 0}}function l(we){return _e;function _e(ve){we&&we.call(this,ve),c.call(this,ve)}}function c(we,_e){const ve=this.stack.pop(),Ue=this.tokenStack.pop();if(Ue)Ue[0].type!==we.type&&(_e?_e.call(this,we,Ue[0]):(Ue[1]||bL).call(this,we,Ue[0]));else throw new Error("Cannot close `"+we.type+"` ("+nS({start:we.start,end:we.end})+"): it’s not open");ve.position.end=wm(we.end)}function f(){return zge(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(we){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(we),10),this.data.expectingFirstListItemValue=void 0}}function x(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=we}function b(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=we}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.value=we.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.value=we.replace(/(\r?\n|\r)$/g,"")}function C(we){const _e=this.resume(),ve=this.stack[this.stack.length-1];ve.label=_e,ve.identifier=O1(this.sliceSerialize(we)).toLowerCase()}function A(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.title=we}function N(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.url=we}function P(we){const _e=this.stack[this.stack.length-1];if(!_e.depth){const ve=this.sliceSerialize(we).length;_e.depth=ve}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function O(we){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(we).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function L(we){const ve=this.stack[this.stack.length-1].children;let Ue=ve[ve.length-1];(!Ue||Ue.type!=="text")&&(Ue=Z(),Ue.position={start:wm(we.start),end:void 0},ve.push(Ue)),this.stack.push(Ue)}function B(we){const _e=this.stack.pop();_e.value+=this.sliceSerialize(we),_e.position.end=wm(we.end)}function V(we){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=_e.children[_e.children.length-1];ve.position.end=wm(we.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(_e.type)&&(L.call(this,we),B.call(this,we))}function W(){this.data.atHardBreak=!0}function G(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.value=we}function ee(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.value=we}function H(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.value=we}function q(){const we=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";we.type+="Reference",we.referenceType=_e,delete we.url,delete we.title}else delete we.identifier,delete we.label;this.data.referenceType=void 0}function J(){const we=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";we.type+="Reference",we.referenceType=_e,delete we.url,delete we.title}else delete we.identifier,delete we.label;this.data.referenceType=void 0}function K(we){const _e=this.sliceSerialize(we),ve=this.stack[this.stack.length-2];ve.label=jve(_e),ve.identifier=O1(_e).toLowerCase()}function ne(){const we=this.stack[this.stack.length-1],_e=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const Ue=we.children;ve.children=Ue}else ve.alt=_e}function U(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.url=we}function z(){const we=this.resume(),_e=this.stack[this.stack.length-1];_e.title=we}function Y(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function le(we){const _e=this.resume(),ve=this.stack[this.stack.length-1];ve.label=_e,ve.identifier=O1(this.sliceSerialize(we)).toLowerCase(),this.data.referenceType="full"}function ce(we){this.data.characterReferenceType=we.type}function X(we){const _e=this.sliceSerialize(we),ve=this.data.characterReferenceType;let Ue;ve?(Ue=bq(_e,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ue=F8(_e);const Se=this.stack[this.stack.length-1];Se.value+=Ue}function ie(we){const _e=this.stack.pop();_e.position.end=wm(we.end)}function fe(we){B.call(this,we);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(we)}function Q(we){B.call(this,we);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(we)}function ue(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function se(){return{type:"inlineCode",value:""}}function Ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function de(){return{type:"emphasis",children:[]}}function Me(){return{type:"heading",depth:0,children:[]}}function Te(){return{type:"break"}}function Pe(){return{type:"html",value:""}}function oe(){return{type:"image",title:null,url:"",alt:null}}function Ve(){return{type:"link",title:null,url:"",children:[]}}function He(we){return{type:"list",ordered:we.type==="listOrdered",start:null,spread:we._spread,children:[]}}function ze(we){return{type:"listItem",spread:we._spread,checked:null,children:[]}}function Ge(){return{type:"paragraph",children:[]}}function ae(){return{type:"strong",children:[]}}function Z(){return{type:"text",value:""}}function ge(){return{type:"thematicBreak"}}}function wm(t){return{line:t.line,column:t.column,offset:t.offset}}function Rq(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?Rq(t,r):Bve(t,r)}}function Bve(t,e){let n;for(n in e)if(kq.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 bL(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+nS({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+nS({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+nS({start:e.start,end:e.end})+") is still open")}function Hve(t){const e=this;e.parser=n;function n(r){return Fve(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Vve(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 Gve(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function Wve(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 $ve(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function qve(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Xve(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Zy(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 Yve(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 Kve(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function Dq(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 Zve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Dq(t,e);const i={src:Zy(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 Qve(t,e){const n={src:Zy(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 Jve(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 e1e(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Dq(t,e);const i={href:Zy(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 t1e(t,e){const n={href:Zy(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 n1e(t,e,n){const r=t.all(e),i=n?r1e(n):Pq(e),s={},o=[];if(typeof e.checked=="boolean"){const f=r[0];let p;f&&f.type==="element"&&f.tagName==="p"?p=f:(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 f=r[a];(i||a!==0||f.type!=="element"||f.tagName!=="p")&&o.push({type:"text",value:`
`}),f.type==="element"&&f.tagName==="p"&&!i?o.push(...f.children):o.push(f)}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 r1e(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=Pq(n[r])}return e}function Pq(t){const e=t.spread;return e??t.children.length>1}function i1e(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 s1e(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function o1e(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function a1e(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function l1e(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=O8(e.children[1]),l=hq(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 c1e(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 f={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,f),t.applyData(e,f)}function u1e(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const _L=9,SL=32;function d1e(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(wL(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(wL(e.slice(i),i>0,!1)),s.join("")}function wL(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===_L||s===SL;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===_L||s===SL;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function f1e(t,e){const n={type:"text",value:d1e(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function h1e(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const p1e={blockquote:Vve,break:Gve,code:Wve,delete:$ve,emphasis:qve,footnoteReference:Xve,heading:Yve,html:Kve,imageReference:Zve,image:Qve,inlineCode:Jve,linkReference:e1e,link:t1e,listItem:n1e,list:i1e,paragraph:s1e,root:o1e,strong:a1e,table:l1e,tableCell:u1e,tableRow:c1e,text:f1e,thematicBreak:h1e,toml:j4,yaml:j4,definition:j4,footnoteDefinition:j4};function j4(){}const Iq=-1,bC=0,iS=1,r5=2,H8=3,V8=4,G8=5,W8=6,Oq=7,Lq=8,ML=typeof self=="object"?self:globalThis,m1e=(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 bC:case Iq:return n(o,i);case iS:{const a=n([],i);for(const l of o)a.push(r(l));return a}case r5:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case H8:return n(new Date(o),i);case V8:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case G8:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case W8:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case Oq:{const{name:a,message:l}=o;return n(new ML[a](l),i)}case Lq: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 ML[s](o),i)};return r},TL=t=>m1e(new Map,t)(0),Vv="",{toString:g1e}={},{keys:x1e}=Object,y_=t=>{const e=typeof t;if(e!=="object"||!t)return[bC,e];const n=g1e.call(t).slice(8,-1);switch(n){case"Array":return[iS,Vv];case"Object":return[r5,Vv];case"Date":return[H8,Vv];case"RegExp":return[V8,Vv];case"Map":return[G8,Vv];case"Set":return[W8,Vv];case"DataView":return[iS,n]}return n.includes("Array")?[iS,n]:n.includes("Error")?[Oq,n]:[r5,n]},z4=([t,e])=>t===bC&&(e==="function"||e==="symbol"),v1e=(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]=y_(o);switch(a){case bC:{let f=o;switch(l){case"bigint":a=Lq,f=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);f=null;break;case"undefined":return i([Iq],o)}return i([a,f],o)}case iS:{if(l){let m=o;return l==="DataView"?m=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(m=new Uint8Array(o)),i([l,[...m]],o)}const f=[],p=i([a,f],o);for(const m of o)f.push(s(m));return p}case r5:{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 f=[],p=i([a,f],o);for(const m of x1e(o))(t||!z4(y_(o[m])))&&f.push([s(m),s(o[m])]);return p}case H8:return i([a,o.toISOString()],o);case V8:{const{source:f,flags:p}=o;return i([a,{source:f,flags:p}],o)}case G8:{const f=[],p=i([a,f],o);for(const[m,x]of o)(t||!(z4(y_(m))||z4(y_(x))))&&f.push([s(m),s(x)]);return p}case W8:{const f=[],p=i([a,f],o);for(const m of o)(t||!z4(y_(m)))&&f.push(s(m));return p}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},CL=(t,{json:e,lossy:n}={})=>{const r=[];return v1e(!(e||n),!!e,new Map,r)(t),r},i5=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?TL(CL(t,e)):structuredClone(t):(t,e)=>TL(CL(t,e));function y1e(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 b1e(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function _1e(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||y1e,r=t.options.footnoteBackLabel||b1e,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 f=t.all(c),p=String(c.identifier).toUpperCase(),m=Zy(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=f[f.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 f.push(...b);const M={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(f,!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:{...i5(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 $8=(function(t){if(t==null)return T1e;if(typeof t=="function")return _C(t);if(typeof t=="object")return Array.isArray(t)?S1e(t):w1e(t);if(typeof t=="string")return M1e(t);throw new Error("Expected function, string, or object as test")});function S1e(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=$8(t[n]);return _C(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function w1e(t){const e=t;return _C(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function M1e(t){return _C(e);function e(n){return n&&n.type===t}}function _C(t){return e;function e(n,r,i){return!!(C1e(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function T1e(){return!0}function C1e(t){return t!==null&&typeof t=="object"&&"type"in t}const jq=[],E1e=!0,EL=!1,zq="skip";function Fq(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=$8(i),o=r?-1:1;a(t,void 0,[])();function a(l,c,f){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=jq,b,_,S;if((!e||s(l,c,f[f.length-1]||void 0))&&(x=A1e(n(l,f)),x[0]===EL))return x;if("children"in l&&l.children){const M=l;if(M.children&&x[0]!==zq)for(_=(r?M.children.length:-1)+o,S=f.concat(M);_>-1&&_<M.children.length;){const C=M.children[_];if(b=a(C,_,S)(),b[0]===EL)return b;_=typeof b[1]=="number"?b[1]:_+o}}return x}}}function A1e(t){return Array.isArray(t)?t:typeof t=="number"?[E1e,t]:t==null?jq:[t]}function Uq(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),Fq(t,s,a,i);function a(l,c){const f=c[c.length-1],p=f?f.children.indexOf(l):void 0;return o(l,p,f)}}const eR={}.hasOwnProperty,N1e={};function k1e(t,e){const n=e||N1e,r=new Map,i=new Map,s=new Map,o={...p1e,...n.handlers},a={all:c,applyData:D1e,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:R1e,wrap:I1e};return Uq(t,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const p=f.type==="definition"?r:i,m=String(f.identifier).toUpperCase();p.has(m)||p.set(m,f)}}),a;function l(f,p){const m=f.type,x=a.handlers[m];if(eR.call(a.handlers,m)&&x)return x(a,f,p);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in f){const{children:_,...S}=f,M=i5(S);return M.children=a.all(f),M}return i5(f)}return(a.options.unknownHandler||P1e)(a,f,p)}function c(f){const p=[];if("children"in f){const m=f.children;let x=-1;for(;++x<m.length;){const b=a.one(m[x],f);if(b){if(x&&m[x-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=AL(b.value)),!Array.isArray(b)&&b.type==="element")){const _=b.children[0];_&&_.type==="text"&&(_.value=AL(_.value))}Array.isArray(b)?p.push(...b):p.push(b)}}}return p}}function R1e(t,e){t.position&&(e.position=gge(t))}function D1e(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,i5(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function P1e(t,e){const n=e.data||{},r="value"in e&&!(eR.call(n,"hProperties")||eR.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 I1e(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 AL(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function NL(t,e){const n=k1e(t,e),r=n.one(t,void 0),i=_1e(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
`},i),s}function O1e(t,e){return t&&"run"in t?async function(n,r){const i=NL(n,{file:r,...e});await t.run(i,r)}:function(n,r){return NL(n,{file:r,...t||e})}}function kL(t){if(t)throw t}var ZA,RL;function L1e(){if(RL)return ZA;RL=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 f=t.call(c,"constructor"),p=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!f&&!p)return!1;var m;for(m in c);return typeof m>"u"||t.call(c,m)},o=function(c,f){n&&f.name==="__proto__"?n(c,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):c[f.name]=f.newValue},a=function(c,f){if(f==="__proto__")if(t.call(c,f)){if(r)return r(c,f).value}else return;return c[f]};return ZA=function l(){var c,f,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(f in c)p=a(_,f),m=a(c,f),_!==m&&(C&&m&&(s(m)||(x=i(m)))?(x?(x=!1,b=p&&i(p)?p:[]):b=p&&s(p)?p:{},o(_,{name:f,newValue:l(C,b,m)})):typeof m<"u"&&o(_,{name:f,newValue:m}));return _},ZA}var j1e=L1e();const QA=Oy(j1e);function tR(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 z1e(){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 f=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,f?F1e(f,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 F1e(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 f=c;if(a&&n)throw f;return i(f)}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 Xf={basename:U1e,dirname:B1e,extname:H1e,join:V1e,sep:"/"};function U1e(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');zw(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 B1e(t){if(zw(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 H1e(t){zw(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 V1e(...t){let e=-1,n;for(;++e<t.length;)zw(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":G1e(n)}function G1e(t){zw(t);const e=t.codePointAt(0)===47;let n=W1e(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function W1e(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 zw(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const $1e={cwd:q1e};function q1e(){return"/"}function nR(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function X1e(t){if(typeof t=="string")t=new URL(t);else if(!nR(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 Y1e(t)}function Y1e(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 Bq{constructor(e){let n;e?nR(e)?n={path:e}:typeof e=="string"||K1e(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":$1e.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"?Xf.basename(this.path):void 0}set basename(e){t6(e,"basename"),e6(e,"basename"),this.path=Xf.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Xf.dirname(this.path):void 0}set dirname(e){DL(this.basename,"dirname"),this.path=Xf.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Xf.extname(this.path):void 0}set extname(e){if(e6(e,"extname"),DL(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=Xf.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){nR(e)&&(e=X1e(e)),t6(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Xf.basename(this.path,this.extname):void 0}set stem(e){t6(e,"stem"),e6(e,"stem"),this.path=Xf.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 wl(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(Xf.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Xf.sep+"`")}function t6(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function DL(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function K1e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Z1e=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),Q1e={}.hasOwnProperty;class q8 extends Z1e{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=z1e()}copy(){const e=new q8;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):Q1e.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=F4(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=F4(e),l=r.parse(a);r.run(l,a,function(f,p,m){if(f||!p||!m)return c(f);const x=p,b=r.stringify(x,m);tye(b)?m.value=b:m.result=b,c(f,m)});function c(f,p){f||!p?o(f):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),IL("processSync","process",n),r;function i(s,o){n=!0,kL(s),r=o}}run(e,n,r){PL(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=F4(n);i.run(e,l,c);function c(f,p,m){const x=p||e;f?a(f):o?o(x):r(void 0,x,m)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),IL("runSync","run",r),i;function s(o,a){kL(o),i=a,r=!0}}stringify(e,n){this.freeze();const r=F4(n),i=this.compiler||this.Compiler;return r6("stringify",i),PL(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[f,...p]=c;l(f,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 f=-1;if(c!=null)if(Array.isArray(c))for(;++f<c.length;){const p=c[f];s(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,f){let p=-1,m=-1;for(;++p<r.length;)if(r[p][0]===c){m=p;break}if(m===-1)r.push([c,...f]);else if(f.length>0){let[x,...b]=f;const _=r[m][1];tR(_)&&tR(x)&&(x=QA(!0,_,x)),r[m]=[c,x,...b]}}}}const J1e=new q8().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 PL(t){if(!tR(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function IL(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function F4(t){return eye(t)?t:new Bq(t)}function eye(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function tye(t){return typeof t=="string"||nye(t)}function nye(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const rye="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",OL=[],LL={allowDangerousHtml:!0},iye=/^(https?|ircs?|mailto|xmpp)$/i,sye=[{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 oye(t){const e=aye(t),n=lye(t);return cye(e.runSync(e.parse(n),n),t)}function aye(t){const e=t.rehypePlugins||OL,n=t.remarkPlugins||OL,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...LL}:LL;return J1e().use(Hve).use(n).use(O1e,r).use(e)}function lye(t){const e=t.children||"",n=new Bq;return typeof e=="string"&&(n.value=e),n}function cye(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||uye;for(const f of sye)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+rye+f.id,void 0);return Uq(t,c),_ge(t,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(f,p,m){if(f.type==="raw"&&m&&typeof p=="number")return o?m.children.splice(p,1):m.children[p]={type:"text",value:f.value},p;if(f.type==="element"){let x;for(x in XA)if(Object.hasOwn(XA,x)&&Object.hasOwn(f.properties,x)){const b=f.properties[x],_=XA[x];(_===null||_.includes(f.tagName))&&(f.properties[x]=l(String(b||""),x,f))}}if(f.type==="element"){let x=n?!n.includes(f.tagName):s?s.includes(f.tagName):!1;if(!x&&r&&typeof p=="number"&&(x=!r(f,p,m)),x&&m&&typeof p=="number")return a&&f.children?m.children.splice(p,1,...f.children):m.children.splice(p,1),p}}}function uye(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||iye.test(t.slice(0,e))?t:""}function dye(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 fye(){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,""),f=this.stack[this.stack.length-1];f.type,this.exit(l),f.value=c;const p=f.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(),f=this.stack[this.stack.length-1];f.type,this.exit(l),f.value=c,f.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 hye(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||"",f=a.createTracker(l),p="$".repeat(Math.max(dye(c,"$")+1,2)),m=a.enter("mathFlow");let x=f.move(p);if(s.meta){const b=a.enter("mathFlowMeta");x+=f.move(a.safe(s.meta,{after:`
`,before:x,encode:["$"],...f.current()})),b()}return x+=f.move(`
`),c&&(x+=f.move(c+`
`)),x+=f.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 f="$".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 f+l+f}function i(){return"$"}}const pye={tokenize:mye,concrete:!0,name:"mathFlow"},jL={tokenize:gye,partial:!0};function mye(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||tr(C)?p(C):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||tr(C)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),p(C)):C===36?n(C):(t.consume(C),f)}function p(C){return t.exit("mathFlowFence"),r.interrupt?e(C):t.attempt(jL,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):tr(C)?t.attempt(jL,m,S)(C):(t.enter("mathFlowValue"),_(C))}function _(C){return C===null||tr(C)?(t.exit("mathFlowValue"),b(C)):(t.consume(C),_)}function S(C){return t.exit("mathFlow"),e(C)}function M(C,A,N){let P=0;return Vi(C,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function k(L){return C.enter("mathFlowFence"),C.enter("mathFlowFenceSequence"),O(L)}function O(L){return L===36?(P++,C.consume(L),O):P<o?N(L):(C.exit("mathFlowFenceSequence"),Vi(C,R,"whitespace")(L))}function R(L){return L===null||tr(L)?(C.exit("mathFlowFence"),A(L)):N(L)}}}function gye(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 xye(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:vye,previous:yye,name:"mathText"};function r(i,s,o){let a=0,l,c;return f;function f(_){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):tr(_)?(i.enter("lineEnding"),i.consume(_),i.exit("lineEnding"),m):(i.enter("mathTextData"),x(_))}function x(_){return _===null||_===32||_===36||tr(_)?(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 vye(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 yye(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function bye(t){return{flow:{36:pye},text:{36:xye(t)}}}class Rc{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 Rc(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class pu{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 pu(n,Rc.range(this,e))}}class pn{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 f;s+15<a.length?f=a.slice(s,s+15)+"…":f=a.slice(s),r+=c+l+f}var p=new Error(r);return p.name="ParseError",p.__proto__=pn.prototype,p.position=i,i!=null&&s!=null&&(p.length=s-i),p.rawMessage=e,p}}pn.prototype.__proto__=Error.prototype;var _ye=/([A-Z])/g,X8=t=>t.replace(_ye,"-$1").toLowerCase(),Sye={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},wye=/[&><"']/g,yl=t=>String(t).replace(wye,e=>Sye[e]),sS=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?sS(t.body[0]):t:t.type==="font"?sS(t.body):t,Mye=new Set(["mathord","textord","atom"]),Rp=t=>Mye.has(sS(t).type),Tye=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"},u2={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 Cye(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 Y8{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 u2)if(u2.hasOwnProperty(n)){var r=u2[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Cye(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 pn("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=Tye(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Mm{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 Qf[Eye[this.id]]}sub(){return Qf[Aye[this.id]]}fracNum(){return Qf[Nye[this.id]]}fracDen(){return Qf[kye[this.id]]}cramp(){return Qf[Rye[this.id]]}text(){return Qf[Dye[this.id]]}isTight(){return this.size>=2}}var K8=0,s5=1,L1=2,vp=3,zS=4,ld=5,wy=6,Yl=7,Qf=[new Mm(K8,0,!1),new Mm(s5,0,!0),new Mm(L1,1,!1),new Mm(vp,1,!0),new Mm(zS,2,!1),new Mm(ld,2,!0),new Mm(wy,3,!1),new Mm(Yl,3,!0)],Eye=[zS,ld,zS,ld,wy,Yl,wy,Yl],Aye=[ld,ld,ld,ld,Yl,Yl,Yl,Yl],Nye=[L1,vp,zS,ld,wy,Yl,wy,Yl],kye=[vp,vp,ld,ld,Yl,Yl,Yl,Yl],Rye=[s5,s5,vp,vp,ld,ld,Yl,Yl],Dye=[K8,s5,L1,vp,L1,vp,L1,vp],_r={DISPLAY:Qf[K8],TEXT:Qf[L1],SCRIPT:Qf[zS],SCRIPTSCRIPT:Qf[wy]},rR=[{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 Pye(t){for(var e=0;e<rR.length;e++)for(var n=rR[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 d2=[];rR.forEach(t=>t.blocks.forEach(e=>d2.push(...e)));function Hq(t){for(var e=0;e<d2.length;e+=2)if(t>=d2[e]&&t<=d2[e+1])return!0;return!1}var Gv=80,Iye=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"},Oye=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"},Lye=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"},jye=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"},zye=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"},Fye=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},Uye=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"},Bye=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=Iye(n,Gv);break;case"sqrtSize1":i=Oye(n,Gv);break;case"sqrtSize2":i=Lye(n,Gv);break;case"sqrtSize3":i=jye(n,Gv);break;case"sqrtSize4":i=zye(n,Gv);break;case"sqrtTall":i=Uye(n,Gv,r)}return i},Hye=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""}},zL={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`},Vye=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 Fw=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 ih={"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]}},U4={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]},FL={Å:"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 Gye(t,e){ih[t]=e}function Z8(t,e,n){if(!ih[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=ih[e][r];if(!i&&t[0]in FL&&(r=FL[t[0]].charCodeAt(0),i=ih[e][r]),!i&&n==="text"&&Hq(r)&&(i=ih[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var s6={};function Wye(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!s6[e]){var n=s6[e]={cssEmPerMu:U4.quad[e]/18};for(var r in U4)U4.hasOwnProperty(r)&&(n[r]=U4[r][e])}return s6[e]}var $ye=[[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]],UL=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],BL=function(e,n){return n.size<2?e:$ye[e-1][n.size-1]};class lp{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||lp.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=UL[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 lp(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:BL(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:UL[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=BL(lp.BASESIZE,e);return this.size===n&&this.textSize===lp.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!==lp.BASESIZE?["sizing","reset-size"+this.size,"size"+lp.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Wye(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}lp.BASESIZE=6;var iR={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},qye={ex:!0,em:!0,mu:!0},Vq=function(e){return typeof e!="string"&&(e=e.unit),e in iR||e in qye||e==="ex"},oo=function(e,n){var r;if(e.unit in iR)r=iR[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 pn("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},_n=function(e){return+e.toFixed(4)+"em"},m0=function(e){return e.filter(n=>n).join(" ")},Gq=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)}},Wq=function(e){var n=document.createElement(e);n.className=m0(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},Xye=/[\s"'>/=\x00-\x1f]/,$q=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+yl(m0(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=X8(i)+":"+this.style[i]+";");r&&(n+=' style="'+yl(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(Xye.test(s))throw new pn("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 Uw{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,Gq.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return Wq.call(this,"span")}toMarkup(){return $q.call(this,"span")}}class Q8{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,Gq.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 Wq.call(this,"a")}toMarkup(){return $q.call(this,"a")}}class Yye{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+=X8(r)+":"+this.style[r]+";");return n&&(e+=' style="'+yl(n)+'"'),e+="'/>",e}}var Kye={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class hd{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=Pye(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Kye[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=_n(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=m0(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(m0(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+=X8(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 Mp{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 g0{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",zL[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+yl(this.alternate)+'"/>':'<path d="'+yl(zL[this.pathName])+'"/>'}}class sR{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 HL(t){if(t instanceof hd)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function Zye(t){if(t instanceof Uw)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var Qye={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Jye={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},xs={math:{},text:{}};function te(t,e,n,r,i,s){xs[t][i]={font:e,group:n,replace:r},s&&r&&(xs[t][r]=xs[t][i])}var pe="math",sn="text",Ne="main",rt="ams",Xs="accent-token",In="bin",Jl="close",Qy="inner",ir="mathord",ea="op-token",Mu="open",SC="punct",st="rel",Dp="spacing",yt="textord";te(pe,Ne,st,"≡","\\equiv",!0);te(pe,Ne,st,"≺","\\prec",!0);te(pe,Ne,st,"≻","\\succ",!0);te(pe,Ne,st,"∼","\\sim",!0);te(pe,Ne,st,"⊥","\\perp");te(pe,Ne,st,"⪯","\\preceq",!0);te(pe,Ne,st,"⪰","\\succeq",!0);te(pe,Ne,st,"≃","\\simeq",!0);te(pe,Ne,st,"∣","\\mid",!0);te(pe,Ne,st,"≪","\\ll",!0);te(pe,Ne,st,"≫","\\gg",!0);te(pe,Ne,st,"≍","\\asymp",!0);te(pe,Ne,st,"∥","\\parallel");te(pe,Ne,st,"⋈","\\bowtie",!0);te(pe,Ne,st,"⌣","\\smile",!0);te(pe,Ne,st,"⊑","\\sqsubseteq",!0);te(pe,Ne,st,"⊒","\\sqsupseteq",!0);te(pe,Ne,st,"≐","\\doteq",!0);te(pe,Ne,st,"⌢","\\frown",!0);te(pe,Ne,st,"∋","\\ni",!0);te(pe,Ne,st,"∝","\\propto",!0);te(pe,Ne,st,"⊢","\\vdash",!0);te(pe,Ne,st,"⊣","\\dashv",!0);te(pe,Ne,st,"∋","\\owns");te(pe,Ne,SC,".","\\ldotp");te(pe,Ne,SC,"⋅","\\cdotp");te(pe,Ne,yt,"#","\\#");te(sn,Ne,yt,"#","\\#");te(pe,Ne,yt,"&","\\&");te(sn,Ne,yt,"&","\\&");te(pe,Ne,yt,"ℵ","\\aleph",!0);te(pe,Ne,yt,"∀","\\forall",!0);te(pe,Ne,yt,"ℏ","\\hbar",!0);te(pe,Ne,yt,"∃","\\exists",!0);te(pe,Ne,yt,"∇","\\nabla",!0);te(pe,Ne,yt,"♭","\\flat",!0);te(pe,Ne,yt,"ℓ","\\ell",!0);te(pe,Ne,yt,"♮","\\natural",!0);te(pe,Ne,yt,"♣","\\clubsuit",!0);te(pe,Ne,yt,"℘","\\wp",!0);te(pe,Ne,yt,"♯","\\sharp",!0);te(pe,Ne,yt,"♢","\\diamondsuit",!0);te(pe,Ne,yt,"ℜ","\\Re",!0);te(pe,Ne,yt,"♡","\\heartsuit",!0);te(pe,Ne,yt,"ℑ","\\Im",!0);te(pe,Ne,yt,"♠","\\spadesuit",!0);te(pe,Ne,yt,"§","\\S",!0);te(sn,Ne,yt,"§","\\S");te(pe,Ne,yt,"¶","\\P",!0);te(sn,Ne,yt,"¶","\\P");te(pe,Ne,yt,"†","\\dag");te(sn,Ne,yt,"†","\\dag");te(sn,Ne,yt,"†","\\textdagger");te(pe,Ne,yt,"‡","\\ddag");te(sn,Ne,yt,"‡","\\ddag");te(sn,Ne,yt,"‡","\\textdaggerdbl");te(pe,Ne,Jl,"⎱","\\rmoustache",!0);te(pe,Ne,Mu,"⎰","\\lmoustache",!0);te(pe,Ne,Jl,"⟯","\\rgroup",!0);te(pe,Ne,Mu,"⟮","\\lgroup",!0);te(pe,Ne,In,"∓","\\mp",!0);te(pe,Ne,In,"⊖","\\ominus",!0);te(pe,Ne,In,"⊎","\\uplus",!0);te(pe,Ne,In,"⊓","\\sqcap",!0);te(pe,Ne,In,"∗","\\ast");te(pe,Ne,In,"⊔","\\sqcup",!0);te(pe,Ne,In,"◯","\\bigcirc",!0);te(pe,Ne,In,"∙","\\bullet",!0);te(pe,Ne,In,"‡","\\ddagger");te(pe,Ne,In,"≀","\\wr",!0);te(pe,Ne,In,"⨿","\\amalg");te(pe,Ne,In,"&","\\And");te(pe,Ne,st,"⟵","\\longleftarrow",!0);te(pe,Ne,st,"⇐","\\Leftarrow",!0);te(pe,Ne,st,"⟸","\\Longleftarrow",!0);te(pe,Ne,st,"⟶","\\longrightarrow",!0);te(pe,Ne,st,"⇒","\\Rightarrow",!0);te(pe,Ne,st,"⟹","\\Longrightarrow",!0);te(pe,Ne,st,"↔","\\leftrightarrow",!0);te(pe,Ne,st,"⟷","\\longleftrightarrow",!0);te(pe,Ne,st,"⇔","\\Leftrightarrow",!0);te(pe,Ne,st,"⟺","\\Longleftrightarrow",!0);te(pe,Ne,st,"↦","\\mapsto",!0);te(pe,Ne,st,"⟼","\\longmapsto",!0);te(pe,Ne,st,"↗","\\nearrow",!0);te(pe,Ne,st,"↩","\\hookleftarrow",!0);te(pe,Ne,st,"↪","\\hookrightarrow",!0);te(pe,Ne,st,"↘","\\searrow",!0);te(pe,Ne,st,"↼","\\leftharpoonup",!0);te(pe,Ne,st,"⇀","\\rightharpoonup",!0);te(pe,Ne,st,"↙","\\swarrow",!0);te(pe,Ne,st,"↽","\\leftharpoondown",!0);te(pe,Ne,st,"⇁","\\rightharpoondown",!0);te(pe,Ne,st,"↖","\\nwarrow",!0);te(pe,Ne,st,"⇌","\\rightleftharpoons",!0);te(pe,rt,st,"≮","\\nless",!0);te(pe,rt,st,"","\\@nleqslant");te(pe,rt,st,"","\\@nleqq");te(pe,rt,st,"⪇","\\lneq",!0);te(pe,rt,st,"≨","\\lneqq",!0);te(pe,rt,st,"","\\@lvertneqq");te(pe,rt,st,"⋦","\\lnsim",!0);te(pe,rt,st,"⪉","\\lnapprox",!0);te(pe,rt,st,"⊀","\\nprec",!0);te(pe,rt,st,"⋠","\\npreceq",!0);te(pe,rt,st,"⋨","\\precnsim",!0);te(pe,rt,st,"⪹","\\precnapprox",!0);te(pe,rt,st,"≁","\\nsim",!0);te(pe,rt,st,"","\\@nshortmid");te(pe,rt,st,"∤","\\nmid",!0);te(pe,rt,st,"⊬","\\nvdash",!0);te(pe,rt,st,"⊭","\\nvDash",!0);te(pe,rt,st,"⋪","\\ntriangleleft");te(pe,rt,st,"⋬","\\ntrianglelefteq",!0);te(pe,rt,st,"⊊","\\subsetneq",!0);te(pe,rt,st,"","\\@varsubsetneq");te(pe,rt,st,"⫋","\\subsetneqq",!0);te(pe,rt,st,"","\\@varsubsetneqq");te(pe,rt,st,"≯","\\ngtr",!0);te(pe,rt,st,"","\\@ngeqslant");te(pe,rt,st,"","\\@ngeqq");te(pe,rt,st,"⪈","\\gneq",!0);te(pe,rt,st,"≩","\\gneqq",!0);te(pe,rt,st,"","\\@gvertneqq");te(pe,rt,st,"⋧","\\gnsim",!0);te(pe,rt,st,"⪊","\\gnapprox",!0);te(pe,rt,st,"⊁","\\nsucc",!0);te(pe,rt,st,"⋡","\\nsucceq",!0);te(pe,rt,st,"⋩","\\succnsim",!0);te(pe,rt,st,"⪺","\\succnapprox",!0);te(pe,rt,st,"≆","\\ncong",!0);te(pe,rt,st,"","\\@nshortparallel");te(pe,rt,st,"∦","\\nparallel",!0);te(pe,rt,st,"⊯","\\nVDash",!0);te(pe,rt,st,"⋫","\\ntriangleright");te(pe,rt,st,"⋭","\\ntrianglerighteq",!0);te(pe,rt,st,"","\\@nsupseteqq");te(pe,rt,st,"⊋","\\supsetneq",!0);te(pe,rt,st,"","\\@varsupsetneq");te(pe,rt,st,"⫌","\\supsetneqq",!0);te(pe,rt,st,"","\\@varsupsetneqq");te(pe,rt,st,"⊮","\\nVdash",!0);te(pe,rt,st,"⪵","\\precneqq",!0);te(pe,rt,st,"⪶","\\succneqq",!0);te(pe,rt,st,"","\\@nsubseteqq");te(pe,rt,In,"⊴","\\unlhd");te(pe,rt,In,"⊵","\\unrhd");te(pe,rt,st,"↚","\\nleftarrow",!0);te(pe,rt,st,"↛","\\nrightarrow",!0);te(pe,rt,st,"⇍","\\nLeftarrow",!0);te(pe,rt,st,"⇏","\\nRightarrow",!0);te(pe,rt,st,"↮","\\nleftrightarrow",!0);te(pe,rt,st,"⇎","\\nLeftrightarrow",!0);te(pe,rt,st,"△","\\vartriangle");te(pe,rt,yt,"ℏ","\\hslash");te(pe,rt,yt,"▽","\\triangledown");te(pe,rt,yt,"◊","\\lozenge");te(pe,rt,yt,"Ⓢ","\\circledS");te(pe,rt,yt,"®","\\circledR");te(sn,rt,yt,"®","\\circledR");te(pe,rt,yt,"∡","\\measuredangle",!0);te(pe,rt,yt,"∄","\\nexists");te(pe,rt,yt,"℧","\\mho");te(pe,rt,yt,"Ⅎ","\\Finv",!0);te(pe,rt,yt,"⅁","\\Game",!0);te(pe,rt,yt,"‵","\\backprime");te(pe,rt,yt,"▲","\\blacktriangle");te(pe,rt,yt,"▼","\\blacktriangledown");te(pe,rt,yt,"■","\\blacksquare");te(pe,rt,yt,"⧫","\\blacklozenge");te(pe,rt,yt,"★","\\bigstar");te(pe,rt,yt,"∢","\\sphericalangle",!0);te(pe,rt,yt,"∁","\\complement",!0);te(pe,rt,yt,"ð","\\eth",!0);te(sn,Ne,yt,"ð","ð");te(pe,rt,yt,"╱","\\diagup");te(pe,rt,yt,"╲","\\diagdown");te(pe,rt,yt,"□","\\square");te(pe,rt,yt,"□","\\Box");te(pe,rt,yt,"◊","\\Diamond");te(pe,rt,yt,"¥","\\yen",!0);te(sn,rt,yt,"¥","\\yen",!0);te(pe,rt,yt,"✓","\\checkmark",!0);te(sn,rt,yt,"✓","\\checkmark");te(pe,rt,yt,"ℶ","\\beth",!0);te(pe,rt,yt,"ℸ","\\daleth",!0);te(pe,rt,yt,"ℷ","\\gimel",!0);te(pe,rt,yt,"ϝ","\\digamma",!0);te(pe,rt,yt,"ϰ","\\varkappa");te(pe,rt,Mu,"┌","\\@ulcorner",!0);te(pe,rt,Jl,"┐","\\@urcorner",!0);te(pe,rt,Mu,"└","\\@llcorner",!0);te(pe,rt,Jl,"┘","\\@lrcorner",!0);te(pe,rt,st,"≦","\\leqq",!0);te(pe,rt,st,"⩽","\\leqslant",!0);te(pe,rt,st,"⪕","\\eqslantless",!0);te(pe,rt,st,"≲","\\lesssim",!0);te(pe,rt,st,"⪅","\\lessapprox",!0);te(pe,rt,st,"≊","\\approxeq",!0);te(pe,rt,In,"⋖","\\lessdot");te(pe,rt,st,"⋘","\\lll",!0);te(pe,rt,st,"≶","\\lessgtr",!0);te(pe,rt,st,"⋚","\\lesseqgtr",!0);te(pe,rt,st,"⪋","\\lesseqqgtr",!0);te(pe,rt,st,"≑","\\doteqdot");te(pe,rt,st,"≓","\\risingdotseq",!0);te(pe,rt,st,"≒","\\fallingdotseq",!0);te(pe,rt,st,"∽","\\backsim",!0);te(pe,rt,st,"⋍","\\backsimeq",!0);te(pe,rt,st,"⫅","\\subseteqq",!0);te(pe,rt,st,"⋐","\\Subset",!0);te(pe,rt,st,"⊏","\\sqsubset",!0);te(pe,rt,st,"≼","\\preccurlyeq",!0);te(pe,rt,st,"⋞","\\curlyeqprec",!0);te(pe,rt,st,"≾","\\precsim",!0);te(pe,rt,st,"⪷","\\precapprox",!0);te(pe,rt,st,"⊲","\\vartriangleleft");te(pe,rt,st,"⊴","\\trianglelefteq");te(pe,rt,st,"⊨","\\vDash",!0);te(pe,rt,st,"⊪","\\Vvdash",!0);te(pe,rt,st,"⌣","\\smallsmile");te(pe,rt,st,"⌢","\\smallfrown");te(pe,rt,st,"≏","\\bumpeq",!0);te(pe,rt,st,"≎","\\Bumpeq",!0);te(pe,rt,st,"≧","\\geqq",!0);te(pe,rt,st,"⩾","\\geqslant",!0);te(pe,rt,st,"⪖","\\eqslantgtr",!0);te(pe,rt,st,"≳","\\gtrsim",!0);te(pe,rt,st,"⪆","\\gtrapprox",!0);te(pe,rt,In,"⋗","\\gtrdot");te(pe,rt,st,"⋙","\\ggg",!0);te(pe,rt,st,"≷","\\gtrless",!0);te(pe,rt,st,"⋛","\\gtreqless",!0);te(pe,rt,st,"⪌","\\gtreqqless",!0);te(pe,rt,st,"≖","\\eqcirc",!0);te(pe,rt,st,"≗","\\circeq",!0);te(pe,rt,st,"≜","\\triangleq",!0);te(pe,rt,st,"∼","\\thicksim");te(pe,rt,st,"≈","\\thickapprox");te(pe,rt,st,"⫆","\\supseteqq",!0);te(pe,rt,st,"⋑","\\Supset",!0);te(pe,rt,st,"⊐","\\sqsupset",!0);te(pe,rt,st,"≽","\\succcurlyeq",!0);te(pe,rt,st,"⋟","\\curlyeqsucc",!0);te(pe,rt,st,"≿","\\succsim",!0);te(pe,rt,st,"⪸","\\succapprox",!0);te(pe,rt,st,"⊳","\\vartriangleright");te(pe,rt,st,"⊵","\\trianglerighteq");te(pe,rt,st,"⊩","\\Vdash",!0);te(pe,rt,st,"∣","\\shortmid");te(pe,rt,st,"∥","\\shortparallel");te(pe,rt,st,"≬","\\between",!0);te(pe,rt,st,"⋔","\\pitchfork",!0);te(pe,rt,st,"∝","\\varpropto");te(pe,rt,st,"◀","\\blacktriangleleft");te(pe,rt,st,"∴","\\therefore",!0);te(pe,rt,st,"∍","\\backepsilon");te(pe,rt,st,"▶","\\blacktriangleright");te(pe,rt,st,"∵","\\because",!0);te(pe,rt,st,"⋘","\\llless");te(pe,rt,st,"⋙","\\gggtr");te(pe,rt,In,"⊲","\\lhd");te(pe,rt,In,"⊳","\\rhd");te(pe,rt,st,"≂","\\eqsim",!0);te(pe,Ne,st,"⋈","\\Join");te(pe,rt,st,"≑","\\Doteq",!0);te(pe,rt,In,"∔","\\dotplus",!0);te(pe,rt,In,"∖","\\smallsetminus");te(pe,rt,In,"⋒","\\Cap",!0);te(pe,rt,In,"⋓","\\Cup",!0);te(pe,rt,In,"⩞","\\doublebarwedge",!0);te(pe,rt,In,"⊟","\\boxminus",!0);te(pe,rt,In,"⊞","\\boxplus",!0);te(pe,rt,In,"⋇","\\divideontimes",!0);te(pe,rt,In,"⋉","\\ltimes",!0);te(pe,rt,In,"⋊","\\rtimes",!0);te(pe,rt,In,"⋋","\\leftthreetimes",!0);te(pe,rt,In,"⋌","\\rightthreetimes",!0);te(pe,rt,In,"⋏","\\curlywedge",!0);te(pe,rt,In,"⋎","\\curlyvee",!0);te(pe,rt,In,"⊝","\\circleddash",!0);te(pe,rt,In,"⊛","\\circledast",!0);te(pe,rt,In,"⋅","\\centerdot");te(pe,rt,In,"⊺","\\intercal",!0);te(pe,rt,In,"⋒","\\doublecap");te(pe,rt,In,"⋓","\\doublecup");te(pe,rt,In,"⊠","\\boxtimes",!0);te(pe,rt,st,"⇢","\\dashrightarrow",!0);te(pe,rt,st,"⇠","\\dashleftarrow",!0);te(pe,rt,st,"⇇","\\leftleftarrows",!0);te(pe,rt,st,"⇆","\\leftrightarrows",!0);te(pe,rt,st,"⇚","\\Lleftarrow",!0);te(pe,rt,st,"↞","\\twoheadleftarrow",!0);te(pe,rt,st,"↢","\\leftarrowtail",!0);te(pe,rt,st,"↫","\\looparrowleft",!0);te(pe,rt,st,"⇋","\\leftrightharpoons",!0);te(pe,rt,st,"↶","\\curvearrowleft",!0);te(pe,rt,st,"↺","\\circlearrowleft",!0);te(pe,rt,st,"↰","\\Lsh",!0);te(pe,rt,st,"⇈","\\upuparrows",!0);te(pe,rt,st,"↿","\\upharpoonleft",!0);te(pe,rt,st,"⇃","\\downharpoonleft",!0);te(pe,Ne,st,"⊶","\\origof",!0);te(pe,Ne,st,"⊷","\\imageof",!0);te(pe,rt,st,"⊸","\\multimap",!0);te(pe,rt,st,"↭","\\leftrightsquigarrow",!0);te(pe,rt,st,"⇉","\\rightrightarrows",!0);te(pe,rt,st,"⇄","\\rightleftarrows",!0);te(pe,rt,st,"↠","\\twoheadrightarrow",!0);te(pe,rt,st,"↣","\\rightarrowtail",!0);te(pe,rt,st,"↬","\\looparrowright",!0);te(pe,rt,st,"↷","\\curvearrowright",!0);te(pe,rt,st,"↻","\\circlearrowright",!0);te(pe,rt,st,"↱","\\Rsh",!0);te(pe,rt,st,"⇊","\\downdownarrows",!0);te(pe,rt,st,"↾","\\upharpoonright",!0);te(pe,rt,st,"⇂","\\downharpoonright",!0);te(pe,rt,st,"⇝","\\rightsquigarrow",!0);te(pe,rt,st,"⇝","\\leadsto");te(pe,rt,st,"⇛","\\Rrightarrow",!0);te(pe,rt,st,"↾","\\restriction");te(pe,Ne,yt,"‘","`");te(pe,Ne,yt,"$","\\$");te(sn,Ne,yt,"$","\\$");te(sn,Ne,yt,"$","\\textdollar");te(pe,Ne,yt,"%","\\%");te(sn,Ne,yt,"%","\\%");te(pe,Ne,yt,"_","\\_");te(sn,Ne,yt,"_","\\_");te(sn,Ne,yt,"_","\\textunderscore");te(pe,Ne,yt,"∠","\\angle",!0);te(pe,Ne,yt,"∞","\\infty",!0);te(pe,Ne,yt,"′","\\prime");te(pe,Ne,yt,"△","\\triangle");te(pe,Ne,yt,"Γ","\\Gamma",!0);te(pe,Ne,yt,"Δ","\\Delta",!0);te(pe,Ne,yt,"Θ","\\Theta",!0);te(pe,Ne,yt,"Λ","\\Lambda",!0);te(pe,Ne,yt,"Ξ","\\Xi",!0);te(pe,Ne,yt,"Π","\\Pi",!0);te(pe,Ne,yt,"Σ","\\Sigma",!0);te(pe,Ne,yt,"Υ","\\Upsilon",!0);te(pe,Ne,yt,"Φ","\\Phi",!0);te(pe,Ne,yt,"Ψ","\\Psi",!0);te(pe,Ne,yt,"Ω","\\Omega",!0);te(pe,Ne,yt,"A","Α");te(pe,Ne,yt,"B","Β");te(pe,Ne,yt,"E","Ε");te(pe,Ne,yt,"Z","Ζ");te(pe,Ne,yt,"H","Η");te(pe,Ne,yt,"I","Ι");te(pe,Ne,yt,"K","Κ");te(pe,Ne,yt,"M","Μ");te(pe,Ne,yt,"N","Ν");te(pe,Ne,yt,"O","Ο");te(pe,Ne,yt,"P","Ρ");te(pe,Ne,yt,"T","Τ");te(pe,Ne,yt,"X","Χ");te(pe,Ne,yt,"¬","\\neg",!0);te(pe,Ne,yt,"¬","\\lnot");te(pe,Ne,yt,"⊤","\\top");te(pe,Ne,yt,"⊥","\\bot");te(pe,Ne,yt,"∅","\\emptyset");te(pe,rt,yt,"∅","\\varnothing");te(pe,Ne,ir,"α","\\alpha",!0);te(pe,Ne,ir,"β","\\beta",!0);te(pe,Ne,ir,"γ","\\gamma",!0);te(pe,Ne,ir,"δ","\\delta",!0);te(pe,Ne,ir,"ϵ","\\epsilon",!0);te(pe,Ne,ir,"ζ","\\zeta",!0);te(pe,Ne,ir,"η","\\eta",!0);te(pe,Ne,ir,"θ","\\theta",!0);te(pe,Ne,ir,"ι","\\iota",!0);te(pe,Ne,ir,"κ","\\kappa",!0);te(pe,Ne,ir,"λ","\\lambda",!0);te(pe,Ne,ir,"μ","\\mu",!0);te(pe,Ne,ir,"ν","\\nu",!0);te(pe,Ne,ir,"ξ","\\xi",!0);te(pe,Ne,ir,"ο","\\omicron",!0);te(pe,Ne,ir,"π","\\pi",!0);te(pe,Ne,ir,"ρ","\\rho",!0);te(pe,Ne,ir,"σ","\\sigma",!0);te(pe,Ne,ir,"τ","\\tau",!0);te(pe,Ne,ir,"υ","\\upsilon",!0);te(pe,Ne,ir,"ϕ","\\phi",!0);te(pe,Ne,ir,"χ","\\chi",!0);te(pe,Ne,ir,"ψ","\\psi",!0);te(pe,Ne,ir,"ω","\\omega",!0);te(pe,Ne,ir,"ε","\\varepsilon",!0);te(pe,Ne,ir,"ϑ","\\vartheta",!0);te(pe,Ne,ir,"ϖ","\\varpi",!0);te(pe,Ne,ir,"ϱ","\\varrho",!0);te(pe,Ne,ir,"ς","\\varsigma",!0);te(pe,Ne,ir,"φ","\\varphi",!0);te(pe,Ne,In,"∗","*",!0);te(pe,Ne,In,"+","+");te(pe,Ne,In,"−","-",!0);te(pe,Ne,In,"⋅","\\cdot",!0);te(pe,Ne,In,"∘","\\circ",!0);te(pe,Ne,In,"÷","\\div",!0);te(pe,Ne,In,"±","\\pm",!0);te(pe,Ne,In,"×","\\times",!0);te(pe,Ne,In,"∩","\\cap",!0);te(pe,Ne,In,"∪","\\cup",!0);te(pe,Ne,In,"∖","\\setminus",!0);te(pe,Ne,In,"∧","\\land");te(pe,Ne,In,"∨","\\lor");te(pe,Ne,In,"∧","\\wedge",!0);te(pe,Ne,In,"∨","\\vee",!0);te(pe,Ne,yt,"√","\\surd");te(pe,Ne,Mu,"⟨","\\langle",!0);te(pe,Ne,Mu,"∣","\\lvert");te(pe,Ne,Mu,"∥","\\lVert");te(pe,Ne,Jl,"?","?");te(pe,Ne,Jl,"!","!");te(pe,Ne,Jl,"⟩","\\rangle",!0);te(pe,Ne,Jl,"∣","\\rvert");te(pe,Ne,Jl,"∥","\\rVert");te(pe,Ne,st,"=","=");te(pe,Ne,st,":",":");te(pe,Ne,st,"≈","\\approx",!0);te(pe,Ne,st,"≅","\\cong",!0);te(pe,Ne,st,"≥","\\ge");te(pe,Ne,st,"≥","\\geq",!0);te(pe,Ne,st,"←","\\gets");te(pe,Ne,st,">","\\gt",!0);te(pe,Ne,st,"∈","\\in",!0);te(pe,Ne,st,"","\\@not");te(pe,Ne,st,"⊂","\\subset",!0);te(pe,Ne,st,"⊃","\\supset",!0);te(pe,Ne,st,"⊆","\\subseteq",!0);te(pe,Ne,st,"⊇","\\supseteq",!0);te(pe,rt,st,"⊈","\\nsubseteq",!0);te(pe,rt,st,"⊉","\\nsupseteq",!0);te(pe,Ne,st,"⊨","\\models");te(pe,Ne,st,"←","\\leftarrow",!0);te(pe,Ne,st,"≤","\\le");te(pe,Ne,st,"≤","\\leq",!0);te(pe,Ne,st,"<","\\lt",!0);te(pe,Ne,st,"→","\\rightarrow",!0);te(pe,Ne,st,"→","\\to");te(pe,rt,st,"≱","\\ngeq",!0);te(pe,rt,st,"≰","\\nleq",!0);te(pe,Ne,Dp," ","\\ ");te(pe,Ne,Dp," ","\\space");te(pe,Ne,Dp," ","\\nobreakspace");te(sn,Ne,Dp," ","\\ ");te(sn,Ne,Dp," "," ");te(sn,Ne,Dp," ","\\space");te(sn,Ne,Dp," ","\\nobreakspace");te(pe,Ne,Dp,null,"\\nobreak");te(pe,Ne,Dp,null,"\\allowbreak");te(pe,Ne,SC,",",",");te(pe,Ne,SC,";",";");te(pe,rt,In,"⊼","\\barwedge",!0);te(pe,rt,In,"⊻","\\veebar",!0);te(pe,Ne,In,"⊙","\\odot",!0);te(pe,Ne,In,"⊕","\\oplus",!0);te(pe,Ne,In,"⊗","\\otimes",!0);te(pe,Ne,yt,"∂","\\partial",!0);te(pe,Ne,In,"⊘","\\oslash",!0);te(pe,rt,In,"⊚","\\circledcirc",!0);te(pe,rt,In,"⊡","\\boxdot",!0);te(pe,Ne,In,"△","\\bigtriangleup");te(pe,Ne,In,"▽","\\bigtriangledown");te(pe,Ne,In,"†","\\dagger");te(pe,Ne,In,"⋄","\\diamond");te(pe,Ne,In,"⋆","\\star");te(pe,Ne,In,"◃","\\triangleleft");te(pe,Ne,In,"▹","\\triangleright");te(pe,Ne,Mu,"{","\\{");te(sn,Ne,yt,"{","\\{");te(sn,Ne,yt,"{","\\textbraceleft");te(pe,Ne,Jl,"}","\\}");te(sn,Ne,yt,"}","\\}");te(sn,Ne,yt,"}","\\textbraceright");te(pe,Ne,Mu,"{","\\lbrace");te(pe,Ne,Jl,"}","\\rbrace");te(pe,Ne,Mu,"[","\\lbrack",!0);te(sn,Ne,yt,"[","\\lbrack",!0);te(pe,Ne,Jl,"]","\\rbrack",!0);te(sn,Ne,yt,"]","\\rbrack",!0);te(pe,Ne,Mu,"(","\\lparen",!0);te(pe,Ne,Jl,")","\\rparen",!0);te(sn,Ne,yt,"<","\\textless",!0);te(sn,Ne,yt,">","\\textgreater",!0);te(pe,Ne,Mu,"⌊","\\lfloor",!0);te(pe,Ne,Jl,"⌋","\\rfloor",!0);te(pe,Ne,Mu,"⌈","\\lceil",!0);te(pe,Ne,Jl,"⌉","\\rceil",!0);te(pe,Ne,yt,"\\","\\backslash");te(pe,Ne,yt,"∣","|");te(pe,Ne,yt,"∣","\\vert");te(sn,Ne,yt,"|","\\textbar",!0);te(pe,Ne,yt,"∥","\\|");te(pe,Ne,yt,"∥","\\Vert");te(sn,Ne,yt,"∥","\\textbardbl");te(sn,Ne,yt,"~","\\textasciitilde");te(sn,Ne,yt,"\\","\\textbackslash");te(sn,Ne,yt,"^","\\textasciicircum");te(pe,Ne,st,"↑","\\uparrow",!0);te(pe,Ne,st,"⇑","\\Uparrow",!0);te(pe,Ne,st,"↓","\\downarrow",!0);te(pe,Ne,st,"⇓","\\Downarrow",!0);te(pe,Ne,st,"↕","\\updownarrow",!0);te(pe,Ne,st,"⇕","\\Updownarrow",!0);te(pe,Ne,ea,"∐","\\coprod");te(pe,Ne,ea,"⋁","\\bigvee");te(pe,Ne,ea,"⋀","\\bigwedge");te(pe,Ne,ea,"⨄","\\biguplus");te(pe,Ne,ea,"⋂","\\bigcap");te(pe,Ne,ea,"⋃","\\bigcup");te(pe,Ne,ea,"∫","\\int");te(pe,Ne,ea,"∫","\\intop");te(pe,Ne,ea,"∬","\\iint");te(pe,Ne,ea,"∭","\\iiint");te(pe,Ne,ea,"∏","\\prod");te(pe,Ne,ea,"∑","\\sum");te(pe,Ne,ea,"⨂","\\bigotimes");te(pe,Ne,ea,"⨁","\\bigoplus");te(pe,Ne,ea,"⨀","\\bigodot");te(pe,Ne,ea,"∮","\\oint");te(pe,Ne,ea,"∯","\\oiint");te(pe,Ne,ea,"∰","\\oiiint");te(pe,Ne,ea,"⨆","\\bigsqcup");te(pe,Ne,ea,"∫","\\smallint");te(sn,Ne,Qy,"…","\\textellipsis");te(pe,Ne,Qy,"…","\\mathellipsis");te(sn,Ne,Qy,"…","\\ldots",!0);te(pe,Ne,Qy,"…","\\ldots",!0);te(pe,Ne,Qy,"⋯","\\@cdots",!0);te(pe,Ne,Qy,"⋱","\\ddots",!0);te(pe,Ne,yt,"⋮","\\varvdots");te(sn,Ne,yt,"⋮","\\varvdots");te(pe,Ne,Xs,"ˊ","\\acute");te(pe,Ne,Xs,"ˋ","\\grave");te(pe,Ne,Xs,"¨","\\ddot");te(pe,Ne,Xs,"~","\\tilde");te(pe,Ne,Xs,"ˉ","\\bar");te(pe,Ne,Xs,"˘","\\breve");te(pe,Ne,Xs,"ˇ","\\check");te(pe,Ne,Xs,"^","\\hat");te(pe,Ne,Xs,"⃗","\\vec");te(pe,Ne,Xs,"˙","\\dot");te(pe,Ne,Xs,"˚","\\mathring");te(pe,Ne,ir,"","\\@imath");te(pe,Ne,ir,"","\\@jmath");te(pe,Ne,yt,"ı","ı");te(pe,Ne,yt,"ȷ","ȷ");te(sn,Ne,yt,"ı","\\i",!0);te(sn,Ne,yt,"ȷ","\\j",!0);te(sn,Ne,yt,"ß","\\ss",!0);te(sn,Ne,yt,"æ","\\ae",!0);te(sn,Ne,yt,"œ","\\oe",!0);te(sn,Ne,yt,"ø","\\o",!0);te(sn,Ne,yt,"Æ","\\AE",!0);te(sn,Ne,yt,"Œ","\\OE",!0);te(sn,Ne,yt,"Ø","\\O",!0);te(sn,Ne,Xs,"ˊ","\\'");te(sn,Ne,Xs,"ˋ","\\`");te(sn,Ne,Xs,"ˆ","\\^");te(sn,Ne,Xs,"˜","\\~");te(sn,Ne,Xs,"ˉ","\\=");te(sn,Ne,Xs,"˘","\\u");te(sn,Ne,Xs,"˙","\\.");te(sn,Ne,Xs,"¸","\\c");te(sn,Ne,Xs,"˚","\\r");te(sn,Ne,Xs,"ˇ","\\v");te(sn,Ne,Xs,"¨",'\\"');te(sn,Ne,Xs,"˝","\\H");te(sn,Ne,Xs,"◯","\\textcircled");var qq={"--":!0,"---":!0,"``":!0,"''":!0};te(sn,Ne,yt,"–","--",!0);te(sn,Ne,yt,"–","\\textendash");te(sn,Ne,yt,"—","---",!0);te(sn,Ne,yt,"—","\\textemdash");te(sn,Ne,yt,"‘","`",!0);te(sn,Ne,yt,"‘","\\textquoteleft");te(sn,Ne,yt,"’","'",!0);te(sn,Ne,yt,"’","\\textquoteright");te(sn,Ne,yt,"“","``",!0);te(sn,Ne,yt,"“","\\textquotedblleft");te(sn,Ne,yt,"”","''",!0);te(sn,Ne,yt,"”","\\textquotedblright");te(pe,Ne,yt,"°","\\degree",!0);te(sn,Ne,yt,"°","\\degree");te(sn,Ne,yt,"°","\\textdegree",!0);te(pe,Ne,yt,"£","\\pounds");te(pe,Ne,yt,"£","\\mathsterling",!0);te(sn,Ne,yt,"£","\\pounds");te(sn,Ne,yt,"£","\\textsterling",!0);te(pe,rt,yt,"✠","\\maltese");te(sn,rt,yt,"✠","\\maltese");var VL='0123456789/@."';for(var o6=0;o6<VL.length;o6++){var GL=VL.charAt(o6);te(pe,Ne,yt,GL,GL)}var WL='0123456789!@*()-=+";:?/.,';for(var a6=0;a6<WL.length;a6++){var $L=WL.charAt(a6);te(sn,Ne,yt,$L,$L)}var o5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var l6=0;l6<o5.length;l6++){var B4=o5.charAt(l6);te(pe,Ne,ir,B4,B4),te(sn,Ne,yt,B4,B4)}te(pe,rt,yt,"C","ℂ");te(sn,rt,yt,"C","ℂ");te(pe,rt,yt,"H","ℍ");te(sn,rt,yt,"H","ℍ");te(pe,rt,yt,"N","ℕ");te(sn,rt,yt,"N","ℕ");te(pe,rt,yt,"P","ℙ");te(sn,rt,yt,"P","ℙ");te(pe,rt,yt,"Q","ℚ");te(sn,rt,yt,"Q","ℚ");te(pe,rt,yt,"R","ℝ");te(sn,rt,yt,"R","ℝ");te(pe,rt,yt,"Z","ℤ");te(sn,rt,yt,"Z","ℤ");te(pe,Ne,ir,"h","ℎ");te(sn,Ne,ir,"h","ℎ");var gr="";for(var zl=0;zl<o5.length;zl++){var bo=o5.charAt(zl);gr=String.fromCharCode(55349,56320+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56372+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56424+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56580+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56684+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56736+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56788+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56840+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56944+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),zl<26&&(gr=String.fromCharCode(55349,56632+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr),gr=String.fromCharCode(55349,56476+zl),te(pe,Ne,ir,bo,gr),te(sn,Ne,yt,bo,gr))}gr="𝕜";te(pe,Ne,ir,"k",gr);te(sn,Ne,yt,"k",gr);for(var Ag=0;Ag<10;Ag++){var Tm=Ag.toString();gr=String.fromCharCode(55349,57294+Ag),te(pe,Ne,ir,Tm,gr),te(sn,Ne,yt,Tm,gr),gr=String.fromCharCode(55349,57314+Ag),te(pe,Ne,ir,Tm,gr),te(sn,Ne,yt,Tm,gr),gr=String.fromCharCode(55349,57324+Ag),te(pe,Ne,ir,Tm,gr),te(sn,Ne,yt,Tm,gr),gr=String.fromCharCode(55349,57334+Ag),te(pe,Ne,ir,Tm,gr),te(sn,Ne,yt,Tm,gr)}var oR="ÐÞþ";for(var c6=0;c6<oR.length;c6++){var H4=oR.charAt(c6);te(pe,Ne,ir,H4,H4),te(sn,Ne,yt,H4,H4)}var V4=[["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"]],qL=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],ebe=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[V4[a][2],V4[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[qL[l][2],qL[l][o]]}else{if(s===120485||s===120486)return[V4[0][2],V4[0][o]];if(120486<s&&s<120782)return["",""];throw new pn("Unsupported character: "+e)}},wC=function(e,n,r){return xs[r][e]&&xs[r][e].replace&&(e=xs[r][e].replace),{value:e,metrics:Z8(e,n,r)}},Gl=function(e,n,r,i,s){var o=wC(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 hd(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 hd(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var f=i.getColor();f&&(l.style.color=f)}return l},J8=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&wC(e,"Main-Bold",n).metrics?Gl(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||xs[n][e].font==="main"?Gl(e,"Main-Regular",n,r,i):Gl(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},tbe=function(e,n,r,i,s){return s!=="textord"&&wC(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},MC=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="",f="";if(s.charCodeAt(0)===55349&&([c,f]=ebe(s,i)),c.length>0)return Gl(s,c,i,n,o.concat(f));if(l){var p,m;if(l==="boldsymbol"){var x=tbe(s,i,n,o,r);p=x.fontName,m=[x.fontClass]}else a?(p=aR[l].fontName,m=[l]):(p=G4(l,n.fontWeight,n.fontShape),m=[l,n.fontWeight,n.fontShape]);if(wC(s,p,i).metrics)return Gl(s,p,i,n,o.concat(m));if(qq.hasOwnProperty(s)&&p.slice(0,10)==="Typewriter"){for(var b=[],_=0;_<s.length;_++)b.push(Gl(s[_],p,i,n,o.concat(m)));return Pp(b)}}if(r==="mathord")return Gl(s,"Math-Italic",i,n,o.concat(["mathnormal"]));if(r==="textord"){var S=xs[i][s]&&xs[i][s].font;if(S==="ams"){var M=G4("amsrm",n.fontWeight,n.fontShape);return Gl(s,M,i,n,o.concat("amsrm",n.fontWeight,n.fontShape))}else if(S==="main"||!S){var C=G4("textrm",n.fontWeight,n.fontShape);return Gl(s,C,i,n,o.concat(n.fontWeight,n.fontShape))}else{var A=G4(S,n.fontWeight,n.fontShape);return Gl(s,A,i,n,o.concat(A,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},nbe=(t,e)=>{if(m0(t.classes)!==m0(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},Xq=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof hd&&r instanceof hd&&nbe(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},eD=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 Uw(e,n,r,i);return eD(s),s},x0=(t,e,n,r)=>new Uw(t,e,n,r),My=function(e,n,r){var i=an([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=_n(i.height),i.maxFontSize=1,i},rbe=function(e,n,r,i){var s=new Q8(e,n,r,i);return eD(s),s},Pp=function(e){var n=new Fw(e);return eD(n),n},Ty=function(e,n){return e instanceof Fw?an([],[e],n):e},ibe=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 f=e.positionData,p=0;p<e.children.length;p++){var m=e.children[p];f-=m.type==="kern"?m.size:m.elem.height+m.elem.depth}c=f}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}},Ei=function(e,n){for(var{children:r,depth:i}=ibe(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=_n(s);for(var f=[],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=_n(-s-x-S.depth),_.marginLeft&&(A.style.marginLeft=_.marginLeft),_.marginRight&&(A.style.marginRight=_.marginRight),f.push(A),x+=S.height+S.depth}p=Math.min(p,x),m=Math.max(m,x)}var N=an(["vlist"],f);N.style.height=_n(m);var P;if(p<0){var k=an([],[]),O=an(["vlist"],[k]);O.style.height=_n(-p);var R=an(["vlist-s"],[new hd("​")]);P=[an(["vlist-r"],[N,R]),an(["vlist-r"],[O])]}else P=[an(["vlist-r"],[N])];var L=an(["vlist-t"],P);return P.length===2&&L.classes.push("vlist-t2"),L.height=m,L.depth=-p,L},Yq=(t,e)=>{var n=an(["mspace"],[],e),r=oo(t,e);return n.style.marginRight=_n(r),n},G4=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},aR={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"}},Kq={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Zq=function(e,n){var[r,i,s]=Kq[e],o=new g0(r),a=new Mp([o],{width:_n(i),height:_n(s),style:"width:"+_n(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=x0(["overlay"],[a],n);return l.height=s,l.style.height=_n(s),l.style.width=_n(i),l},io={number:3,unit:"mu"},Ng={number:4,unit:"mu"},Jh={number:5,unit:"mu"},sbe={mord:{mop:io,mbin:Ng,mrel:Jh,minner:io},mop:{mord:io,mop:io,mrel:Jh,minner:io},mbin:{mord:Ng,mop:Ng,mopen:Ng,minner:Ng},mrel:{mord:Jh,mop:Jh,mopen:Jh,minner:Jh},mopen:{},mclose:{mop:io,mbin:Ng,mrel:Jh,minner:io},mpunct:{mord:io,mop:io,mrel:Jh,mopen:io,mclose:io,mpunct:io,minner:io},minner:{mord:io,mop:io,mbin:Ng,mrel:Jh,mopen:io,mpunct:io,minner:io}},obe={mord:{mop:io},mop:{mord:io,mop:io},mbin:{},mrel:{},mopen:{},mclose:{mop:io},mpunct:{},minner:{mop:io}},Qq={},a5={},l5={};function Dn(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&&(a5[e]=s),o&&(l5[e]=o))}function Ux(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;Dn({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var c5=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Io=function(e){return e.type==="ordgroup"?e.body:[e]},abe=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),lbe=new Set(["rightmost","mrel","mclose","mpunct"]),cbe={display:_r.DISPLAY,text:_r.TEXT,script:_r.SCRIPT,scriptscript:_r.SCRIPTSCRIPT},ube={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 Fw){var l=a.children;s.push(...l)}else s.push(a)}if(Xq(s),!r)return s;var c=n;if(e.length===1){var f=e[0];f.type==="sizing"?c=n.havingSize(f.size):f.type==="styling"&&(c=n.havingStyle(cbe[f.style]))}var p=an([i[0]||"leftmost"],[],n),m=an([i[1]||"rightmost"],[],n),x=r==="root";return XL(s,(b,_)=>{var S=_.classes[0],M=b.classes[0];S==="mbin"&&lbe.has(M)?_.classes[0]="mord":M==="mbin"&&abe.has(S)&&(b.classes[0]="mord")},{node:p},m,x),XL(s,(b,_)=>{var S=lR(_),M=lR(b),C=S&&M?b.hasClass("mtight")?obe[S][M]:sbe[S][M]:null;if(C)return Yq(C,c)},{node:p},m,x),s},XL=function t(e,n,r,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=Jq(a);if(l){t(l.children,n,r,null,s);continue}var c=!a.hasClass("mspace");if(c){var f=n(a,r.node);f&&(r.insertAfter?r.insertAfter(f):(e.unshift(f),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()},Jq=function(e){return e instanceof Fw||e instanceof Q8||e instanceof Uw&&e.hasClass("enclosing")?e:null},dbe=function t(e,n){var r=Jq(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},lR=function(e,n){return e?(n&&(e=dbe(e,n)),ube[e.classes[0]]||null):null},FS=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return an(n.concat(r))},bi=function(e,n,r){if(!e)return an();if(a5[e.type]){var i=a5[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 pn("Got group of unknown type: '"+e.type+"'")};function W4(t,e){var n=an(["base"],t,e),r=an(["strut"]);return r.style.height=_n(n.height+n.depth),n.depth&&(r.style.verticalAlign=_n(-n.depth)),n.children.unshift(r),n}function cR(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(W4(o,e)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(W4(o,e)),o=[]),s.push(r[a]));o.length>0&&s.push(W4(o,e));var c;n?(c=W4(pa(n,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var f=an(["katex-html"],s);if(f.setAttribute("aria-hidden","true"),c){var p=c.children[0];p.style.height=_n(f.height+f.depth),f.depth&&(p.style.verticalAlign=_n(-f.depth))}return f}function eX(t){return new Fw(t)}class mn{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=m0(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Qo&&this.children[r+1]instanceof Qo){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Qo;)i+=this.children[++r].toText();e.appendChild(new Qo(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(m0(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 Qo{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 tX{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",_n(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+_n(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var fbe=new Set(["\\imath","\\jmath"]),hbe=new Set(["mrow","mtable"]),pd=function(e,n,r){return xs[n][e]&&xs[n][e].replace&&e.charCodeAt(0)!==55349&&!(qq.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=xs[n][e].replace),new Qo(e)},tD=function(e){return e.length===1?e[0]:new mn("mrow",e)},nD=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(fbe.has(s))return null;xs[i][s]&&xs[i][s].replace&&(s=xs[i][s].replace);var o=aR[r].fontName;return Z8(s,o,i)?aR[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 Qo&&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 Qo&&n.text===","}else return!1}var Bc=function(e,n,r){if(e.length===1){var i=os(e[0],n);return r&&i instanceof mn&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=os(e[a],n);if(l instanceof mn&&o instanceof mn){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 mn&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var f=o.children[0];if(f instanceof Qo&&f.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var p=l.children[0];p instanceof Qo&&p.text.length>0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),s.pop())}}}s.push(l),o=l}return s},v0=function(e,n,r){return tD(Bc(e,n,r))},os=function(e,n){if(!e)return new mn("mrow");if(l5[e.type]){var r=l5[e.type](e,n);return r}else throw new pn("Got group of unknown type: '"+e.type+"'")};function YL(t,e,n,r,i){var s=Bc(t,n),o;s.length===1&&s[0]instanceof mn&&hbe.has(s[0].type)?o=s[0]:o=new mn("mrow",s);var a=new mn("annotation",[new Qo(e)]);a.setAttribute("encoding","application/x-tex");var l=new mn("semantics",[o,a]),c=new mn("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var f=i?"katex":"katex-mathml";return an([f],[c])}var nX=function(e){return new lp({style:e.displayMode?_r.DISPLAY:_r.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},rX=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},pbe=function(e,n,r){var i=nX(r),s;if(r.output==="mathml")return YL(e,n,i,r.displayMode,!0);if(r.output==="html"){var o=cR(e,i);s=an(["katex"],[o])}else{var a=YL(e,n,i,r.displayMode,!1),l=cR(e,i);s=an(["katex"],[a,l])}return rX(s,r)},mbe=function(e,n,r){var i=nX(r),s=cR(e,i),o=an(["katex"],[s]);return rX(o,r)},gbe={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":"="},TC=function(e){var n=new mn("mo",[new Qo(gbe[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},xbe={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]},vbe=new Set(["widehat","widecheck","widetilde","utilde"]),CC=function(e,n){function r(){var a=4e5,l=e.label.slice(1);if(vbe.has(l)){var c=e,f=c.base.type==="ordgroup"?c.base.body.length:1,p,m,x;if(f>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][f];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 g0(m),S=new Mp([_],{width:"100%",height:_n(x),viewBox:"0 0 "+a+" "+p,preserveAspectRatio:"none"});return{span:x0([],[S],n),minWidth:0,height:x}}else{var M=[],C=xbe[l],[A,N,P]=C,k=P/1e3,O=A.length,R,L;if(O===1){var B=C[3];R=["hide-tail"],L=[B]}else if(O===2)R=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(O===3)R=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+O+" children.");for(var V=0;V<O;V++){var W=new g0(A[V]),G=new Mp([W],{width:"400em",height:_n(k),viewBox:"0 0 "+a+" "+P,preserveAspectRatio:L[V]+" slice"}),ee=x0([R[V]],[G],n);if(O===1)return{span:ee,minWidth:N,height:k};ee.style.height=_n(k),M.push(ee)}return{span:an(["stretchy"],M,n),minWidth:N,height:k}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=_n(o),s>0&&(i.style.minWidth=_n(s)),i},ybe=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 sR({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new sR({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var f=new Mp(c,{width:"100%",height:_n(a)});o=x0([],[f],s)}return o.height=a,o.style.height=_n(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 rD(t){var e=EC(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function EC(t){return t&&(t.type==="atom"||Jye.hasOwnProperty(t.type))?t:null}var iD=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=Ur(t.base,"accent"),n=r.base,t.base=n,i=Zye(bi(t,e)),t.base=r):(r=Ur(t,"accent"),n=r.base);var s=bi(n,e.havingCrampedStyle()),o=r.isShifty&&Rp(n),a=0;if(o){var l=sS(n),c=bi(l,e.havingCrampedStyle());a=HL(c).skew}var f=r.label==="\\c",p=f?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),m;if(r.isStretchy)m=CC(r,e),m=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+_n(2*a)+")",marginLeft:_n(2*a)}:void 0}]});else{var x,b;r.label==="\\vec"?(x=Zq("vec",e),b=Kq.vec[1]):(x=MC({mode:r.mode,text:r.label},e,"textord"),x=HL(x),x.italic=0,b=x.width,f&&(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=_n(S),r.label==="\\textcircled"&&(m.style.top=".2em"),m=Ei({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},iX=(t,e)=>{var n=t.isStretchy?TC(t.label):new mn("mo",[pd(t.label,t.mode)]),r=new mn("mover",[os(t.base,e),n]);return r.setAttribute("accent","true"),r},bbe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Dn({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=c5(e[0]),r=!bbe.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:iD,mathmlBuilder:iX});Dn({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:iD,mathmlBuilder:iX});Dn({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=CC(t,e),i=t.label==="\\utilde"?.12:0,s=Ei({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=TC(t.label),r=new mn("munder",[os(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var $4=t=>{var e=new mn("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Dn({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=Ty(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=Ty(bi(t.below,r,e),e),o.classes.push(s+"-arrow-pad"));var a=CC(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 f;if(o){var p=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;f=Ei({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:p}]})}else f=Ei({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l}]});return f.children[0].children[0].children[1].classes.push("svg-align"),an(["mrel","x-arrow"],[f],e)},mathmlBuilder(t,e){var n=TC(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var i=$4(os(t.body,e));if(t.below){var s=$4(os(t.below,e));r=new mn("munderover",[n,s,i])}else r=new mn("mover",[n,i])}else if(t.below){var o=$4(os(t.below,e));r=new mn("munder",[n,o])}else r=$4(),r=new mn("mover",[n,r]);return r}});function sX(t,e){var n=pa(t.body,e,!0);return an([t.mclass],n,e)}function oX(t,e){var n,r=Bc(t.body,e);return t.mclass==="minner"?n=new mn("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new mn("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new mn("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}Dn({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:Io(i),isCharacterBox:Rp(i)}},htmlBuilder:sX,mathmlBuilder:oX});var AC=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"};Dn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:AC(e[0]),body:Io(e[1]),isCharacterBox:Rp(e[1])}}});Dn({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=AC(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Io(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:Rp(l)}},htmlBuilder:sX,mathmlBuilder:oX});Dn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:AC(e[0]),body:Io(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=Bc(t.body,e),r=new mn("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var _be={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},KL=()=>({type:"styling",body:[],mode:"math",style:"display"}),ZL=t=>t.type==="textord"&&t.text==="@",Sbe=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function wbe(t,e,n){var r=_be[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 Mbe(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 pn("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var o=e[s],a=KL(),l=0;l<o.length;l++)if(!ZL(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=rD(o[l]).text,f=new Array(2);if(f[0]={type:"ordgroup",mode:"math",body:[]},f[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(Sbe(o[x],c)){m=!1,l=x;break}if(ZL(o[x]))throw new pn("Missing a "+c+" character to complete a CD arrow.",o[x]);f[p].body.push(o[x])}if(m)throw new pn("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new pn('Expected one of "<>AV=|." after @',o[l]);var b=wbe(c,f,t),_={type:"styling",body:[b],mode:"math",style:"display"};r.push(_),a=KL()}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([])}}Dn({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=Ty(bi(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=_n(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new mn("mrow",[os(t.label,e)]);return n=new mn("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new mn("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Dn({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=Ty(bi(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new mn("mrow",[os(t.fragment,e)])}});Dn({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 pn("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new pn("\\@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 aX=(t,e)=>{var n=pa(t.body,e.withColor(t.color),!1);return Pp(n)},lX=(t,e)=>{var n=Bc(t.body,e.withColor(t.color)),r=new mn("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Dn({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:Io(i)}},htmlBuilder:aX,mathmlBuilder:lX});Dn({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:aX,mathmlBuilder:lX});Dn({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=_n(oo(t.size,e)))),n},mathmlBuilder(t,e){var n=new mn("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",_n(oo(t.size,e)))),n}});var uR={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},cX=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new pn("Expected a control sequence",t);return e},Tbe=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},uX=(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)};Dn({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(uR[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=uR[r.text]),Ur(e.parseFunction(),"internal");throw new pn("Invalid token after macro prefix",r)}});Dn({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 pn("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 pn('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new pn('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if(r.text==="EOF")throw new pn("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===uR[n]),{type:"internal",mode:e.mode}}});Dn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=cX(e.gullet.popToken());e.gullet.consumeSpaces();var i=Tbe(e);return uX(e,r,i,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Dn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=cX(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return uX(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var G_=function(e,n,r){var i=xs.math[e]&&xs.math[e].replace,s=Z8(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},sD=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},dX=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=_n(s),e.height-=s,e.depth+=s},Cbe=function(e,n,r,i,s,o){var a=Gl(e,"Main-Regular",s,i),l=sD(a,n,i,o);return dX(l,i,n),l},Ebe=function(e,n,r,i){return Gl(e,"Size"+n+"-Regular",r,i)},fX=function(e,n,r,i,s,o){var a=Ebe(e,n,s,i),l=sD(an(["delimsizing","size"+n],[a],i),_r.TEXT,i,o);return r&&dX(l,i,_r.TEXT),l},d6=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=an(["delimsizinginner",i],[an([],[Gl(e,n,r)])]);return{type:"elem",elem:s}},f6=function(e,n,r){var i=ih["Size4-Regular"][e.charCodeAt(0)]?ih["Size4-Regular"][e.charCodeAt(0)][4]:ih["Size1-Regular"][e.charCodeAt(0)][4],s=new g0("inner",Hye(e,Math.round(1e3*n))),o=new Mp([s],{width:_n(i),height:_n(n),style:"width:"+_n(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=x0([],[o],r);return a.height=n,a.style.height=_n(n),a.style.width=_n(i),{type:"elem",elem:a}},dR=.008,q4={type:"kern",size:-1*dR},Abe=new Set(["|","\\lvert","\\rvert","\\vert"]),Nbe=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),hX=function(e,n,r,i,s,o){var a,l,c,f,p="",m=0;a=c=f=e,l=null;var x="Size1-Regular";e==="\\uparrow"?c=f="⏐":e==="\\Uparrow"?c=f="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",f="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",f="\\Downarrow"):Abe.has(e)?(c="∣",p="vert",m=333):Nbe.has(e)?(c="∥",p="doublevert",m=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",f="⎣",x="Size4-Regular",p="lbrack",m=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",f="⎦",x="Size4-Regular",p="rbrack",m=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",f="⎣",x="Size4-Regular",p="lfloor",m=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=f="⎢",x="Size4-Regular",p="lceil",m=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",f="⎦",x="Size4-Regular",p="rfloor",m=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=f="⎥",x="Size4-Regular",p="rceil",m=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",f="⎝",x="Size4-Regular",p="lparen",m=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",f="⎠",x="Size4-Regular",p="rparen",m=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",f="⎩",c="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",f="⎭",c="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",f="⎩",c="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",f="⎭",c="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",f="⎭",c="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",f="⎩",c="⎪",x="Size4-Regular");var b=G_(a,x,s),_=b.height+b.depth,S=G_(c,x,s),M=S.height+S.depth,C=G_(f,x,s),A=C.height+C.depth,N=0,P=1;if(l!==null){var k=G_(l,x,s);N=k.height+k.depth,P=2}var O=_+A+N,R=Math.max(0,Math.ceil((n-O)/(P*M))),L=O+R*P*M,B=i.fontMetrics().axisHeight;r&&(B*=i.sizeMultiplier);var V=L/2-B,W=[];if(p.length>0){var G=L-_-A,ee=Math.round(L*1e3),H=Vye(p,Math.round(G*1e3)),q=new g0(p,H),J=(m/1e3).toFixed(3)+"em",K=(ee/1e3).toFixed(3)+"em",ne=new Mp([q],{width:J,height:K,viewBox:"0 0 "+m+" "+ee}),U=x0([],[ne],i);U.height=ee/1e3,U.style.width=J,U.style.height=K,W.push({type:"elem",elem:U})}else{if(W.push(d6(f,x,s)),W.push(q4),l===null){var z=L-_-A+2*dR;W.push(f6(c,z,i))}else{var Y=(L-_-A-N)/2+2*dR;W.push(f6(c,Y,i)),W.push(q4),W.push(d6(l,x,s)),W.push(q4),W.push(f6(c,Y,i))}W.push(q4),W.push(d6(a,x,s))}var j=i.havingBaseStyle(_r.TEXT),le=Ei({positionType:"bottom",positionData:V,children:W});return sD(an(["delimsizing","mult"],[le],j),_r.TEXT,i,o)},h6=80,p6=.08,m6=function(e,n,r,i,s){var o=Bye(e,i,r),a=new g0(e,o),l=new Mp([a],{width:"400em",height:_n(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return x0(["hide-tail"],[l],s)},kbe=function(e,n){var r=n.havingBaseSizing(),i=vX("\\surd",e*r.sizeMultiplier,xX,r),s=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l=0,c=0,f=0,p;return i.type==="small"?(f=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,f,o,n),a.style.minWidth="0.853em",p=.833/s):i.type==="large"?(f=(1e3+h6)*oS[i.size],c=(oS[i.size]+o)/s,l=(oS[i.size]+o+p6)/s,a=m6("sqrtSize"+i.size,l,f,o,n),a.style.minWidth="1.02em",p=1/s):(l=e+o+p6,c=e+o,f=Math.floor(1e3*e+o)+h6,a=m6("sqrtTall",l,f,o,n),a.style.minWidth="0.742em",p=1.056),a.height=c,a.style.height=_n(l),{span:a,advanceWidth:p,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*s}},pX=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),Rbe=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),mX=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),oS=[0,1.2,1.8,2.4,3],gX=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),pX.has(e)||mX.has(e))return fX(e,n,!1,r,i,s);if(Rbe.has(e))return hX(e,oS[n],!1,r,i,s);throw new pn("Illegal delimiter: '"+e+"'")},Dbe=[{type:"small",style:_r.SCRIPTSCRIPT},{type:"small",style:_r.SCRIPT},{type:"small",style:_r.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Pbe=[{type:"small",style:_r.SCRIPTSCRIPT},{type:"small",style:_r.SCRIPT},{type:"small",style:_r.TEXT},{type:"stack"}],xX=[{type:"small",style:_r.SCRIPTSCRIPT},{type:"small",style:_r.SCRIPT},{type:"small",style:_r.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Ibe=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.")},vX=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=G_(e,Ibe(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]},fR=function(e,n,r,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;mX.has(e)?a=Dbe:pX.has(e)?a=xX:a=Pbe;var l=vX(e,n,a,i);return l.type==="small"?Cbe(e,l.style,r,i,s,o):l.type==="large"?fX(e,l.size,r,i,s,o):hX(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,f=Math.max(n-a,r+a),p=Math.max(f/500*l,2*f-c);return fR(e,p,!0,i,s,o)},QL={"\\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}},Obe=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function NC(t,e){var n=EC(t);if(n&&Obe.has(n.text))return n;throw n?new pn("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new pn("Invalid delimiter type '"+t.type+"'",t)}Dn({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=NC(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:QL[t.funcName].size,mclass:QL[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?an([t.mclass]):gX(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(pd(t.delim,t.mode));var n=new mn("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=_n(oS[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function JL(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Dn({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 pn("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:NC(e[0],t).text,color:n}}});Dn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=NC(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=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)=>{JL(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=FS(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],f=c.isMiddle;f&&(n[l]=g6(f.delim,r,i,f.options,t.mode,[]))}var p;if(t.right===".")p=FS(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)=>{JL(t);var n=Bc(t.body,e);if(t.left!=="."){var r=new mn("mo",[pd(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new mn("mo",[pd(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return tD(n)}});Dn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=NC(e[0],t);if(!t.parser.leftrightDepth)throw new pn("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=FS(e,[]);else{n=gX(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==="|"?pd("|","text"):pd(t.delim,t.mode),r=new mn("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var oD=(t,e)=>{var n=Ty(bi(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,o=0,a=Rp(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=oo({number:.6,unit:"pt"},e),c=oo({number:.35,unit:"ex"},e),f=e.havingBaseSizing();i=i/f.sizeMultiplier;var p=n.height+n.depth+l+c;n.style.paddingLeft=_n(p/2+l);var m=Math.floor(1e3*p*i),x=Fye(m),b=new Mp([new g0("phase",x)],{width:"400em",height:_n(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});s=x0(["hide-tail"],[b],e),s.style.height=_n(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=ybe(n,r,_,S,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=_n(M)):r==="angl"&&M!==.049&&(s.style.borderTopWidth=_n(M),s.style.borderRightWidth=_n(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=Ei({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=Ei({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)},aD=(t,e)=>{var n=0,r=new mn(t.label.includes("colorbox")?"mpadded":"menclose",[os(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};Dn({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:oD,mathmlBuilder:aD});Dn({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:oD,mathmlBuilder:aD});Dn({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]}}});Dn({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:oD,mathmlBuilder:aD});Dn({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 yX={};function Sh(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)yX[n[l]]=a;s&&(a5[e]=s),o&&(l5[e]=o)}var bX={};function Fe(t,e){bX[t]=e}function ej(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 kC=t=>{var e=t.parser.settings;if(!e.displayMode)throw new pn("{"+t.envName+"} can be used only in display mode.")},Lbe=new Set(["gather","gather*"]);function lD(t){if(!t.includes("ed"))return!t.includes("*")}function F0(t,e,n){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:f,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 pn("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 pu("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):C.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),M.push(ej(t));;){var P=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),P={type:"ordgroup",mode:t.mode,body:P},n&&(P={type:"styling",mode:t.mode,style:n,body:[P]}),b.push(P);var k=t.fetch().text;if(k==="&"){if(p&&b.length===p){if(c||a)throw new pn("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(k==="\\end"){N(),b.length===1&&P.type==="styling"&&P.body[0].body.length===0&&(_.length>1||!f)&&_.pop(),M.length<_.length+1&&M.push([]);break}else if(k==="\\\\"){t.consume();var O=void 0;t.gullet.future().text!==" "&&(O=t.parseSizeGroup(!0)),S.push(O?O.value:null),N(),M.push(ej(t)),b=[],_.push(b),A()}else throw new pn("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 cD(t){return t.slice(0,1)==="d"?"display":"text"}var wh=function(e,n){var r,i,s=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(s),c=[],f=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(_r.SCRIPT).sizeMultiplier;m=.2778*(x/n.sizeMultiplier)}var b=e.colSeparationType==="CD"?oo({number:3,unit:"ex"},n):12*p,_=3*p,S=e.arraystretch*b,M=.7*S,C=.3*S,A=0;function N(He){for(var ze=0;ze<He.length;++ze)ze>0&&(A+=.25),c.push({pos:A,isDashed:He[ze]})}for(N(o[0]),r=0;r<e.body.length;++r){var P=e.body[r],k=M,O=C;a<P.length&&(a=P.length);var R=new Array(P.length);for(i=0;i<P.length;++i){var L=bi(P[i],n);O<L.depth&&(O=L.depth),k<L.height&&(k=L.height),R[i]=L}var B=e.rowGaps[r],V=0;B&&(V=oo(B,n),V>0&&(V+=C,O<V&&(O=V),V=0)),e.addJot&&(O+=_),R.height=k,R.depth=O,A+=k,R.pos=A,A+=O+V,l[r]=R,N(o[r+1])}var W=A/2+n.fontMetrics().axisHeight,G=e.cols||[],ee=[],H,q,J=[];if(e.tags&&e.tags.some(He=>He))for(r=0;r<s;++r){var K=l[r],ne=K.pos-W,U=e.tags[r],z=void 0;U===!0?z=an(["eqn-num"],[],n):U===!1?z=an([],[],n):z=an([],pa(U,n,!0),n),z.depth=K.depth,z.height=K.height,J.push({type:"elem",elem:z,shift:ne})}for(i=0,q=0;i<a||q<G.length;++i,++q){for(var Y=G[q]||{},j=!0;Y.type==="separator";){if(j||(H=an(["arraycolsep"],[]),H.style.width=_n(n.fontMetrics().doubleRuleSep),ee.push(H)),Y.separator==="|"||Y.separator===":"){var le=Y.separator==="|"?"solid":"dashed",ce=an(["vertical-separator"],[],n);ce.style.height=_n(A),ce.style.borderRightWidth=_n(f),ce.style.borderRightStyle=le,ce.style.margin="0 "+_n(-f/2);var X=A-W;X&&(ce.style.verticalAlign=_n(-X)),ee.push(ce)}else throw new pn("Invalid separator type: "+Y.separator);q++,Y=G[q]||{},j=!1}if(!(i>=a)){var ie=void 0;if(i>0||e.hskipBeforeAndAfter){var fe;ie=(fe=Y.pregap)!=null?fe:m,ie!==0&&(H=an(["arraycolsep"],[]),H.style.width=_n(ie),ee.push(H))}var Q=[];for(r=0;r<s;++r){var ue=l[r],he=ue[i];if(he){var se=ue.pos-W;he.depth=ue.depth,he.height=ue.height,Q.push({type:"elem",elem:he,shift:se})}}if(Q=Ei({positionType:"individualShift",children:Q}),Q=an(["col-align-"+(Y.align||"c")],[Q]),ee.push(Q),i<a-1||e.hskipBeforeAndAfter){var Ce;ie=(Ce=Y.postgap)!=null?Ce:m,ie!==0&&(H=an(["arraycolsep"],[]),H.style.width=_n(ie),ee.push(H))}}}if(l=an(["mtable"],ee),c.length>0){for(var de=My("hline",n,f),Me=My("hdashline",n,f),Te=[{type:"elem",elem:l,shift:0}];c.length>0;){var Pe=c.pop(),oe=Pe.pos-W;Pe.isDashed?Te.push({type:"elem",elem:Me,shift:oe}):Te.push({type:"elem",elem:de,shift:oe})}l=Ei({positionType:"individualShift",children:Te})}if(J.length===0)return an(["mord"],[l],n);var Ve=Ei({positionType:"individualShift",children:J});return Ve=an(["tag"],[Ve],n),Pp([l,Ve])},jbe={c:"center ",l:"left ",r:"right "},Mh=function(e,n){for(var r=[],i=new mn("mtd",[],["mtr-glue"]),s=new mn("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 mn("mtd",[os(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 mn("mtr",l))}var f=new mn("mtable",r),p=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);f.setAttribute("rowspacing",_n(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+=jbe[b[A].align],S&&(_+="none "),S=!0):b[A].type==="separator"&&S&&(_+=b[A].separator==="|"?"solid ":"dashed ",S=!1);f.setAttribute("columnalign",x.trim()),/[sd]/.test(_)&&f.setAttribute("columnlines",_.trim())}if(e.colSeparationType==="align"){for(var N=e.cols||[],P="",k=1;k<N.length;k++)P+=k%2?"0em ":"1em ";f.setAttribute("columnspacing",P.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?f.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?f.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?f.setAttribute("columnspacing","0.5em"):f.setAttribute("columnspacing","1em");var O="",R=e.hLinesBeforeRow;m+=R[0].length>0?"left ":"",m+=R[R.length-1].length>0?"right ":"";for(var L=1;L<R.length-1;L++)O+=R[L].length===0?"none ":R[L][0]?"dashed ":"solid ";return/[sd]/.test(O)&&f.setAttribute("rowlines",O.trim()),m!==""&&(f=new mn("menclose",[f]),f.setAttribute("notation",m.trim())),e.arraystretch&&e.arraystretch<1&&(f=new mn("mstyle",[f]),f.setAttribute("scriptlevel","1")),f},_X=function(e,n){e.envName.includes("ed")||kC(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",o=F0(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:lD(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 f="",p=0;p<n[0].body.length;p++){var m=Ur(n[0].body[p],"textord");f+=m.text}a=Number(f),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 P=M.length/2;if(a<P)throw new pn("Too many math in a row: "+("expected "+a+", but got "+P),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};Sh({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=EC(e[0]),r=n?[e[0]]:Ur(e[0],"ordgroup").body,i=r.map(function(o){var a=rD(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 pn("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return F0(t.parser,s,cD(t.envName))},htmlBuilder:wh,mathmlBuilder:Mh});Sh({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 pn("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=F0(t.parser,r,cD(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:wh,mathmlBuilder:Mh});Sh({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=F0(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:wh,mathmlBuilder:Mh});Sh({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=EC(e[0]),r=n?[e[0]]:Ur(e[0],"ordgroup").body,i=r.map(function(o){var a=rD(o),l=a.text;if("lc".includes(l))return{type:"align",align:l};throw new pn("Unknown column alignment: "+l,o)});if(i.length>1)throw new pn("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=F0(t.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new pn("{subarray} can contain only one column");return s},htmlBuilder:wh,mathmlBuilder:Mh});Sh({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=F0(t.parser,e,cD(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:wh,mathmlBuilder:Mh});Sh({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:_X,htmlBuilder:wh,mathmlBuilder:Mh});Sh({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){Lbe.has(t.envName)&&kC(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:lD(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return F0(t.parser,e,"display")},htmlBuilder:wh,mathmlBuilder:Mh});Sh({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:_X,htmlBuilder:wh,mathmlBuilder:Mh});Sh({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){kC(t);var e={autoTag:lD(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return F0(t.parser,e,"display")},htmlBuilder:wh,mathmlBuilder:Mh});Sh({type:"array",names:["CD"],props:{numArgs:0},handler(t){return kC(t),Mbe(t.parser)},htmlBuilder:wh,mathmlBuilder:Mh});Fe("\\nonumber","\\gdef\\@eqnsw{0}");Fe("\\notag","\\nonumber");Dn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new pn(t.funcName+" valid only within array environment")}});var tj=yX;Dn({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 pn("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(!tj.hasOwnProperty(s))throw new pn("No such environment: "+s,i);var a=tj[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",a),f={mode:n.mode,envName:s,parser:n},p=a.handler(f,l,c);n.expect("\\end",!1);var m=n.nextToken,x=Ur(n.parseFunction(),"environment");if(x.name!==s)throw new pn("Mismatch: \\begin{"+s+"} matched by \\end{"+x.name+"}",m);return p}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var SX=(t,e)=>{var n=t.font,r=e.withFont(n);return bi(t.body,r)},wX=(t,e)=>{var n=t.font,r=e.withFont(n);return os(t.body,r)},nj={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Dn({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=c5(e[0]),s=r;return s in nj&&(s=nj[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:SX,mathmlBuilder:wX});Dn({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:AC(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Rp(r)}}});Dn({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:SX,mathmlBuilder:wX});var zbe=(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),f,p,m;t.hasBarLine?(t.barSize?(p=oo(t.barSize,e),f=My("frac-line",e,p)):f=My("frac-line",e),p=f.height,m=f.height):(f=null,p=0,m=e.fontMetrics().defaultRuleThickness);var x,b,_;n.size===_r.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(f){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=Ei({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:f,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=Ei({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===_r.DISPLAY.size?N=e.fontMetrics().delim1:n.size===_r.SCRIPTSCRIPT.size?N=e.havingStyle(_r.SCRIPT).fontMetrics().delim2:N=e.fontMetrics().delim2;var P,k;return t.leftDelim==null?P=FS(e,["mopen"]):P=fR(t.leftDelim,N,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?k=an([]):t.rightDelim==null?k=FS(e,["mclose"]):k=fR(t.rightDelim,N,!0,e.havingStyle(n),t.mode,["mclose"]),an(["mord"].concat(s.sizingClasses(e)),[P,an(["mfrac"],[S]),k],e)},Fbe=(t,e)=>{var n=new mn("mfrac",[os(t.numer,e),os(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=oo(t.barSize,e);n.setAttribute("linethickness",_n(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new mn("mo",[new Qo(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var o=new mn("mo",[new Qo(t.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),i.push(o)}return tD(i)}return n},MX=(t,e)=>{if(!e)return t;var n={type:"styling",mode:t.mode,style:e,body:[t]};return n};Dn({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",f=null;return c||r.startsWith("\\d")?f="display":r.startsWith("\\t")&&(f="text"),MX({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},f)},htmlBuilder:zbe,mathmlBuilder:Fbe});Dn({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 rj=["display","text","script","scriptscript"],ij=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Dn({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=c5(e[0]),o=s.type==="atom"&&s.family==="open"?ij(s.text):null,a=c5(e[1]),l=a.type==="atom"&&a.family==="close"?ij(a.text):null,c=Ur(e[2],"size"),f,p=null;c.isBlank?f=!0:(p=c.value,f=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=rj[Number(b.text)]}}else x=Ur(x,"textord"),m=rj[Number(x.text)];return MX({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:f,barSize:p,leftDelim:o,rightDelim:l},m)}});Dn({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}}});Dn({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 TX=(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(_r.DISPLAY)),o=CC(i,e),a;if(i.isOver?(a=Ei({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=Ei({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=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=Ei({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)},Ube=(t,e)=>{var n=TC(t.label);return new mn(t.isOver?"mover":"munder",[os(t.base,e),n])};Dn({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:TX,mathmlBuilder:Ube});Dn({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:Io(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=pa(t.body,e,!1);return rbe(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=v0(t.body,e);return n instanceof mn||(n=new mn("mrow",[n])),n.setAttribute("href",t.href),n}});Dn({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:Io(a)}}});Dn({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:Io(e[0])}},htmlBuilder(t,e){var n=pa(t.body,e,!1);return Pp(n)},mathmlBuilder(t,e){return new mn("mrow",Bc(t.body,e))}});Dn({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(","),f=0;f<c.length;f++){var p=c[f],m=p.indexOf("=");if(m<0)throw new pn("\\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:Io(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)=>v0(t.body,e)});Dn({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:Io(e[0]),mathml:Io(e[1])}},htmlBuilder:(t,e)=>{var n=pa(t.html,e,!1);return Pp(n)},mathmlBuilder:(t,e)=>v0(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 pn("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!Vq(r))throw new pn("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Dn({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(","),f=0;f<c.length;f++){var p=c[f].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 pn("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=oo(t.height,e),r=0;t.totalheight.number>0&&(r=oo(t.totalheight,e)-n);var i=0;t.width.number>0&&(i=oo(t.width,e));var s={height:_n(n+r)};i>0&&(s.width=_n(i)),r>0&&(s.verticalAlign=_n(-r));var o=new Yye(t.src,t.alt,s);return o.height=n,o.depth=r,o},mathmlBuilder:(t,e)=>{var n=new mn("mglyph",[]);n.setAttribute("alt",t.alt);var r=oo(t.height,e),i=0;if(t.totalheight.number>0&&(i=oo(t.totalheight,e)-r,n.setAttribute("valign",_n(-i))),n.setAttribute("height",_n(r+i)),t.width.number>0){var s=oo(t.width,e);n.setAttribute("width",_n(s))}return n.setAttribute("src",t.src),n}});Dn({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 Yq(t.dimension,e)},mathmlBuilder(t,e){var n=oo(t.dimension,e);return new tX(n)}});Dn({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=_n(i.height+i.depth),i.depth&&(s.style.verticalAlign=_n(-i.depth)),i.children.unshift(s),i=an(["thinbox"],[i],e),an(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new mn("mpadded",[os(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}});Dn({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}}});Dn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new pn("Mismatched "+t.funcName)}});var sj=(t,e)=>{switch(e.style.size){case _r.DISPLAY.size:return t.display;case _r.TEXT.size:return t.text;case _r.SCRIPT.size:return t.script;case _r.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Dn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Io(e[0]),text:Io(e[1]),script:Io(e[2]),scriptscript:Io(e[3])}},htmlBuilder:(t,e)=>{var n=sj(t,e),r=pa(n,e,!1);return Pp(r)},mathmlBuilder:(t,e)=>{var n=sj(t,e);return v0(n,e)}});var CX=(t,e,n,r,i,s,o)=>{t=an([],[t]);var a=n&&Rp(n),l,c;if(e){var f=bi(e,r.havingStyle(i.sup()),r);c={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-f.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=Ei({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:_n(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:_n(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var b=t.height-o;m=Ei({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:_n(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var _=t.depth+o;m=Ei({positionType:"bottom",positionData:_,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:_n(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=_n(s),S.unshift(M)}return an(["mop","op-limits"],S,r)},EX=new Set(["\\smallint"]),Jy=(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===_r.DISPLAY.size&&s.symbol&&!EX.has(s.name)&&(a=!0);var l;if(s.symbol){var c=a?"Size2-Regular":"Size1-Regular",f="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(f=s.name.slice(1),s.name=f==="oiint"?"\\iint":"\\iiint"),l=Gl(s.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),f.length>0){var p=l.italic,m=Zq(f+"Size"+(a?"2":"1"),e);l=Ei({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:m,shift:a?.08:0}]}),s.name="\\"+f,l.classes.unshift("mop"),l.italic=p}}else if(s.body){var x=pa(s.body,e,!0);x.length===1&&x[0]instanceof hd?(l=x[0],l.classes[0]="mop"):l=an(["mop"],x,e)}else{for(var b=[],_=1;_<s.name.length;_++)b.push(J8(s.name[_],s.mode,e));l=an(["mop"],b,e)}var S=0,M=0;return(l instanceof hd||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(S=(l.height-l.depth)/2-e.fontMetrics().axisHeight,M=l.italic),i?CX(l,n,r,e,o,M,S):(S&&(l.style.position="relative",l.style.top=_n(S)),l)},Bw=(t,e)=>{var n;if(t.symbol)n=new mn("mo",[pd(t.name,t.mode)]),EX.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new mn("mo",Bc(t.body,e));else{n=new mn("mi",[new Qo(t.name.slice(1))]);var r=new mn("mo",[pd("⁡","text")]);t.parentIsSupSub?n=new mn("mrow",[n,r]):n=eX([n,r])}return n},Bbe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Dn({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=Bbe[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Jy,mathmlBuilder:Bw});Dn({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:Io(r)}},htmlBuilder:Jy,mathmlBuilder:Bw});var Hbe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Dn({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:Jy,mathmlBuilder:Bw});Dn({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:Jy,mathmlBuilder:Bw});Dn({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=Hbe[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Jy,mathmlBuilder:Bw});var AX=(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 f=l[c];f instanceof hd&&(f.text=f.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=an(["mop"],l,e)}else o=an(["mop"],[],e);return i?CX(o,n,r,e,e.style,0,0):o},Vbe=(t,e)=>{for(var n=Bc(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof tX))if(s instanceof mn)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 Qo?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(f=>f.toText()).join("");n=[new Qo(a)]}var l=new mn("mi",n);l.setAttribute("mathvariant","normal");var c=new mn("mo",[pd("⁡","text")]);return t.parentIsSupSub?new mn("mrow",[l,c]):eX([l,c])};Dn({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:Io(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:AX,mathmlBuilder:Vbe});Fe("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Ux({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 v0(t.body,e,!0)}});Dn({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=My("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Ei({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 mn("mo",[new Qo("‾")]);n.setAttribute("stretchy","true");var r=new mn("mover",[os(t.body,e),n]);return r.setAttribute("accent","true"),r}});Dn({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:Io(r)}},htmlBuilder:(t,e)=>{var n=pa(t.body,e.withPhantom(),!1);return Pp(n)},mathmlBuilder:(t,e)=>{var n=Bc(t.body,e);return new mn("mphantom",n)}});Dn({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=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:n}]}),an(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=Bc(Io(t.body),e),r=new mn("mphantom",n),i=new mn("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});Dn({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=Bc(Io(t.body),e),r=new mn("mphantom",n),i=new mn("mpadded",[r]);return i.setAttribute("width","0px"),i}});Dn({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=oo(t.dy,e);return Ei({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new mn("mpadded",[os(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Dn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Dn({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=oo(t.width,e),i=oo(t.height,e),s=t.shift?oo(t.shift,e):0;return n.style.borderRightWidth=_n(r),n.style.borderTopWidth=_n(i),n.style.bottom=_n(s),n.width=r,n.height=i+s,n.depth=-s,n.maxFontSize=i*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=oo(t.width,e),r=oo(t.height,e),i=t.shift?oo(t.shift,e):0,s=e.color&&e.getColor()||"black",o=new mn("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",_n(n)),o.setAttribute("height",_n(r));var a=new mn("mpadded",[o]);return i>=0?a.setAttribute("height",_n(i)):(a.setAttribute("height",_n(i)),a.setAttribute("depth",_n(-i))),a.setAttribute("voffset",_n(i)),a}});function NX(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 oj=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Gbe=(t,e)=>{var n=e.havingSize(t.size);return NX(t.body,n,e)};Dn({type:"sizing",names:oj,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:oj.indexOf(r)+1,body:s}},htmlBuilder:Gbe,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Bc(t.body,n),i=new mn("mstyle",r);return i.setAttribute("mathsize",_n(n.sizeMultiplier)),i}});Dn({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 f=e[0];return{type:"smash",mode:r.mode,body:f,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=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return an(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var n=new mn("mpadded",[os(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Dn({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=Ty(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<_r.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=n.height+n.depth+o+i,{span:l,ruleWidth:c,advanceWidth:f}=kbe(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=_n(f);var x=Ei({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(_r.SCRIPTSCRIPT),_=bi(t.index,b,e),S=.6*(x.height-x.depth),M=Ei({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 mn("mroot",[os(n,e),os(r,e)]):new mn("msqrt",[os(n,e)])}});var aj={display:_r.DISPLAY,text:_r.TEXT,script:_r.SCRIPT,scriptscript:_r.SCRIPTSCRIPT};Dn({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=aj[t.style],r=e.havingStyle(n).withFont("");return NX(t.body,r,e)},mathmlBuilder(t,e){var n=aj[t.style],r=e.havingStyle(n),i=Bc(t.body,r),s=new mn("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 Wbe=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===_r.DISPLAY.size||r.alwaysHandleSupSub);return i?Jy:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===_r.DISPLAY.size||r.limits);return s?AX:null}else{if(r.type==="accent")return Rp(r.base)?iD:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?TX:null}else return null}else return null};Ux({type:"supsub",htmlBuilder(t,e){var n=Wbe(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(),f=0,p=0,m=r&&Rp(r);if(i){var x=e.havingStyle(e.style.sup());a=bi(i,x,e),m||(f=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===_r.DISPLAY?_=c.sup1:e.style.cramped?_=c.sup3:_=c.sup2;var S=e.sizeMultiplier,M=_n(.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 hd||A)&&(C=_n(-o.italic))}var N;if(a&&l){f=Math.max(f,_,a.depth+.25*c.xHeight),p=Math.max(p,c.sub2);var P=c.defaultRuleThickness,k=4*P;if(f-a.depth-(l.height-p)<k){p=k-(f-a.depth)+l.height;var O=.8*c.xHeight-(f-a.depth);O>0&&(f+=O,p-=O)}var R=[{type:"elem",elem:l,shift:p,marginRight:M,marginLeft:C},{type:"elem",elem:a,shift:-f,marginRight:M}];N=Ei({positionType:"individualShift",children:R})}else if(l){p=Math.max(p,c.sub1,l.height-.8*c.xHeight);var L=[{type:"elem",elem:l,marginLeft:C,marginRight:M}];N=Ei({positionType:"shift",positionData:p,children:L})}else if(a)f=Math.max(f,_,a.depth+.25*c.xHeight),N=Ei({positionType:"shift",positionData:-f,children:[{type:"elem",elem:a,marginRight:M}]});else throw new Error("supsub must have either sup or sub.");var B=lR(o,"right")||"mord";return an([B],[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=[os(t.base,e)];t.sub&&s.push(os(t.sub,e)),t.sup&&s.push(os(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===_r.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===_r.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===_r.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===_r.DISPLAY)?o="munder":o="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===_r.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===_r.DISPLAY)?o="mover":o="msup"}return new mn(o,s)}});Ux({type:"atom",htmlBuilder(t,e){return J8(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new mn("mo",[pd(t.text,t.mode)]);if(t.family==="bin"){var r=nD(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 kX={mi:"italic",mn:"normal",mtext:"normal"};Ux({type:"mathord",htmlBuilder(t,e){return MC(t,e,"mathord")},mathmlBuilder(t,e){var n=new mn("mi",[pd(t.text,t.mode,e)]),r=nD(t,e)||"italic";return r!==kX[n.type]&&n.setAttribute("mathvariant",r),n}});Ux({type:"textord",htmlBuilder(t,e){return MC(t,e,"textord")},mathmlBuilder(t,e){var n=pd(t.text,t.mode,e),r=nD(t,e)||"normal",i;return t.mode==="text"?i=new mn("mtext",[n]):/[0-9]/.test(t.text)?i=new mn("mn",[n]):t.text==="\\prime"?i=new mn("mo",[n]):i=new mn("mi",[n]),r!==kX[i.type]&&i.setAttribute("mathvariant",r),i}});var v6={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},y6={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Ux({type:"spacing",htmlBuilder(t,e){if(y6.hasOwnProperty(t.text)){var n=y6[t.text].className||"";if(t.mode==="text"){var r=MC(t,e,"textord");return r.classes.push(n),r}else return an(["mspace",n],[J8(t.text,t.mode,e)],e)}else{if(v6.hasOwnProperty(t.text))return an(["mspace",v6[t.text]],[],e);throw new pn('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(y6.hasOwnProperty(t.text))n=new mn("mtext",[new Qo(" ")]);else{if(v6.hasOwnProperty(t.text))return new mn("mspace");throw new pn('Unknown type of space "'+t.text+'"')}return n}});var lj=()=>{var t=new mn("mtd",[]);return t.setAttribute("width","50%"),t};Ux({type:"tag",mathmlBuilder(t,e){var n=new mn("mtable",[new mn("mtr",[lj(),new mn("mtd",[v0(t.body,e)]),lj(),new mn("mtd",[v0(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var cj={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},uj={"\\textbf":"textbf","\\textmd":"textmd"},$be={"\\textit":"textit","\\textup":"textup"},dj=(t,e)=>{var n=t.font;if(n){if(cj[n])return e.withTextFontFamily(cj[n]);if(uj[n])return e.withTextFontWeight(uj[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape($be[n])};Dn({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:Io(i),font:r}},htmlBuilder(t,e){var n=dj(t,e),r=pa(t.body,n,!0);return an(["mord","text"],r,n)},mathmlBuilder(t,e){var n=dj(t,e);return v0(t.body,n)}});Dn({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=My("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Ei({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 mn("mo",[new Qo("‾")]);n.setAttribute("stretchy","true");var r=new mn("munder",[os(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Dn({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 Ei({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){return new mn("mpadded",[os(t.body,e)],["vcenter"])}});Dn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new pn("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=fj(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),r.push(Gl(o,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return an(["mord","text"].concat(i.sizingClasses(e)),Xq(r),i)},mathmlBuilder(t,e){var n=new Qo(fj(t)),r=new mn("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var fj=t=>t.body.replace(/ /g,t.star?"␣":" "),Qm=Qq,RX=`[ \r
	]`,qbe="\\\\[a-zA-Z@]+",Xbe="\\\\[^\uD800-\uDFFF]",Ybe="("+qbe+")"+RX+"*",Kbe=`\\\\(
|[ \r	]+
?)[ \r	]*`,hR="[̀-ͯ]",Zbe=new RegExp(hR+"+$"),Qbe="("+RX+"+)|"+(Kbe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(hR+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(hR+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Ybe)+("|"+Xbe+")");class hj{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(Qbe,"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 pu("EOF",new Rc(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new pn("Unexpected character: '"+e[n]+"'",new pu(e[n],new Rc(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 pu(i,new Rc(this,n,this.tokenRegex.lastIndex))}}class Jbe{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 pn("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 e_e=bX;Fe("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Fe("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Fe("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Fe("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Fe("\\@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}});Fe("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Fe("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var pj={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};Fe("\\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 pn("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=pj[e.text],r==null||r>=n)throw new pn("Invalid base-"+n+" digit "+e.text);for(var i;(i=pj[t.future().text])!=null&&i<n;)r*=n,r+=i,t.popToken()}return"\\@char{"+r+"}"});var uD=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new pn("\\newcommand's first argument must be a macro name");var s=i[0].text,o=t.isDefined(s);if(o&&!e)throw new pn("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!n)throw new pn("\\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 pn("Invalid number of arguments: "+l);a=parseInt(l),i=t.consumeArg().tokens}return o&&r||t.macros.set(s,{tokens:i,numArgs:a}),""};Fe("\\newcommand",t=>uD(t,!1,!0,!1));Fe("\\renewcommand",t=>uD(t,!0,!1,!1));Fe("\\providecommand",t=>uD(t,!0,!0,!0));Fe("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Fe("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Fe("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),Qm[n],xs.math[n],xs.text[n]),""});Fe("\\bgroup","{");Fe("\\egroup","}");Fe("~","\\nobreakspace");Fe("\\lq","`");Fe("\\rq","'");Fe("\\aa","\\r a");Fe("\\AA","\\r A");Fe("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Fe("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Fe("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Fe("ℬ","\\mathscr{B}");Fe("ℰ","\\mathscr{E}");Fe("ℱ","\\mathscr{F}");Fe("ℋ","\\mathscr{H}");Fe("ℐ","\\mathscr{I}");Fe("ℒ","\\mathscr{L}");Fe("ℳ","\\mathscr{M}");Fe("ℛ","\\mathscr{R}");Fe("ℭ","\\mathfrak{C}");Fe("ℌ","\\mathfrak{H}");Fe("ℨ","\\mathfrak{Z}");Fe("\\Bbbk","\\Bbb{k}");Fe("·","\\cdotp");Fe("\\llap","\\mathllap{\\textrm{#1}}");Fe("\\rlap","\\mathrlap{\\textrm{#1}}");Fe("\\clap","\\mathclap{\\textrm{#1}}");Fe("\\mathstrut","\\vphantom{(}");Fe("\\underbar","\\underline{\\text{#1}}");Fe("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Fe("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Fe("\\ne","\\neq");Fe("≠","\\neq");Fe("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Fe("∉","\\notin");Fe("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Fe("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Fe("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Fe("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Fe("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Fe("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Fe("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Fe("⟂","\\perp");Fe("‼","\\mathclose{!\\mkern-0.8mu!}");Fe("∌","\\notni");Fe("⌜","\\ulcorner");Fe("⌝","\\urcorner");Fe("⌞","\\llcorner");Fe("⌟","\\lrcorner");Fe("©","\\copyright");Fe("®","\\textregistered");Fe("️","\\textregistered");Fe("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Fe("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Fe("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Fe("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Fe("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Fe("⋮","\\vdots");Fe("\\varGamma","\\mathit{\\Gamma}");Fe("\\varDelta","\\mathit{\\Delta}");Fe("\\varTheta","\\mathit{\\Theta}");Fe("\\varLambda","\\mathit{\\Lambda}");Fe("\\varXi","\\mathit{\\Xi}");Fe("\\varPi","\\mathit{\\Pi}");Fe("\\varSigma","\\mathit{\\Sigma}");Fe("\\varUpsilon","\\mathit{\\Upsilon}");Fe("\\varPhi","\\mathit{\\Phi}");Fe("\\varPsi","\\mathit{\\Psi}");Fe("\\varOmega","\\mathit{\\Omega}");Fe("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Fe("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Fe("\\boxed","\\fbox{$\\displaystyle{#1}$}");Fe("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Fe("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Fe("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Fe("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Fe("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var mj={",":"\\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"},t_e=new Set(["bin","rel"]);Fe("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in mj?e=mj[n]:(n.slice(0,4)==="\\not"||n in xs.math&&t_e.has(xs.math[n].group))&&(e="\\dotsb"),e});var dD={")":!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};Fe("\\dotso",function(t){var e=t.future().text;return e in dD?"\\ldots\\,":"\\ldots"});Fe("\\dotsc",function(t){var e=t.future().text;return e in dD&&e!==","?"\\ldots\\,":"\\ldots"});Fe("\\cdots",function(t){var e=t.future().text;return e in dD?"\\@cdots\\,":"\\@cdots"});Fe("\\dotsb","\\cdots");Fe("\\dotsm","\\cdots");Fe("\\dotsi","\\!\\cdots");Fe("\\dotsx","\\ldots\\,");Fe("\\DOTSI","\\relax");Fe("\\DOTSB","\\relax");Fe("\\DOTSX","\\relax");Fe("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Fe("\\,","\\tmspace+{3mu}{.1667em}");Fe("\\thinspace","\\,");Fe("\\>","\\mskip{4mu}");Fe("\\:","\\tmspace+{4mu}{.2222em}");Fe("\\medspace","\\:");Fe("\\;","\\tmspace+{5mu}{.2777em}");Fe("\\thickspace","\\;");Fe("\\!","\\tmspace-{3mu}{.1667em}");Fe("\\negthinspace","\\!");Fe("\\negmedspace","\\tmspace-{4mu}{.2222em}");Fe("\\negthickspace","\\tmspace-{5mu}{.277em}");Fe("\\enspace","\\kern.5em ");Fe("\\enskip","\\hskip.5em\\relax");Fe("\\quad","\\hskip1em\\relax");Fe("\\qquad","\\hskip2em\\relax");Fe("\\tag","\\@ifstar\\tag@literal\\tag@paren");Fe("\\tag@paren","\\tag@literal{({#1})}");Fe("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new pn("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Fe("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Fe("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Fe("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Fe("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Fe("\\newline","\\\\\\relax");Fe("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var DX=_n(ih["Main-Regular"][84][1]-.7*ih["Main-Regular"][65][1]);Fe("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+DX+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Fe("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+DX+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Fe("\\hspace","\\@ifstar\\@hspacer\\@hspace");Fe("\\@hspace","\\hskip #1\\relax");Fe("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Fe("\\ordinarycolon",":");Fe("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Fe("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Fe("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Fe("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Fe("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Fe("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Fe("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Fe("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Fe("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Fe("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Fe("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Fe("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Fe("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Fe("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Fe("∷","\\dblcolon");Fe("∹","\\eqcolon");Fe("≔","\\coloneqq");Fe("≕","\\eqqcolon");Fe("⩴","\\Coloneqq");Fe("\\ratio","\\vcentcolon");Fe("\\coloncolon","\\dblcolon");Fe("\\colonequals","\\coloneqq");Fe("\\coloncolonequals","\\Coloneqq");Fe("\\equalscolon","\\eqqcolon");Fe("\\equalscoloncolon","\\Eqqcolon");Fe("\\colonminus","\\coloneq");Fe("\\coloncolonminus","\\Coloneq");Fe("\\minuscolon","\\eqcolon");Fe("\\minuscoloncolon","\\Eqcolon");Fe("\\coloncolonapprox","\\Colonapprox");Fe("\\coloncolonsim","\\Colonsim");Fe("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Fe("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Fe("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Fe("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Fe("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Fe("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Fe("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Fe("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Fe("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Fe("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Fe("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Fe("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Fe("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Fe("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Fe("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Fe("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Fe("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Fe("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Fe("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Fe("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Fe("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Fe("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Fe("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Fe("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Fe("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Fe("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Fe("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Fe("\\imath","\\html@mathml{\\@imath}{ı}");Fe("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Fe("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Fe("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Fe("⟦","\\llbracket");Fe("⟧","\\rrbracket");Fe("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Fe("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Fe("⦃","\\lBrace");Fe("⦄","\\rBrace");Fe("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Fe("⦵","\\minuso");Fe("\\darr","\\downarrow");Fe("\\dArr","\\Downarrow");Fe("\\Darr","\\Downarrow");Fe("\\lang","\\langle");Fe("\\rang","\\rangle");Fe("\\uarr","\\uparrow");Fe("\\uArr","\\Uparrow");Fe("\\Uarr","\\Uparrow");Fe("\\N","\\mathbb{N}");Fe("\\R","\\mathbb{R}");Fe("\\Z","\\mathbb{Z}");Fe("\\alef","\\aleph");Fe("\\alefsym","\\aleph");Fe("\\Alpha","\\mathrm{A}");Fe("\\Beta","\\mathrm{B}");Fe("\\bull","\\bullet");Fe("\\Chi","\\mathrm{X}");Fe("\\clubs","\\clubsuit");Fe("\\cnums","\\mathbb{C}");Fe("\\Complex","\\mathbb{C}");Fe("\\Dagger","\\ddagger");Fe("\\diamonds","\\diamondsuit");Fe("\\empty","\\emptyset");Fe("\\Epsilon","\\mathrm{E}");Fe("\\Eta","\\mathrm{H}");Fe("\\exist","\\exists");Fe("\\harr","\\leftrightarrow");Fe("\\hArr","\\Leftrightarrow");Fe("\\Harr","\\Leftrightarrow");Fe("\\hearts","\\heartsuit");Fe("\\image","\\Im");Fe("\\infin","\\infty");Fe("\\Iota","\\mathrm{I}");Fe("\\isin","\\in");Fe("\\Kappa","\\mathrm{K}");Fe("\\larr","\\leftarrow");Fe("\\lArr","\\Leftarrow");Fe("\\Larr","\\Leftarrow");Fe("\\lrarr","\\leftrightarrow");Fe("\\lrArr","\\Leftrightarrow");Fe("\\Lrarr","\\Leftrightarrow");Fe("\\Mu","\\mathrm{M}");Fe("\\natnums","\\mathbb{N}");Fe("\\Nu","\\mathrm{N}");Fe("\\Omicron","\\mathrm{O}");Fe("\\plusmn","\\pm");Fe("\\rarr","\\rightarrow");Fe("\\rArr","\\Rightarrow");Fe("\\Rarr","\\Rightarrow");Fe("\\real","\\Re");Fe("\\reals","\\mathbb{R}");Fe("\\Reals","\\mathbb{R}");Fe("\\Rho","\\mathrm{P}");Fe("\\sdot","\\cdot");Fe("\\sect","\\S");Fe("\\spades","\\spadesuit");Fe("\\sub","\\subset");Fe("\\sube","\\subseteq");Fe("\\supe","\\supseteq");Fe("\\Tau","\\mathrm{T}");Fe("\\thetasym","\\vartheta");Fe("\\weierp","\\wp");Fe("\\Zeta","\\mathrm{Z}");Fe("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Fe("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Fe("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Fe("\\bra","\\mathinner{\\langle{#1}|}");Fe("\\ket","\\mathinner{|{#1}\\rangle}");Fe("\\braket","\\mathinner{\\langle{#1}\\rangle}");Fe("\\Bra","\\left\\langle#1\\right|");Fe("\\Ket","\\left|#1\\right\\rangle");var PX=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,f=e.expandTokens([...s,...c,...n]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};Fe("\\bra@ket",PX(!1));Fe("\\bra@set",PX(!0));Fe("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Fe("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Fe("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Fe("\\angln","{\\angl n}");Fe("\\blue","\\textcolor{##6495ed}{#1}");Fe("\\orange","\\textcolor{##ffa500}{#1}");Fe("\\pink","\\textcolor{##ff00af}{#1}");Fe("\\red","\\textcolor{##df0030}{#1}");Fe("\\green","\\textcolor{##28ae7b}{#1}");Fe("\\gray","\\textcolor{gray}{#1}");Fe("\\purple","\\textcolor{##9d38bd}{#1}");Fe("\\blueA","\\textcolor{##ccfaff}{#1}");Fe("\\blueB","\\textcolor{##80f6ff}{#1}");Fe("\\blueC","\\textcolor{##63d9ea}{#1}");Fe("\\blueD","\\textcolor{##11accd}{#1}");Fe("\\blueE","\\textcolor{##0c7f99}{#1}");Fe("\\tealA","\\textcolor{##94fff5}{#1}");Fe("\\tealB","\\textcolor{##26edd5}{#1}");Fe("\\tealC","\\textcolor{##01d1c1}{#1}");Fe("\\tealD","\\textcolor{##01a995}{#1}");Fe("\\tealE","\\textcolor{##208170}{#1}");Fe("\\greenA","\\textcolor{##b6ffb0}{#1}");Fe("\\greenB","\\textcolor{##8af281}{#1}");Fe("\\greenC","\\textcolor{##74cf70}{#1}");Fe("\\greenD","\\textcolor{##1fab54}{#1}");Fe("\\greenE","\\textcolor{##0d923f}{#1}");Fe("\\goldA","\\textcolor{##ffd0a9}{#1}");Fe("\\goldB","\\textcolor{##ffbb71}{#1}");Fe("\\goldC","\\textcolor{##ff9c39}{#1}");Fe("\\goldD","\\textcolor{##e07d10}{#1}");Fe("\\goldE","\\textcolor{##a75a05}{#1}");Fe("\\redA","\\textcolor{##fca9a9}{#1}");Fe("\\redB","\\textcolor{##ff8482}{#1}");Fe("\\redC","\\textcolor{##f9685d}{#1}");Fe("\\redD","\\textcolor{##e84d39}{#1}");Fe("\\redE","\\textcolor{##bc2612}{#1}");Fe("\\maroonA","\\textcolor{##ffbde0}{#1}");Fe("\\maroonB","\\textcolor{##ff92c6}{#1}");Fe("\\maroonC","\\textcolor{##ed5fa6}{#1}");Fe("\\maroonD","\\textcolor{##ca337c}{#1}");Fe("\\maroonE","\\textcolor{##9e034e}{#1}");Fe("\\purpleA","\\textcolor{##ddd7ff}{#1}");Fe("\\purpleB","\\textcolor{##c6b9fc}{#1}");Fe("\\purpleC","\\textcolor{##aa87ff}{#1}");Fe("\\purpleD","\\textcolor{##7854ab}{#1}");Fe("\\purpleE","\\textcolor{##543b78}{#1}");Fe("\\mintA","\\textcolor{##f5f9e8}{#1}");Fe("\\mintB","\\textcolor{##edf2df}{#1}");Fe("\\mintC","\\textcolor{##e0e5cc}{#1}");Fe("\\grayA","\\textcolor{##f6f7f7}{#1}");Fe("\\grayB","\\textcolor{##f0f1f2}{#1}");Fe("\\grayC","\\textcolor{##e3e5e6}{#1}");Fe("\\grayD","\\textcolor{##d6d8da}{#1}");Fe("\\grayE","\\textcolor{##babec2}{#1}");Fe("\\grayF","\\textcolor{##888d93}{#1}");Fe("\\grayG","\\textcolor{##626569}{#1}");Fe("\\grayH","\\textcolor{##3b3e40}{#1}");Fe("\\grayI","\\textcolor{##21242c}{#1}");Fe("\\kaBlue","\\textcolor{##314453}{#1}");Fe("\\kaGreen","\\textcolor{##71B307}{#1}");var IX={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class n_e{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 Jbe(e_e,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new hj(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 pu("EOF",r.loc)),this.pushTokens(i),new pu("",Rc.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 pn("Extra }",s)}else if(s.text==="EOF")throw new pn("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 pn("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 pn("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 pn("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 pn("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 pn("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 pn("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 pu(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 hj(i,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var f={tokens:l,numArgs:s};return f}return i}isDefined(e){return this.macros.has(e)||Qm.hasOwnProperty(e)||xs.math.hasOwnProperty(e)||xs.text.hasOwnProperty(e)||IX.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Qm.hasOwnProperty(e)&&!Qm[e].primitive}}var gj=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,X4=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"}},xj={á:"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 RC{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 n_e(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 pn("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 pu("}")),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(RC.endOfExpression.has(i.text)||n&&i.text===n||e&&Qm[i.text]&&Qm[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 pn("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 pn("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 pn("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new pn("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new pn("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new pn("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(X4[s.text]){var c=gj.test(s.text),f=[];for(f.push(new pu(X4[s.text])),this.consume();;){var p=this.fetch().text;if(!X4[p]||gj.test(p)!==c)break;f.unshift(new pu(X4[p])),this.consume()}var m=this.subparse(f);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=Qm[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new pn("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new pn("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new pn("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=Qm[e];if(a&&a.handler)return a.handler(o,n,r);throw new pn("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 pn("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 pn("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new pn("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new pn("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 pn("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 pn("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 pn("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!Vq(s))throw new pn("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:Rc.range(r,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!IX.hasOwnProperty(i)){if(this.settings.throwOnError)throw new pn("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:Rc.range(i,e[r+2]),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Rc.range(i,e[r+1]),text:"--"}),n-=1)),(s==="'"||s==="`")&&e[r+1].text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:Rc.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 pn(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}xj.hasOwnProperty(n[0])&&!xs[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=xj[n[0]]+n.slice(1));var s=Zbe.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(xs[this.mode][n]){this.settings.strict&&this.mode==="math"&&oR.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var a=xs[this.mode][n].group,l=Rc.range(e),c;if(Qye.hasOwnProperty(a)){var f=a;c={type:"atom",mode:this.mode,family:f,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&&(Hq(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:Rc.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 pn("Unknown accent ' "+m+"'",e);var x=b6[m][this.mode]||b6[m].text;if(!x)throw new pn("Accent "+m+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Rc.range(e),label:x,isStretchy:!1,isShifty:!0,base:o}}return o}}RC.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var fD=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new RC(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 pn("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new pu("\\df@tag")])}]}return i},OX=function(e,n,r){n.textContent="";var i=hD(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."),OX=function(){throw new pn("KaTeX doesn't work in quirks mode.")});var r_e=function(e,n){var r=hD(e,n).toMarkup();return r},i_e=function(e,n){var r=new Y8(n);return fD(e,r)},LX=function(e,n,r){if(r.throwOnError||!(e instanceof pn))throw e;var i=an(["katex-error"],[new hd(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},hD=function(e,n){var r=new Y8(n);try{var i=fD(e,r);return pbe(i,e,r)}catch(s){return LX(s,e,r)}},s_e=function(e,n){var r=new Y8(n);try{var i=fD(e,r);return mbe(i,e,r)}catch(s){return LX(s,e,r)}},o_e="0.16.33",a_e={Span:Uw,Anchor:Q8,SymbolNode:hd,SvgNode:Mp,PathNode:g0,LineNode:sR},pR={version:o_e,render:OX,renderToString:r_e,ParseError:pn,SETTINGS_SCHEMA:u2,__parse:i_e,__renderToDomTree:hD,__renderToHTMLTree:s_e,__setFontMetrics:Gye,__defineSymbol:te,__defineFunction:Dn,__defineMacro:Fe,__domTree:a_e};const l_e={};function c_e(t){const e=this,n=t||l_e,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(bye(n)),s.push(fye()),o.push(hye(n))}const vj=/[#.]/g;function u_e(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){vj.lastIndex=i;const a=vj.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 jX(t,e,n){const r=n?p_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=u_e(s,e);const c=l.tagName.toLowerCase(),f=r?r.get(c):void 0;if(l.tagName=f||c,d_e(o))a.unshift(o);else for(const[p,m]of Object.entries(o))f_e(t,l.properties,p,m)}for(const c of a)mR(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function d_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 f_e(t,e,n,r){const i=dq(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=nL(r):i.commaSeparated?s=ZO(r):i.commaOrSpaceSeparated?s=nL(ZO(r).join(" ")):s=yj(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?h_e(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(yj(i,i.property,a));s=o}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function mR(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)mR(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?mR(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function yj(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||LS(n)===LS(e)))return!0}return n}function h_e(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function p_e(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const m_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"],g_e=jX(fq,"div"),x_e=jX(vC,"g",m_e),_6={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function v_e(t,e){return zX(t,{})||{type:"root",children:[]}}function zX(t,e){const n=y_e(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function y_e(t,e){switch(t.nodeType){case 1:return w_e(t,e);case 3:return __e(t);case 8:return S_e(t);case 9:return bj(t,e);case 10:return b_e();case 11:return bj(t,e);default:return}}function bj(t,e){return{type:"root",children:FX(t,e)}}function b_e(){return{type:"doctype"}}function __e(t){return{type:"text",value:t.nodeValue||""}}function S_e(t){return{type:"comment",value:t.nodeValue||""}}function w_e(t,e){const n=t.namespaceURI,r=n===_6.svg?x_e:g_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,FX(s,e))}function FX(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=zX(n[i],e);s!==void 0&&r.push(s)}return r}new DOMParser;function M_e(t,e){const n=T_e(t);return v_e(n)}function T_e(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const _j=(function(t,e,n){const r=$8(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]}),Bx=(function(t){if(t==null)return A_e;if(typeof t=="string")return E_e(t);if(typeof t=="object")return C_e(t);if(typeof t=="function")return pD(t);throw new Error("Expected function, string, or array as `test`")});function C_e(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Bx(t[n]);return pD(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function E_e(t){return pD(e);function e(n){return n.tagName===t}}function pD(t){return e;function e(n,r,i){return!!(N_e(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function A_e(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function N_e(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const Sj=/\n/g,wj=/[\t ]+/g,gR=Bx("br"),Mj=Bx(j_e),k_e=Bx("p"),Tj=Bx("tr"),R_e=Bx(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",L_e,z_e]),UX=Bx(["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 D_e(t,e){const n=e||{},r="children"in t?t.children:[],i=UX(t),s=VX(t,{whitespace:n.whitespace||"normal"}),o=[];(t.type==="text"||t.type==="comment")&&o.push(...HX(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...BX(r[a],t,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?gR(r[a+1]):i}));const l=[];let c;for(a=-1;++a<o.length;){const f=o[a];typeof f=="number"?c!==void 0&&f>c&&(c=f):f&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(f))}return l.join("")}function BX(t,e,n){return t.type==="element"?P_e(t,e,n):t.type==="text"?n.whitespace==="normal"?HX(t,n):I_e(t):[]}function P_e(t,e,n){const r=VX(t,n),i=t.children||[];let s=-1,o=[];if(R_e(t))return o;let a,l;for(gR(t)||Tj(t)&&_j(e,t,Tj)?l=`
`:k_e(t)?(a=2,l=2):UX(t)&&(a=1,l=1);++s<i.length;)o=o.concat(BX(i[s],t,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?gR(i[s+1]):l}));return Mj(t)&&_j(e,t,Mj)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function HX(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){Sj.lastIndex=s;const l=Sj.exec(n),c=l&&"index"in l?l.index:n.length;r.push(O_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 I_e(t){return[String(t.value)]}function O_e(t,e,n){const r=[];let i=0,s;for(;i<t.length;){wj.lastIndex=i;const o=wj.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 VX(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 L_e(t){return!!(t.properties||{}).hidden}function j_e(t){return t.tagName==="td"||t.tagName==="th"}function z_e(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const F_e={},U_e=[];function B_e(t){const e=t||F_e;return function(n,r){Fq(n,"element",function(i,s){const o=Array.isArray(i.properties.className)?i.properties.className:U_e,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let f=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],f=!0),!p)return;const x=D_e(m,{whitespace:"pre"});let b;try{b=pR.renderToString(x,{...e,displayMode:f,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=pR.renderToString(x,{...e,displayMode:f,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=M_e(b).children);const _=p.children.indexOf(m);return p.children.splice(_,1,...b),zq})}}function mD(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 Hw(t){const e=new Map,n=mD(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 Tp(t){const e=new Map,n=mD(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 f={min:c.min,max:c.max};c.invert===!0&&(f.invert=!0),o.set(a,f)}}o.size>0&&e.set(i.name,o)}}return e}function Vw(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 Cp(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 j1({prompts:t,data:e,samplesData:n,rolloutMetrics:r,goldenAnswers:i,infoTurns:s,isLoading:o,step:a,scrollToSampleId:l=null,showGoTo:c=!1,goToBasePath:f="/rollouts",goToStepParam:p="step",filterGroupId:m=null,filterSampleIdx:x=null,lastValidSampleAtom:b=sW,collapseAllSignal:_=0,expandAllSignal:S=0,defaultSectionsOpen:M=!0,envRewardRanges:C,envMetricRanges:A,advantageRange:N,renderOptions:P=[],formatThinkBlocks:k=!0}){var fe;const O=w.useMemo(()=>{if(!r)return new Map;const Q=new Map;for(const ue of r){const he=Q.get(ue.sample_idx)||[];he.push(ue),Q.set(ue.sample_idx,he)}return Q},[r]),R=w.useMemo(()=>{if(!r)return[];const Q=new Set;for(const ue of r)Q.add(ue.metric_name);return[...Q].sort()},[r]),L=w.useMemo(()=>{if(!i)return new Map;const Q=new Map;for(const ue of i){const he=Q.get(ue.sample_idx)||[];he.push(ue),Q.set(ue.sample_idx,he)}return Q},[i]),B=w.useMemo(()=>{if(!s)return new Map;const Q=new Map;for(const ue of s){const he=Q.get(ue.sample_idx)||[];he.push(ue),Q.set(ue.sample_idx,he)}return Q},[s]),V=w.useMemo(()=>{if(!t)return new Map;const Q=new Map;for(const ue of t)Q.set(ue.group_id,ue);return Q},[t]),W=w.useMemo(()=>{if(!n)return new Map;const Q=new Map;for(const ue of n)Q.set(ue.sample_idx,ue);return Q},[n]),G=w.useMemo(()=>{if(!e)return[];const Q=new Map,ue=new Map;for(const Ce of e){const de=Q.get(Ce.sample_idx)||[];de.push(Ce),Q.set(Ce.sample_idx,de),ue.set(Ce.sample_idx,Ce.group_id)}const he=[];for(const[Ce,de]of Q){const Me=[...de].sort((Ve,He)=>Ve.turn_order-He.turn_order),Te=ue.get(Ce)??-1,Pe=V.get(Te)??null,oe=W.get(Ce);he.push({sample_idx:Ce,group_id:Te,prompt:Pe,turns:Me,reward:(oe==null?void 0:oe.reward)??null,advantage:(oe==null?void 0:oe.advantage)??null,total_tokens:(oe==null?void 0:oe.total_tokens)??null,raw_string:(oe==null?void 0:oe.raw_string)??null})}let se=he.sort((Ce,de)=>Ce.sample_idx-de.sample_idx);return m!==null&&(se=se.filter(Ce=>Ce.group_id===m)),x!==null&&(se=se.filter(Ce=>Ce.sample_idx===x)),se},[e,V,W,m,x]),[ee,H]=fn(b),q=G[0],J=(q==null?void 0:q.sample_idx)??null,K=w.useMemo(()=>J!==null?O.get(J)??[]:[],[O,J]),ne=w.useMemo(()=>J!==null?L.get(J)??[]:[],[L,J]),U=w.useMemo(()=>J!==null?B.get(J)??[]:[],[B,J]);w.useEffect(()=>{!q||x===null||H({sample:q,rolloutMetrics:K,goldenAnswers:ne})},[q,K,ne,x,H]);const z=x!==null&&(ee==null?void 0:ee.sample.sample_idx)===x?ee:null,Y=q||(z==null?void 0:z.sample),j=q?K:(z==null?void 0:z.rolloutMetrics)||[],le=q?ne:(z==null?void 0:z.goldenAnswers)||[],ce=q?U:[],X=w.useRef(null);w.useEffect(()=>{if(l==null||X.current===l)return;const Q=document.getElementById(`sample-${l}`);Q&&(Q.scrollIntoView({behavior:"smooth",block:"start"}),X.current=l)},[l,G]);const ie=a!==void 0?a:(fe=e==null?void 0:e[0])==null?void 0:fe.step;return x===null?d.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground text-sm",children:d.jsx("p",{children:"Select a sample from the sidebar to view"})}):!Y&&!o?d.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:d.jsx("p",{children:"No rollouts data available"})}):Y?d.jsx("div",{className:"space-y-4 min-w-0",children:d.jsx(H_e,{sample:Y,rolloutMetrics:j,goldenAnswers:le,infoTurns:ce,availableMetricNames:R,showGoTo:c,goToStep:ie,goToBasePath:f,goToStepParam:p,collapseAllSignal:_,expandAllSignal:S,defaultSectionsOpen:M,envRewardRanges:C,envMetricRanges:A,advantageRange:N,renderOptions:P,formatThinkBlocks:k},Y.sample_idx)}):null}function H_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:f=0,defaultSectionsOpen:p=!0,envRewardRanges:m,envMetricRanges:x,advantageRange:b,renderOptions:_=[],formatThinkBlocks:S=!0}){var se,Ce;const[M,C]=fn(Oce),A=M.length===0,N=M.length===1&&M[0]==="__none__",P=de=>A?!0:N?!1:M.includes(de),k=de=>{C(Me=>{if(Me.length===0)return i.filter(oe=>oe!==de);const Te=Me.filter(oe=>oe!=="__none__");if(Te.length===0)return[de];if(Te.includes(de)){const oe=Te.filter(Ve=>Ve!==de);return oe.length===0?["__none__"]:oe}const Pe=[...Te,de];return i.length>0&&Pe.length>=i.length?[]:Pe})},O=w.useMemo(()=>[...e].sort((de,Me)=>de.metric_name.localeCompare(Me.metric_name)),[e]),R=w.useMemo(()=>M.length===0?O:O.filter(de=>M.includes(de.metric_name)),[O,M]),L=w.useMemo(()=>n.filter(de=>de.value!=null&&de.value!==""),[n]),B=((se=t.prompt)==null?void 0:se.env)??null,V=fT(),W=()=>{o!=null&&V(`${a}?${l}=${o}&group=${t.group_id}&sample=${t.sample_idx}`)},G=w.useMemo(()=>{if(!r||r.length===0)return new Map;const de=new Map;for(const Me of r){const Te=de.get(Me.turn_order)||[];Te.push(Me),de.set(Me.turn_order,Te)}return de},[r]),[ee,H]=w.useState(!1),[q,J]=w.useState(!1),[K,ne]=w.useState(p),[U,z]=w.useState({}),[Y,j]=w.useState(c),[le,ce]=w.useState(f),X=t.turns.length;if(c!==Y){j(c),H(!1),J(!1),ne(!1);const de={};for(let Me=0;Me<X;Me++)de[Me]=!1;z(de)}if(f!==le){ce(f),H(!0),J(!0),ne(!0);const de={};for(let Me=0;Me<X;Me++)de[Me]=!0;z(de)}const ie=de=>{z(Me=>({...Me,[de]:!Me[de]}))},fe=B?m==null?void 0:m.get(B):void 0,Q=[];B&&Q.push({label:"Env",value:B});const ue=t.turns.filter(de=>de.turn_type==="model").length;if(ue>1&&Q.push({label:"Turns",value:String(ue)}),t.reward!==null){const de=T6(t.reward,(fe==null?void 0:fe.min)??null,(fe==null?void 0:fe.max)??null);Q.push({label:"Reward",value:t.reward.toFixed(2),rangeColor:de})}if(t.advantage!==null){const de=T6(t.advantage,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null);Q.push({label:"Advantage",value:t.advantage.toFixed(2),rangeColor:de})}const he=[];for(const de of R){const Me=de.env??B,Te=J_e(x,Me,de.metric_name),Pe=T6(de.value,(Te==null?void 0:Te.min)??null,(Te==null?void 0:Te.max)??null,Te==null?void 0:Te.invert);he.push({label:Y4(de.metric_name),value:Q_e(de.value),highlight:Pe?void 0:de.value===1?"positive":de.value===0?"negative":void 0,rangeColor:Pe})}return d.jsxs("div",{id:`sample-${t.sample_idx}`,children:[(Q.length>0||he.length>0||s)&&d.jsxs("div",{className:"mb-2 space-y-0.5",children:[(Q.length>0||s||i.length>0)&&d.jsxs("div",{className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[s&&d.jsx(wn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs mr-1",onClick:W,disabled:o==null,children:"Go to"}),Q.map((de,Me)=>d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Me>0&&d.jsx("span",{className:"text-foreground/20",children:"·"}),d.jsx("span",{className:"text-muted-foreground",children:de.label}),d.jsx("span",{className:"font-medium tabular-nums text-foreground/80",style:de.rangeColor?{color:de.rangeColor}:void 0,children:de.value})]},de.label)),i.length>0&&d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs("button",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:underline cursor-pointer",children:["Sample Metrics",d.jsx(kr,{className:"h-3 w-3"})]})}),d.jsxs($s,{align:"start",className:"w-max max-w-[400px]",children:[d.jsx(Yo,{onSelect:de=>{de.preventDefault(),C([])},children:"Select All"}),d.jsx(Yo,{onSelect:de=>{de.preventDefault(),C(["__none__"])},children:"Unselect All"}),d.jsx(Ds,{}),i.map(de=>d.jsx(ur,{checked:P(de),onCheckedChange:()=>k(de),onSelect:Me=>Me.preventDefault(),children:Y4(de)},de))]})]})]}),he.length>0&&d.jsx("div",{className:"flex items-center gap-1.5 text-xs min-w-0 flex-wrap",children:he.map((de,Me)=>d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx("span",{className:"text-muted-foreground",children:de.label}),d.jsx("span",{className:bt("font-medium tabular-nums",!de.rangeColor&&de.highlight==="positive"&&"text-emerald-600 dark:text-emerald-400",!de.rangeColor&&de.highlight==="negative"&&"text-red-500 dark:text-red-400",!de.rangeColor&&!de.highlight&&"text-foreground/80"),style:de.rangeColor?{color:de.rangeColor}:void 0,children:de.value}),Me<he.length-1&&d.jsx("span",{className:"text-foreground/20",children:"·"})]},de.label))})]}),L.length>0&&d.jsxs(Di,{open:ee,onOpenChange:H,className:"mb-2",children:[d.jsx(Pi,{asChild:!0,children:d.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:d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/70 font-medium text-[11px] uppercase tracking-wide shrink-0",children:"Golden"}),!ee&&d.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:L.map(de=>`${Y4(de.key)}: ${de.value}`).join(" · ")}),d.jsx("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!ee&&"-rotate-90")})})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"py-2 px-2 -mx-2 bg-amber-500/[0.03] rounded-b",children:d.jsx("div",{className:"flex items-baseline gap-2 text-xs min-w-0 flex-wrap",children:L.map((de,Me)=>d.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[Me>0&&d.jsx("span",{className:"text-foreground/20",children:"·"}),d.jsx("span",{className:"text-muted-foreground",children:Y4(de.key)}),d.jsx("span",{className:"font-medium text-foreground/80 whitespace-pre-wrap break-words",children:_.length>0&&de.value?d.jsx(u5,{content:de.value,renderOptions:_}):de.value})]},de.key))})})})]}),((Ce=t.prompt)==null?void 0:Ce.system_prompt)&&d.jsxs(Di,{open:q,onOpenChange:J,className:"mb-2",children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"System"}),!q&&d.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:S6(t.prompt.system_prompt,60,S)}),d.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_system_prompt!=null&&d.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_system_prompt.toLocaleString()," ","tokens"]}),d.jsx(M6,{text:t.prompt.system_prompt}),d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!q&&"-rotate-90")})]})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"py-2",children:d.jsx(w6,{content:t.prompt.system_prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.prompt&&d.jsxs(Di,{open:K,onOpenChange:ne,className:"mb-2",children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"User"}),!K&&d.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:S6(t.prompt.prompt,60,S)}),d.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_prompt!=null&&d.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_prompt.toLocaleString()," tokens"]}),d.jsx(M6,{text:t.prompt.prompt}),d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!K&&"-rotate-90")})]})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"py-2",children:d.jsx(w6,{content:t.prompt.prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.turns.map((de,Me)=>{const Te=U[Me]??p,Pe=de.turn_type==="model"?t.turns.slice(0,Me).filter(oe=>oe.turn_type==="model").length:null;return d.jsxs(Di,{open:Te,onOpenChange:()=>ie(Me),className:"mb-2",children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:G_e(de.turn_type)}),!Te&&d.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:S6(de.content,60,de.turn_type==="model"&&S)}),d.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[de.tokens!=null&&d.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[de.tokens.toLocaleString()," tokens"]}),Pe!==null&&d.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:["Turn ",Pe]}),d.jsx(M6,{text:de.content}),d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!Te&&"-rotate-90")})]})]})})}),d.jsx(Ii,{children:d.jsxs("div",{className:"py-2",children:[d.jsx(w6,{content:de.content,renderOptions:_,enableThinkBlocks:de.turn_type==="model"&&S}),(()=>{const oe=G.get(de.turn_order);return!oe||oe.length===0?null:d.jsx("div",{className:"mt-2 space-y-1",children:oe.map((Ve,He)=>d.jsx(V_e,{info:Ve,renderOptions:_},`${Ve.info_key}-${He}`))})})()]})})]},`${de.sample_idx}-${de.turn_order}`)})]})}function V_e({info:t,renderOptions:e=[]}){const[n,r]=w.useState(!1);return d.jsxs(Di,{open:n,onOpenChange:r,children:[d.jsx(Pi,{asChild:!0,children:d.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:[d.jsx(kr,{className:bt("h-3 w-3 text-muted-foreground transition-transform shrink-0",!n&&"-rotate-90")}),d.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t.info_key}),!n&&t.info_value&&d.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?"…":""]})]})}),d.jsx(Ii,{children:d.jsx("div",{className:"py-1.5 px-2 text-xs bg-accent/20 rounded mt-0.5",children:e.length>0&&t.info_value?d.jsx(u5,{content:t.info_value,renderOptions:e}):d.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:t.info_value})})})]})}function G_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 W_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?W_e(t):t).replace(/\s+/g," ").trim();return i.length<=e?i:i.slice(0,e)+"…"}function $_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 q_e(t,e=80){const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"…"}function Cj({content:t}){const[e,n]=w.useState(!0);return d.jsxs("span",{className:"block",children:[d.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&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-foreground/40 italic text-xs ml-1",children:q_e(t)}),d.jsx("span",{children:"</think>"}),d.jsx(r0,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&d.jsx(kr,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&d.jsxs("span",{className:"block text-foreground/70",children:[t,d.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 X_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 Y_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 K_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 d.jsxs("div",{className:"my-2 rounded-md border bg-muted/50 overflow-hidden",children:[e&&d.jsxs("div",{className:"flex items-center justify-between px-3 py-1 text-xs text-muted-foreground border-b bg-muted/30",children:[d.jsx("span",{children:e}),d.jsx("button",{onClick:i,className:"hover:text-foreground transition-colors",title:"Copy code",children:n?d.jsx(D0,{className:"h-3 w-3"}):d.jsx(GT,{className:"h-3 w-3"})})]}),d.jsx("pre",{className:"p-3 text-sm font-sans whitespace-pre-wrap break-words overflow-x-auto",children:d.jsx("code",{children:t})})]})}function Z_e({content:t}){const e="katex-scroll",n=X_e(t);return d.jsx("div",{className:bt("whitespace-pre-wrap break-words [&_.katex]:text-sm",e),children:n.map((r,i)=>{if(r.type==="text")return d.jsx("span",{children:r.value},i);try{const s=pR.renderToString(r.value,{displayMode:r.type==="display",throwOnError:!1});return d.jsx("span",{dangerouslySetInnerHTML:{__html:s}},i)}catch{return d.jsx("span",{children:r.type==="display"?`$$${r.value}$$`:`$${r.value}$`},i)}})})}function Ej({content:t,renderMarkdown:e,renderLatex:n}){const r="katex-scroll";if(e){const i=[],s=[];return n&&(i.push(c_e),s.push(B_e)),d.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:d.jsx(oye,{remarkPlugins:i,rehypePlugins:s,children:t})})}return n?d.jsx(Z_e,{content:t}):d.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})}function u5({content:t,renderOptions:e=[]}){const n=e.includes("markdown"),r=e.includes("latex"),i=e.includes("code");if(!n&&!r&&!i)return d.jsx(d.Fragment,{children:t});if(i){const s=Y_e(t);if(s.some(o=>o.type==="code"))return d.jsx(d.Fragment,{children:s.map((o,a)=>o.type==="code"?d.jsx(K_e,{code:o.value,language:o.language},a):d.jsx(Ej,{content:o.value,renderMarkdown:n,renderLatex:r},a))})}return d.jsx(Ej,{content:t,renderMarkdown:n,renderLatex:r})}function w6({content:t,renderOptions:e=[],enableThinkBlocks:n=!0}){const r=w.useMemo(()=>n?$_e(t):[{type:"text",value:t}],[t,n]),i=e.length>0;return r.length===1&&r[0].type==="text"?i?d.jsx("div",{className:"text-sm text-foreground/90",children:d.jsx(u5,{content:t,renderOptions:e})}):d.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:t}):i?d.jsx("div",{className:"text-sm text-foreground/90",children:r.map((s,o)=>s.type==="text"?d.jsx(u5,{content:s.value,renderOptions:e},o):d.jsx(Cj,{content:s.value},o))}):d.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:r.map((s,o)=>s.type==="text"?d.jsx("span",{children:s.value},o):d.jsx(Cj,{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 d.jsx("button",{onClick:r,className:"p-0.5 rounded hover:bg-muted-foreground/10 transition-colors",title:e?"Copied!":"Copy to clipboard",children:e?d.jsx(D0,{className:"h-3.5 w-3.5 text-foreground/30"}):d.jsx(GT,{className:"h-3.5 w-3.5 text-foreground/30"})})}function Y4(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Q_e(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function J_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 DC({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 f=c.split(`
`);return f.map((p,m)=>d.jsxs("span",{children:[p,m<f.length-1&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-muted-foreground/50",children:"\\n"}),`
`]})]},m))};return d.jsxs(su,{children:[d.jsx(XT,{asChild:!0,children:d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Raw Text"})}),d.jsxs(ou,{className:"sm:max-w-[75vw] max-h-[80vh]",children:[d.jsx(Dc,{children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Pc,{children:"Raw Text"}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:[e!=null&&d.jsxs(d.Fragment,{children:[e.toLocaleString()," tokens"]}),e!=null&&n!=null&&n>0&&" • ",n!=null&&n>0&&d.jsxs(d.Fragment,{children:[n," ",n===1?"turn":"turns"]})]}),d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:a,children:[r?d.jsx(D0,{className:"size-3"}):d.jsx(GT,{className:"size-3"}),r?"Copied":"Copy"]}),d.jsx(R1,{variant:"outline",size:"sm",pressed:s,onPressedChange:o,className:"text-xs",children:"Line breaks"})]})}),d.jsx(jx,{className:"h-[60vh] w-full rounded-md border bg-background p-4",children:d.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:s?l(t):t})})]})]})}function eSe(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 tSe(t){switch(t){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}}function nSe(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 rSe({runPath:t,groupId:e,sampleId:n,isEval:r,isCanceled:i,children:s}){var ie,fe,Q,ue,he;const[o,a]=w.useState(!1),{data:l,isLoading:c,error:f}=hW(t,e,n,o,r),{data:p}=_h(t,o&&!!t,!1),m=r?((ie=p==null?void 0:p.summary)==null?void 0:ie.eval_env_details)??((fe=p==null?void 0:p.config)==null?void 0:fe.eval_env_details):(Q=p==null?void 0:p.config)==null?void 0:Q.environments,x=r||(ue=p==null?void 0:p.summary)==null?void 0:ue.env_details,b=w.useMemo(()=>Hw(m),[m]),_=w.useMemo(()=>{const se=Tp(m),Ce=Tp(x),de=Vw(p==null?void 0:p.data_metric_ranges);return Cp(Cp(se,Ce),de)},[m,x,p==null?void 0:p.data_metric_ranges]),S=w.useMemo(()=>{var Me;const se=(Me=p==null?void 0:p.config)==null?void 0:Me.group_size,Ce=typeof se=="object"&&se!==null&&"value"in se?Number(se.value):Number(se);if(!Ce||isNaN(Ce)||Ce<=1)return null;const de=Math.sqrt(Ce-1);return{min:-de,max:de}},[(he=p==null?void 0:p.config)==null?void 0:he.group_size]),M=(l==null?void 0:l.kind)==="rollouts_discarded"?l:null,{mappedPrompts:C,mappedRollouts:A,mappedSamplesData:N,mappedRolloutMetrics:P,mappedGoldenAnswers:k,mappedInfoTurns:O}=nSe(M),R=w.useMemo(()=>{var Ce;if(!l||l.kind!=="eval")return null;const se=(Ce=l.samples_data)==null?void 0:Ce[0];return se?{groupId:se.group_id,sampleIdx:se.sample_idx}:null},[l]),L=(l==null?void 0:l.kind)==="rollouts_discarded"?"Discarded":(l==null?void 0:l.kind)==="rollouts"?"Kept":(l==null?void 0:l.kind)==="eval"?"Eval":null,B=fT(),V=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]),W=()=>{V&&(a(!1),B(V))},[G,ee]=w.useState(0),[H,q]=w.useState(0),[J,K]=w.useState(!0),[ne,U]=fn(BT),[z,Y]=fn(HT),j=ne.length+(z?1:0),le=se=>{U(Ce=>Ce.includes(se)?Ce.filter(de=>de!==se):[...Ce,se])},ce=w.useMemo(()=>{if(!l)return null;const se=l.kind==="rollouts"?l.samples_data:l.kind==="rollouts_discarded"?N:l.kind==="eval"?l.samples_data:null;if(!se)return null;const Ce=l.kind==="eval"?(R==null?void 0:R.sampleIdx)??n:n;return se.find(de=>de.sample_idx===Ce)??null},[l,N,n,R]),X=!c&&!f&&l&&l.kind!==null;return d.jsxs(su,{open:o,onOpenChange:a,children:[d.jsx(XT,{asChild:!0,children:s??d.jsx(wn,{variant:"outline",size:"sm",className:"h-6 px-2 text-[10px]",children:"Check"})}),d.jsxs(ou,{className:"sm:max-w-[85vw] max-h-[85vh] overflow-auto",children:[d.jsx(Dc,{children:d.jsxs(Pc,{className:"flex items-center gap-2 flex-wrap",children:[d.jsx("span",{children:(l==null?void 0:l.kind)==="eval"?`Completion ${n} / Sample ${e}`:`Sample ${n} / Group ${e}`}),L&&d.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[L,(l==null?void 0:l.kind)==="eval"&&l.eval_name&&` — ${l.eval_name}`]}),(M==null?void 0:M.discard_reason)&&d.jsx(xy,{variant:tSe(M.discard_reason),className:"text-xs",children:eSe(M.discard_reason)}),V&&d.jsx(wn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:W,children:"Go to"}),X&&d.jsxs(d.Fragment,{children:[(ce==null?void 0:ce.raw_string)&&d.jsx(DC,{rawString:ce.raw_string,totalTokens:ce.total_tokens,turns:ce.turns??void 0}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{ee(se=>se+1),K(!1)},children:"Collapse All"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{q(se=>se+1),K(!0)},children:"Expand All"}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",j>0&&` (${j})`]})}),d.jsxs($s,{align:"start",className:"w-auto",children:[d.jsx(ur,{checked:z,onCheckedChange:se=>Y(!!se),onSelect:se=>se.preventDefault(),children:"Format Think"}),d.jsx(ur,{checked:ne.includes("markdown"),onCheckedChange:()=>le("markdown"),onSelect:se=>se.preventDefault(),children:"Markdown"}),d.jsx(ur,{checked:ne.includes("latex"),onCheckedChange:()=>le("latex"),onSelect:se=>se.preventDefault(),children:"LaTeX"}),d.jsx(ur,{checked:ne.includes("code"),onCheckedChange:()=>le("code"),onSelect:se=>se.preventDefault(),children:"Code"})]})]})]})]})}),f&&d.jsx(dd,{className:"border-destructive",children:d.jsx(ch,{className:"pt-6",children:d.jsxs("p",{className:"text-sm text-destructive",children:["Error: ",f instanceof Error?f.message:"Unknown error"]})})}),c&&!f&&d.jsx(dd,{children:d.jsxs(ch,{className:"pt-6 space-y-3",children:[d.jsx(ap,{className:"h-5 w-40"}),d.jsx(ap,{className:"h-32 w-full"}),d.jsx(ap,{className:"h-24 w-full"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(ap,{className:"h-6 w-20"}),d.jsx(ap,{className:"h-6 w-20"}),d.jsx(ap,{className:"h-6 w-20"})]})]})}),!c&&!f&&(l==null?void 0:l.kind)==="rollouts"&&d.jsx(j1,{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:G,expandAllSignal:H,defaultSectionsOpen:J,renderOptions:ne,formatThinkBlocks:z}),!c&&!f&&(l==null?void 0:l.kind)==="rollouts_discarded"&&d.jsx(j1,{prompts:C,data:A,samplesData:N,rolloutMetrics:P,goldenAnswers:k,infoTurns:O,step:l.trainer_step,goToBasePath:"/rollouts-discarded",goToStepParam:"trainer_step",filterGroupId:e,filterSampleIdx:n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:G,expandAllSignal:H,defaultSectionsOpen:J,renderOptions:ne,formatThinkBlocks:z}),!c&&!f&&(l==null?void 0:l.kind)==="eval"&&d.jsx(j1,{prompts:l.prompts,data:l.rollouts,samplesData:l.samples_data,rolloutMetrics:l.rollout_metrics,goldenAnswers:l.golden_answers,infoTurns:l.info_turns,step:l.step,filterGroupId:(R==null?void 0:R.groupId)??e,filterSampleIdx:(R==null?void 0:R.sampleIdx)??n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:G,expandAllSignal:H,defaultSectionsOpen:J,renderOptions:ne,formatThinkBlocks:z}),!c&&!f&&(l==null?void 0:l.kind)===null&&d.jsx(dd,{children:d.jsx(ch,{className:"pt-6",children:d.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 iSe=.005;function sSe(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 ms(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 GX(t,e,n=[]){return[{label:"Duration",value:ms(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:ms(t.queue_time*1e3)}]:[],...t.time_to_first_token!==void 0&&t.time_to_first_token!==null?[{label:"TTFT",value:ms(t.time_to_first_token*1e3)}]:[],...t.prefill_time!==void 0&&t.prefill_time!==null?[{label:"Prefill time",value:ms(t.prefill_time*1e3)}]:[],...t.decode_time!==void 0&&t.decode_time!==null?[{label:"Decode time",value:ms(t.decode_time*1e3)}]:[],...t.inference_time!==void 0&&t.inference_time!==null?[{label:"Inference time",value:ms(t.inference_time*1e3)}]:[],...t.e2e_latency!==void 0&&t.e2e_latency!==null?[{label:"E2E latency",value:ms(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 oSe(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 aSe(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 lSe(t,e,n){return n?aSe(t,e):oSe(t,e)}const cSe=new Set;function WX(t){var n;const e=(n=xC[t])==null?void 0:n.label;return e||t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function uSe(t,e=iSe){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 dSe({orchestratorData:t,trainerData:e,inferenceData:n,inflightSnapshot:r,isLoading:i,intervalStart:s,intervalEnd:o,trainerGpuMetricsByGpuIndex:a,trainerGpuMetricsByRank:l,trainerGpuMetricsIsLoading:c=!1,trainerAvailableGpuMetrics:f=[],selectedTrainerGpuMetrics:p=[],onSelectedTrainerGpuMetricsChange:m,trainerSystemGpuIndices:x,trainerRankInfoByRank:b,totalSetupNodes:_,inferenceServerNodeMap:S,numInferenceServers:M=0,maxConcurrentPrompts:C=12,groupSize:A=1,freeLaneAfterGeneration:N=!1}){const P=qn(FT),k=w.useMemo(()=>{const K=(x??[]).filter(U=>Number.isFinite(U));return K.length>0?K:a?Object.keys(a).map(Number).filter(U=>Number.isFinite(U)).sort((U,z)=>U-z):[]},[x,a]),O=o-s,R=w.useMemo(()=>!t||t.length===0?[]:t.filter(K=>K.timestamp>=s&&K.timestamp<o),[t,s,o]),L=w.useMemo(()=>!e||e.length===0?[]:e.filter(K=>K.start_time<o&&K.end_time>s),[e,s,o]),B=w.useMemo(()=>{var z;const K=n??[];if(!((z=r==null?void 0:r.running)!=null&&z.length)||!r.snapshot_time)return K;const ne=new Set(K.filter(Y=>Y.sample_id!=null).map(Y=>Y.sample_id)),U=r.running.filter(Y=>!ne.has(Y.sample_id)).map(Y=>({event_type:"request",server:Y.server,start_time:Y.start_time,end_time:r.snapshot_time,prompt_tokens:Y.prompt_tokens,sample_id:Y.sample_id,group_id:Y.group_id,lane:Y.server_lane,is_eval:Y.is_eval,phase:"inflight"}));return[...K,...U]},[n,r]),V=w.useMemo(()=>!B||B.length===0?[]:B.filter(K=>{const ne=K.end_time+(K.environment_response_time??0)+(K.compute_reward_time??0);return K.start_time<o&&ne>s}),[B,s,o]),{eventsByRank:W,ranks:G}=w.useMemo(()=>{const K={};L.forEach(U=>{K[U.rank]||(K[U.rank]=[]),K[U.rank].push(U)});const ne=Object.keys(K).map(Number).sort((U,z)=>U-z);return{eventsByRank:K,ranks:ne}},[L]),{eventsByServer:ee,servers:H}=w.useMemo(()=>{const K={};V.forEach(U=>{K[U.server]||(K[U.server]=[]),K[U.server].push(U)});const ne=Object.keys(K).map(Number).sort((U,z)=>U-z);return{eventsByServer:K,servers:ne}},[V]),q=M>0?M:Math.max(1,H.length),J=Math.max(1,Math.floor(C/q*A));return d.jsx("div",{className:`transition-opacity duration-200 overflow-visible ${i&&!P?"opacity-50":""}`,children:d.jsxs("div",{className:"space-y-6",children:[(H.length>0||M>0)&&d.jsx(mSe,{servers:H.length>0?H:Array.from({length:M},(K,ne)=>ne),eventsByServer:ee,intervalStart:s,intervalDuration:O,lanesPerServer:J,inferenceServerNodeMap:S,totalSetupNodes:_,isLoading:i,freeLaneAfterGeneration:N}),d.jsx(fSe,{events:R,intervalStart:s,intervalDuration:O,isLoading:i}),d.jsx(ISe,{ranks:G,eventsByRank:W,intervalStart:s,intervalDuration:O,intervalEnd:o,trainerGpuMetricsByGpuIndex:a,trainerGpuMetricsByRank:l,trainerGpuMetricsIsLoading:c,trainerAvailableGpuMetrics:f,selectedMetricNames:p,onSelectedMetricNamesChange:m,trainerSystemGpuIndices:k,trainerRankInfoByRank:b,totalSetupNodes:_,isLoading:i})]})})}function fSe({events:t,intervalStart:e,intervalDuration:n,isLoading:r}){const[i,s]=w.useState(!0),[o,a]=w.useState(null),[l,c]=w.useState(null),f=l??o,{thresholdSeconds:p,displayLabel:m}=w.useMemo(()=>sSe(n),[n]),{sortedEvents:x,windowByOriginalIndex:b}=w.useMemo(()=>uSe(t,p),[t,p]),_=w.useMemo(()=>{const S=[],M=new Map;return t.forEach(C=>{const A=s8(C.event_type),N=M.get(A);N!==void 0?S[N].count++:(M.set(A,S.length),S.push({displayName:A,color:i8(C.event_type),count:1}))}),S},[t]);return d.jsxs(Di,{open:i,onOpenChange:s,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!i&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Orchestrator"}),r&&d.jsx(gl,{className:"size-3.5 text-muted-foreground"})]})})}),d.jsx(Ii,{children:d.jsxs("div",{className:"mt-3",children:[_.length>0&&d.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=f===S,N=f!==null&&!A;return d.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(P=>P===S?null:S),children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:M}}),d.jsx("span",{className:"capitalize text-muted-foreground",children:S}),d.jsx("span",{className:"text-muted-foreground/50",children:C})]},S)})}),d.jsx("div",{className:"relative",children:d.jsxs("div",{className:"relative h-32 bg-background rounded-lg border border-border/50",children:[d.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:[d.jsx("span",{children:mp(0)}),d.jsx("span",{children:mp(n/2)}),d.jsx("span",{children:mp(n)})]}),d.jsx("div",{className:"absolute top-0 left-0 right-0 h-24",children:t.map((S,M)=>d.jsx(hSe,{event:S,intervalStart:e,intervalDuration:n,sortedEvents:x,closeEventWindow:b.get(M),thresholdLabel:m,highlightedDisplayName:f},`${S.timestamp}-${M}`))})]})})]})})]})}function hSe({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(as),f=i8(t.event_type),m=(i?Math.max(0,i.end-i.start):0)>0,x=s8(t.event_type),b=o===null?null:x===o;return d.jsx(Oc,{className:"absolute top-0 bottom-0 w-0.5 group cursor-pointer",style:{left:`${l}%`,backgroundColor:b===!1?lSe(f,.8,c):f,zIndex:b===!0?20:1},interactive:m,tooltip:d.jsx(pSe,{event:t,sortedEvents:r,closeEventWindow:i,thresholdLabel:s})})}function pSe({event:t,sortedEvents:e,closeEventWindow:n,thresholdLabel:r}){const i=a=>{const l=s8(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 d.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&&d.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:[d.jsx("div",{className:"w-1 h-1 rounded-full bg-amber-500 flex-shrink-0"}),d.jsxs("span",{className:"text-amber-500 font-medium text-[10px]",children:[s.length," events within ",r]})]}),d.jsx("div",{className:`px-3 ${o?"pt-2 pb-2 space-y-3":"py-2"}`,children:s.map((a,l)=>{const c=i8(a.event_type),f=i(a);return d.jsxs("div",{className:o&&l>0?"pt-2 border-t border-border/30":"",children:[d.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:c}}),d.jsx("span",{children:f})]}),d.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[a.step!==-1&&d.jsxs("div",{children:["Step: ",a.step]}),d.jsxs("div",{children:["Time:"," ",new Date(a.timestamp*1e3).toISOString().slice(11,23)]})]})]},`${a.timestamp}-${l}`)})})]})}function mSe({servers:t,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i,inferenceServerNodeMap:s,totalSetupNodes:o,isLoading:a,freeLaneAfterGeneration:l=!1}){var tt;const[x,b]=w.useState(!0),[_,S]=fn(Ace),[M,C]=fn(FT),[A,N]=fn(Cce),[P,k]=fn(eW),[O,R]=fn(Ece),L=qn(as),B=L?"1px solid rgba(255, 255, 255, 0.15)":"1px solid rgba(0, 0, 0, 0.2)",[V,W]=fn(Nce),[G,ee]=fn(kce),[H,q]=fn(Mce),[J,K]=fn(nW),ne=qn(bl),U=8,z=t.length>U,Y=w.useMemo(()=>{if(!z)return[];const be=[];for(let Le=0;Le<t.length;Le+=U){const Ze=t.slice(Le,Le+U),Ee=Le,Ye=Math.min(Le+U,t.length)-1;be.push({label:`${Ee} – ${Ye}`,servers:Ze})}return be},[t,z]),j=z?Math.min(H,Math.max(0,Y.length-1)):0;w.useEffect(()=>{z&&H!==j&&q(j)},[z,H,j,q]);const le=z?((tt=Y[j])==null?void 0:tt.servers)??t.slice(0,U):t,ce=w.useMemo(()=>typeof o=="number"&&Number.isFinite(o)?o>1:s?new Set(Object.values(s).filter(Le=>Le!==null)).size>1:!1,[s,o]),X=w.useMemo(()=>{const be=new Set;for(const Ze of Object.values(e))for(const Ee of Ze)Ee.is_canceled&&Ee.group_id!=null&&be.add(Ee.group_id);if(be.size===0)return e;const Le={};for(const[Ze,Ee]of Object.entries(e))Le[Number(Ze)]=Ee.map(Ye=>!Ye.is_canceled&&Ye.group_id!=null&&be.has(Ye.group_id)?{...Ye,is_canceled:!0}:Ye);return Le},[e]),ie=w.useMemo(()=>{const be=new Set,Le=[];for(const Ze of Object.values(X))for(const Ee of Ze){if(Ee.event_type!=="request"||Ee.sample_id==null||Ee.group_id==null)continue;const Ye=`${Ee.group_id}:${Ee.sample_id}`;be.has(Ye)||(be.add(Ye),Le.push({group_id:Ee.group_id,sample_idx:Ee.sample_id}))}return Le},[X]),{data:fe}=o8(ne??"",ie,!!ne&&ie.length>0&&M),Q=!M||ie.length===0||!!fe,ue=!M||Q,he=w.useMemo(()=>{const be=new Map;return fe==null||fe.statuses.forEach(Le=>{be.set(`${Le.group_id}:${Le.sample_idx}`,Le.kind)}),be},[fe]),se=w.useMemo(()=>{let be=i;for(const Le of Object.values(X))for(const Ze of Le)Ze.event_type==="request"&&Ze.lane!=null&&Ze.lane+1>be&&(be=Ze.lane+1);return be},[X,i]),Ce=Math.max(1,t.length),de=Math.max(1,Math.floor(G/Ce)),Me=se,Te=Math.max(1,Math.ceil(Me/de)),Pe=Math.min(V,Math.max(0,Te-1));w.useEffect(()=>{V!==Pe&&W(Pe)},[V,Pe,W]);const oe=Pe*de,Ve=de,He=Math.min(oe+de-1,Me-1),ze=w.useMemo(()=>{let be=0;for(const Le of Object.values(X))be+=Le.length;return be},[X]),Ge=w.useMemo(()=>({servers:le,eventsByServer:X,intervalStart:n,intervalDuration:r,lanesPerServer:i}),[le,X,n,r,i]),ae=w.useMemo(()=>`${n}:${r}:${le.join(",")}:${ze}:${M}`,[n,r,le,ze,M]),[Z,ge]=w.useState(null),[we,_e]=w.useState(null),[ve,Ue]=w.useState(null);ue&&(Z!==Ge||we!==he||ve!==ae)&&(ge(Ge),_e(he),Ue(ae));const Se=M&&ve!==null&&ae!==ve,ke=w.useCallback(be=>{if(be.event_type==="request"&&!(be.sample_id===void 0||be.group_id===void 0)){if((J==null?void 0:J.sampleId)===be.sample_id){K(null);return}K({sampleId:be.sample_id,groupId:be.group_id,isEval:be.is_eval})}},[J,K]),qe=w.useMemo(()=>{if(!P||!O)return[];const be=[];for(const[Le,Ze]of Object.entries(X)){const Ee=Number(Le);for(const Ye of Ze){if(Ye.event_type!=="request")continue;const it=Ye.compute_reward_time;if(it==null||it<=0)continue;const mt=Ye.environment_response_time,ft=Ye.end_time+(mt!=null&&mt>0?mt:0);be.push({startTime:ft,duration:it,sourceEvent:Ye,server:Ee})}}return be.sort((Le,Ze)=>Le.startTime-Ze.startTime),be},[P,O,X]),{packedRewardItems:Je,rewardLaneCount:nt}=w.useMemo(()=>{if(qe.length===0)return{packedRewardItems:[],rewardLaneCount:0};const be=[],Le=[];for(const Ze of qe){let Ee=!1;for(let Ye=0;Ye<be.length;Ye++)if(be[Ye]<=Ze.startTime){be[Ye]=Ze.startTime+Ze.duration,Le.push({...Ze,lane:Ye}),Ee=!0;break}Ee||(Le.push({...Ze,lane:be.length}),be.push(Ze.startTime+Ze.duration))}return{packedRewardItems:Le,rewardLaneCount:be.length}},[qe]);return d.jsxs(Di,{open:x,onOpenChange:b,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Pi,{asChild:!0,children:d.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:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!x&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Inference Servers"}),d.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:a&&d.jsx(gl,{className:"size-3.5 text-muted-foreground"})})]})}),x&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[d.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(be=>Math.max(2,be-4)),disabled:_<=2,children:d.jsx(Gue,{className:"h-3 w-3"})}),d.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"}),d.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(be=>Math.min(42,be+4)),disabled:_>=42,children:d.jsx(pp,{className:"h-3 w-3"})})]}),d.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[d.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:()=>W(be=>Math.max(0,be-1)),disabled:Pe<=0,children:d.jsx(t8,{className:"h-3 w-3"})}),d.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:Me===0?"0":`${oe}–${He}`}),d.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:()=>W(be=>Math.min(Te-1,be+1)),disabled:Pe>=Te-1,children:d.jsx(kr,{className:"h-3 w-3"})})]}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(uW,{className:"h-3.5 w-3.5"})})}),d.jsxs($s,{align:"end",children:[d.jsx(l0,{children:"Max Lanes"}),d.jsx(Ds,{}),[64,128,256,512,1024].map(be=>d.jsx(ur,{checked:G===be,onCheckedChange:()=>{ee(be),W(0)},children:be},be))]})]}),z&&d.jsxs(ay,{value:String(j),onValueChange:be=>q(Number(be)),children:[d.jsx(cy,{size:"sm",className:"text-xs h-7 gap-1",children:d.jsx(ly,{})}),d.jsx(uy,{children:Y.map((be,Le)=>d.jsxs(Mx,{value:String(Le),children:["Servers ",be.label]},Le))})]}),d.jsx(R1,{variant:"selecting",size:"sm",pressed:M,onPressedChange:C,className:"text-xs px-2 h-7",children:"Highlight Discarded"}),d.jsx(R1,{variant:"selecting",size:"sm",pressed:A,onPressedChange:N,className:"text-xs px-2 h-7",children:"Show Weight Update"}),d.jsxs("div",{className:"flex items-center",children:[d.jsx(R1,{variant:"selecting",size:"sm",pressed:P,onPressedChange:k,className:"text-xs px-2 h-7 rounded-r-none",children:"Show Compute Reward"}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx("button",{className:bt("flex items-center justify-center h-7 w-6 rounded-r-[min(var(--radius-md),12px)] transition-colors",P?"bg-primary text-secondary hover:bg-primary/90":"bg-accent text-muted-foreground hover:text-accent-foreground hover:bg-muted"),children:d.jsx(kr,{className:"h-3 w-3"})})}),d.jsx($s,{align:"end",children:d.jsx(ur,{checked:O,onCheckedChange:R,children:"Separate"})})]})]})]})]}),d.jsxs(Ii,{children:[d.jsx("div",{className:"space-y-4",children:t.length>0?(()=>{const be=Z??(ue?Ge:null),Le=we??(ue?he:null);if(!be||!Le)return null;const Ze=Se?!0:Q;return d.jsx("div",{className:`transition-opacity ${Se?"opacity-60":"opacity-100"}`,children:d.jsx("div",{className:"space-y-3",children:be.servers.map(Ee=>d.jsx(kSe,{server:Ee,nodeId:(s==null?void 0:s[Ee])??null,showNodeLabel:ce,events:be.eventsByServer[Ee]||[],intervalStart:be.intervalStart,intervalDuration:be.intervalDuration,numLanes:be.lanesPerServer,selectedRequest:J,sampleStatusByKey:Le,highlightDiscarded:M,discardStatusReady:Ze,onEventClick:ke,showWeightUpdate:A,showComputeReward:P&&!O,laneHeight:_,laneStart:oe,maxLanesToShow:Ve,freeLaneAfterGeneration:l},Ee))})})})():d.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"})}),O&&Je.length>0&&d.jsxs("div",{className:"mt-3",children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-0.5",children:"Compute Reward"}),d.jsx("div",{className:"relative bg-muted/30 rounded-lg border border-border/50",style:{height:nt*_+Math.max(0,nt-1)*2},children:Je.map((be,Le)=>{const Ze=n+r,Ee=be.startTime+be.duration;if(be.startTime>=Ze||Ee<=n)return null;const Ye=Math.max(be.startTime,n),it=Math.min(Ee,Ze),mt=Math.max(0,(Ye-n)/r*100),ft=Math.max(.3,(it-Ye)/r*100),Qe=be.lane*(_+2),Ae=xR(be.sourceEvent,"reward",J,he,M,Q,L);return d.jsx(Oc,{className:"absolute group cursor-pointer",style:{left:`${mt}%`,width:`${Math.min(ft,100-mt)}%`,top:Qe,height:_,backgroundColor:Ae.color,borderRadius:"1px",border:B,boxSizing:"border-box",opacity:Ae.opacity},onClick:()=>ke(be.sourceEvent),tooltip:d.jsx(cu,{title:be.sourceEvent.is_eval?"Compute Metrics":"Compute Reward",titleSecondary:be.sourceEvent.sample_id!==void 0?`Sample ${be.sourceEvent.sample_id}`:void 0,color:Ae.color,details:[{label:"Duration",value:ms(be.duration*1e3)},...be.sourceEvent.group_id!==void 0?[{label:"Group",value:String(be.sourceEvent.group_id)}]:[],{label:"Server",value:String(be.server)},{label:"Lane",value:String(be.lane)}]})},`cr-${Le}`)})})]}),d.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[d.jsx("span",{children:mp(0)}),d.jsx("span",{children:mp(r/2)}),d.jsx("span",{children:mp(r)})]})]})]})}const gSe="#075985",xSe="#047857",$X="#0284c7",qX="#10b981",XX="#a1a1a1",YX="#555555",KX="#b0b0b0",ZX="#4a4a4a",vSe="#0c4a6e",ySe="#065f46",QX="#8a8a8a",JX="#606060",bSe="#0ea5e9",_Se="#ababab",SSe="#555555",wSe="#0ea5e9",MSe="#ababab",TSe="#555555",CSe="#34d399",ESe="#ababab",ASe="#555555",eY="#0369a1",tY="#0369a1",nY="#047857",rY="#0284c7",iY="#0284c7",sY="#10b981",oY="#b3b3b3",aY="#505050",lY="#b3b3b3",cY="#505050",uY="#b3b3b3",dY="#505050";function NSe({eventsBySampleId:t,selectedSampleId:e,timeBounds:n,groupId:r,runPath:i,envResponseTimesBySample:s,computeRewardTimeBySample:o,onSampleClick:a,showNodeLabel:l,isEval:c}){const f=Object.keys(t).map(Number).sort((W,G)=>W-G),p=qn(FT),m=qn(as),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(()=>f.map(W=>({group_id:r,sample_idx:W})),[r,f.join(",")]),{data:M}=o8(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(W=>W.kind==="rollouts_discarded"),[p,M]),N=w.useMemo(()=>{for(const W of Object.values(t))if(W.some(G=>G.is_eval))return!0;return!1},[t]),P=w.useMemo(()=>{for(const W of Object.values(t))if(W.some(G=>G.is_canceled))return!0;return!1},[t]),k=w.useMemo(()=>{var W;return P||A||!p||N?!1:!C||!((W=M==null?void 0:M.statuses)!=null&&W.length)?!0:!M.statuses.some(G=>G.kind==="rollouts")},[P,A,N,p,C,M]),O=P?m?ZX:KX:A?m?YX:XX:k?m?"rgba(202, 138, 4, 0.7)":"rgba(202, 138, 4, 0.8)":N?qX:$X,R=16,L=3,B=f.length*R+(f.length-1)*L,V=48;return C?d.jsxs("div",{className:"px-3 pb-2",children:[d.jsxs("div",{className:"flex items-start",children:[d.jsx("div",{className:"flex flex-col pr-2",style:{width:V,gap:L},children:f.map(W=>{const G=W===e;return d.jsx(rSe,{runPath:i,groupId:r,sampleId:W,isEval:c,isCanceled:P,children:d.jsx("button",{className:`text-[10px] font-semibold text-center rounded transition-colors flex items-center justify-center ${G?P?"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":k?"text-yellow-800 bg-yellow-500/15 hover:bg-yellow-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":P?"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":k?"text-yellow-700 bg-yellow-500/10 hover:bg-yellow-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:R,width:34},children:W})},W)})}),d.jsx("div",{className:"relative flex-1 bg-muted/30 rounded-lg border border-border/50",style:{height:B},children:f.map((W,G)=>{const ee=t[W],H=W===e,q=G*(R+L),J=H?P?m?JX:QX:A?m?"#9ca3af":"#6b7280":k?m?"rgba(161, 98, 7, 0.8)":"rgba(161, 98, 7, 0.9)":N?ySe:vSe:O,K=[...ee].sort((j,le)=>j.start_time-le.start_time),ne=(s==null?void 0:s[W])??[],U=(o==null?void 0:o[W])??0,z=[];for(let j=0;j<K.length&&j<ne.length;j++){const le=ne[j].time;le>0&&z.push({start:K[j].end_time,duration:le,idx:j})}let Y=0;if(U>0&&K.length>0&&(Y=K[K.length-1].end_time,ne.length>=K.length)){const le=ne[K.length-1];le&&le.time>0&&(Y+=le.time)}return d.jsxs("div",{className:"absolute left-0 right-0",style:{top:q,height:R},children:[ee.map((j,le)=>{const X=(j.start_time-n.start)/n.duration*100,ie=j.end_time-j.start_time,fe=ie*1e3,Q=Math.max(.5,ie/n.duration*100);return d.jsx(Oc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${X}%`,width:`${Math.min(Q,100-X)}%`,backgroundColor:J,borderRadius:"1px",border:P?b:x,boxSizing:"border-box"},onClick:a?()=>a(W):void 0,tooltip:d.jsx(cu,{title:j.sample_id!==void 0?`Sample ${j.sample_id}`:j.group_id!==void 0?`Group ${j.group_id}`:"Request",titleSecondary:j.group_id!==void 0?`Group ${j.group_id}`:null,color:J,statusLabel:P?{text:"Canceled",className:"text-muted-foreground"}:A?{text:"Discarded",className:"text-red-700"}:null,details:GX(j,fe,[{label:"Server",value:String(j.server)},...l&&j.node_id!==null&&j.node_id!==void 0?[{label:"Node",value:String(j.node_id)}]:[]]),startTime:j.start_time,endTime:j.end_time})},`req-${le}`)}),z.map(j=>{const ce=(j.start-n.start)/n.duration*100,X=Math.max(.3,j.duration/n.duration*100),ie=j.duration*1e3,fe=H?A?m?"#9ca3af":"#6b7280":eY:A?m?aY:oY:rY;return d.jsx(Oc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${ce}%`,width:`${Math.min(X,100-ce)}%`,backgroundColor:fe,borderRadius:"1px",border:_,boxSizing:"border-box",opacity:.85},onClick:a?()=>a(W):void 0,tooltip:d.jsx(cu,{title:"Env Response",titleSecondary:`Turn ${j.idx}`,color:fe,details:[{label:"Duration",value:ms(ie)}]})},`env-${j.idx}`)}),U>0&&K.length>0&&(()=>{const le=(Y-n.start)/n.duration*100,ce=Math.max(.3,U/n.duration*100),X=U*1e3,ie=H?A?m?"#9ca3af":"#6b7280":c?nY:tY:A?c?m?dY:uY:m?cY:lY:c?sY:iY;return d.jsx(Oc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${le}%`,width:`${Math.min(ce,100-le)}%`,backgroundColor:ie,borderRadius:"1px",border:_,boxSizing:"border-box",opacity:.85},onClick:a?()=>a(W):void 0,tooltip:d.jsx(cu,{title:c?"Compute Metrics":"Compute Reward",color:ie,details:[{label:"Duration",value:ms(X)}]})})})()]},W)})})]}),d.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",style:{marginLeft:V},children:[d.jsx("span",{children:ms(0)}),d.jsx("span",{children:ms(n.duration/2*1e3)}),d.jsx("span",{children:ms(n.duration*1e3)})]})]}):d.jsx("div",{className:"px-3 pb-2 flex items-center justify-center",style:{height:B+24},children:d.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})})}function kSe({server:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,numLanes:o,selectedRequest:a,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:f,onEventClick:p,showWeightUpdate:m=!0,showComputeReward:x=!1,laneHeight:b=14,laneStart:_=0,maxLanesToShow:S,freeLaneAfterGeneration:M=!1}){const C=qn(as),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)",P=n&&e!==null&&e!==void 0?e:void 0,k=w.useMemo(()=>r.filter(K=>K.event_type==="weight_broadcast"),[r]),O=w.useMemo(()=>r.filter(K=>K.event_type==="request"),[r]),{assignedEvents:R,actualNumLanes:L}=w.useMemo(()=>{const K=[],ne=[];for(const z of O)z.lane!=null&&z.lane>=0?K.push({...z,lane:z.lane}):ne.push(z);if(ne.length>0){const z=[...ne].sort((j,le)=>j.start_time-le.start_time),Y=[];for(const j of z){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 ce=!1;for(let X=0;X<Y.length;X++)if(Y[X]<=j.start_time){Y[X]=le,K.push({...j,lane:X}),ce=!0;break}if(!ce){const X=Y.length;Y.push(le),K.push({...j,lane:X})}}}const U=K.reduce((z,Y)=>Math.max(z,Y.lane),-1);return{assignedEvents:K,actualNumLanes:Math.max(o,U+1)}},[O,o,M]),B=i+s,V=b,W=S!==void 0?Math.min(_+S,L):L,G=Math.max(0,W-_),ee=G*V+Math.max(0,G-1)*2,H=w.useMemo(()=>Array.from({length:G},(K,ne)=>ne),[G]),{laneEventsByIndex:q,idlePeriodsByLane:J}=w.useMemo(()=>{const K=Array.from({length:L},()=>[]);for(const U of R){const z=U.lane;K[z]&&K[z].push(U)}const ne=K.map(U=>{const z=[];if(U.length>0){U[0].start_time>i&&z.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,ce=U[j+1].start_time;le<ce&&z.push({start:le,end:ce,duration:ce-le})}const Y=U[U.length-1];Y.end_time<B&&z.push({start:Y.end_time,end:B,duration:B-Y.end_time})}else z.push({start:i,end:B,duration:s});return z});return{laneEventsByIndex:K,idlePeriodsByLane:ne}},[R,i,B,s,L]);return d.jsxs("div",{children:[d.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[d.jsxs("span",{children:["Server ",t]}),n&&e!==null&&e!==void 0&&d.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),d.jsx("div",{className:"relative",children:d.jsxs("div",{className:"relative bg-muted/30 rounded-lg border border-border/50",style:{height:ee},children:[H.map(K=>{const ne=K+_,U=K*(V+2),z=q[ne]||[],Y=J[ne]||[];return d.jsxs("div",{className:"absolute left-0 right-0",style:{top:U,height:V},children:[Y.map((j,le)=>{const ce=Math.max(j.start,i),X=Math.min(j.end,B),ie=X-ce,fe=(ce-i)/s*100,Q=ie/s*100;if(Q<.5||fe>=100||X<=ce)return null;const ue=C?r8:kS;return d.jsx(Oc,{className:"absolute top-0 bottom-0 group",style:{left:`${fe}%`,width:`${Math.min(Q,100-fe)}%`,backgroundColor:ue,borderRadius:"1px"},tooltip:d.jsx(cu,{title:"Idle",color:ue,details:[{label:"Duration",value:ms(j.duration*1e3)},{label:"Server",value:String(t)},...P!==void 0?[{label:"Node",value:String(P)}]:[],{label:"Lane",value:String(ne)}]})},`idle-${le}`)}),z.map((j,le)=>{const ce=j.environment_response_time,X=j.compute_reward_time,ie=xR(j,"env",a,l,c,f,C),fe=xR(j,"reward",a,l,c,f,C);return d.jsxs(w.Fragment,{children:[d.jsx(PSe,{event:j,server:t,nodeId:P,lane:ne,intervalStart:i,intervalDuration:s,selectedRequest:a,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:f,onClick:()=>p(j)}),ce!=null&&ce>0&&(()=>{const Q=i+s,ue=j.end_time,he=ue+ce;if(ue>=Q||he<=i)return null;const se=Math.max(ue,i),Ce=Math.min(he,Q),de=Math.max(0,(se-i)/s*100),Me=Math.max(.3,(Ce-se)/s*100),Te=ce*1e3;return d.jsx(Oc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${de}%`,width:`${Math.min(Me,100-de)}%`,backgroundColor:ie.color,borderRadius:"1px",border:A,boxSizing:"border-box",opacity:ie.opacity},onClick:()=>p(j),tooltip:d.jsx(cu,{title:"Env Response",titleSecondary:j.sample_id!==void 0?`Sample ${j.sample_id}`:void 0,color:ie.color,details:[{label:"Duration",value:ms(Te)},...j.group_id!==void 0?[{label:"Group",value:String(j.group_id)}]:[],{label:"Server",value:String(t)},...P!==void 0?[{label:"Node",value:String(P)}]:[],{label:"Lane",value:String(ne)}]})})})(),x&&X!=null&&X>0&&(()=>{const Q=i+s,ue=j.end_time+(ce!=null&&ce>0?ce:0),he=ue+X;if(ue>=Q||he<=i)return null;const se=Math.max(ue,i),Ce=Math.min(he,Q),de=Math.max(0,(se-i)/s*100),Me=Math.max(.3,(Ce-se)/s*100),Te=X*1e3,Pe=M?Math.max(3,Math.round(V*.4)):void 0,oe=M?Math.round((V-Pe)/2):void 0;return d.jsx(Oc,{className:"absolute group cursor-pointer",style:{left:`${de}%`,width:`${Math.min(Me,100-de)}%`,backgroundColor:fe.color,borderRadius:"1px",border:A,boxSizing:"border-box",opacity:fe.opacity,...M?{top:oe,height:Pe,zIndex:2}:{top:0,bottom:0}},onClick:()=>p(j),tooltip:d.jsx(cu,{title:j.is_eval?"Compute Metrics":"Compute Reward",titleSecondary:j.sample_id!==void 0?`Sample ${j.sample_id}`:void 0,color:fe.color,details:[{label:"Duration",value:ms(Te)},...j.group_id!==void 0?[{label:"Group",value:String(j.group_id)}]:[],{label:"Server",value:String(t)},...P!==void 0?[{label:"Node",value:String(P)}]:[],{label:"Lane",value:String(ne)}]})})})()]},`event-${le}`)})]},ne)}),m&&k.map((K,ne)=>{const U=K.start_time-i,z=Math.max(0,U/s*100),j=(K.end_time-K.start_time)*1e3,le=Math.max(K.start_time,i),ce=K.end_time-le,X=Math.max(.5,ce/s*100),ie=dW(K.event_type);return d.jsx(Oc,{className:"absolute group cursor-default",style:{top:0,left:`${z}%`,width:`${Math.min(X,100-z)}%`,height:ee,backgroundColor:ie,borderRadius:"2px",border:N,boxSizing:"border-box",opacity:.6},tooltip:d.jsx(cu,{title:"Weight Broadcast",color:ie,details:[...K.step!=null?[{label:"Step",value:String(K.step)}]:[],{label:"Duration",value:ms(j)},{label:"Server",value:String(t)},...P!==void 0?[{label:"Node",value:String(P)}]:[]],startTime:K.start_time,endTime:K.end_time})},`wb-${ne}`)})]})})]})}function RSe(t,e,n=!0,r=!0,i=!1){if(t.event_type!=="request")return dW(t.event_type);if(t.phase==="inflight")return i?"rgba(250, 204, 21, 0.5)":"rgba(234, 179, 8, 0.5)";if(t.is_canceled)return i?NS:eC;if(!n||t.is_eval)return t.is_eval?AA:Y_;if(!r)return i?"rgba(202, 138, 4, 0.6)":"rgba(202, 138, 4, 0.7)";if(!e||t.sample_id==null||t.group_id==null)return t.is_eval?AA:Y_;const s=`${t.group_id}:${t.sample_id}`,o=e.get(s);return o==="rollouts_discarded"?i?JT:QT:o==null?i?"rgba(202, 138, 4, 0.6)":"rgba(202, 138, 4, 0.7)":t.is_eval?AA:Y_}function DSe(t,e,n,r=!0,i=!0,s=!1){const o=RSe(t,n,r,i,s);if(!e)return{color:o,opacity:1};const a=o===QT||o===JT,l=o===eC||o===NS,c=t.phase==="inflight"||o.includes("202, 138, 4")||o.includes("234, 179, 8")||o.includes("250, 204, 21");return t.sample_id===e.sampleId?l?{color:s?JX:QX,opacity:1}:a?{color:s?"#9ca3af":"#6b7280",opacity:1}:c?{color:s?"rgba(161, 98, 7, 0.8)":"rgba(161, 98, 7, 0.9)",opacity:1}:{color:t.is_eval?xSe:gSe,opacity:1}:t.group_id===e.groupId?l?{color:s?ZX:KX,opacity:1}:a?{color:s?YX:XX,opacity:1}:c?{color:s?"rgba(202, 138, 4, 0.7)":"rgba(202, 138, 4, 0.8)",opacity:1}:{color:t.is_eval?qX:$X,opacity:1}:{color:o,opacity:.55}}function xR(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 f=`${t.group_id}:${t.sample_id}`;return r.get(f)==="rollouts_discarded"})(),c=l?e==="env"?o?SSe:_Se:a?o?ASe:ESe:o?TSe:MSe:e==="env"?bSe:a?CSe:wSe;return n?t.sample_id===n.sampleId?l?{color:o?"#9ca3af":"#6b7280",opacity:1}:{color:e==="env"?eY:a?nY:tY,opacity:1}:t.group_id===n.groupId?{color:l?e==="env"?o?aY:oY:a?o?dY:uY:o?cY:lY:e==="env"?rY:a?sY:iY,opacity:1}:{color:c,opacity:.35}:{color:c,opacity:.85}}function PSe({event:t,server:e,nodeId:n,lane:r,intervalStart:i,intervalDuration:s,selectedRequest:o,sampleStatusByKey:a,highlightDiscarded:l,discardStatusReady:c,onClick:f}){const p=qn(as),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:P}=DSe(t,o,a,l,c,p),k=t.event_type==="request"&&t.sample_id!==void 0,O=(()=>{if(t.event_type!=="request")return null;if(t.phase==="inflight")return{text:"In Progress",className:"text-yellow-500"};if(t.is_canceled)return{text:"Canceled",className:"text-muted-foreground"};if(l&&!t.is_eval&&t.sample_id!=null&&t.group_id!=null){if(!c)return{text:"Pending Status",className:"text-yellow-600"};const R=`${t.group_id}:${t.sample_id}`,L=a.get(R);if(L==="rollouts_discarded")return{text:"Discarded",className:"text-red-700"};if(L==null)return{text:"Finished (Waiting for Group)",className:"text-yellow-600"}}return null})();return d.jsx(Oc,{className:`absolute top-0 bottom-0 group ${k?"cursor-pointer":"cursor-default"}`,style:{left:`${b}%`,width:`${Math.min(A,100-b)}%`,minWidth:"1px",backgroundColor:N,borderRadius:"1px",border:t.phase==="inflight"?p?"1.5px dashed rgba(250, 204, 21, 0.7)":"1.5px dashed rgba(234, 179, 8, 0.7)":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:P},onClick:k?f:void 0,tooltip:d.jsx(cu,{title:t.event_type==="request"?t.sample_id!==void 0?`Sample ${t.sample_id}`:t.group_id!==void 0?`Group ${t.group_id}`:"Request":t.event_type,titleSecondary:t.event_type==="request"&&t.group_id!==void 0?`Group ${t.group_id}`:null,color:N,capitalize:!0,statusLabel:O,details:t.event_type==="request"?GX(t,S,[{label:"Server",value:String(e)},...n!=null?[{label:"Node",value:String(n)}]:[],{label:"Lane",value:String(r)}]):[{label:"Duration",value:ms(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 ISe({ranks:t,eventsByRank:e,intervalStart:n,intervalDuration:r,intervalEnd:i,trainerGpuMetricsByGpuIndex:s,trainerGpuMetricsByRank:o,trainerGpuMetricsIsLoading:a,trainerAvailableGpuMetrics:l,selectedMetricNames:c,onSelectedMetricNamesChange:f,trainerSystemGpuIndices:p,trainerRankInfoByRank:m,totalSetupNodes:x,isLoading:b}){var ie;const[_,S]=w.useState(!0),[M,C]=fn(tW),[A,N]=fn(Tce),P=w.useMemo(()=>{const fe=new Set;return(l??[]).forEach(Q=>{typeof Q=="string"&&fe.add(Q)}),Array.from(fe)},[l]),[k,O]=w.useState([]),R=((p==null?void 0:p.length)??0)===0;R&&k.length>0?O([]):!R&&P.length>0&&k!==P&&O(P);const L=w.useMemo(()=>R?[]:P.length>0?P:k,[R,P,k]),B=w.useMemo(()=>Array.from(new Set((c??[]).filter(fe=>typeof fe=="string"&&fe.trim().length>0))),[c]),V=w.useMemo(()=>L.length===0?B:B.filter(fe=>L.includes(fe)),[L,B]),W=w.useMemo(()=>{const fe=Object.keys(m??{}).map(Number).filter(Q=>Number.isFinite(Q)).sort((Q,ue)=>Q-ue);return fe.length>0?fe:!p||p.length===0?[]:p.map((Q,ue)=>ue)},[m,p]),G=w.useMemo(()=>{const fe=new Set;return t.forEach(Q=>fe.add(Q)),W.forEach(Q=>fe.add(Q)),Array.from(fe).sort((Q,ue)=>Q-ue)},[t,W]),ee=8,H=G.length>ee,q=w.useMemo(()=>{if(!H)return[];const fe=[];for(let Q=0;Q<G.length;Q+=ee){const ue=G.slice(Q,Q+ee),he=Q+1,se=Math.min(Q+ee,G.length);fe.push({label:`${he} – ${se}`,ranks:ue})}return fe},[G,H]),J=H?Math.min(A,Math.max(0,q.length-1)):0;w.useEffect(()=>{H&&A!==J&&N(J)},[H,A,J,N]);const K=H?((ie=q[J])==null?void 0:ie.ranks)??G.slice(0,ee):G;w.useMemo(()=>new Set(K),[K]);const ne=w.useMemo(()=>{const fe=new Map;return Object.entries(e).forEach(([Q,ue])=>{const he=new Set;ue.forEach(se=>{if(!se.event_type.includes("/"))return;const Ce=se.event_type.split("/")[0];he.add(`${Ce}|${se.step}`)}),fe.set(Number(Q),he)}),fe},[e]),U=w.useMemo(()=>{const fe=new Map;return K.forEach(Q=>{var se;const ue=((se=m==null?void 0:m[Q])==null?void 0:se.node_id)??null,he=ue===null?"__unknown__":String(ue);fe.has(he)||fe.set(he,{nodeId:ue,ranks:[]}),fe.get(he).ranks.push(Q)}),Array.from(fe.values()).map(Q=>({nodeId:Q.nodeId,ranks:Q.ranks.sort((ue,he)=>ue-he)})).sort((Q,ue)=>Q.nodeId===null&&ue.nodeId===null?0:Q.nodeId===null?1:ue.nodeId===null?-1:Q.nodeId-ue.nodeId)},[K,m]),z=w.useMemo(()=>typeof x=="number"&&Number.isFinite(x)?x>1:U.filter(Q=>Q.nodeId!==null).length>1,[U,x]),Y=w.useCallback(fe=>{var ue;fe.event_type.includes("/")||!(((ue=ne.get(fe.rank))==null?void 0:ue.has(`${fe.event_type}|${fe.step}`))??!1)||C(he=>(he==null?void 0:he.eventType)===fe.event_type&&(he==null?void 0:he.rank)===fe.rank&&(he==null?void 0:he.step)===fe.step?null:{eventType:fe.event_type,rank:fe.rank,step:fe.step})},[ne,C]),j=w.useCallback((fe,Q)=>{const ue=V,se=Q===!0?ue.includes(fe)?ue:[...ue,fe]:ue.filter(Ce=>Ce!==fe);f==null||f(se)},[V,f]),le=w.useCallback(()=>f==null?void 0:f([...L]),[L,f]),ce=w.useCallback(()=>f==null?void 0:f([]),[f]),X=w.useCallback(fe=>{const Q=m==null?void 0:m[fe],ue=(Q==null?void 0:Q.local_rank)??(p?p[fe]:void 0),he=(o==null?void 0:o[fe])??(ue!==void 0&&s?s[ue]??[]:void 0);return d.jsx(LSe,{rank:fe,nodeId:(Q==null?void 0:Q.node_id)??null,showNodeLabel:z,events:e[fe]||[],intervalStart:n,intervalDuration:r,intervalEnd:i,selectedEvent:M,onEventClick:Y,childEventKeys:ne.get(fe)??cSe,systemGpuIndex:ue,gpuMetrics:he,selectedMetricNames:V,gpuMetricsIsLoading:a??!1},fe)},[ne,V,e,Y,r,i,n,M,s,o,a,m,p,z]);return d.jsxs(Di,{open:_,onOpenChange:S,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Pi,{asChild:!0,children:d.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:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!_&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Trainer GPUs"}),d.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:b&&d.jsx(gl,{className:"size-3.5 text-muted-foreground"})})]})}),_&&d.jsxs(d.Fragment,{children:[H&&d.jsxs(ay,{value:String(J),onValueChange:fe=>N(Number(fe)),children:[d.jsx(cy,{size:"sm",className:"text-xs h-7 gap-1",children:d.jsx(ly,{})}),d.jsx(uy,{children:q.map((fe,Q)=>d.jsxs(Mx,{value:String(Q),children:["GPUs ",fe.label]},Q))})]}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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",d.jsx("span",{className:"text-[10px] font-medium rounded bg-accent text-accent-foreground px-1.5 py-0.5",children:V.length}),d.jsx(kr,{className:"h-3 w-3 text-muted-foreground"})]})}),d.jsxs($s,{align:"start",className:"w-64",children:[d.jsx(l0,{children:"Trainer GPU Plots"}),d.jsx(Ds,{}),d.jsx(Yo,{onSelect:fe=>{fe.preventDefault(),le()},className:"text-xs",children:"Select All"}),d.jsx(Yo,{onSelect:fe=>{fe.preventDefault(),ce()},className:"text-xs",children:"Unselect All"}),d.jsx(Ds,{}),L.length>0?L.map(fe=>d.jsx(ur,{checked:V.includes(fe),onCheckedChange:Q=>j(fe,Q),onSelect:Q=>Q.preventDefault(),className:"text-xs",children:WX(fe)},fe)):d.jsx(Yo,{disabled:!0,className:"text-xs text-muted-foreground",children:a?"Loading plots...":"No plots available"})]})]})]})]}),d.jsxs(Ii,{children:[d.jsx("div",{className:"space-y-4",children:K.length>0?z?U.map(fe=>d.jsx(OSe,{nodeId:fe.nodeId,rankCount:fe.ranks.length,children:fe.ranks.map(Q=>X(Q))},fe.nodeId===null?"__unknown__":String(fe.nodeId))):K.map(fe=>X(fe)):d.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"})}),d.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[d.jsx("span",{children:mp(0)}),d.jsx("span",{children:mp(r/2)}),d.jsx("span",{children:mp(r)})]})]})]})}function OSe({nodeId:t,rankCount:e,children:n}){const[r,i]=w.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return d.jsxs(Di,{open:r,onOpenChange:i,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),d.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),d.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"space-y-4 mt-2",children:n})})]})}function LSe({rank:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,intervalEnd:o,selectedEvent:a,onEventClick:l,childEventKeys:c,systemGpuIndex:f,gpuMetrics:p,selectedMetricNames:m,gpuMetricsIsLoading:x}){const b=w.useMemo(()=>[...r.filter(P=>!P.event_type.includes("/"))].sort((P,k)=>P.start_time-k.start_time),[r]),_=w.useMemo(()=>fY(b,i,o),[b,i,o]),S=w.useMemo(()=>{if(!p||p.length===0)return{};const N={};return p.forEach(P=>{N[P.metric_name]||(N[P.metric_name]=[]),N[P.metric_name].push(P)}),N},[p]),M=w.useMemo(()=>{const N=new Set;return p==null||p.forEach(P=>{Number.isFinite(P.gpu_index)&&N.add(P.gpu_index)}),N.size>0?Array.from(N).sort((P,k)=>P-k):f!==void 0?[f]:[]},[p,f]),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(P=>{N[P]=C}),N},[M,C]);return d.jsxs("div",{children:[d.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[d.jsxs("span",{children:["Rank ",t]}),n&&e!==null&&e!==void 0&&d.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"relative h-12 bg-muted/30 rounded-lg border border-border/50",children:[_.map((N,P)=>d.jsx(jSe,{idle:N,rank:t,intervalStart:i,intervalDuration:s,dimmed:a!==null},`idle-${P}`)),b.map((N,P)=>{const k=(a==null?void 0:a.eventType)===N.event_type&&(a==null?void 0:a.rank)===N.rank&&(a==null?void 0:a.step)===N.step,O=c.has(`${N.event_type}|${N.step}`),R=a!==null&&!k;return d.jsx(zSe,{event:N,intervalStart:i,intervalDuration:s,isSelected:k,isDimmed:R,hasChildren:O,onClick:()=>l(N)},`${N.start_time}-${N.rank}-${P}`)})]}),M.length>0&&m.map(N=>d.jsxs("div",{className:`mt-2 transition-opacity duration-200 ${x?"opacity-50":""}`,children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-0.5",children:WX(N)}),d.jsx(rq,{metricName:N,data:S[N]??[],gpuIndices:M,intervalStart:i,intervalEnd:o,variant:"timeline",strokeColor:"#ef4444",gpuDisplayNames:A,isLoading:x})]},N))]})]})}function jSe({idle:t,rank:e,intervalStart:n,intervalDuration:r,dimmed:i=!1}){const o=qn(as)?r8:kS,l=(t.start-n)/r*100,c=t.duration/r*100;return c<.5||l<0||l>=100?null:d.jsx(Oc,{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:d.jsx(cu,{title:"Idle",color:o,details:[{label:"Duration",value:ms(t.duration*1e3)},{label:"Rank",value:String(e)}],startTime:t.start,endTime:t.end})})}function zSe({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,_=G2(t.event_type),S=fW(t.event_type,t.step,t.microbatch,t.minibatch);return d.jsx(Oc,{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:d.jsx(cu,{title:S.primary,titleSecondary:S.secondary,color:_,details:[{label:"Duration",value:ms(p)},{label:"Rank",value:String(t.rank)},...s?[{label:"Click",value:"to expand children"}]:[]],startTime:t.start_time,endTime:t.end_time})})}function FSe({parentEvent:t,childEvents:e}){const n=qn(as),r=[...e].sort((l,c)=>l.start_time-c.start_time),i=t.start_time,s=t.end_time,o=s-i,a=fY(r,i,s);return d.jsxs("div",{className:"px-3 pb-2",children:[d.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 text-xs",children:r.map(l=>{const c=G2(l.event_type),f=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 d.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full",style:{backgroundColor:`${c}20`},children:[d.jsx("div",{className:"w-2 h-2 rounded-sm",style:{backgroundColor:c}}),d.jsx("span",{className:"capitalize text-muted-foreground",children:f}),d.jsx("span",{className:"font-medium",children:ms(p*1e3)}),d.jsxs("span",{className:"text-muted-foreground",children:[m,"%"]})]},l.event_type)})}),d.jsx("div",{className:"relative",children:d.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:d.jsx(Oc,{className:"absolute top-px bottom-px group",style:{left:`${p}%`,width:`${Math.min(m,100-p)}%`,backgroundColor:kS,borderRadius:"1px",opacity:.5},tooltip:d.jsx(cu,{title:"Gap",color:kS,details:[{label:"Duration",value:ms(l.duration*1e3)}]})},`child-idle-${c}`)}),r.map((l,c)=>{const f=l.start_time-i,p=Math.max(0,f/o*100),m=l.end_time-l.start_time,x=m*1e3,b=Math.max(.5,m/o*100),_=G2(l.event_type),S=l.event_type.includes("/")?l.event_type.split("/").pop():l.event_type;return d.jsx(Oc,{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:d.jsx(cu,{title:S||l.event_type,color:_,capitalize:!0,details:[{label:"Duration",value:ms(x)},{label:"% of parent",value:`${(m/o*100).toFixed(1)}%`}],startTime:l.start_time,endTime:l.end_time}),children:b>8&&d.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}`)})]})}),d.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[d.jsx("span",{children:ms(0)}),d.jsx("span",{children:ms(o/2*1e3)}),d.jsx("span",{children:ms(o*1e3)})]})]})}function cu({title:t,titleSecondary:e,color:n,details:r,capitalize:i=!1,timestamp:s,startTime:o,endTime:a,statusLabel:l}){return d.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:[d.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:n}}),d.jsxs("span",{className:i?"capitalize":"",children:[t,e&&d.jsx("span",{className:"text-muted-foreground font-normal ml-1",children:e})]})]}),l&&d.jsx("div",{className:`font-semibold mb-1.5 ${l.className}`,children:l.text}),d.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[r.map(c=>d.jsxs("div",{children:[c.label,": ",c.value]},c.label)),s!==void 0&&d.jsxs("div",{children:["Time: ",new Date(s*1e3).toISOString().slice(11,23)]}),o!==void 0&&d.jsxs("div",{children:["Start: ",new Date(o*1e3).toISOString().slice(11,23)]}),a!==void 0&&d.jsxs("div",{children:["End: ",new Date(a*1e3).toISOString().slice(11,23)]})]})]})}function Oc({className:t,style:e,onClick:n,tooltip:r,children:i,interactive:s=!1}){const[o,a]=w.useState(!1),[l,c]=w.useState(!1),[f,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:f;w.useLayoutEffect(()=>{const A=b.current;if(!S||!A)return;const N=A.getBoundingClientRect(),P=8;let k=M.x-N.width/2;k+N.width+P>window.innerWidth&&(k=window.innerWidth-N.width-P),k<P&&(k=P);let O=M.y-N.height-12;O<P&&(O=M.y+16),O+N.height+P>window.innerHeight&&(O=window.innerHeight-N.height-P),A.style.left=`${k}px`,A.style.top=`${O}px`,A.style.visibility="visible"},[S,M]),w.useEffect(()=>{if(!l)return;const A=P=>{var O,R;const k=P.target;(O=b.current)!=null&&O.contains(k)||(R=_.current)!=null&&R.contains(k)||(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(f),!0)),n==null||n()},[s,n,f]);return d.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?ql.createPortal(d.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 fY(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 gD({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 f=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 d.jsxs("div",{className:"flex items-center gap-0.5",children:[d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(0),disabled:r||t===0,title:"First page",children:d.jsx(bue,{className:"h-3.5 w-3.5"})}),d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t-1),disabled:r||t===0,title:"Previous page",children:d.jsx(VT,{className:"h-3.5 w-3.5"})}),d.jsxs("div",{className:"flex items-center gap-1 text-xs px-1",children:[d.jsx(Jd,{type:"number",value:l,onChange:f,onKeyDown:p,onBlur:m,disabled:r,className:"w-12 h-6 text-center px-1 py-0 text-xs",min:o,max:a}),d.jsxs("span",{className:"text-muted-foreground",children:["/ ",a]})]}),d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t+1),disabled:r||t>=e-1,title:"Next page",children:d.jsx(r0,{className:"h-3.5 w-3.5"})}),d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(e-1),disabled:r||t>=e-1,title:"Last page",children:d.jsx(Sue,{className:"h-3.5 w-3.5"})})]})}/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const Gw="183",qg={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Xg={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},hY=0,vR=1,pY=2,USe=3,mY=0,z1=1,aS=2,Jg=3,Ep=0,Zl=1,au=2,uh=0,mx=1,yR=2,bR=3,_R=4,gY=5,BSe=6,Bm=100,xY=101,vY=102,yY=103,bY=104,_Y=200,SY=201,wY=202,MY=203,d5=204,f5=205,TY=206,CY=207,EY=208,AY=209,NY=210,kY=211,RY=212,DY=213,PY=214,h5=0,p5=1,m5=2,Cx=3,g5=4,x5=5,v5=6,y5=7,Ww=0,IY=1,OY=2,mu=0,xD=1,vD=2,yD=3,PC=4,bD=5,_D=6,SD=7,SR="attached",LY="detached",IC=300,ph=301,y0=302,lS=303,cS=304,eb=306,US=1e3,Lc=1001,BS=1002,Oo=1003,wD=1004,HSe=1004,b1=1005,VSe=1005,is=1006,uS=1007,GSe=1007,sh=1008,WSe=1008,Wl=1009,MD=1010,TD=1011,Cy=1012,OC=1013,md=1014,Kl=1015,mh=1016,LC=1017,jC=1018,Ey=1020,CD=35902,ED=35899,AD=1021,ND=1022,vl=1023,gh=1026,Jm=1027,zC=1028,$w=1029,Ex=1030,FC=1031,$Se=1032,UC=1033,dS=33776,fS=33777,hS=33778,pS=33779,b5=35840,_5=35841,S5=35842,w5=35843,M5=36196,T5=37492,C5=37496,E5=37488,A5=37489,N5=37490,k5=37491,R5=37808,D5=37809,P5=37810,I5=37811,O5=37812,L5=37813,j5=37814,z5=37815,F5=37816,U5=37817,B5=37818,H5=37819,V5=37820,G5=37821,W5=36492,$5=36494,q5=36495,X5=36283,Y5=36284,K5=36285,Z5=36286,jY=2200,zY=2201,FY=2202,HS=2300,Q5=2301,f2=2302,wR=2303,ex=2400,tx=2401,VS=2402,BC=2500,kD=2501,qSe=0,XSe=1,YSe=2,UY=3200,BY=3201,KSe=3202,ZSe=3203,U0=0,HY=1,fp="",xl="srgb",b0="srgb-linear",GS="linear",Hi="srgb",QSe="",JSe="rg",ewe="ga",twe=0,Yg=7680,nwe=7681,rwe=7682,iwe=7683,swe=34055,owe=34056,awe=5386,lwe=512,cwe=513,uwe=514,dwe=515,fwe=516,hwe=517,pwe=518,MR=519,VY=512,GY=513,WY=514,HC=515,$Y=516,qY=517,VC=518,XY=519,WS=35044,mwe=35048,gwe=35040,xwe=35045,vwe=35049,ywe=35041,bwe=35046,_we=35050,Swe=35042,wwe="100",TR="300 es",uu=2e3,Ax=2001,Mwe={COMPUTE:"compute",RENDER:"render"},Twe={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Cwe={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Ewe={TEXTURE_COMPARE:"depthTextureCompare"};function Awe(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Nwe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function _1(t,e){return new Nwe[t](e)}function YY(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function $S(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function KY(){const t=$S("canvas");return t.style.display="block",t}const Aj={};let _0=null;function kwe(t){_0=t}function Rwe(){return _0}function qS(...t){const e="THREE."+t.shift();_0?_0("log",e,...t):console.log(e,...t)}function ZY(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 Mn(...t){t=ZY(t);const e="THREE."+t.shift();if(_0)_0("warn",e,...t);else{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function Wn(...t){t=ZY(t);const e="THREE."+t.shift();if(_0)_0("error",e,...t);else{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function XS(...t){const e=t.join(" ");e in Aj||(Aj[e]=!0,Mn(...t))}function Dwe(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 Pwe={[h5]:p5,[m5]:v5,[g5]:y5,[Cx]:x5,[p5]:h5,[v5]:m5,[y5]:g5,[x5]:Cx};let Th=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 Nj=1234567;const gx=Math.PI/180,Ay=180/Math.PI;function gu(){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 hr(t,e,n){return Math.max(e,Math.min(n,t))}function RD(t,e){return(t%e+e)%e}function Iwe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Owe(t,e,n){return t!==e?(n-t)/(e-t):0}function mS(t,e,n){return(1-n)*t+n*e}function Lwe(t,e,n,r){return mS(t,e,1-Math.exp(-n*r))}function jwe(t,e=1){return e-Math.abs(RD(t,e*2)-e)}function zwe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Fwe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Uwe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Bwe(t,e){return t+Math.random()*(e-t)}function Hwe(t){return t*(.5-Math.random())}function Vwe(t){t!==void 0&&(Nj=t);let e=Nj+=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 Gwe(t){return t*gx}function Wwe(t){return t*Ay}function $we(t){return(t&t-1)===0&&t!==0}function qwe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Xwe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Ywe(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),f=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*f,l*p,l*m,a*c);break;case"YZY":t.set(l*m,a*f,l*p,a*c);break;case"ZXZ":t.set(l*p,l*m,a*f,a*c);break;case"XZX":t.set(a*f,l*b,l*x,a*c);break;case"YXY":t.set(l*x,a*f,l*b,a*c);break;case"ZYZ":t.set(l*b,l*x,a*f,a*c);break;default:Mn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function $l(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:gx,RAD2DEG:Ay,generateUUID:gu,clamp:hr,euclideanModulo:RD,mapLinear:Iwe,inverseLerp:Owe,lerp:mS,damp:Lwe,pingpong:jwe,smoothstep:zwe,smootherstep:Fwe,randInt:Uwe,randFloat:Bwe,randFloatSpread:Hwe,seededRandom:Vwe,degToRad:Gwe,radToDeg:Wwe,isPowerOfTwo:$we,ceilPowerOfTwo:qwe,floorPowerOfTwo:Xwe,setQuaternionFromProperEuler:Ywe,normalize:jr,denormalize:$l};class $t{constructor(e=0,n=0){$t.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=hr(this.x,e.x,n.x),this.y=hr(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=hr(this.x,e,n),this.y=hr(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(hr(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(hr(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],f=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||f!==b){let S=l*m+c*x+f*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,f=f*M+b*a,p=p*M+_*a}else{l=l*M+m*a,c=c*M+x*a,f=f*M+b*a,p=p*M+_*a;const C=1/Math.sqrt(l*l+c*c+f*f+p*p);l*=C,c*=C,f*=C,p*=C}}e[n]=l,e[n+1]=c,e[n+2]=f,e[n+3]=p}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],f=r[i+3],p=s[o],m=s[o+1],x=s[o+2],b=s[o+3];return e[n]=a*b+f*p+l*x-c*m,e[n+1]=l*b+f*m+c*p-a*x,e[n+2]=c*b+f*x+a*m-l*p,e[n+3]=f*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),f=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*f*p+c*x*b,this._y=c*x*p-m*f*b,this._z=c*f*b+m*x*p,this._w=c*f*p-m*x*b;break;case"YXZ":this._x=m*f*p+c*x*b,this._y=c*x*p-m*f*b,this._z=c*f*b-m*x*p,this._w=c*f*p+m*x*b;break;case"ZXY":this._x=m*f*p-c*x*b,this._y=c*x*p+m*f*b,this._z=c*f*b+m*x*p,this._w=c*f*p-m*x*b;break;case"ZYX":this._x=m*f*p-c*x*b,this._y=c*x*p+m*f*b,this._z=c*f*b-m*x*p,this._w=c*f*p+m*x*b;break;case"YZX":this._x=m*f*p+c*x*b,this._y=c*x*p+m*f*b,this._z=c*f*b-m*x*p,this._w=c*f*p-m*x*b;break;case"XZY":this._x=m*f*p-c*x*b,this._y=c*x*p-m*f*b,this._z=c*f*b+m*x*p,this._w=c*f*p+m*x*b;break;default:Mn("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],f=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=(f-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=(f-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+f)/x}else{const x=2*Math.sqrt(1+p-r-a);this._w=(o-i)/x,this._x=(s+c)/x,this._y=(l+f)/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(hr(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,f=n._w;return this._x=r*f+o*a+i*c-s*l,this._y=i*f+o*l+s*a-r*c,this._z=s*f+o*c+r*l-i*a,this._w=o*f-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),f=Math.sin(c);l=Math.sin(l*c)/f,n=Math.sin(n*c)/f,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 We{constructor(e=0,n=0,r=0){We.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(kj.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(kj.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),f=2*(a*n-s*i),p=2*(s*r-o*n);return this.x=n+l*c+o*p-a*f,this.y=r+l*f+a*c-s*p,this.z=i+l*p+s*f-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=hr(this.x,e.x,n.x),this.y=hr(this.y,e.y,n.y),this.z=hr(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=hr(this.x,e,n),this.y=hr(this.y,e,n),this.z=hr(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(hr(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(hr(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 We,kj=new Ya;class Er{constructor(e,n,r,i,s,o,a,l,c){Er.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 f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=n,f[4]=s,f[5]=l,f[6]=r,f[7]=o,f[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],f=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],P=i[2],k=i[5],O=i[8];return s[0]=o*_+a*C+l*P,s[3]=o*S+a*A+l*k,s[6]=o*M+a*N+l*O,s[1]=c*_+f*C+p*P,s[4]=c*S+f*A+p*k,s[7]=c*M+f*N+p*O,s[2]=m*_+x*C+b*P,s[5]=m*S+x*A+b*k,s[8]=m*M+x*N+b*O,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],f=e[8];return n*o*f-n*a*c-r*s*f+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],f=e[8],p=f*o-a*c,m=a*l-f*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-f*r)*_,e[2]=(a*r-i*o)*_,e[3]=m*_,e[4]=(f*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 Er,Rj=new Er().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Dj=new Er().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Kwe(){const t={enabled:!0,workingColorSpace:b0,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Hi&&(i.r=yp(i.r),i.g=yp(i.g),i.b=yp(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=F1(i.r),i.g=F1(i.g),i.b=F1(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===fp?GS: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 XS("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return XS("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({[b0]:{primaries:e,whitePoint:r,transfer:GS,toXYZ:Rj,fromXYZ:Dj,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:xl},outputColorSpaceConfig:{drawingBufferColorSpace:xl}},[xl]:{primaries:e,whitePoint:r,transfer:Hi,toXYZ:Rj,fromXYZ:Dj,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:xl}}}),t}const li=Kwe();function yp(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function F1(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Wv;class JY{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{Wv===void 0&&(Wv=$S("canvas")),Wv.width=e.width,Wv.height=e.height;const i=Wv.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Wv}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=$S("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]=yp(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(yp(n[r]/255)*255):n[r]=yp(n[r]);return{data:n,width:e.width,height:e.height}}else return Mn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Zwe=0;class e0{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Zwe++}),this.uuid=gu(),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?JY.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(Mn("Texture: Unable to serialize Texture."),{})}let Qwe=0;const k6=new We;class uo extends Th{constructor(e=uo.DEFAULT_IMAGE,n=uo.DEFAULT_MAPPING,r=Lc,i=Lc,s=is,o=sh,a=vl,l=Wl,c=uo.DEFAULT_ANISOTROPY,f=fp){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Qwe++}),this.uuid=gu(),this.name="",this.source=new e0(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 $t(0,0),this.repeat=new $t(1,1),this.center=new $t(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Er,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,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){Mn(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){Mn(`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!==IC)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case US:e.x=e.x-Math.floor(e.x);break;case Lc:e.x=e.x<0?0:1;break;case BS: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 US:e.y=e.y-Math.floor(e.y);break;case Lc:e.y=e.y<0?0:1;break;case BS: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++}}uo.DEFAULT_IMAGE=null;uo.DEFAULT_MAPPING=IC;uo.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],f=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(f-m)<.01&&Math.abs(p-_)<.01&&Math.abs(b-S)<.01){if(Math.abs(f+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,P=(M+1)/2,k=(f+m)/4,O=(p+_)/4,R=(b+S)/4;return A>N&&A>P?A<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(A),i=k/r,s=O/r):N>P?N<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(N),r=k/i,s=R/i):P<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(P),r=O/s,i=R/s),this.set(r,i,s,n),this}let C=Math.sqrt((S-b)*(S-b)+(p-_)*(p-_)+(m-f)*(m-f));return Math.abs(C)<.001&&(C=1),this.x=(S-b)/C,this.y=(p-_)/C,this.z=(m-f)/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=hr(this.x,e.x,n.x),this.y=hr(this.y,e.y,n.y),this.z=hr(this.z,e.z,n.z),this.w=hr(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=hr(this.x,e,n),this.y=hr(this.y,e,n),this.z=hr(this.z,e,n),this.w=hr(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(hr(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 DD extends Th{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:is,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 uo(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:is,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 e0(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 xu extends DD{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class GC extends uo{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=Oo,this.minFilter=Oo,this.wrapR=Lc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Jwe extends xu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new GC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class WC extends uo{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=Oo,this.minFilter=Oo,this.wrapR=Lc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class e3e extends xu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new WC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class dr{constructor(e,n,r,i,s,o,a,l,c,f,p,m,x,b,_,S){dr.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,f,p,m,x,b,_,S)}set(e,n,r,i,s,o,a,l,c,f,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]=f,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 dr().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/$v.setFromMatrixColumn(e,0).length(),s=1/$v.setFromMatrixColumn(e,1).length(),o=1/$v.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),f=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const m=o*f,x=o*p,b=a*f,_=a*p;n[0]=l*f,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*f,x=l*p,b=c*f,_=c*p;n[0]=m+_*a,n[4]=b*a-x,n[8]=o*c,n[1]=o*p,n[5]=o*f,n[9]=-a,n[2]=x*a-b,n[6]=_+m*a,n[10]=o*l}else if(e.order==="ZXY"){const m=l*f,x=l*p,b=c*f,_=c*p;n[0]=m-_*a,n[4]=-o*p,n[8]=b+x*a,n[1]=x+b*a,n[5]=o*f,n[9]=_-m*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const m=o*f,x=o*p,b=a*f,_=a*p;n[0]=l*f,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*f,n[4]=_-m*p,n[8]=b*p+x,n[1]=p,n[5]=o*f,n[9]=-a*f,n[2]=-c*f,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*f,n[4]=-p,n[8]=c*f,n[1]=m*p+_,n[5]=o*f,n[9]=x*p-b,n[2]=b*p-x,n[6]=a*f,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(t3e,e,n3e)}lookAt(e,n,r){const i=this.elements;return Jc.subVectors(e,n),Jc.lengthSq()===0&&(Jc.z=1),Jc.normalize(),Cm.crossVectors(r,Jc),Cm.lengthSq()===0&&(Math.abs(r.z)===1?Jc.x+=1e-4:Jc.z+=1e-4,Jc.normalize(),Cm.crossVectors(r,Jc)),Cm.normalize(),K4.crossVectors(Jc,Cm),i[0]=Cm.x,i[4]=K4.x,i[8]=Jc.x,i[1]=Cm.y,i[5]=K4.y,i[9]=Jc.y,i[2]=Cm.z,i[6]=K4.z,i[10]=Jc.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],f=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],P=r[15],k=i[0],O=i[4],R=i[8],L=i[12],B=i[1],V=i[5],W=i[9],G=i[13],ee=i[2],H=i[6],q=i[10],J=i[14],K=i[3],ne=i[7],U=i[11],z=i[15];return s[0]=o*k+a*B+l*ee+c*K,s[4]=o*O+a*V+l*H+c*ne,s[8]=o*R+a*W+l*q+c*U,s[12]=o*L+a*G+l*J+c*z,s[1]=f*k+p*B+m*ee+x*K,s[5]=f*O+p*V+m*H+x*ne,s[9]=f*R+p*W+m*q+x*U,s[13]=f*L+p*G+m*J+x*z,s[2]=b*k+_*B+S*ee+M*K,s[6]=b*O+_*V+S*H+M*ne,s[10]=b*R+_*W+S*q+M*U,s[14]=b*L+_*G+S*J+M*z,s[3]=C*k+A*B+N*ee+P*K,s[7]=C*O+A*V+N*H+P*ne,s[11]=C*R+A*W+N*q+P*U,s[15]=C*L+A*G+N*J+P*z,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],f=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,P=o*x-c*f,k=o*m-l*f,O=o*p-a*f;return n*(_*C-S*A+M*N)-r*(b*C-S*P+M*k)+i*(b*A-_*P+M*O)-s*(b*N-_*k+S*O)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],f=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,P=r*l-i*a,k=r*c-s*a,O=i*c-s*l,R=f*_-p*b,L=f*S-m*b,B=f*M-x*b,V=p*S-m*_,W=p*M-x*_,G=m*M-x*S,ee=C*G-A*W+N*V+P*B-k*L+O*R;if(ee===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const H=1/ee;return e[0]=(a*G-l*W+c*V)*H,e[1]=(i*W-r*G-s*V)*H,e[2]=(_*O-S*k+M*P)*H,e[3]=(m*k-p*O-x*P)*H,e[4]=(l*B-o*G-c*L)*H,e[5]=(n*G-i*B+s*L)*H,e[6]=(S*N-b*O-M*A)*H,e[7]=(f*O-m*N+x*A)*H,e[8]=(o*W-a*B+c*R)*H,e[9]=(r*B-n*W-s*R)*H,e[10]=(b*k-_*N+M*C)*H,e[11]=(p*N-f*k-x*C)*H,e[12]=(a*L-o*V-l*R)*H,e[13]=(n*V-r*L+i*R)*H,e[14]=(_*A-b*P-S*C)*H,e[15]=(f*P-p*A+m*C)*H,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,f=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,f*a+r,f*l-i*o,0,c*l-i*a,f*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,f=o+o,p=a+a,m=s*c,x=s*f,b=s*p,_=o*f,S=o*p,M=a*p,C=l*c,A=l*f,N=l*p,P=r.x,k=r.y,O=r.z;return i[0]=(1-(_+M))*P,i[1]=(x+N)*P,i[2]=(b-A)*P,i[3]=0,i[4]=(x-N)*k,i[5]=(1-(m+M))*k,i[6]=(S+C)*k,i[7]=0,i[8]=(b+A)*O,i[9]=(S-C)*O,i[10]=(1-(m+_))*O,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinant();if(s===0)return r.set(1,1,1),n.identity(),this;let o=$v.set(i[0],i[1],i[2]).length();const a=$v.set(i[4],i[5],i[6]).length(),l=$v.set(i[8],i[9],i[10]).length();s<0&&(o=-o),Vd.copy(this);const c=1/o,f=1/a,p=1/l;return Vd.elements[0]*=c,Vd.elements[1]*=c,Vd.elements[2]*=c,Vd.elements[4]*=f,Vd.elements[5]*=f,Vd.elements[6]*=f,Vd.elements[8]*=p,Vd.elements[9]*=p,Vd.elements[10]*=p,n.setFromRotationMatrix(Vd),r.x=o,r.y=a,r.z=l,this}makePerspective(e,n,r,i,s,o,a=uu,l=!1){const c=this.elements,f=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===uu)b=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===Ax)b=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=f,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=uu,l=!1){const c=this.elements,f=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===uu)b=-2/(o-s),_=-(o+s)/(o-s);else if(a===Ax)b=-1/(o-s),_=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=f,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 $v=new We,Vd=new dr,t3e=new We(0,0,0),n3e=new We(1,1,1),Cm=new We,K4=new We,Jc=new We,Pj=new dr,Ij=new Ya;class bu{constructor(e=0,n=0,r=0,i=bu.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],f=i[9],p=i[2],m=i[6],x=i[10];switch(n){case"XYZ":this._y=Math.asin(hr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-hr(f,-1,1)),Math.abs(f)<.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(hr(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(-hr(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(hr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-hr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-f,x),this._y=0);break;default:Mn("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return Pj.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Pj,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Ij.setFromEuler(this),this.setFromQuaternion(Ij,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}}bu.DEFAULT_ORDER="XYZ";class Ny{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 r3e=0;const Oj=new We,qv=new Ya,ep=new dr,Z4=new We,b_=new We,i3e=new We,s3e=new Ya,Lj=new We(1,0,0),jj=new We(0,1,0),zj=new We(0,0,1),Fj={type:"added"},o3e={type:"removed"},Xv={type:"childadded",child:null},R6={type:"childremoved",child:null};class _i extends Th{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:r3e++}),this.uuid=gu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_i.DEFAULT_UP.clone();const e=new We,n=new bu,r=new Ya,i=new We(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 dr},normalMatrix:{value:new Er}}),this.matrix=new dr,this.matrixWorld=new dr,this.matrixAutoUpdate=_i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=_i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ny,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 qv.setFromAxisAngle(e,n),this.quaternion.multiply(qv),this}rotateOnWorldAxis(e,n){return qv.setFromAxisAngle(e,n),this.quaternion.premultiply(qv),this}rotateX(e){return this.rotateOnAxis(Lj,e)}rotateY(e){return this.rotateOnAxis(jj,e)}rotateZ(e){return this.rotateOnAxis(zj,e)}translateOnAxis(e,n){return Oj.copy(e).applyQuaternion(this.quaternion),this.position.add(Oj.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Lj,e)}translateY(e){return this.translateOnAxis(jj,e)}translateZ(e){return this.translateOnAxis(zj,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ep.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Z4.copy(e):Z4.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),b_.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ep.lookAt(b_,Z4,this.up):ep.lookAt(Z4,b_,this.up),this.quaternion.setFromRotationMatrix(ep),i&&(ep.extractRotation(i.matrixWorld),qv.setFromRotationMatrix(ep),this.quaternion.premultiply(qv.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(Fj),Xv.child=e,this.dispatchEvent(Xv),Xv.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(o3e),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),ep.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ep.multiply(e.parent.matrixWorld)),e.applyMatrix4(ep),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Fj),Xv.child=e,this.dispatchEvent(Xv),Xv.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(b_,e,i3e),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(b_,s3e,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,f=l.length;c<f;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),f=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),f.length>0&&(r.images=f),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 f=a[c];delete f.metadata,l.push(f)}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 We(0,1,0);_i.DEFAULT_MATRIX_AUTO_UPDATE=!0;_i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class S1 extends _i{constructor(){super(),this.isGroup=!0,this.type="Group"}}const a3e={type:"move"};class h2{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new S1,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 S1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new We,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new We),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new S1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new We,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new We),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 f=c.joints["index-finger-tip"],p=c.joints["thumb-tip"],m=f.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(a3e)))}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 S1;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const eK={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},Em={h:0,s:0,l:0},Q4={h:0,s:0,l:0};function D6(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 kn{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=RD(e,1),n=hr(n,0,1),r=hr(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=D6(o,s,e+1/3),this.g=D6(o,s,e),this.b=D6(o,s,e-1/3)}return li.colorSpaceToWorking(this,i),this}setStyle(e,n=xl){function r(s){s!==void 0&&parseFloat(s)<1&&Mn("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:Mn("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);Mn("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=xl){const r=eK[e.toLowerCase()];return r!==void 0?this.setHex(r,n):Mn("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=yp(e.r),this.g=yp(e.g),this.b=yp(e.b),this}copyLinearToSRGB(e){return this.r=F1(e.r),this.g=F1(e.g),this.b=F1(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(hr(hl.r*255,0,255))*65536+Math.round(hr(hl.g*255,0,255))*256+Math.round(hr(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 f=(a+o)/2;if(a===o)l=0,c=0;else{const p=o-a;switch(c=f<=.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=f,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(Em),this.setHSL(Em.h+e,Em.s+n,Em.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(Em),e.getHSL(Q4);const r=mS(Em.h,Q4.h,n),i=mS(Em.s,Q4.s,n),s=mS(Em.l,Q4.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 kn;kn.NAMES=eK;class $C{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new kn(e),this.density=n}clone(){return new $C(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class qC{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new kn(e),this.near=n,this.far=r}clone(){return new qC(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let PD=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 bu,this.environmentIntensity=1,this.environmentRotation=new bu,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 Gd=new We,tp=new We,P6=new We,np=new We,Yv=new We,Kv=new We,Uj=new We,I6=new We,O6=new We,L6=new We,j6=new hi,z6=new hi,F6=new hi;class Ic{constructor(e=new We,n=new We,r=new We){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Gd.subVectors(e,n),i.cross(Gd);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){Gd.subVectors(i,n),tp.subVectors(r,n),P6.subVectors(e,n);const o=Gd.dot(Gd),a=Gd.dot(tp),l=Gd.dot(P6),c=tp.dot(tp),f=tp.dot(P6),p=o*c-a*a;if(p===0)return s.set(0,0,0),null;const m=1/p,x=(c*l-a*f)*m,b=(o*f-a*l)*m;return s.set(1-x-b,b,x)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,np)===null?!1:np.x>=0&&np.y>=0&&np.x+np.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,np)===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,np.x),l.addScaledVector(o,np.y),l.addScaledVector(a,np.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 Gd.subVectors(r,n),tp.subVectors(e,n),Gd.cross(tp).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 Gd.subVectors(this.c,this.b),tp.subVectors(this.a,this.b),Gd.cross(tp).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ic.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Ic.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Ic.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Ic.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ic.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;Yv.subVectors(i,r),Kv.subVectors(s,r),I6.subVectors(e,r);const l=Yv.dot(I6),c=Kv.dot(I6);if(l<=0&&c<=0)return n.copy(r);O6.subVectors(e,i);const f=Yv.dot(O6),p=Kv.dot(O6);if(f>=0&&p<=f)return n.copy(i);const m=l*p-f*c;if(m<=0&&l>=0&&f<=0)return o=l/(l-f),n.copy(r).addScaledVector(Yv,o);L6.subVectors(e,s);const x=Yv.dot(L6),b=Kv.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(Kv,a);const S=f*b-x*p;if(S<=0&&p-f>=0&&x-b>=0)return Uj.subVectors(s,i),a=(p-f)/(p-f+(x-b)),n.copy(i).addScaledVector(Uj,a);const M=1/(S+_+m);return o=_*M,a=m*M,n.copy(r).addScaledVector(Yv,o).addScaledVector(Kv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Lo{constructor(e=new We(1/0,1/0,1/0),n=new We(-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(Wd.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Wd.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=Wd.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,Wd):Wd.fromBufferAttribute(s,o),Wd.applyMatrix4(e.matrixWorld),this.expandByPoint(Wd);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),J4.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),J4.copy(r.boundingBox)),J4.applyMatrix4(e.matrixWorld),this.union(J4)}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,Wd),Wd.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(__),eM.subVectors(this.max,__),Zv.subVectors(e.a,__),Qv.subVectors(e.b,__),Jv.subVectors(e.c,__),Am.subVectors(Qv,Zv),Nm.subVectors(Jv,Qv),kg.subVectors(Zv,Jv);let n=[0,-Am.z,Am.y,0,-Nm.z,Nm.y,0,-kg.z,kg.y,Am.z,0,-Am.x,Nm.z,0,-Nm.x,kg.z,0,-kg.x,-Am.y,Am.x,0,-Nm.y,Nm.x,0,-kg.y,kg.x,0];return!U6(n,Zv,Qv,Jv,eM)||(n=[1,0,0,0,1,0,0,0,1],!U6(n,Zv,Qv,Jv,eM))?!1:(tM.crossVectors(Am,Nm),n=[tM.x,tM.y,tM.z],U6(n,Zv,Qv,Jv,eM))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Wd).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Wd).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:(rp[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rp[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rp[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rp[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rp[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rp[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rp[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rp[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rp),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 rp=[new We,new We,new We,new We,new We,new We,new We,new We],Wd=new We,J4=new Lo,Zv=new We,Qv=new We,Jv=new We,Am=new We,Nm=new We,kg=new We,__=new We,eM=new We,tM=new We,Rg=new We;function U6(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Rg.fromArray(t,s);const a=i.x*Math.abs(Rg.x)+i.y*Math.abs(Rg.y)+i.z*Math.abs(Rg.z),l=e.dot(Rg),c=n.dot(Rg),f=r.dot(Rg);if(Math.max(-Math.max(l,c,f),Math.min(l,c,f))>a)return!1}return!0}const hp=l3e();function l3e(){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,f=0;for(;(c&8388608)===0;)c<<=1,f-=8388608;c&=-8388609,f+=947912704,s[l]=c|f}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 Ec(t){Math.abs(t)>65504&&Mn("DataUtils.toHalfFloat(): Value out of range."),t=hr(t,-65504,65504),hp.floatView[0]=t;const e=hp.uint32View[0],n=e>>23&511;return hp.baseTable[n]+((e&8388607)>>hp.shiftTable[n])}function W_(t){const e=t>>10;return hp.uint32View[0]=hp.mantissaTable[hp.offsetTable[e]+(t&1023)]+hp.exponentTable[e],hp.floatView[0]}class c3e{static toHalfFloat(e){return Ec(e)}static fromHalfFloat(e){return W_(e)}}const qo=new We,nM=new $t;let u3e=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:u3e++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=WS,this.updateRanges=[],this.gpuType=Kl,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++)nM.fromBufferAttribute(this,n),nM.applyMatrix3(e),this.setXY(n,nM.x,nM.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)qo.fromBufferAttribute(this,n),qo.applyMatrix3(e),this.setXYZ(n,qo.x,qo.y,qo.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)qo.fromBufferAttribute(this,n),qo.applyMatrix4(e),this.setXYZ(n,qo.x,qo.y,qo.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)qo.fromBufferAttribute(this,n),qo.applyNormalMatrix(e),this.setXYZ(n,qo.x,qo.y,qo.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)qo.fromBufferAttribute(this,n),qo.transformDirection(e),this.setXYZ(n,qo.x,qo.y,qo.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=$l(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=$l(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=$l(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=$l(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=$l(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!==WS&&(e.usage=this.usage),e}}class d3e extends $i{constructor(e,n,r){super(new Int8Array(e),n,r)}}class f3e extends $i{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class h3e extends $i{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class p3e extends $i{constructor(e,n,r){super(new Int16Array(e),n,r)}}class ID extends $i{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class m3e extends $i{constructor(e,n,r){super(new Int32Array(e),n,r)}}class OD extends $i{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class g3e extends $i{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=W_(this.array[e*this.itemSize]);return this.normalized&&(n=$l(n,this.array)),n}setX(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize]=Ec(n),this}getY(e){let n=W_(this.array[e*this.itemSize+1]);return this.normalized&&(n=$l(n,this.array)),n}setY(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+1]=Ec(n),this}getZ(e){let n=W_(this.array[e*this.itemSize+2]);return this.normalized&&(n=$l(n,this.array)),n}setZ(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+2]=Ec(n),this}getW(e){let n=W_(this.array[e*this.itemSize+3]);return this.normalized&&(n=$l(n,this.array)),n}setW(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+3]=Ec(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]=Ec(n),this.array[e+1]=Ec(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]=Ec(n),this.array[e+1]=Ec(r),this.array[e+2]=Ec(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]=Ec(n),this.array[e+1]=Ec(r),this.array[e+2]=Ec(i),this.array[e+3]=Ec(s),this}}class On extends $i{constructor(e,n,r){super(new Float32Array(e),n,r)}}const x3e=new Lo,S_=new We,B6=new We;class Jo{constructor(e=new We,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):x3e.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;S_.subVectors(e,this.center);const n=S_.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(S_,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(B6.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(S_.copy(e.center).add(B6)),this.expandByPoint(S_.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 v3e=0;const Yu=new dr,H6=new _i,e1=new We,eu=new Lo,w_=new Lo,Ma=new We;class Ar extends Th{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:v3e++}),this.uuid=gu(),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(Awe(e)?OD:ID)(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 Er().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 Yu.makeRotationFromQuaternion(e),this.applyMatrix4(Yu),this}rotateX(e){return Yu.makeRotationX(e),this.applyMatrix4(Yu),this}rotateY(e){return Yu.makeRotationY(e),this.applyMatrix4(Yu),this}rotateZ(e){return Yu.makeRotationZ(e),this.applyMatrix4(Yu),this}translate(e,n,r){return Yu.makeTranslation(e,n,r),this.applyMatrix4(Yu),this}scale(e,n,r){return Yu.makeScale(e,n,r),this.applyMatrix4(Yu),this}lookAt(e){return H6.lookAt(e),H6.updateMatrix(),this.applyMatrix4(H6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(e1).negate(),this.translate(e1.x,e1.y,e1.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 On(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&&Mn("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 Lo);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 We(-1/0,-1/0,-1/0),new We(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];eu.setFromBufferAttribute(s),this.morphTargetsRelative?(Ma.addVectors(this.boundingBox.min,eu.min),this.boundingBox.expandByPoint(Ma),Ma.addVectors(this.boundingBox.max,eu.max),this.boundingBox.expandByPoint(Ma)):(this.boundingBox.expandByPoint(eu.min),this.boundingBox.expandByPoint(eu.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 Jo);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 We,1/0);return}if(e){const r=this.boundingSphere.center;if(eu.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const a=n[s];w_.setFromBufferAttribute(a),this.morphTargetsRelative?(Ma.addVectors(eu.min,w_.min),eu.expandByPoint(Ma),Ma.addVectors(eu.max,w_.max),eu.expandByPoint(Ma)):(eu.expandByPoint(w_.min),eu.expandByPoint(w_.max))}eu.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,f=a.count;c<f;c++)Ma.fromBufferAttribute(a,c),l&&(e1.fromBufferAttribute(e,c),Ma.add(e1)),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 R=0;R<r.count;R++)a[R]=new We,l[R]=new We;const c=new We,f=new We,p=new We,m=new $t,x=new $t,b=new $t,_=new We,S=new We;function M(R,L,B){c.fromBufferAttribute(r,R),f.fromBufferAttribute(r,L),p.fromBufferAttribute(r,B),m.fromBufferAttribute(s,R),x.fromBufferAttribute(s,L),b.fromBufferAttribute(s,B),f.sub(c),p.sub(c),x.sub(m),b.sub(m);const V=1/(x.x*b.y-b.x*x.y);isFinite(V)&&(_.copy(f).multiplyScalar(b.y).addScaledVector(p,-x.y).multiplyScalar(V),S.copy(p).multiplyScalar(x.x).addScaledVector(f,-b.x).multiplyScalar(V),a[R].add(_),a[L].add(_),a[B].add(_),l[R].add(S),l[L].add(S),l[B].add(S))}let C=this.groups;C.length===0&&(C=[{start:0,count:e.count}]);for(let R=0,L=C.length;R<L;++R){const B=C[R],V=B.start,W=B.count;for(let G=V,ee=V+W;G<ee;G+=3)M(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const A=new We,N=new We,P=new We,k=new We;function O(R){P.fromBufferAttribute(i,R),k.copy(P);const L=a[R];A.copy(L),A.sub(P.multiplyScalar(P.dot(L))).normalize(),N.crossVectors(k,L);const V=N.dot(l[R])<0?-1:1;o.setXYZW(R,A.x,A.y,A.z,V)}for(let R=0,L=C.length;R<L;++R){const B=C[R],V=B.start,W=B.count;for(let G=V,ee=V+W;G<ee;G+=3)O(e.getX(G+0)),O(e.getX(G+1)),O(e.getX(G+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 We,s=new We,o=new We,a=new We,l=new We,c=new We,f=new We,p=new We;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),f.subVectors(o,s),p.subVectors(i,s),f.cross(p),a.fromBufferAttribute(r,b),l.fromBufferAttribute(r,_),c.fromBufferAttribute(r,S),a.add(f),l.add(f),c.add(f),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),f.subVectors(o,s),p.subVectors(i,s),f.cross(p),r.setXYZ(m+0,f.x,f.y,f.z),r.setXYZ(m+1,f.x,f.y,f.z),r.setXYZ(m+2,f.x,f.y,f.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,f=a.itemSize,p=a.normalized,m=new c.constructor(l.length*f);let x=0,b=0;for(let _=0,S=l.length;_<S;_++){a.isInterleavedBufferAttribute?x=l[_]*a.data.stride+a.offset:x=l[_]*f;for(let M=0;M<f;M++)m[b++]=c[x++]}return new $i(m,f,p)}if(this.index===null)return Mn("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 f=0,p=c.length;f<p;f++){const m=c[f],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],f=[];for(let p=0,m=c.length;p<m;p++){const x=c[p];f.push(x.toJSON(e.data))}f.length>0&&(i[l]=f,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 f=i[c];this.setAttribute(c,f.clone(n))}const s=e.morphAttributes;for(const c in s){const f=[],p=s[c];for(let m=0,x=p.length;m<x;m++)f.push(p[m].clone(n));this.morphAttributes[c]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,f=o.length;c<f;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 XC{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=WS,this.updateRanges=[],this.version=0,this.uuid=gu()}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=gu()),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=gu()),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 Fl=new We;class du{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++)Fl.fromBufferAttribute(this,n),Fl.applyMatrix4(e),this.setXYZ(n,Fl.x,Fl.y,Fl.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Fl.fromBufferAttribute(this,n),Fl.applyNormalMatrix(e),this.setXYZ(n,Fl.x,Fl.y,Fl.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Fl.fromBufferAttribute(this,n),Fl.transformDirection(e),this.setXYZ(n,Fl.x,Fl.y,Fl.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=$l(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=$l(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=$l(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=$l(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=$l(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){qS("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 du(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){qS("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 y3e=0;class Ml extends Th{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:y3e++}),this.uuid=gu(),this.name="",this.type="Material",this.blending=mx,this.side=Ep,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=d5,this.blendDst=f5,this.blendEquation=Bm,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new kn(0,0,0),this.blendAlpha=0,this.depthFunc=Cx,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=MR,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Yg,this.stencilZFail=Yg,this.stencilZPass=Yg,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){Mn(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){Mn(`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!==mx&&(r.blending=this.blending),this.side!==Ep&&(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!==d5&&(r.blendSrc=this.blendSrc),this.blendDst!==f5&&(r.blendDst=this.blendDst),this.blendEquation!==Bm&&(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!==Cx&&(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!==MR&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yg&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Yg&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Yg&&(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 LD extends Ml{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new kn(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 t1;const M_=new We,n1=new We,r1=new We,i1=new $t,T_=new $t,tK=new dr,rM=new We,C_=new We,iM=new We,Bj=new $t,V6=new $t,Hj=new $t;class nK extends _i{constructor(e=new LD){if(super(),this.isSprite=!0,this.type="Sprite",t1===void 0){t1=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 XC(n,5);t1.setIndex([0,1,2,0,2,3]),t1.setAttribute("position",new du(r,3,0,!1)),t1.setAttribute("uv",new du(r,2,3,!1))}this.geometry=t1,this.material=e,this.center=new $t(.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.'),n1.setFromMatrixScale(this.matrixWorld),tK.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),r1.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&n1.multiplyScalar(-r1.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const o=this.center;sM(rM.set(-.5,-.5,0),r1,o,n1,i,s),sM(C_.set(.5,-.5,0),r1,o,n1,i,s),sM(iM.set(.5,.5,0),r1,o,n1,i,s),Bj.set(0,0),V6.set(1,0),Hj.set(1,1);let a=e.ray.intersectTriangle(rM,C_,iM,!1,M_);if(a===null&&(sM(C_.set(-.5,.5,0),r1,o,n1,i,s),V6.set(0,1),a=e.ray.intersectTriangle(rM,iM,C_,!1,M_),a===null))return;const l=e.ray.origin.distanceTo(M_);l<e.near||l>e.far||n.push({distance:l,point:M_.clone(),uv:Ic.getInterpolation(M_,rM,C_,iM,Bj,V6,Hj,new $t),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 sM(t,e,n,r,i,s){i1.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(T_.x=s*i1.x-i*i1.y,T_.y=i*i1.x+s*i1.y):T_.copy(i1),t.copy(e),t.x+=T_.x,t.y+=T_.y,t.applyMatrix4(tK)}const oM=new We,Vj=new We;class rK 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){oM.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(oM);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){oM.setFromMatrixPosition(e.matrixWorld),Vj.setFromMatrixPosition(this.matrixWorld);const r=oM.distanceTo(Vj)/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 ip=new We,G6=new We,aM=new We,km=new We,W6=new We,lM=new We,$6=new We;class Hx{constructor(e=new We,n=new We(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,ip)),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=ip.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(ip.copy(this.origin).addScaledVector(this.direction,n),ip.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){G6.copy(e).add(n).multiplyScalar(.5),aM.copy(n).sub(e).normalize(),km.copy(this.origin).sub(G6);const s=e.distanceTo(n)*.5,o=-this.direction.dot(aM),a=km.dot(this.direction),l=-km.dot(aM),c=km.lengthSq(),f=Math.abs(1-o*o);let p,m,x,b;if(f>0)if(p=o*l-a,m=o*a-l,b=s*f,p>=0)if(m>=-b)if(m<=b){const _=1/f;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(aM,m),x}intersectSphere(e,n){ip.subVectors(e.center,this.origin);const r=ip.dot(this.direction),i=ip.dot(ip)-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,f=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),f>=0?(s=(e.min.y-m.y)*f,o=(e.max.y-m.y)*f):(s=(e.max.y-m.y)*f,o=(e.min.y-m.y)*f),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,ip)!==null}intersectTriangle(e,n,r,i,s){W6.subVectors(n,e),lM.subVectors(r,e),$6.crossVectors(W6,lM);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;km.subVectors(this.origin,e);const l=a*this.direction.dot(lM.crossVectors(km,lM));if(l<0)return null;const c=a*this.direction.dot(W6.cross(km));if(c<0||l+c>o)return null;const f=-a*km.dot($6);return f<0?null:this.at(f/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 Ip extends Ml{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new kn(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 bu,this.combine=Ww,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 Gj=new dr,Dg=new Hx,cM=new Jo,Wj=new We,uM=new We,dM=new We,fM=new We,q6=new We,hM=new We,$j=new We,pM=new We;class qs extends _i{constructor(e=new Ar,n=new Ip){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){hM.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const f=a[l],p=s[l];f!==0&&(q6.fromBufferAttribute(p,e),o?hM.addScaledVector(q6,f):hM.addScaledVector(q6.sub(n),f))}n.add(hM)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),cM.copy(r.boundingSphere),cM.applyMatrix4(s),Dg.copy(e.ray).recast(e.near),!(cM.containsPoint(Dg.origin)===!1&&(Dg.intersectSphere(cM,Wj)===null||Dg.origin.distanceToSquared(Wj)>(e.far-e.near)**2))&&(Gj.copy(s).invert(),Dg.copy(e.ray).applyMatrix4(Gj),!(r.boundingBox!==null&&Dg.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Dg)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,f=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,P=A;N<P;N+=3){const k=a.getX(N),O=a.getX(N+1),R=a.getX(N+2);i=mM(this,M,e,r,c,f,p,k,O,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=S.materialIndex,n.push(i))}}else{const b=Math.max(0,x.start),_=Math.min(a.count,x.start+x.count);for(let S=b,M=_;S<M;S+=3){const C=a.getX(S),A=a.getX(S+1),N=a.getX(S+2);i=mM(this,o,e,r,c,f,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,P=A;N<P;N+=3){const k=N,O=N+1,R=N+2;i=mM(this,M,e,r,c,f,p,k,O,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=S.materialIndex,n.push(i))}}else{const b=Math.max(0,x.start),_=Math.min(l.count,x.start+x.count);for(let S=b,M=_;S<M;S+=3){const C=S,A=S+1,N=S+2;i=mM(this,o,e,r,c,f,p,C,A,N),i&&(i.faceIndex=Math.floor(S/3),n.push(i))}}}}function b3e(t,e,n,r,i,s,o,a){let l;if(e.side===Zl?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===Ep,a),l===null)return null;pM.copy(a),pM.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(pM);return c<n.near||c>n.far?null:{distance:c,point:pM.clone(),object:t}}function mM(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,uM),t.getVertexPosition(l,dM),t.getVertexPosition(c,fM);const f=b3e(t,e,n,r,uM,dM,fM,$j);if(f){const p=new We;Ic.getBarycoord($j,uM,dM,fM,p),i&&(f.uv=Ic.getInterpolatedAttribute(i,a,l,c,p,new $t)),s&&(f.uv1=Ic.getInterpolatedAttribute(s,a,l,c,p,new $t)),o&&(f.normal=Ic.getInterpolatedAttribute(o,a,l,c,p,new We),f.normal.dot(r.direction)>0&&f.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new We,materialIndex:0};Ic.getNormal(uM,dM,fM,m.normal),f.face=m,f.barycoord=p}return f}const qj=new We,Xj=new hi,Yj=new hi,_3e=new We,Kj=new dr,gM=new We,X6=new Jo,Zj=new dr,Y6=new Hx;class iK extends qs{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=SR,this.bindMatrix=new dr,this.bindMatrixInverse=new dr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Lo),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,gM),this.boundingBox.expandByPoint(gM)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Jo),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,gM),this.boundingSphere.expandByPoint(gM)}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&&(Zj.copy(i).invert(),Y6.copy(e.ray).applyMatrix4(Zj),!(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===SR?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===LY?this.bindMatrixInverse.copy(this.bindMatrix).invert():Mn("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;Xj.fromBufferAttribute(i.attributes.skinIndex,e),Yj.fromBufferAttribute(i.attributes.skinWeight,e),qj.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const o=Yj.getComponent(s);if(o!==0){const a=Xj.getComponent(s);Kj.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),n.addScaledVector(_3e.copy(qj).applyMatrix4(Kj),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}class jD extends _i{constructor(){super(),this.isBone=!0,this.type="Bone"}}class tf extends uo{constructor(e=null,n=1,r=1,i,s,o,a,l,c=Oo,f=Oo,p,m){super(null,o,a,l,c,f,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 Qj=new dr,S3e=new dr;class YC{constructor(e=[],n=[]){this.uuid=gu(),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){Mn("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 dr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new dr;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:S3e;Qj.multiplyMatrices(a,n[s]),Qj.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new YC(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 tf(n,e,e,vl,Kl);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&&(Mn("Skeleton: No bone found with UUID:",s),o=new jD),this.bones.push(o),this.boneInverses.push(new dr().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 Nx 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 s1=new dr,Jj=new dr,xM=[],ez=new Lo,w3e=new dr,E_=new qs,A_=new Jo;class sK extends qs{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new Nx(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,w3e)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new Lo),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,s1),ez.copy(e.boundingBox).applyMatrix4(s1),this.boundingBox.union(ez)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Jo),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,s1),A_.copy(e.boundingSphere).applyMatrix4(s1),this.boundingSphere.union(A_)}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(E_.geometry=this.geometry,E_.material=this.material,E_.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),A_.copy(this.boundingSphere),A_.applyMatrix4(r),e.ray.intersectsSphere(A_)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,s1),Jj.multiplyMatrices(r,s1),E_.matrixWorld=Jj,E_.raycast(e,xM);for(let o=0,a=xM.length;o<a;o++){const l=xM[o];l.instanceId=s,l.object=this,n.push(l)}xM.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new Nx(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 tf(new Float32Array(i*this.count),i,this.count,zC,Kl));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 We,M3e=new We,T3e=new Er;class cp{constructor(e=new We(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(M3e.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||T3e.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 Pg=new Jo,C3e=new $t(.5,.5),vM=new We;class tb{constructor(e=new cp,n=new cp,r=new cp,i=new cp,s=new cp,o=new cp){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=uu,r=!1){const i=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],f=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],P=s[15];if(i[0].setComponents(c-o,x-f,M-b,P-C).normalize(),i[1].setComponents(c+o,x+f,M+b,P+C).normalize(),i[2].setComponents(c+a,x+p,M+_,P+A).normalize(),i[3].setComponents(c-a,x-p,M-_,P-A).normalize(),r)i[4].setComponents(l,m,S,N).normalize(),i[5].setComponents(c-l,x-m,M-S,P-N).normalize();else if(i[4].setComponents(c-l,x-m,M-S,P-N).normalize(),n===uu)i[5].setComponents(c+l,x+m,M+S,P+N).normalize();else if(n===Ax)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(),Pg.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Pg.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Pg)}intersectsSprite(e){Pg.center.set(0,0,0);const n=C3e.distanceTo(e.center);return Pg.radius=.7071067811865476+n,Pg.applyMatrix4(e.matrixWorld),this.intersectsSphere(Pg)}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(vM.x=i.normal.x>0?e.max.x:e.min.x,vM.y=i.normal.y>0?e.max.y:e.min.y,vM.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(vM)<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 Ff=new dr,Uf=new tb;class KC{constructor(){this.coordinateSystem=uu}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(Ff.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Uf.setFromProjectionMatrix(Ff,i.coordinateSystem,i.reversedDepth),Uf.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(Ff.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Uf.setFromProjectionMatrix(Ff,i.coordinateSystem,i.reversedDepth),Uf.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(Ff.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Uf.setFromProjectionMatrix(Ff,i.coordinateSystem,i.reversedDepth),Uf.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(Ff.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Uf.setFromProjectionMatrix(Ff,i.coordinateSystem,i.reversedDepth),Uf.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(Ff.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Uf.setFromProjectionMatrix(Ff,i.coordinateSystem,i.reversedDepth),Uf.containsPoint(e))return!0}return!1}clone(){return new KC}}function Z6(t,e){return t-e}function E3e(t,e){return t.z-e.z}function A3e(t,e){return e.z-t.z}class N3e{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 Tc=new dr,k3e=new kn(1,1,1),tz=new tb,R3e=new KC,yM=new Lo,Ig=new Jo,N_=new We,nz=new We,D3e=new We,Q6=new N3e,pl=new qs,bM=[];function P3e(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 Og(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 oK extends qs{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 tf(n,e,e,vl,Kl);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new tf(n,e,e,$w,md);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 tf(n,e,e,vl,Kl);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,f=new a.constructor(r*l),p=new $i(f,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 Lo);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,Tc),this.getBoundingBoxAt(s,yM).applyMatrix4(Tc),e.union(yM)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Jo);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,Tc),this.getBoundingSphereAt(s,Ig).applyMatrix4(Tc),e.union(Ig)}}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;Tc.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(k3e.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 f in r.attributes){const p=n.getAttribute(f),m=r.getAttribute(f);P3e(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 f=a.indexStart,p=a.reservedIndexCount;a.indexCount=n.getIndex().count;for(let m=0;m<o.count;m++)s.setX(f+m,l+o.getX(m));for(let m=o.count,x=p;m<x;m++)s.setX(f+m,l);s.needsUpdate=!0,s.addUpdateRange(f,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:f,vertexStart:p,reservedIndexCount:m}=c,x=s.index,b=x.array,_=e-p;for(let S=f;S<f+m;S++)b[S]=b[S]+_;x.array.copyWithin(n,f,f+m),x.addUpdateRange(n,m),x.needsUpdate=!0,c.indexStart=n}n+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:f,reservedVertexCount:p}=c,m=s.attributes;for(const x in m){const b=m[x],{array:_,itemSize:S}=b;_.copyWithin(e*S,f*S,(f+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 Lo,o=r.index,a=r.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let f=l;o&&(f=o.getX(f)),s.expandByPoint(N_.fromBufferAttribute(a,f))}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 Jo;this.getBoundingBoxAt(e,yM),yM.getCenter(s.center);const o=r.index,a=r.attributes.position;let l=0;for(let c=i.start,f=i.start+i.count;c<f;c++){let p=c;o&&(p=o.getX(p)),N_.fromBufferAttribute(a,p),l=Math.max(l,s.center.distanceToSquared(N_))}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);Og(this._multiDrawCounts,i),Og(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(),Og(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),Og(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),Og(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&&Og(s.index.array,o.index.array);for(const a in s.attributes)Og(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 Lo),pl.geometry.boundingSphere===null&&(pl.geometry.boundingSphere=new Jo);for(let a=0,l=r.length;a<l;a++){if(!r[a].visible||!r[a].active)continue;const c=r[a].geometryIndex,f=i[c];pl.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(a,pl.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,pl.geometry.boundingBox),this.getBoundingSphereAt(c,pl.geometry.boundingSphere),pl.raycast(e,bM);for(let p=0,m=bM.length;p<m;p++){const x=bM[p];x.object=this,x.batchId=a,n.push(x)}bM.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,f=this._multiDrawStarts,p=this._multiDrawCounts,m=this._geometryInfo,x=this.perObjectFrustumCulled,b=this._indirectTexture,_=b.image.data,S=r.isArrayCamera?R3e:tz;x&&!r.isArrayCamera&&(Tc.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),tz.setFromProjectionMatrix(Tc,r.coordinateSystem,r.reversedDepth));let M=0;if(this.sortObjects){Tc.copy(this.matrixWorld).invert(),N_.setFromMatrixPosition(r.matrixWorld).applyMatrix4(Tc),nz.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(Tc);for(let N=0,P=c.length;N<P;N++)if(c[N].visible&&c[N].active){const k=c[N].geometryIndex;this.getMatrixAt(N,Tc),this.getBoundingSphereAt(k,Ig).applyMatrix4(Tc);let O=!1;if(x&&(O=!S.intersectsSphere(Ig,r)),!O){const R=m[k],L=D3e.subVectors(Ig.center,N_).dot(nz);Q6.push(R.start,R.count,L,N)}}const C=Q6.list,A=this.customSort;A===null?C.sort(s.transparent?A3e:E3e):A.call(this,C,r);for(let N=0,P=C.length;N<P;N++){const k=C[N];f[M]=k.start*a*l,p[M]=k.count*l,_[M]=k.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 P=!1;if(x&&(this.getMatrixAt(C,Tc),this.getBoundingSphereAt(N,Ig).applyMatrix4(Tc),P=!S.intersectsSphere(Ig,r)),!P){const k=m[N];f[M]=k.start*a*l,p[M]=k.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 ec extends Ml{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new kn(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 J5=new We,eT=new We,rz=new dr,k_=new Hx,_M=new Jo,J6=new We,iz=new We;let S0=class extends _i{constructor(e=new Ar,n=new ec){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++)J5.fromBufferAttribute(n,i-1),eT.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=J5.distanceTo(eT);e.setAttribute("lineDistance",new On(r,1))}else Mn("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(),_M.copy(r.boundingSphere),_M.applyMatrix4(i),_M.radius+=s,e.ray.intersectsSphere(_M)===!1)return;rz.copy(i).invert(),k_.copy(e.ray).applyMatrix4(rz);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,f=r.index,m=r.attributes.position;if(f!==null){const x=Math.max(0,o.start),b=Math.min(f.count,o.start+o.count);for(let _=x,S=b-1;_<S;_+=c){const M=f.getX(_),C=f.getX(_+1),A=SM(this,e,k_,l,M,C,_);A&&n.push(A)}if(this.isLineLoop){const _=f.getX(b-1),S=f.getX(x),M=SM(this,e,k_,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=SM(this,e,k_,l,_,_+1,_);M&&n.push(M)}if(this.isLineLoop){const _=SM(this,e,k_,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 SM(t,e,n,r,i,s,o){const a=t.geometry.attributes.position;if(J5.fromBufferAttribute(a,i),eT.fromBufferAttribute(a,s),n.distanceSqToSegment(J5,eT,J6,iz)>r)return;J6.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(J6);if(!(c<e.near||c>e.far))return{distance:c,point:iz.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const sz=new We,oz=new We;class Ch extends S0{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)sz.fromBufferAttribute(n,i),oz.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+sz.distanceTo(oz);e.setAttribute("lineDistance",new On(r,1))}else Mn("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class aK extends S0{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class zD extends Ml{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new kn(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 az=new dr,CR=new Hx,wM=new Jo,MM=new We;class lK extends _i{constructor(e=new Ar,n=new zD){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(),wM.copy(r.boundingSphere),wM.applyMatrix4(i),wM.radius+=s,e.ray.intersectsSphere(wM)===!1)return;az.copy(i).invert(),CR.copy(e.ray).applyMatrix4(az);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);MM.fromBufferAttribute(p,S),lz(MM,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++)MM.fromBufferAttribute(p,b),lz(MM,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 lz(t,e,n,r,i,s,o){const a=CR.distanceSqToPoint(t);if(a<n){const l=new We;CR.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 cK extends uo{constructor(e,n,r,i,s=is,o=is,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const f=this;function p(){f.needsUpdate=!0,f._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 I3e extends cK{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 O3e extends uo{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Oo,this.minFilter=Oo,this.generateMipmaps=!1,this.needsUpdate=!0}}class ZC extends uo{constructor(e,n,r,i,s,o,a,l,c,f,p,m){super(null,o,a,l,c,f,i,s,p,m),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class L3e extends ZC{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Lc,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class j3e extends ZC{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,ph),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class qw extends uo{constructor(e=[],n=ph,r,i,s,o,a,l,c,f){super(e,n,r,i,s,o,a,l,c,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class z3e extends uo{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 ky extends uo{constructor(e,n,r=md,i,s,o,a=Oo,l=Oo,c,f=gh,p=1){if(f!==gh&&f!==Jm)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,f,r,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new e0(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 uK extends ky{constructor(e,n=md,r=ph,i,s,o=Oo,a=Oo,l,c=gh){const f={width:e,height:e,depth:1},p=[f,f,f,f,f,f];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 FD extends uo{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Vx 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=[],f=[],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 On(c,3)),this.setAttribute("normal",new On(f,3)),this.setAttribute("uv",new On(p,2));function b(_,S,M,C,A,N,P,k,O,R,L){const B=N/O,V=P/R,W=N/2,G=P/2,ee=k/2,H=O+1,q=R+1;let J=0,K=0;const ne=new We;for(let U=0;U<q;U++){const z=U*V-G;for(let Y=0;Y<H;Y++){const j=Y*B-W;ne[_]=j*C,ne[S]=z*A,ne[M]=ee,c.push(ne.x,ne.y,ne.z),ne[_]=0,ne[S]=0,ne[M]=k>0?1:-1,f.push(ne.x,ne.y,ne.z),p.push(Y/O),p.push(1-U/R),J+=1}}for(let U=0;U<R;U++)for(let z=0;z<O;z++){const Y=m+z+H*U,j=m+z+H*(U+1),le=m+(z+1)+H*(U+1),ce=m+(z+1)+H*U;l.push(Y,j,ce),l.push(j,le,ce),K+=6}a.addGroup(x,K,L),x+=K,m+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vx(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class QC 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=[],f=n/2,p=Math.PI/2*e,m=n,x=2*p+m,b=r*2+s,_=i+1,S=new We,M=new We;for(let C=0;C<=b;C++){let A=0,N=0,P=0,k=0;if(C<=r){const L=C/r,B=L*Math.PI/2;N=-f-e*Math.cos(B),P=e*Math.sin(B),k=-e*Math.cos(B),A=L*p}else if(C<=r+s){const L=(C-r)/s;N=-f+L*n,P=e,k=0,A=p+L*m}else{const L=(C-r-s)/r,B=L*Math.PI/2;N=f+e*Math.sin(B),P=e*Math.cos(B),k=e*Math.sin(B),A=p+m+L*p}const O=Math.max(0,Math.min(1,A/x));let R=0;C===0?R=.5/i:C===b&&(R=-.5/i);for(let L=0;L<=i;L++){const B=L/i,V=B*Math.PI*2,W=Math.sin(V),G=Math.cos(V);M.x=-P*G,M.y=N,M.z=P*W,a.push(M.x,M.y,M.z),S.set(-P*G,k,P*W),S.normalize(),l.push(S.x,S.y,S.z),c.push(B+R,O)}if(C>0){const L=(C-1)*_;for(let B=0;B<i;B++){const V=L+B,W=L+B+1,G=C*_+B,ee=C*_+B+1;o.push(V,W,G),o.push(W,ee,G)}}}this.setIndex(o),this.setAttribute("position",new On(a,3)),this.setAttribute("normal",new On(l,3)),this.setAttribute("uv",new On(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new QC(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class JC 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 We,f=new $t;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),f.x=(o[m]/e+1)/2,f.y=(o[m+1]/e+1)/2,l.push(f.x,f.y)}for(let p=1;p<=n;p++)s.push(p,p+1,0);this.setIndex(s),this.setAttribute("position",new On(o,3)),this.setAttribute("normal",new On(a,3)),this.setAttribute("uv",new On(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new JC(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xw 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 f=[],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(f),this.setAttribute("position",new On(p,3)),this.setAttribute("normal",new On(m,3)),this.setAttribute("uv",new On(x,2));function C(){const N=new We,P=new We;let k=0;const O=(n-e)/r;for(let R=0;R<=s;R++){const L=[],B=R/s,V=B*(n-e)+e;for(let W=0;W<=i;W++){const G=W/i,ee=G*l+a,H=Math.sin(ee),q=Math.cos(ee);P.x=V*H,P.y=-B*r+S,P.z=V*q,p.push(P.x,P.y,P.z),N.set(H,O,q).normalize(),m.push(N.x,N.y,N.z),x.push(G,1-B),L.push(b++)}_.push(L)}for(let R=0;R<i;R++)for(let L=0;L<s;L++){const B=_[L][R],V=_[L+1][R],W=_[L+1][R+1],G=_[L][R+1];(e>0||L!==0)&&(f.push(B,V,G),k+=3),(n>0||L!==s-1)&&(f.push(V,W,G),k+=3)}c.addGroup(M,k,0),M+=k}function A(N){const P=b,k=new $t,O=new We;let R=0;const L=N===!0?e:n,B=N===!0?1:-1;for(let W=1;W<=i;W++)p.push(0,S*B,0),m.push(0,B,0),x.push(.5,.5),b++;const V=b;for(let W=0;W<=i;W++){const ee=W/i*l+a,H=Math.cos(ee),q=Math.sin(ee);O.x=L*q,O.y=S*B,O.z=L*H,p.push(O.x,O.y,O.z),m.push(0,B,0),k.x=H*.5+.5,k.y=q*.5*B+.5,x.push(k.x,k.y),b++}for(let W=0;W<i;W++){const G=P+W,ee=V+W;N===!0?f.push(ee,ee+1,G):f.push(ee+1,ee,G),R+=3}c.addGroup(M,R,N===!0?1:2),M+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Xw(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Yw extends Xw{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 Yw(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class B0 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),f(),this.setAttribute("position",new On(s,3)),this.setAttribute("normal",new On(s.slice(),3)),this.setAttribute("uv",new On(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(C){const A=new We,N=new We,P=new We;for(let k=0;k<n.length;k+=3)x(n[k+0],A),x(n[k+1],N),x(n[k+2],P),l(A,N,P,C)}function l(C,A,N,P){const k=P+1,O=[];for(let R=0;R<=k;R++){O[R]=[];const L=C.clone().lerp(N,R/k),B=A.clone().lerp(N,R/k),V=k-R;for(let W=0;W<=V;W++)W===0&&R===k?O[R][W]=L:O[R][W]=L.clone().lerp(B,W/V)}for(let R=0;R<k;R++)for(let L=0;L<2*(k-R)-1;L++){const B=Math.floor(L/2);L%2===0?(m(O[R][B+1]),m(O[R+1][B]),m(O[R][B])):(m(O[R][B+1]),m(O[R+1][B+1]),m(O[R+1][B]))}}function c(C){const A=new We;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 f(){const C=new We;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,P=M(C)/Math.PI+.5;o.push(N,1-P)}b(),p()}function p(){for(let C=0;C<o.length;C+=6){const A=o[C+0],N=o[C+2],P=o[C+4],k=Math.max(A,N,P),O=Math.min(A,N,P);k>.9&&O<.1&&(A<.2&&(o[C+0]+=1),N<.2&&(o[C+2]+=1),P<.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 We,A=new We,N=new We,P=new We,k=new $t,O=new $t,R=new $t;for(let L=0,B=0;L<s.length;L+=9,B+=6){C.set(s[L+0],s[L+1],s[L+2]),A.set(s[L+3],s[L+4],s[L+5]),N.set(s[L+6],s[L+7],s[L+8]),k.set(o[B+0],o[B+1]),O.set(o[B+2],o[B+3]),R.set(o[B+4],o[B+5]),P.copy(C).add(A).add(N).divideScalar(3);const V=S(P);_(k,B+0,C,V),_(O,B+2,A,V),_(R,B+4,N,V)}}function _(C,A,N,P){P<0&&C.x===1&&(o[A]=C.x-1),N.x===0&&N.z===0&&(o[A]=P/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 B0(e.vertices,e.indices,e.radius,e.detail)}}class eE extends B0{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 eE(e.radius,e.detail)}}const TM=new We,CM=new We,eN=new We,EM=new Ic;class UD 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(gx*n),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],f=["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}=EM;if(_.fromBufferAttribute(a,c[0]),S.fromBufferAttribute(a,c[1]),M.fromBufferAttribute(a,c[2]),EM.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],P=p[A],k=EM[f[C]],O=EM[f[A]],R=`${N}_${P}`,L=`${P}_${N}`;L in m&&m[L]?(eN.dot(m[L].normal)<=s&&(x.push(k.x,k.y,k.z),x.push(O.x,O.y,O.z)),m[L]=null):R in m||(m[R]={index0:c[C],index1:c[A],normal:eN.clone()})}}for(const b in m)if(m[b]){const{index0:_,index1:S}=m[b];TM.fromBufferAttribute(a,_),CM.fromBufferAttribute(a,S),x.push(TM.x,TM.y,TM.z),x.push(CM.x,CM.y,CM.z)}this.setAttribute("position",new On(x,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class uf{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Mn("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 f=r[i],m=r[i+1]-f,x=(o-f)/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 $t:new We);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 We,i=[],s=[],o=[],a=new We,l=new dr;for(let x=0;x<=e;x++){const b=x/e;i[x]=this.getTangentAt(b,new We)}s[0]=new We,o[0]=new We;let c=Number.MAX_VALUE;const f=Math.abs(i[0].x),p=Math.abs(i[0].y),m=Math.abs(i[0].z);f<=c&&(c=f,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(hr(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(hr(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 tE extends uf{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 $t){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 f=Math.cos(this.aRotation),p=Math.sin(this.aRotation),m=l-this.aX,x=c-this.aY;l=m*f-x*p+this.aX,c=m*p+x*f+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 dK extends tE{constructor(e,n,r,i,s,o){super(e,n,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function BD(){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,f,p){let m=(o-s)/c-(a-s)/(c+f)+(a-o)/f,x=(a-o)/f-(l-o)/(f+p)+(l-a)/p;m*=f,x*=f,i(o,a,m,x)},calc:function(s){const o=s*s,a=o*s;return t+e*s+n*o+r*a}}}const AM=new We,tN=new BD,nN=new BD,rN=new BD;class fK extends uf{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 We){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,f;this.closed||a>0?c=i[(a-1)%s]:(AM.subVectors(i[0],i[1]).add(i[0]),c=AM);const p=i[a%s],m=i[(a+1)%s];if(this.closed||a+2<s?f=i[(a+2)%s]:(AM.subVectors(i[s-1],i[s-2]).add(i[s-1]),f=AM),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(f),x);_<1e-4&&(_=1),b<1e-4&&(b=_),S<1e-4&&(S=_),tN.initNonuniformCatmullRom(c.x,p.x,m.x,f.x,b,_,S),nN.initNonuniformCatmullRom(c.y,p.y,m.y,f.y,b,_,S),rN.initNonuniformCatmullRom(c.z,p.z,m.z,f.z,b,_,S)}else this.curveType==="catmullrom"&&(tN.initCatmullRom(c.x,p.x,m.x,f.x,this.tension),nN.initCatmullRom(c.y,p.y,m.y,f.y,this.tension),rN.initCatmullRom(c.z,p.z,m.z,f.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 We().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function cz(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 F3e(t,e){const n=1-t;return n*n*e}function U3e(t,e){return 2*(1-t)*t*e}function B3e(t,e){return t*t*e}function gS(t,e,n,r){return F3e(t,e)+U3e(t,n)+B3e(t,r)}function H3e(t,e){const n=1-t;return n*n*n*e}function V3e(t,e){const n=1-t;return 3*n*n*t*e}function G3e(t,e){return 3*(1-t)*t*t*e}function W3e(t,e){return t*t*t*e}function xS(t,e,n,r,i){return H3e(t,e)+V3e(t,n)+G3e(t,r)+W3e(t,i)}class HD extends uf{constructor(e=new $t,n=new $t,r=new $t,i=new $t){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new $t){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(xS(e,i.x,s.x,o.x,a.x),xS(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 hK extends uf{constructor(e=new We,n=new We,r=new We,i=new We){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new We){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(xS(e,i.x,s.x,o.x,a.x),xS(e,i.y,s.y,o.y,a.y),xS(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 VD extends uf{constructor(e=new $t,n=new $t){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new $t){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 $t){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 pK extends uf{constructor(e=new We,n=new We){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new We){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 We){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 GD extends uf{constructor(e=new $t,n=new $t,r=new $t){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new $t){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(gS(e,i.x,s.x,o.x),gS(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 WD extends uf{constructor(e=new We,n=new We,r=new We){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new We){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(gS(e,i.x,s.x,o.x),gS(e,i.y,s.y,o.y),gS(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 $D extends uf{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new $t){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],f=i[o>i.length-2?i.length-1:o+1],p=i[o>i.length-3?i.length-1:o+2];return r.set(cz(a,l.x,c.x,f.x,p.x),cz(a,l.y,c.y,f.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 $t().fromArray(i))}return this}}var tT=Object.freeze({__proto__:null,ArcCurve:dK,CatmullRomCurve3:fK,CubicBezierCurve:HD,CubicBezierCurve3:hK,EllipseCurve:tE,LineCurve:VD,LineCurve3:pK,QuadraticBezierCurve:GD,QuadraticBezierCurve3:WD,SplineCurve:$D});class mK extends uf{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 tT[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 f=l[c];r&&r.equals(f)||(n.push(f),r=f)}}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 tT[i.type]().fromJSON(i))}return this}}class nT extends mK{constructor(e){super(),this.type="Path",this.currentPoint=new $t,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 VD(this.currentPoint.clone(),new $t(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new GD(this.currentPoint.clone(),new $t(e,n),new $t(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,o){const a=new HD(this.currentPoint.clone(),new $t(e,n),new $t(r,i),new $t(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new $D(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,f=this.currentPoint.y;return this.absellipse(e+c,n+f,r,i,s,o,a,l),this}absellipse(e,n,r,i,s,o,a,l){const c=new tE(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 f=c.getPoint(1);return this.currentPoint.copy(f),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 i0 extends nT{constructor(e){super(e),this.uuid=gu(),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 nT().fromJSON(i))}return this}}function $3e(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=gK(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=Z3e(t,e,s,n)),t.length>80*n){a=t[0],l=t[1];let f=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>f&&(f=x),b>p&&(p=b)}c=Math.max(f-a,p-l),c=c!==0?32767/c:0}return YS(s,o,n,a,l,c,0),o}function gK(t,e,n,r,i){let s;if(i===l4e(t,e,n,r)>0)for(let o=e;o<n;o+=r)s=uz(o/r|0,t[o],t[o+1],s);else for(let o=n-r;o>=e;o-=r)s=uz(o/r|0,t[o],t[o+1],s);return s&&Ry(s,s.next)&&(ZS(s),s=s.next),s}function kx(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(Ry(n,n.next)||lo(n.prev,n,n.next)===0)){if(ZS(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function YS(t,e,n,r,i,s,o){if(!t)return;!o&&s&&n4e(t,r,i,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?X3e(t,r,i,s):q3e(t)){e.push(l.i,t.i,c.i),ZS(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Y3e(kx(t),e),YS(t,e,n,r,i,s,2)):o===2&&K3e(t,e,n,r,i,s):YS(kx(t),e,n,r,i,s,1);break}}}function q3e(t){const e=t.prev,n=t,r=t.next;if(lo(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,f=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>=f&&b.x<=m&&b.y>=p&&b.y<=x&&$_(i,a,s,l,o,c,b.x,b.y)&&lo(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function X3e(t,e,n,r){const i=t.prev,s=t,o=t.next;if(lo(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,f=i.y,p=s.y,m=o.y,x=Math.min(a,l,c),b=Math.min(f,p,m),_=Math.max(a,l,c),S=Math.max(f,p,m),M=ER(x,b,e,n,r),C=ER(_,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&&$_(a,f,l,p,c,m,A.x,A.y)&&lo(A.prev,A,A.next)>=0||(A=A.prevZ,N.x>=x&&N.x<=_&&N.y>=b&&N.y<=S&&N!==i&&N!==o&&$_(a,f,l,p,c,m,N.x,N.y)&&lo(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&&$_(a,f,l,p,c,m,A.x,A.y)&&lo(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&&$_(a,f,l,p,c,m,N.x,N.y)&&lo(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function Y3e(t,e){let n=t;do{const r=n.prev,i=n.next.next;!Ry(r,i)&&vK(r,n,n.next,i)&&KS(r,i)&&KS(i,r)&&(e.push(r.i,n.i,i.i),ZS(n),ZS(n.next),n=t=i),n=n.next}while(n!==t);return kx(n)}function K3e(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&s4e(o,a)){let l=yK(o,a);o=kx(o,o.next),l=kx(l,l.next),YS(o,e,n,r,i,s,0),YS(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Z3e(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=gK(t,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(i4e(c))}i.sort(Q3e);for(let s=0;s<i.length;s++)n=J3e(i[s],n);return n}function Q3e(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 J3e(t,e){const n=e4e(t,e);if(!n)return e;const r=yK(n,t);return kx(r,r.next),kx(n,n.next)}function e4e(t,e){let n=e;const r=t.x,i=t.y;let s=-1/0,o;if(Ry(t,n))return n;do{if(Ry(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 f=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&xK(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)){const p=Math.abs(i-n.y)/(r-n.x);KS(n,t)&&(p<f||p===f&&(n.x>o.x||n.x===o.x&&t4e(o,n)))&&(o=n,f=p)}n=n.next}while(n!==a);return o}function t4e(t,e){return lo(t.prev,t,e.prev)<0&&lo(e.next,t,t.next)<0}function n4e(t,e,n,r){let i=t;do i.z===0&&(i.z=ER(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,r4e(i)}function r4e(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 ER(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 i4e(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 xK(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 $_(t,e,n,r,i,s,o,a){return!(t===o&&e===a)&&xK(t,e,n,r,i,s,o,a)}function s4e(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!o4e(t,e)&&(KS(t,e)&&KS(e,t)&&a4e(t,e)&&(lo(t.prev,t,e.prev)||lo(t,e.prev,e))||Ry(t,e)&&lo(t.prev,t,t.next)>0&&lo(e.prev,e,e.next)>0)}function lo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ry(t,e){return t.x===e.x&&t.y===e.y}function vK(t,e,n,r){const i=kM(lo(t,e,n)),s=kM(lo(t,e,r)),o=kM(lo(n,r,t)),a=kM(lo(n,r,e));return!!(i!==s&&o!==a||i===0&&NM(t,n,e)||s===0&&NM(t,r,e)||o===0&&NM(n,t,r)||a===0&&NM(n,e,r))}function NM(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 kM(t){return t>0?1:t<0?-1:0}function o4e(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&&vK(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function KS(t,e){return lo(t.prev,t,t.next)<0?lo(t,e,t.next)>=0&&lo(t,t.prev,e)>=0:lo(t,e,t.prev)<0||lo(t,t.next,e)<0}function a4e(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 yK(t,e){const n=AR(t.i,t.x,t.y),r=AR(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 uz(t,e,n,r){const i=AR(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 ZS(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 AR(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function l4e(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 c4e{static triangulate(e,n,r=2){return $3e(e,n,r)}}class ef{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 ef.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];dz(e),fz(r,e);let o=e.length;n.forEach(dz);for(let l=0;l<n.length;l++)i.push(o),o+=n[l].length,fz(r,n[l]);const a=c4e.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function dz(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function fz(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class nE extends Ar{constructor(e=new i0([new $t(.5,.5),new $t(-.5,.5),new $t(-.5,-.5),new $t(.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 On(i,3)),this.setAttribute("uv",new On(s,2)),this.computeVertexNormals();function o(a){const l=[],c=n.curveSegments!==void 0?n.curveSegments:12,f=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:u4e;let A,N=!1,P,k,O,R;if(M){A=M.getSpacedPoints(f),N=!0,m=!1;const de=M.isCatmullRomCurve3?M.closed:!1;P=M.computeFrenetFrames(f,de),k=new We,O=new We,R=new We}m||(S=0,x=0,b=0,_=0);const L=a.extractPoints(c);let B=L.shape;const V=L.holes;if(!ef.isClockWise(B)){B=B.reverse();for(let de=0,Me=V.length;de<Me;de++){const Te=V[de];ef.isClockWise(Te)&&(V[de]=Te.reverse())}}function G(de){const Te=10000000000000001e-36;let Pe=de[0];for(let oe=1;oe<=de.length;oe++){const Ve=oe%de.length,He=de[Ve],ze=He.x-Pe.x,Ge=He.y-Pe.y,ae=ze*ze+Ge*Ge,Z=Math.max(Math.abs(He.x),Math.abs(He.y),Math.abs(Pe.x),Math.abs(Pe.y)),ge=Te*Z*Z;if(ae<=ge){de.splice(Ve,1),oe--;continue}Pe=He}}G(B),V.forEach(G);const ee=V.length,H=B;for(let de=0;de<ee;de++){const Me=V[de];B=B.concat(Me)}function q(de,Me,Te){return Me||Wn("ExtrudeGeometry: vec does not exist"),de.clone().addScaledVector(Me,Te)}const J=B.length;function K(de,Me,Te){let Pe,oe,Ve;const He=de.x-Me.x,ze=de.y-Me.y,Ge=Te.x-de.x,ae=Te.y-de.y,Z=He*He+ze*ze,ge=He*ae-ze*Ge;if(Math.abs(ge)>Number.EPSILON){const we=Math.sqrt(Z),_e=Math.sqrt(Ge*Ge+ae*ae),ve=Me.x-ze/we,Ue=Me.y+He/we,Se=Te.x-ae/_e,ke=Te.y+Ge/_e,qe=((Se-ve)*ae-(ke-Ue)*Ge)/(He*ae-ze*Ge);Pe=ve+He*qe-de.x,oe=Ue+ze*qe-de.y;const Je=Pe*Pe+oe*oe;if(Je<=2)return new $t(Pe,oe);Ve=Math.sqrt(Je/2)}else{let we=!1;He>Number.EPSILON?Ge>Number.EPSILON&&(we=!0):He<-Number.EPSILON?Ge<-Number.EPSILON&&(we=!0):Math.sign(ze)===Math.sign(ae)&&(we=!0),we?(Pe=-ze,oe=He,Ve=Math.sqrt(Z)):(Pe=He,oe=ze,Ve=Math.sqrt(Z/2))}return new $t(Pe/Ve,oe/Ve)}const ne=[];for(let de=0,Me=H.length,Te=Me-1,Pe=de+1;de<Me;de++,Te++,Pe++)Te===Me&&(Te=0),Pe===Me&&(Pe=0),ne[de]=K(H[de],H[Te],H[Pe]);const U=[];let z,Y=ne.concat();for(let de=0,Me=ee;de<Me;de++){const Te=V[de];z=[];for(let Pe=0,oe=Te.length,Ve=oe-1,He=Pe+1;Pe<oe;Pe++,Ve++,He++)Ve===oe&&(Ve=0),He===oe&&(He=0),z[Pe]=K(Te[Pe],Te[Ve],Te[He]);U.push(z),Y=Y.concat(z)}let j;if(S===0)j=ef.triangulateShape(H,V);else{const de=[],Me=[];for(let Te=0;Te<S;Te++){const Pe=Te/S,oe=x*Math.cos(Pe*Math.PI/2),Ve=b*Math.sin(Pe*Math.PI/2)+_;for(let He=0,ze=H.length;He<ze;He++){const Ge=q(H[He],ne[He],Ve);Q(Ge.x,Ge.y,-oe),Pe===0&&de.push(Ge)}for(let He=0,ze=ee;He<ze;He++){const Ge=V[He];z=U[He];const ae=[];for(let Z=0,ge=Ge.length;Z<ge;Z++){const we=q(Ge[Z],z[Z],Ve);Q(we.x,we.y,-oe),Pe===0&&ae.push(we)}Pe===0&&Me.push(ae)}}j=ef.triangulateShape(de,Me)}const le=j.length,ce=b+_;for(let de=0;de<J;de++){const Me=m?q(B[de],Y[de],ce):B[de];N?(O.copy(P.normals[0]).multiplyScalar(Me.x),k.copy(P.binormals[0]).multiplyScalar(Me.y),R.copy(A[0]).add(O).add(k),Q(R.x,R.y,R.z)):Q(Me.x,Me.y,0)}for(let de=1;de<=f;de++)for(let Me=0;Me<J;Me++){const Te=m?q(B[Me],Y[Me],ce):B[Me];N?(O.copy(P.normals[de]).multiplyScalar(Te.x),k.copy(P.binormals[de]).multiplyScalar(Te.y),R.copy(A[de]).add(O).add(k),Q(R.x,R.y,R.z)):Q(Te.x,Te.y,p/f*de)}for(let de=S-1;de>=0;de--){const Me=de/S,Te=x*Math.cos(Me*Math.PI/2),Pe=b*Math.sin(Me*Math.PI/2)+_;for(let oe=0,Ve=H.length;oe<Ve;oe++){const He=q(H[oe],ne[oe],Pe);Q(He.x,He.y,p+Te)}for(let oe=0,Ve=V.length;oe<Ve;oe++){const He=V[oe];z=U[oe];for(let ze=0,Ge=He.length;ze<Ge;ze++){const ae=q(He[ze],z[ze],Pe);N?Q(ae.x,ae.y+A[f-1].y,A[f-1].x+Te):Q(ae.x,ae.y,p+Te)}}}X(),ie();function X(){const de=i.length/3;if(m){let Me=0,Te=J*Me;for(let Pe=0;Pe<le;Pe++){const oe=j[Pe];ue(oe[2]+Te,oe[1]+Te,oe[0]+Te)}Me=f+S*2,Te=J*Me;for(let Pe=0;Pe<le;Pe++){const oe=j[Pe];ue(oe[0]+Te,oe[1]+Te,oe[2]+Te)}}else{for(let Me=0;Me<le;Me++){const Te=j[Me];ue(Te[2],Te[1],Te[0])}for(let Me=0;Me<le;Me++){const Te=j[Me];ue(Te[0]+J*f,Te[1]+J*f,Te[2]+J*f)}}r.addGroup(de,i.length/3-de,0)}function ie(){const de=i.length/3;let Me=0;fe(H,Me),Me+=H.length;for(let Te=0,Pe=V.length;Te<Pe;Te++){const oe=V[Te];fe(oe,Me),Me+=oe.length}r.addGroup(de,i.length/3-de,1)}function fe(de,Me){let Te=de.length;for(;--Te>=0;){const Pe=Te;let oe=Te-1;oe<0&&(oe=de.length-1);for(let Ve=0,He=f+S*2;Ve<He;Ve++){const ze=J*Ve,Ge=J*(Ve+1),ae=Me+Pe+ze,Z=Me+oe+ze,ge=Me+oe+Ge,we=Me+Pe+Ge;he(ae,Z,ge,we)}}}function Q(de,Me,Te){l.push(de),l.push(Me),l.push(Te)}function ue(de,Me,Te){se(de),se(Me),se(Te);const Pe=i.length/3,oe=C.generateTopUV(r,i,Pe-3,Pe-2,Pe-1);Ce(oe[0]),Ce(oe[1]),Ce(oe[2])}function he(de,Me,Te,Pe){se(de),se(Me),se(Pe),se(Me),se(Te),se(Pe);const oe=i.length/3,Ve=C.generateSideWallUV(r,i,oe-6,oe-3,oe-2,oe-1);Ce(Ve[0]),Ce(Ve[1]),Ce(Ve[3]),Ce(Ve[1]),Ce(Ve[2]),Ce(Ve[3])}function se(de){i.push(l[de*3+0]),i.push(l[de*3+1]),i.push(l[de*3+2])}function Ce(de){s.push(de.x),s.push(de.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 d4e(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 tT[i.type]().fromJSON(i)),new nE(r,e.options)}}const u4e={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],f=e[i*3+1];return[new $t(s,o),new $t(a,l),new $t(c,f)]},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],f=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-f)<Math.abs(o-c)?[new $t(o,1-l),new $t(c,1-p),new $t(m,1-b),new $t(_,1-M)]:[new $t(a,1-l),new $t(f,1-p),new $t(x,1-b),new $t(S,1-M)]}};function d4e(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 rE extends B0{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 rE(e.radius,e.detail)}}class iE extends Ar{constructor(e=[new $t(0,-.5),new $t(.5,0),new $t(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=hr(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],f=1/n,p=new We,m=new $t,x=new We,b=new We,_=new We;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*f*i,N=Math.sin(A),P=Math.cos(A);for(let k=0;k<=e.length-1;k++){p.x=e[k].x*N,p.y=e[k].y,p.z=e[k].x*P,o.push(p.x,p.y,p.z),m.x=C/n,m.y=k/(e.length-1),a.push(m.x,m.y);const O=l[3*k+0]*N,R=l[3*k+1],L=l[3*k+0]*P;c.push(O,R,L)}}for(let C=0;C<n;C++)for(let A=0;A<e.length-1;A++){const N=A+C*e.length,P=N,k=N+e.length,O=N+e.length+1,R=N+1;s.push(P,k,R),s.push(O,R,k)}this.setIndex(s),this.setAttribute("position",new On(o,3)),this.setAttribute("uv",new On(a,2)),this.setAttribute("normal",new On(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iE(e.points,e.segments,e.phiStart,e.phiLength)}}class Kw extends B0{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 Kw(e.radius,e.detail)}}class Op 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,f=l+1,p=e/a,m=n/l,x=[],b=[],_=[],S=[];for(let M=0;M<f;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),P=C+1+c*(M+1),k=C+1+c*M;x.push(A,N,k),x.push(N,P,k)}this.setIndex(x),this.setAttribute("position",new On(b,3)),this.setAttribute("normal",new On(_,3)),this.setAttribute("uv",new On(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Op(e.width,e.height,e.widthSegments,e.heightSegments)}}class sE 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=[],f=[];let p=e;const m=(n-e)/i,x=new We,b=new $t;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,f.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,P=C+r+2,k=C+1;a.push(A,N,k),a.push(N,P,k)}}this.setIndex(a),this.setAttribute("position",new On(l,3)),this.setAttribute("normal",new On(c,3)),this.setAttribute("uv",new On(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sE(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class oE extends Ar{constructor(e=new i0([new $t(0,.5),new $t(-.5,-.5),new $t(.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 f=0;f<e.length;f++)c(e[f]),this.addGroup(a,l,f),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new On(i,3)),this.setAttribute("normal",new On(s,3)),this.setAttribute("uv",new On(o,2));function c(f){const p=i.length/3,m=f.extractPoints(n);let x=m.shape;const b=m.holes;ef.isClockWise(x)===!1&&(x=x.reverse());for(let S=0,M=b.length;S<M;S++){const C=b[S];ef.isClockWise(C)===!0&&(b[S]=C.reverse())}const _=ef.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,P=C[2]+p;r.push(A,N,P),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 f4e(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 oE(r,e.curveSegments)}}function f4e(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 Zw 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 f=[],p=new We,m=new We,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 P=0;P<=n;P++){const k=P/n;p.x=-e*Math.cos(i+k*s)*Math.sin(o+A*a),p.y=e*Math.cos(o+A*a),p.z=e*Math.sin(i+k*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(k+N,1-A),C.push(c++)}f.push(C)}for(let M=0;M<r;M++)for(let C=0;C<n;C++){const A=f[M][C+1],N=f[M][C],P=f[M+1][C],k=f[M+1][C+1];(M!==0||o>0)&&x.push(A,N,k),(M!==r-1||l<Math.PI)&&x.push(N,P,k)}this.setIndex(x),this.setAttribute("position",new On(b,3)),this.setAttribute("normal",new On(_,3)),this.setAttribute("uv",new On(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zw(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class aE extends B0{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 aE(e.radius,e.detail)}}class lE 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=[],f=[],p=[],m=new We,x=new We,b=new We;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(),f.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 On(c,3)),this.setAttribute("normal",new On(f,3)),this.setAttribute("uv",new On(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lE(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class cE 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=[],f=[],p=new We,m=new We,x=new We,b=new We,_=new We,S=new We,M=new We;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 P=0;P<=i;++P){const k=P/i*Math.PI*2,O=-n*Math.cos(k),R=n*Math.sin(k);p.x=x.x+(O*M.x+R*_.x),p.y=x.y+(O*M.y+R*_.y),p.z=x.z+(O*M.z+R*_.z),l.push(p.x,p.y,p.z),m.subVectors(p,x).normalize(),c.push(m.x,m.y,m.z),f.push(A/r),f.push(P/i)}}for(let A=1;A<=r;A++)for(let N=1;N<=i;N++){const P=(i+1)*(A-1)+(N-1),k=(i+1)*A+(N-1),O=(i+1)*A+N,R=(i+1)*(A-1)+N;a.push(P,k,R),a.push(k,O,R)}this.setIndex(a),this.setAttribute("position",new On(l,3)),this.setAttribute("normal",new On(c,3)),this.setAttribute("uv",new On(f,2));function C(A,N,P,k,O){const R=Math.cos(A),L=Math.sin(A),B=P/N*A,V=Math.cos(B);O.x=k*(2+V)*.5*R,O.y=k*(2+V)*L*.5,O.z=k*Math.sin(B)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cE(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class uE extends Ar{constructor(e=new WD(new We(-1,-1,0),new We(-1,1,0),new We(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 We,l=new We,c=new $t;let f=new We;const p=[],m=[],x=[],b=[];_(),this.setIndex(b),this.setAttribute("position",new On(p,3)),this.setAttribute("normal",new On(m,3)),this.setAttribute("uv",new On(x,2));function _(){for(let A=0;A<n;A++)S(A);S(s===!1?n:0),C(),M()}function S(A){f=e.getPointAt(A/n,f);const N=o.normals[A],P=o.binormals[A];for(let k=0;k<=i;k++){const O=k/i*Math.PI*2,R=Math.sin(O),L=-Math.cos(O);l.x=L*N.x+R*P.x,l.y=L*N.y+R*P.y,l.z=L*N.z+R*P.z,l.normalize(),m.push(l.x,l.y,l.z),a.x=f.x+r*l.x,a.y=f.y+r*l.y,a.z=f.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 P=(i+1)*(A-1)+(N-1),k=(i+1)*A+(N-1),O=(i+1)*A+N,R=(i+1)*(A-1)+N;b.push(P,k,R),b.push(k,O,R)}}function C(){for(let A=0;A<=n;A++)for(let N=0;N<=i;N++)c.x=A/n,c.y=N/i,x.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new uE(new tT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class qD extends Ar{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new We,s=new We;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,f=l.length;c<f;++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),hz(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 f=3*a+c,p=3*a+(c+1)%3;i.fromBufferAttribute(o,f),s.fromBufferAttribute(o,p),hz(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new On(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function hz(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 pz=Object.freeze({__proto__:null,BoxGeometry:Vx,CapsuleGeometry:QC,CircleGeometry:JC,ConeGeometry:Yw,CylinderGeometry:Xw,DodecahedronGeometry:eE,EdgesGeometry:UD,ExtrudeGeometry:nE,IcosahedronGeometry:rE,LatheGeometry:iE,OctahedronGeometry:Kw,PlaneGeometry:Op,PolyhedronGeometry:B0,RingGeometry:sE,ShapeGeometry:oE,SphereGeometry:Zw,TetrahedronGeometry:aE,TorusGeometry:lE,TorusKnotGeometry:cE,TubeGeometry:uE,WireframeGeometry:qD});class bK extends Ml{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new kn(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 Dy(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?(Mn("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 Bl(t){const e={};for(let n=0;n<t.length;n++){const r=Dy(t[n]);for(const i in r)e[i]=r[i]}return e}function h4e(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function _K(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:li.workingColorSpace}const QS={clone:Dy,merge:Bl};var p4e=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,m4e=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class _u extends Ml{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=p4e,this.fragmentShader=m4e,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=Dy(e.uniforms),this.uniformsGroups=h4e(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 XD extends _u{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class YD extends Ml{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new kn(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 kn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=U0,this.normalScale=new $t(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 bu,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 SK extends YD{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 $t(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return hr(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 kn(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 kn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new kn(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 wK extends Ml{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new kn(16777215),this.specular=new kn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new kn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=U0,this.normalScale=new $t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new bu,this.combine=Ww,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 MK extends Ml{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new kn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new kn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=U0,this.normalScale=new $t(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 TK extends Ml{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=U0,this.normalScale=new $t(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 CK extends Ml{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new kn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new kn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=U0,this.normalScale=new $t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new bu,this.combine=Ww,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 dE extends Ml{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=UY,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 fE extends Ml{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class EK extends Ml{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new kn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=U0,this.normalScale=new $t(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 AK extends ec{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 nx(t,e){return!t||t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function NK(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function NR(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 KD(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 g4e(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],f=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;_<f;++_)m.push(c.values[x*f+_])}}p.length!==0&&(c.times=nx(p,c.times.constructor),c.values=nx(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 x4e(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 f=0;const p=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=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=f,C=p-f;_=a.values.slice(M,C)}else if(s>=a.times[b]){const M=b*p+f,C=M+p-f;_=a.values.slice(M,C)}else{const M=a.createInterpolant(),C=f,A=p-f;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=kD,t}class v4e{static convertArray(e,n){return nx(e,n)}static isTypedArray(e){return YY(e)}static getKeyframeOrder(e){return NK(e)}static sortedArray(e,n,r){return NR(e,n,r)}static flattenJSON(e,n,r,i){KD(e,n,r,i)}static subclip(e,n,r,i,s=30){return g4e(e,n,r,i,s)}static makeClipAdditive(e,n=0,r=e,i=30){return x4e(e,n,r,i)}}class nb{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 kK extends nb{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:ex,endingEnd:ex}}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 tx:s=e,a=2*n-r;break;case VS: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 tx:o=e,l=2*r-n;break;case VS:o=1,l=r+i[1]-i[0];break;default:o=e-1,l=n}const c=(r-n)*.5,f=this.valueSize;this._weightPrev=c/(n-a),this._weightNext=c/(l-r),this._offsetPrev=s*f,this._offsetNext=o*f}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,f=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 P=0;P!==a;++P)s[P]=M*o[f+P]+C*o[c+P]+A*o[l+P]+N*o[p+P];return s}}class ZD extends nb{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,f=(r-n)/(i-n),p=1-f;for(let m=0;m!==a;++m)s[m]=o[c+m]*p+o[l+m]*f;return s}}class RK extends nb{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class DK extends nb{interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,f=this.settings||this.DefaultSettings_,p=f.inTangents,m=f.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],P=e*x+_*2,k=p[P],O=p[P+1];let R=(r-n)/(i-n),L,B,V,W,G;for(let ee=0;ee<8;ee++){L=R*R,B=L*R,V=1-R,W=V*V,G=W*V;const q=G*n+3*W*R*A+3*V*L*k+B*i-r;if(Math.abs(q)<1e-10)break;const J=3*W*(A-n)+6*V*R*(k-A)+3*L*(i-k);if(Math.abs(J)<1e-10)break;R=R-q/J,R=Math.max(0,Math.min(1,R))}s[_]=G*S+3*W*R*N+3*V*L*O+B*M}return s}}class vd{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=nx(n,this.TimeBufferType),this.values=nx(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:nx(e.times,Array),values:nx(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new RK(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ZD(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new kK(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const n=new DK(this.times,this.values,this.getValueSize(),e);return this.settings&&(n.settings=this.settings),n}setInterpolation(e){let n;switch(e){case HS:n=this.InterpolantFactoryMethodDiscrete;break;case Q5:n=this.InterpolantFactoryMethodLinear;break;case f2:n=this.InterpolantFactoryMethodSmooth;break;case wR:n=this.InterpolantFactoryMethodBezier;break}if(n===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return Mn("KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return HS;case this.InterpolantFactoryMethodLinear:return Q5;case this.InterpolantFactoryMethodSmooth:return f2;case this.InterpolantFactoryMethodBezier:return wR}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]+=e}return this}scale(e){if(e!==1){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]*=e}return this}trim(e,n){const r=this.times,i=r.length;let s=0,o=i-1;for(;s!==i&&r[s]<e;)++s;for(;o!==-1&&r[o]>n;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(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&&YY(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()===f2,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],f=e[a+1];if(c!==f&&(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}}vd.prototype.ValueTypeName="";vd.prototype.TimeBufferType=Float32Array;vd.prototype.ValueBufferType=Float32Array;vd.prototype.DefaultInterpolation=Q5;class Gx extends vd{constructor(e,n,r){super(e,n,r)}}Gx.prototype.ValueTypeName="bool";Gx.prototype.ValueBufferType=Array;Gx.prototype.DefaultInterpolation=HS;Gx.prototype.InterpolantFactoryMethodLinear=void 0;Gx.prototype.InterpolantFactoryMethodSmooth=void 0;class QD extends vd{constructor(e,n,r,i){super(e,n,r,i)}}QD.prototype.ValueTypeName="color";class JS extends vd{constructor(e,n,r,i){super(e,n,r,i)}}JS.prototype.ValueTypeName="number";class PK extends nb{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 f=c+a;c!==f;c+=4)Ya.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Qw extends vd{constructor(e,n,r,i){super(e,n,r,i)}InterpolantFactoryMethodLinear(e){return new PK(this.times,this.values,this.getValueSize(),e)}}Qw.prototype.ValueTypeName="quaternion";Qw.prototype.InterpolantFactoryMethodSmooth=void 0;class Wx extends vd{constructor(e,n,r){super(e,n,r)}}Wx.prototype.ValueTypeName="string";Wx.prototype.ValueBufferType=Array;Wx.prototype.DefaultInterpolation=HS;Wx.prototype.InterpolantFactoryMethodLinear=void 0;Wx.prototype.InterpolantFactoryMethodSmooth=void 0;class ew extends vd{constructor(e,n,r,i){super(e,n,r,i)}}ew.prototype.ValueTypeName="vector";class tw{constructor(e="",n=-1,r=[],i=BC){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=gu(),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(b4e(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(vd.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 f=NK(l);l=NR(l,1,f),c=NR(c,1,f),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new JS(".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],f=c.name.match(s);if(f&&f.length>1){const p=f[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(Mn("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=[];KD(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 JS(".morphTargetInfluence["+_+"]",S,M))}l=x.length*o}else{const x=".bones["+n[p].name+"]";r(ew,x+".position",m,"pos",i),r(Qw,x+".quaternion",m,"rot",i),r(ew,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 y4e(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return JS;case"vector":case"vector2":case"vector3":case"vector4":return ew;case"color":return QD;case"quaternion":return Qw;case"bool":case"boolean":return Gx;case"string":return Wx}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function b4e(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=y4e(t.type);if(t.times===void 0){const n=[],r=[];KD(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 oh={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(mz(t)||(this.files[t]=e))},get:function(t){if(this.enabled!==!1&&!mz(t))return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function mz(t){try{const e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class JD{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(f){a++,s===!1&&i.onStart!==void 0&&i.onStart(f,o,a),s=!0},this.itemEnd=function(f){o++,i.onProgress!==void 0&&i.onProgress(f,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(f){i.onError!==void 0&&i.onError(f)},this.resolveURL=function(f){return l?l(f):f},this.setURLModifier=function(f){return l=f,this},this.addHandler=function(f,p){return c.push(f,p),this},this.removeHandler=function(f){const p=c.indexOf(f);return p!==-1&&c.splice(p,2),this},this.getHandler=function(f){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(f))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 IK=new JD;class Hc{constructor(e){this.manager=e!==void 0?e:IK,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}}Hc.DEFAULT_MATERIAL_NAME="__DEFAULT";const sp={};class _4e extends Error{constructor(e,n){super(e),this.response=n}}class Ap extends Hc{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=oh.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(sp[e]!==void 0){sp[e].push({onLoad:n,onProgress:r,onError:i});return}sp[e]=[],sp[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&&Mn("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const f=sp[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 P=new ProgressEvent("progress",{lengthComputable:b,loaded:_,total:x});for(let k=0,O=f.length;k<O;k++){const R=f[k];R.onProgress&&R.onProgress(P)}M.enqueue(N),C()}},A=>{M.error(A)})}}});return new Response(S)}else throw new _4e(`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(f=>new DOMParser().parseFromString(f,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=>{oh.add(`file:${e}`,c);const f=sp[e];delete sp[e];for(let p=0,m=f.length;p<m;p++){const x=f[p];x.onLoad&&x.onLoad(c)}}).catch(c=>{const f=sp[e];if(f===void 0)throw this.manager.itemError(e),c;delete sp[e];for(let p=0,m=f.length;p<m;p++){const x=f[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 S4e extends Hc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ap(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=tw.parse(e[r]);n.push(i)}return n}}class w4e extends Hc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=[],a=new ZC,l=new Ap(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function f(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=is),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)f(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=is),a.format=m.format,a.needsUpdate=!0,n&&n(a)},r,i);return a}}const o1=new WeakMap;class nw extends Hc{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=oh.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=o1.get(o);p===void 0&&(p=[],o1.set(o,p)),p.push({onLoad:n,onError:i})}return o}const a=$S("img");function l(){f(),n&&n(this);const p=o1.get(this)||[];for(let m=0;m<p.length;m++){const x=p[m];x.onLoad&&x.onLoad(this)}o1.delete(this),s.manager.itemEnd(e)}function c(p){f(),i&&i(p),oh.remove(`image:${e}`);const m=o1.get(this)||[];for(let x=0;x<m.length;x++){const b=m[x];b.onError&&b.onError(p)}o1.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function f(){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),oh.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class M4e extends Hc{constructor(e){super(e)}load(e,n,r,i){const s=new qw;s.colorSpace=xl;const o=new nw(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(f){s.images[c]=f,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 T4e extends Hc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new tf,a=new Ap(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(f){if(i!==void 0)i(f);else{f(f);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:Lc,o.wrapT=c.wrapT!==void 0?c.wrapT:Lc,o.magFilter=c.magFilter!==void 0?c.magFilter:is,o.minFilter=c.minFilter!==void 0?c.minFilter:is,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=sh),c.mipmapCount===1&&(o.minFilter=is),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,n&&n(o,c)},r,i),o}}class C4e extends Hc{constructor(e){super(e)}load(e,n,r,i){const s=new uo,o=new nw(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 H0 extends _i{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new kn(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 OK extends H0{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(_i.DEFAULT_UP),this.updateMatrix(),this.groundColor=new kn(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 dr,gz=new We,xz=new We;class e9{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 $t(512,512),this.mapType=Wl,this.map=null,this.mapPass=null,this.matrix=new dr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new tb,this._frameExtents=new $t(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;gz.setFromMatrixPosition(e.matrixWorld),n.position.copy(gz),xz.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(xz),n.updateMatrixWorld(),iN.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(iN,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===Ax||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 RM=new We,DM=new Ya,Bf=new We;class hE extends _i{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new dr,this.projectionMatrix=new dr,this.projectionMatrixInverse=new dr,this.coordinateSystem=uu,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(RM,DM,Bf),Bf.x===1&&Bf.y===1&&Bf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(RM,DM,Bf.set(1,1,1)).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorld.decompose(RM,DM,Bf),Bf.x===1&&Bf.y===1&&Bf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(RM,DM,Bf.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Rm=new We,vz=new $t,yz=new $t;class ao extends hE{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=Ay*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(gx*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ay*2*Math.atan(Math.tan(gx*.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){Rm.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Rm.x,Rm.y).multiplyScalar(-e/Rm.z),Rm.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Rm.x,Rm.y).multiplyScalar(-e/Rm.z)}getViewSize(e,n){return this.getViewBounds(e,vz,yz),n.subVectors(yz,vz)}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(gx*.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 E4e extends e9{constructor(){super(new ao(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const n=this.camera,r=Ay*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 LK extends H0{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 E4e}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 A4e extends e9{constructor(){super(new ao(90,1,.5,500)),this.isPointLightShadow=!0}}class jK extends H0{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 A4e}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 nf extends hE{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,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=f*this.view.offsetY,l=a-f*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 N4e extends e9{constructor(){super(new nf(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class zK extends H0{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 N4e}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const n=super.toJSON(e);return n.object.shadow=this.shadow.toJSON(),n.object.target=this.target.uuid,n}}class FK extends H0{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class UK extends H0{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 t9{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new We)}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 BK extends H0{constructor(e=new t9,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 pE extends Hc{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,o=new Ap(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&&Mn("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 kn().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 kn().setHex(o.value);break;case"v2":i.uniforms[s].value=new $t().fromArray(o.value);break;case"v3":i.uniforms[s].value=new We().fromArray(o.value);break;case"v4":i.uniforms[s].value=new hi().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Er().fromArray(o.value);break;case"m4":i.uniforms[s].value=new dr().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 $t().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 $t().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 pE.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:bK,SpriteMaterial:LD,RawShaderMaterial:XD,ShaderMaterial:_u,PointsMaterial:zD,MeshPhysicalMaterial:SK,MeshStandardMaterial:YD,MeshPhongMaterial:wK,MeshToonMaterial:MK,MeshNormalMaterial:TK,MeshLambertMaterial:CK,MeshDepthMaterial:dE,MeshDistanceMaterial:fE,MeshBasicMaterial:Ip,MeshMatcapMaterial:EK,LineDashedMaterial:AK,LineBasicMaterial:ec,Material:Ml};return new n[e]}}class kR{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 mE 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 HK extends Hc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ap(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=_1(S.type,M),A=new XC(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 mE:new Ar,a=e.data.index;if(a!==void 0){const x=_1(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 du(S,b.itemSize,b.offset,b.normalized)}else{const S=_1(b.type,b.array),M=b.isInstancedBufferAttribute?Nx:$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 du(N,C.itemSize,C.offset,C.normalized)}else{const N=_1(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 Jo().fromJSON(m)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class k4e extends Hc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=this.path===""?kR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Ap(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 f=c.metadata;if(f===void 0||f.type===void 0||f.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===""?kR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Ap(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),f=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,f),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 i0().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 YC().fromJSON(e[s],i);r[a.uuid]=a}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new HK;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 pz?a=pz[l.type].fromJSON(l,n):Mn(`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 pE;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=tw.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,f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return o(f)}else return l.data?{data:_1(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new JD(n);s=new nw(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,f=e.length;c<f;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 tf(M.data,M.width,M.height)))}i[p.uuid]=new e0(x)}else{const x=a(p.url);i[p.uuid]=new e0(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:_1(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new nw(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 f=[];for(let p=0,m=c.length;p<m;p++){const x=c[p],b=await s(x);b!==null&&(b instanceof HTMLImageElement?f.push(b):f.push(new tf(b.data,b.width,b.height)))}r[l.uuid]=new e0(f)}else{const f=await s(l.url);r[l.uuid]=new e0(f)}}}return r}parseTextures(e,n){function r(s,o){return typeof s=="number"?s:(Mn("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&&Mn('ObjectLoader: No "image" specified for',a.uuid),n[a.image]===void 0&&Mn("ObjectLoader: Undefined image",a.image);const l=n[a.image],c=l.data;let f;Array.isArray(c)?(f=new qw,c.length===6&&(f.needsUpdate=!0)):(c&&c.data?f=new tf:f=new uo,c&&(f.needsUpdate=!0)),f.source=l,f.uuid=a.uuid,a.name!==void 0&&(f.name=a.name),a.mapping!==void 0&&(f.mapping=r(a.mapping,R4e)),a.channel!==void 0&&(f.channel=a.channel),a.offset!==void 0&&f.offset.fromArray(a.offset),a.repeat!==void 0&&f.repeat.fromArray(a.repeat),a.center!==void 0&&f.center.fromArray(a.center),a.rotation!==void 0&&(f.rotation=a.rotation),a.wrap!==void 0&&(f.wrapS=r(a.wrap[0],bz),f.wrapT=r(a.wrap[1],bz)),a.format!==void 0&&(f.format=a.format),a.internalFormat!==void 0&&(f.internalFormat=a.internalFormat),a.type!==void 0&&(f.type=a.type),a.colorSpace!==void 0&&(f.colorSpace=a.colorSpace),a.minFilter!==void 0&&(f.minFilter=r(a.minFilter,_z)),a.magFilter!==void 0&&(f.magFilter=r(a.magFilter,_z)),a.anisotropy!==void 0&&(f.anisotropy=a.anisotropy),a.flipY!==void 0&&(f.flipY=a.flipY),a.generateMipmaps!==void 0&&(f.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(f.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(f.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(f.compareFunction=a.compareFunction),a.userData!==void 0&&(f.userData=a.userData),i[a.uuid]=f}return i}parseObject(e,n,r,i,s){let o;function a(m){return n[m]===void 0&&Mn("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&&Mn("ObjectLoader: Undefined material",S),x.push(r[S])}return x}return r[m]===void 0&&Mn("ObjectLoader: Undefined material",m),r[m]}}function c(m){return i[m]===void 0&&Mn("ObjectLoader: Undefined texture",m),i[m]}let f,p;switch(e.type){case"Scene":o=new PD,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new kn(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 qC(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new $C(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 ao(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 nf(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new FK(e.color,e.intensity);break;case"DirectionalLight":o=new zK(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new jK(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new UK(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new LK(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new OK(e.color,e.groundColor,e.intensity);break;case"LightProbe":const m=new t9().fromArray(e.sh);o=new BK(m,e.intensity);break;case"SkinnedMesh":f=a(e.geometry),p=l(e.material),o=new iK(f,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":f=a(e.geometry),p=l(e.material),o=new qs(f,p);break;case"InstancedMesh":f=a(e.geometry),p=l(e.material);const x=e.count,b=e.instanceMatrix,_=e.instanceColor;o=new sK(f,p,x),o.instanceMatrix=new Nx(new Float32Array(b.array),16),_!==void 0&&(o.instanceColor=new Nx(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":f=a(e.geometry),p=l(e.material),o=new oK(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,p),o.geometry=f,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 Lo().fromJSON(S.boundingBox)),S.boundingSphere!==void 0&&(C=new Jo().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 Jo().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Lo().fromJSON(e.boundingBox));break;case"LOD":o=new rK;break;case"Line":o=new S0(a(e.geometry),l(e.material));break;case"LineLoop":o=new aK(a(e.geometry),l(e.material));break;case"LineSegments":o=new Ch(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new lK(a(e.geometry),l(e.material));break;case"Sprite":o=new nK(l(e.material));break;case"Group":o=new S1;break;case"Bone":o=new jD;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 We().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?Mn("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 R4e={UVMapping:IC,CubeReflectionMapping:ph,CubeRefractionMapping:y0,EquirectangularReflectionMapping:lS,EquirectangularRefractionMapping:cS,CubeUVReflectionMapping:eb},bz={RepeatWrapping:US,ClampToEdgeWrapping:Lc,MirroredRepeatWrapping:BS},_z={NearestFilter:Oo,NearestMipmapNearestFilter:wD,NearestMipmapLinearFilter:b1,LinearFilter:is,LinearMipmapNearestFilter:uS,LinearMipmapLinearFilter:sh},sN=new WeakMap;class D4e extends Hc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Mn("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Mn("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=oh.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 oh.add(`image-bitmap:${e}`,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),sN.set(l,c),oh.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});oh.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let PM;class n9{static getContext(){return PM===void 0&&(PM=new(window.AudioContext||window.webkitAudioContext)),PM}static setContext(e){PM=e}}class P4e extends Hc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ap(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);n9.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 Sz=new dr,wz=new dr,Lg=new dr;class I4e{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ao,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ao,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,Lg.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(gx*n.fov*.5)/n.zoom;let a,l;wz.elements[12]=-i,Sz.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,Lg.elements[0]=2*n.near/(l-a),Lg.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Lg),a=-o*n.aspect-s,l=o*n.aspect-s,Lg.elements[0]=2*n.near/(l-a),Lg.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Lg)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(wz),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Sz)}}const a1=-90,l1=1;class VK extends _i{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new ao(a1,l1,e,n);i.layers=this.layers,this.add(i);const s=new ao(a1,l1,e,n);s.layers=this.layers,this.add(s);const o=new ao(a1,l1,e,n);o.layers=this.layers,this.add(o);const a=new ao(a1,l1,e,n);a.layers=this.layers,this.add(a);const l=new ao(a1,l1,e,n);l.layers=this.layers,this.add(l);const c=new ao(a1,l1,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===uu)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===Ax)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,f]=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,f),e.setRenderTarget(p,m,x),e.xr.enabled=b,r.texture.needsPMREMUpdate=!0}}class GK extends ao{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class WK{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=O4e.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 O4e(){this._document.hidden===!1&&this.reset()}const jg=new We,oN=new Ya,L4e=new We,zg=new We,Fg=new We;class j4e extends _i{constructor(){super(),this.type="AudioListener",this.context=n9.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new WK}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(jg,oN,L4e),zg.set(0,0,-1).applyQuaternion(oN),Fg.set(0,1,0).applyQuaternion(oN),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(jg.x,r),n.positionY.linearRampToValueAtTime(jg.y,r),n.positionZ.linearRampToValueAtTime(jg.z,r),n.forwardX.linearRampToValueAtTime(zg.x,r),n.forwardY.linearRampToValueAtTime(zg.y,r),n.forwardZ.linearRampToValueAtTime(zg.z,r),n.upX.linearRampToValueAtTime(Fg.x,r),n.upY.linearRampToValueAtTime(Fg.y,r),n.upZ.linearRampToValueAtTime(Fg.z,r)}else n.setPosition(jg.x,jg.y,jg.z),n.setOrientation(zg.x,zg.y,zg.z,Fg.x,Fg.y,Fg.z)}}class $K 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){Mn("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Mn("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){Mn("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){Mn("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){Mn("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?(Mn("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Mn("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"?(Mn("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 Ug=new We,Mz=new Ya,z4e=new We,Bg=new We;class F4e extends $K{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(Ug,Mz,z4e),Bg.set(0,0,1).applyQuaternion(Mz);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(Ug.x,r),n.positionY.linearRampToValueAtTime(Ug.y,r),n.positionZ.linearRampToValueAtTime(Ug.z,r),n.orientationX.linearRampToValueAtTime(Bg.x,r),n.orientationY.linearRampToValueAtTime(Bg.y,r),n.orientationZ.linearRampToValueAtTime(Bg.z,r)}else n.setPosition(Ug.x,Ug.y,Ug.z),n.setOrientation(Bg.x,Bg.y,Bg.z)}}class U4e{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 qK{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 r9="\\[\\]\\.:\\/",B4e=new RegExp("["+r9+"]","g"),i9="[^"+r9+"]",H4e="[^"+r9.replace("\\.","")+"]",V4e=/((?:WC+[\/:])*)/.source.replace("WC",i9),G4e=/(WCOD+)?/.source.replace("WCOD",H4e),W4e=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",i9),$4e=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",i9),q4e=new RegExp("^"+V4e+G4e+W4e+$4e+"$"),X4e=["material","materials","bones","map"];class Y4e{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(B4e,"")}static parseTrackName(e){const n=q4e.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);X4e.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){Mn("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 f=0;f<e.length;f++)if(e[f].name===c){c=f;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=Y4e;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 K4e{constructor(){this.isAnimationObjectGroup=!0,this.uuid=gu(),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 f=0,p=arguments.length;f!==p;++f){const m=arguments[f],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 P=A[b];A[b]=N,P===void 0&&(P=new yi(m,r[M],i[M])),A[_]=P}}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,f=n[c];if(f!==void 0&&f>=s){const p=s++,m=e[p];n[m.uuid]=f,e[f]=m,n[c]=p,e[p]=l;for(let x=0,b=i;x!==b;++x){const _=r[x],S=_[p],M=_[f];_[f]=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],f=c.uuid,p=n[f];if(p!==void 0)if(delete n[f],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,f=this.nCachedObjects_,p=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(p);for(let m=f,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 XK{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:ex,endingEnd:ex};for(let c=0;c!==o;++c){const f=s[c].createInterpolant(null);a[c]=f,f.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=zY,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 kD:for(let f=0,p=l.length;f!==p;++f)l[f].evaluate(o),c[f].accumulateAdditive(a);break;case BC:default:for(let f=0,p=l.length;f!==p;++f)l[f].evaluate(o),c[f].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===FY;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===jY){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=tx,i.endingEnd=tx):(e?i.endingStart=this.zeroSlopeAtStart?tx:ex:i.endingStart=VS,n?i.endingEnd=this.zeroSlopeAtEnd?tx:ex:i.endingEnd=VS)}_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 Z4e=new Float32Array(1);class Q4e extends Th{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 f=c[l];f===void 0&&(f={},c[l]=f);for(let p=0;p!==s;++p){const m=i[p],x=m.name;let b=f[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 qK(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],f=e._byClipCacheIndex;c._byClipCacheIndex=f,l[f]=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 ZD(new Float32Array(2),new Float32Array(2),1,Z4e),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"?tw.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=BC),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 f=new XK(this,o,n,r);return this._bindAction(f,c),this._addInactiveAction(f,a,s),f}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?tw.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 f=c._cacheIndex,p=n[n.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,p._cacheIndex=f,n[f]=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 J4e extends DD{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isRenderTarget3D=!0,this.depth=r,this.texture=new WC(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class s9{constructor(e){this.value=e}clone(){return new s9(this.value.clone===void 0?this.value:this.value.clone())}}let eMe=0;class tMe extends Th{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:eMe++}),this.name="",this.usage=WS,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 rT extends XC{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 nMe{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 Tz=new dr;class YK{constructor(e,n,r=0,i=1/0){this.ray=new Hx(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new Ny,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 Tz.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Tz),this}intersectObject(e,n=!0,r=[]){return RR(e,this,r,n),r.sort(Cz),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)RR(e[i],this,r,n);return r.sort(Cz),r}}function Cz(t,e){return t.distance-e.distance}function RR(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++)RR(s[o],e,n,!0)}}class KK{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Mn("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 DR{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=hr(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(hr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class rMe{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 o9{constructor(e,n,r,i){o9.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 Ez=new $t;class iMe{constructor(e=new $t(1/0,1/0),n=new $t(-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=Ez.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,Ez).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 Az=new We,IM=new We,c1=new We,u1=new We,aN=new We,sMe=new We,oMe=new We;class ZK{constructor(e=new We,n=new We){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){Az.subVectors(e,this.start),IM.subVectors(this.end,this.start);const r=IM.dot(IM);let s=IM.dot(Az)/r;return n&&(s=hr(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=sMe,r=oMe){const i=10000000000000001e-32;let s,o;const a=this.start,l=e.start,c=this.end,f=e.end;c1.subVectors(c,a),u1.subVectors(f,l),aN.subVectors(a,l);const p=c1.dot(c1),m=u1.dot(u1),x=u1.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=hr(o,0,1);else{const b=c1.dot(aN);if(m<=i)o=0,s=hr(-b/p,0,1);else{const _=c1.dot(u1),S=p*m-_*_;S!==0?s=hr((_*x-b*m)/S,0,1):s=0,o=(_*s+x)/m,o<0?(o=0,s=hr(-b/p,0,1)):o>1&&(o=1,s=hr((_-b)/p,0,1))}}return n.copy(a).addScaledVector(c1,s),r.copy(l).addScaledVector(u1,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 Nz=new We;class aMe 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,f=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(f),Math.sin(f),1)}r.setAttribute("position",new On(i,3));const s=new ec({fog:!1,toneMapped:!1});this.cone=new Ch(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),Nz.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Nz),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Dm=new We,OM=new dr,lN=new dr;class lMe extends Ch{constructor(e){const n=QK(e),r=new Ar,i=[],s=[];for(let c=0;c<n.length;c++){const f=n[c];f.parent&&f.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 On(i,3)),r.setAttribute("color",new On(s,3));const o=new ec({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 kn(255),l=new kn(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&&(OM.multiplyMatrices(lN,a.matrixWorld),Dm.setFromMatrixPosition(OM),i.setXYZ(o,Dm.x,Dm.y,Dm.z),OM.multiplyMatrices(lN,a.parent.matrixWorld),Dm.setFromMatrixPosition(OM),i.setXYZ(o+1,Dm.x,Dm.y,Dm.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 cMe extends qs{constructor(e,n,r){const i=new Zw(n,4,2),s=new Ip({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 uMe=new We,kz=new kn,Rz=new kn;class dMe 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 Kw(n);i.rotateY(Math.PI*.5),this.material=new Ip({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 qs(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");kz.copy(this.light.color),Rz.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?kz:Rz;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(uMe.setFromMatrixPosition(this.light.matrixWorld).negate())}}class fMe extends Ch{constructor(e=10,n=10,r=4473924,i=8947848){r=new kn(r),i=new kn(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 f=new Ar;f.setAttribute("position",new On(l,3)),f.setAttribute("color",new On(c,3));const p=new ec({vertexColors:!0,toneMapped:!1});super(f,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class hMe extends Ch{constructor(e=10,n=16,r=8,i=64,s=4473924,o=8947848){s=new kn(s),o=new kn(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 On(a,3)),c.setAttribute("color",new On(l,3));const f=new ec({vertexColors:!0,toneMapped:!1});super(c,f),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Dz=new We,LM=new We,Pz=new We;class pMe 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 On([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));const s=new ec({fog:!1,toneMapped:!1});this.lightPlane=new S0(i,s),this.add(this.lightPlane),i=new Ar,i.setAttribute("position",new On([0,0,0,0,0,1],3)),this.targetLine=new S0(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),Dz.setFromMatrixPosition(this.light.matrixWorld),LM.setFromMatrixPosition(this.light.target.matrixWorld),Pz.subVectors(LM,Dz),this.lightPlane.lookAt(LM),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(LM),this.targetLine.scale.z=Pz.length()}}const jM=new We,_o=new hE;class mMe extends Ch{constructor(e){const n=new Ar,r=new ec({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 On(i,3)),n.setAttribute("color",new On(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 kn(16755200),f=new kn(16711680),p=new kn(43775),m=new kn(16777215),x=new kn(3355443);this.setColors(c,f,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(_o.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,o=0;else if(this.camera.coordinateSystem===uu)s=-1,o=1;else if(this.camera.coordinateSystem===Ax)s=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Po("c",n,e,_o,0,0,s),Po("t",n,e,_o,0,0,o),Po("n1",n,e,_o,-r,-i,s),Po("n2",n,e,_o,r,-i,s),Po("n3",n,e,_o,-r,i,s),Po("n4",n,e,_o,r,i,s),Po("f1",n,e,_o,-r,-i,o),Po("f2",n,e,_o,r,-i,o),Po("f3",n,e,_o,-r,i,o),Po("f4",n,e,_o,r,i,o),Po("u1",n,e,_o,r*.7,i*1.1,s),Po("u2",n,e,_o,-r*.7,i*1.1,s),Po("u3",n,e,_o,0,i*2,s),Po("cf1",n,e,_o,-r,0,o),Po("cf2",n,e,_o,r,0,o),Po("cf3",n,e,_o,0,-i,o),Po("cf4",n,e,_o,0,i,o),Po("cn1",n,e,_o,-r,0,s),Po("cn2",n,e,_o,r,0,s),Po("cn3",n,e,_o,0,-i,s),Po("cn4",n,e,_o,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Po(t,e,n,r,i,s,o){jM.set(i,s,o).unproject(r);const a=e[t];if(a!==void 0){const l=n.getAttribute("position");for(let c=0,f=a.length;c<f;c++)l.setXYZ(a[c],jM.x,jM.y,jM.z)}}const zM=new Lo;class gMe extends Ch{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 ec({color:n,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&zM.setFromObject(this.object),zM.isEmpty())return;const e=zM.min,n=zM.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 xMe extends Ch{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 On(i,3)),super(s,new ec({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 vMe extends S0{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 On(s,3)),o.computeBoundingSphere(),super(o,new ec({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 On(a,3)),l.computeBoundingSphere(),this.add(new qs(l,new Ip({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 Iz=new We;let FM,cN;class yMe extends _i{constructor(e=new We(0,0,1),n=new We(0,0,0),r=1,i=16776960,s=r*.2,o=s*.2){super(),this.type="ArrowHelper",FM===void 0&&(FM=new Ar,FM.setAttribute("position",new On([0,0,0,0,1,0],3)),cN=new Yw(.5,1,5,1),cN.translate(0,-.5,0)),this.position.copy(n),this.line=new S0(FM,new ec({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new qs(cN,new Ip({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{Iz.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(Iz,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 bMe extends Ch{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 On(n,3)),i.setAttribute("color",new On(r,3));const s=new ec({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new kn,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 _Me{constructor(){this.type="ShapePath",this.color=new kn,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new nT,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 P=M[A],k=new i0;k.curves=P.curves,C.push(k)}return C}function r(M,C){const A=C.length;let N=!1;for(let P=A-1,k=0;k<A;P=k++){let O=C[P],R=C[k],L=R.x-O.x,B=R.y-O.y;if(Math.abs(B)>Number.EPSILON){if(B<0&&(O=C[k],L=-L,R=C[P],B=-B),M.y<O.y||M.y>R.y)continue;if(M.y===O.y){if(M.x===O.x)return!0}else{const V=B*(M.x-O.x)-L*(M.y-O.y);if(V===0)return!0;if(V<0)continue;N=!N}}else{if(M.y!==O.y)continue;if(R.x<=M.x&&M.x<=O.x||O.x<=M.x&&M.x<=R.x)return!0}}return N}const i=ef.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 i0,l.curves=a.curves,c.push(l),c;let f=!i(s[0].getPoints());f=e?!f:f;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?(!f&&m[b]&&b++,m[b]={s:new i0,p:_},m[b].s.curves=a.curves,f&&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 P=x[A];for(let k=0;k<P.length;k++){const O=P[k];let R=!0;for(let L=0;L<m.length;L++)r(O.p,m[L].p)&&(A!==L&&C++,R?(R=!1,p[L].push(O)):M=!0);R&&p[A].push(O)}}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 SMe extends Th{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){Mn("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function wMe(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 MMe(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 TMe(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=CMe(r);switch(n){case AD:return t*e;case zC:return t*e/i.components*i.byteLength;case $w:return t*e/i.components*i.byteLength;case Ex:return t*e*2/i.components*i.byteLength;case FC:return t*e*2/i.components*i.byteLength;case ND:return t*e*3/i.components*i.byteLength;case vl:return t*e*4/i.components*i.byteLength;case UC:return t*e*4/i.components*i.byteLength;case dS:case fS:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case hS:case pS:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case _5:case w5:return Math.max(t,16)*Math.max(e,8)/4;case b5:case S5:return Math.max(t,8)*Math.max(e,8)/2;case M5:case T5:case E5:case A5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case C5:case N5:case k5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case R5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case D5: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 I5:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case O5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case L5:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case j5:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case z5:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case F5:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case U5:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case B5:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case H5:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case V5:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case G5:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case W5:case $5:case q5:return Math.ceil(t/4)*Math.ceil(e/4)*16;case X5:case Y5:return Math.ceil(t/4)*Math.ceil(e/4)*8;case K5:case Z5:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function CMe(t){switch(t){case Wl:case MD:return{byteLength:1,components:1};case Cy:case TD:case mh:return{byteLength:2,components:1};case LC:case jC:return{byteLength:2,components:4};case md:case OC:case Kl:return{byteLength:4,components:1};case CD:case ED:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class EMe{static contain(e,n){return wMe(e,n)}static cover(e,n){return MMe(e,n)}static fill(e){return TMe(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:Gw}}));typeof window<"u"&&(window.__THREE__?Mn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Gw);/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function JK(){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 AMe(t){const e=new WeakMap;function n(a,l){const c=a.array,f=a.usage,p=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,f),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 f=l.array,p=l.updateRanges;if(t.bindBuffer(c,a),p.length===0)t.bufferSubData(c,0,f);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*f.BYTES_PER_ELEMENT,f,_.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 f=e.get(a);(!f||f.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 NMe=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,kMe=`#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`,RMe=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,DMe=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,PMe=`#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`,IMe=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,OMe=`#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`,LMe=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,jMe=`#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`,zMe=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,FMe=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,UMe=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,BMe=`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`,HMe=`#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`,VMe=`#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`,GMe=`#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`,WMe=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,$Me=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,qMe=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,XMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#endif`,YMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#endif`,KMe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec4 vColor;
#endif`,ZMe=`#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`,QMe=`#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`,JMe=`#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`,e2e=`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`,t2e=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,n2e=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,r2e=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,i2e=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,s2e="gl_FragColor = linearToOutputTexel( gl_FragColor );",o2e=`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 );
}`,a2e=`#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`,l2e=`#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`,c2e=`#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`,u2e=`#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`,d2e=`#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`,f2e=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,h2e=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,p2e=`#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`,m2e=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,g2e=`#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
}`,x2e=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,v2e=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,y2e=`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`,b2e=`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`,_2e=`#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`,S2e=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,w2e=`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`,M2e=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,T2e=`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`,C2e=`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`,E2e=`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 );
}`,A2e=`
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`,N2e=`#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`,k2e=`#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`,R2e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,D2e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,P2e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,I2e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,O2e=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,L2e=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,j2e=`#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`,z2e=`#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`,F2e=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,U2e=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,B2e=`#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`,H2e=`#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`,V2e=`#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`,G2e=`#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`,W2e=`#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`,$2e=`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;`,q2e=`#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`,X2e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Y2e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,K2e=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,Z2e=`#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`,Q2e=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,J2e=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,e5e=`#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`,t5e=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,n5e=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,r5e=`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
}`,i5e=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,s5e=`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;`,o5e=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,a5e=`#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`,l5e=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,c5e=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,u5e=`#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`,d5e=`#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`,f5e=`#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`,h5e=`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;
}`,p5e=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,m5e=`#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`,g5e=`#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`,x5e=`#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`,v5e=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,y5e=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,b5e=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,_5e=`#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; }`,S5e=`#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`,w5e=`#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`,M5e=`#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`,T5e=`#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`,C5e=`#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`,E5e=`#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 A5e=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,N5e=`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>
}`,k5e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,R5e=`#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>
}`,D5e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,P5e=`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>
}`,I5e=`#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;
}`,O5e=`#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
}`,L5e=`#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;
}`,j5e=`#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 );
}`,z5e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,F5e=`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>
}`,U5e=`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>
}`,B5e=`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>
}`,H5e=`#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>
}`,V5e=`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>
}`,G5e=`#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>
}`,W5e=`#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>
}`,$5e=`#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;
}`,q5e=`#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>
}`,X5e=`#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
}`,Y5e=`#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
}`,K5e=`#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>
}`,Z5e=`#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>
}`,Q5e=`#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
}`,J5e=`#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>
}`,eTe=`#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>
}`,tTe=`#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>
}`,nTe=`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>
}`,rTe=`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>
}`,iTe=`#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>
}`,sTe=`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>
}`,oTe=`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>
}`,aTe=`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:NMe,alphahash_pars_fragment:kMe,alphamap_fragment:RMe,alphamap_pars_fragment:DMe,alphatest_fragment:PMe,alphatest_pars_fragment:IMe,aomap_fragment:OMe,aomap_pars_fragment:LMe,batching_pars_vertex:jMe,batching_vertex:zMe,begin_vertex:FMe,beginnormal_vertex:UMe,bsdfs:BMe,iridescence_fragment:HMe,bumpmap_pars_fragment:VMe,clipping_planes_fragment:GMe,clipping_planes_pars_fragment:WMe,clipping_planes_pars_vertex:$Me,clipping_planes_vertex:qMe,color_fragment:XMe,color_pars_fragment:YMe,color_pars_vertex:KMe,color_vertex:ZMe,common:QMe,cube_uv_reflection_fragment:JMe,defaultnormal_vertex:e2e,displacementmap_pars_vertex:t2e,displacementmap_vertex:n2e,emissivemap_fragment:r2e,emissivemap_pars_fragment:i2e,colorspace_fragment:s2e,colorspace_pars_fragment:o2e,envmap_fragment:a2e,envmap_common_pars_fragment:l2e,envmap_pars_fragment:c2e,envmap_pars_vertex:u2e,envmap_physical_pars_fragment:_2e,envmap_vertex:d2e,fog_vertex:f2e,fog_pars_vertex:h2e,fog_fragment:p2e,fog_pars_fragment:m2e,gradientmap_pars_fragment:g2e,lightmap_pars_fragment:x2e,lights_lambert_fragment:v2e,lights_lambert_pars_fragment:y2e,lights_pars_begin:b2e,lights_toon_fragment:S2e,lights_toon_pars_fragment:w2e,lights_phong_fragment:M2e,lights_phong_pars_fragment:T2e,lights_physical_fragment:C2e,lights_physical_pars_fragment:E2e,lights_fragment_begin:A2e,lights_fragment_maps:N2e,lights_fragment_end:k2e,logdepthbuf_fragment:R2e,logdepthbuf_pars_fragment:D2e,logdepthbuf_pars_vertex:P2e,logdepthbuf_vertex:I2e,map_fragment:O2e,map_pars_fragment:L2e,map_particle_fragment:j2e,map_particle_pars_fragment:z2e,metalnessmap_fragment:F2e,metalnessmap_pars_fragment:U2e,morphinstance_vertex:B2e,morphcolor_vertex:H2e,morphnormal_vertex:V2e,morphtarget_pars_vertex:G2e,morphtarget_vertex:W2e,normal_fragment_begin:$2e,normal_fragment_maps:q2e,normal_pars_fragment:X2e,normal_pars_vertex:Y2e,normal_vertex:K2e,normalmap_pars_fragment:Z2e,clearcoat_normal_fragment_begin:Q2e,clearcoat_normal_fragment_maps:J2e,clearcoat_pars_fragment:e5e,iridescence_pars_fragment:t5e,opaque_fragment:n5e,packing:r5e,premultiplied_alpha_fragment:i5e,project_vertex:s5e,dithering_fragment:o5e,dithering_pars_fragment:a5e,roughnessmap_fragment:l5e,roughnessmap_pars_fragment:c5e,shadowmap_pars_fragment:u5e,shadowmap_pars_vertex:d5e,shadowmap_vertex:f5e,shadowmask_pars_fragment:h5e,skinbase_vertex:p5e,skinning_pars_vertex:m5e,skinning_vertex:g5e,skinnormal_vertex:x5e,specularmap_fragment:v5e,specularmap_pars_fragment:y5e,tonemapping_fragment:b5e,tonemapping_pars_fragment:_5e,transmission_fragment:S5e,transmission_pars_fragment:w5e,uv_pars_fragment:M5e,uv_pars_vertex:T5e,uv_vertex:C5e,worldpos_vertex:E5e,background_vert:A5e,background_frag:N5e,backgroundCube_vert:k5e,backgroundCube_frag:R5e,cube_vert:D5e,cube_frag:P5e,depth_vert:I5e,depth_frag:O5e,distance_vert:L5e,distance_frag:j5e,equirect_vert:z5e,equirect_frag:F5e,linedashed_vert:U5e,linedashed_frag:B5e,meshbasic_vert:H5e,meshbasic_frag:V5e,meshlambert_vert:G5e,meshlambert_frag:W5e,meshmatcap_vert:$5e,meshmatcap_frag:q5e,meshnormal_vert:X5e,meshnormal_frag:Y5e,meshphong_vert:K5e,meshphong_frag:Z5e,meshphysical_vert:Q5e,meshphysical_frag:J5e,meshtoon_vert:eTe,meshtoon_frag:tTe,points_vert:nTe,points_frag:rTe,shadow_vert:iTe,shadow_frag:sTe,sprite_vert:oTe,sprite_frag:aTe},Tn={common:{diffuse:{value:new kn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Er},alphaMap:{value:null},alphaMapTransform:{value:new Er},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Er}},envmap:{envMap:{value:null},envMapRotation:{value:new Er},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 Er}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Er}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Er},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Er},normalScale:{value:new $t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Er},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Er}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Er}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Er}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new kn(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 kn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Er},alphaTest:{value:0},uvTransform:{value:new Er}},sprite:{diffuse:{value:new kn(16777215)},opacity:{value:1},center:{value:new $t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Er},alphaMap:{value:null},alphaMapTransform:{value:new Er},alphaTest:{value:0}}},Zd={basic:{uniforms:Bl([Tn.common,Tn.specularmap,Tn.envmap,Tn.aomap,Tn.lightmap,Tn.fog]),vertexShader:Or.meshbasic_vert,fragmentShader:Or.meshbasic_frag},lambert:{uniforms:Bl([Tn.common,Tn.specularmap,Tn.envmap,Tn.aomap,Tn.lightmap,Tn.emissivemap,Tn.bumpmap,Tn.normalmap,Tn.displacementmap,Tn.fog,Tn.lights,{emissive:{value:new kn(0)},envMapIntensity:{value:1}}]),vertexShader:Or.meshlambert_vert,fragmentShader:Or.meshlambert_frag},phong:{uniforms:Bl([Tn.common,Tn.specularmap,Tn.envmap,Tn.aomap,Tn.lightmap,Tn.emissivemap,Tn.bumpmap,Tn.normalmap,Tn.displacementmap,Tn.fog,Tn.lights,{emissive:{value:new kn(0)},specular:{value:new kn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Or.meshphong_vert,fragmentShader:Or.meshphong_frag},standard:{uniforms:Bl([Tn.common,Tn.envmap,Tn.aomap,Tn.lightmap,Tn.emissivemap,Tn.bumpmap,Tn.normalmap,Tn.displacementmap,Tn.roughnessmap,Tn.metalnessmap,Tn.fog,Tn.lights,{emissive:{value:new kn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Or.meshphysical_vert,fragmentShader:Or.meshphysical_frag},toon:{uniforms:Bl([Tn.common,Tn.aomap,Tn.lightmap,Tn.emissivemap,Tn.bumpmap,Tn.normalmap,Tn.displacementmap,Tn.gradientmap,Tn.fog,Tn.lights,{emissive:{value:new kn(0)}}]),vertexShader:Or.meshtoon_vert,fragmentShader:Or.meshtoon_frag},matcap:{uniforms:Bl([Tn.common,Tn.bumpmap,Tn.normalmap,Tn.displacementmap,Tn.fog,{matcap:{value:null}}]),vertexShader:Or.meshmatcap_vert,fragmentShader:Or.meshmatcap_frag},points:{uniforms:Bl([Tn.points,Tn.fog]),vertexShader:Or.points_vert,fragmentShader:Or.points_frag},dashed:{uniforms:Bl([Tn.common,Tn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Or.linedashed_vert,fragmentShader:Or.linedashed_frag},depth:{uniforms:Bl([Tn.common,Tn.displacementmap]),vertexShader:Or.depth_vert,fragmentShader:Or.depth_frag},normal:{uniforms:Bl([Tn.common,Tn.bumpmap,Tn.normalmap,Tn.displacementmap,{opacity:{value:1}}]),vertexShader:Or.meshnormal_vert,fragmentShader:Or.meshnormal_frag},sprite:{uniforms:Bl([Tn.sprite,Tn.fog]),vertexShader:Or.sprite_vert,fragmentShader:Or.sprite_frag},background:{uniforms:{uvTransform:{value:new Er},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 Er}},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:Bl([Tn.common,Tn.displacementmap,{referencePosition:{value:new We},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Or.distance_vert,fragmentShader:Or.distance_frag},shadow:{uniforms:Bl([Tn.lights,Tn.fog,{color:{value:new kn(0)},opacity:{value:1}}]),vertexShader:Or.shadow_vert,fragmentShader:Or.shadow_frag}};Zd.physical={uniforms:Bl([Zd.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Er},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Er},clearcoatNormalScale:{value:new $t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Er},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Er},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Er},sheen:{value:0},sheenColor:{value:new kn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Er},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Er},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Er},transmissionSamplerSize:{value:new $t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Er},attenuationDistance:{value:0},attenuationColor:{value:new kn(0)},specularColor:{value:new kn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Er},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Er},anisotropyVector:{value:new $t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Er}}]),vertexShader:Or.meshphysical_vert,fragmentShader:Or.meshphysical_frag};const UM={r:0,b:0,g:0},Hg=new bu,lTe=new dr;function cTe(t,e,n,r,i,s){const o=new kn(0);let a=i===!0?0:1,l,c,f=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 P=t.xr.getEnvironmentBlendMode();P==="additive"?n.buffers.color.setClear(0,0,0,1,s):P==="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===eb)?(c===void 0&&(c=new qs(new Vx(1,1,1),new _u({name:"BackgroundCubeMaterial",uniforms:Dy(Zd.backgroundCube.uniforms),vertexShader:Zd.backgroundCube.vertexShader,fragmentShader:Zd.backgroundCube.fragmentShader,side:Zl,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(P,k,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Hg.copy(A.backgroundRotation),Hg.x*=-1,Hg.y*=-1,Hg.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(Hg.y*=-1,Hg.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(lTe.makeRotationFromEuler(Hg)),c.material.toneMapped=li.getTransfer(N.colorSpace)!==Hi,(f!==N||p!==N.version||m!==t.toneMapping)&&(c.material.needsUpdate=!0,f=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 qs(new Op(2,2),new _u({name:"BackgroundMaterial",uniforms:Dy(Zd.background.uniforms),vertexShader:Zd.background.vertexShader,fragmentShader:Zd.background.fragmentShader,side:Ep,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),(f!==N||p!==N.version||m!==t.toneMapping)&&(l.material.needsUpdate=!0,f=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(UM,_K(t)),n.buffers.color.setClear(UM.r,UM.g,UM.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 uTe(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(V,W,G,ee,H){let q=!1;const J=p(V,ee,G,W);s!==J&&(s=J,c(s.object)),q=x(V,ee,G,H),q&&b(V,ee,G,H),H!==null&&e.update(H,t.ELEMENT_ARRAY_BUFFER),(q||o)&&(o=!1,N(V,W,G,ee),H!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function l(){return t.createVertexArray()}function c(V){return t.bindVertexArray(V)}function f(V){return t.deleteVertexArray(V)}function p(V,W,G,ee){const H=ee.wireframe===!0;let q=r[W.id];q===void 0&&(q={},r[W.id]=q);const J=V.isInstancedMesh===!0?V.id:0;let K=q[J];K===void 0&&(K={},q[J]=K);let ne=K[G.id];ne===void 0&&(ne={},K[G.id]=ne);let U=ne[H];return U===void 0&&(U=m(l()),ne[H]=U),U}function m(V){const W=[],G=[],ee=[];for(let H=0;H<n;H++)W[H]=0,G[H]=0,ee[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:W,enabledAttributes:G,attributeDivisors:ee,object:V,attributes:{},index:null}}function x(V,W,G,ee){const H=s.attributes,q=W.attributes;let J=0;const K=G.getAttributes();for(const ne in K)if(K[ne].location>=0){const z=H[ne];let Y=q[ne];if(Y===void 0&&(ne==="instanceMatrix"&&V.instanceMatrix&&(Y=V.instanceMatrix),ne==="instanceColor"&&V.instanceColor&&(Y=V.instanceColor)),z===void 0||z.attribute!==Y||Y&&z.data!==Y.data)return!0;J++}return s.attributesNum!==J||s.index!==ee}function b(V,W,G,ee){const H={},q=W.attributes;let J=0;const K=G.getAttributes();for(const ne in K)if(K[ne].location>=0){let z=q[ne];z===void 0&&(ne==="instanceMatrix"&&V.instanceMatrix&&(z=V.instanceMatrix),ne==="instanceColor"&&V.instanceColor&&(z=V.instanceColor));const Y={};Y.attribute=z,z&&z.data&&(Y.data=z.data),H[ne]=Y,J++}s.attributes=H,s.attributesNum=J,s.index=ee}function _(){const V=s.newAttributes;for(let W=0,G=V.length;W<G;W++)V[W]=0}function S(V){M(V,0)}function M(V,W){const G=s.newAttributes,ee=s.enabledAttributes,H=s.attributeDivisors;G[V]=1,ee[V]===0&&(t.enableVertexAttribArray(V),ee[V]=1),H[V]!==W&&(t.vertexAttribDivisor(V,W),H[V]=W)}function C(){const V=s.newAttributes,W=s.enabledAttributes;for(let G=0,ee=W.length;G<ee;G++)W[G]!==V[G]&&(t.disableVertexAttribArray(G),W[G]=0)}function A(V,W,G,ee,H,q,J){J===!0?t.vertexAttribIPointer(V,W,G,H,q):t.vertexAttribPointer(V,W,G,ee,H,q)}function N(V,W,G,ee){_();const H=ee.attributes,q=G.getAttributes(),J=W.defaultAttributeValues;for(const K in q){const ne=q[K];if(ne.location>=0){let U=H[K];if(U===void 0&&(K==="instanceMatrix"&&V.instanceMatrix&&(U=V.instanceMatrix),K==="instanceColor"&&V.instanceColor&&(U=V.instanceColor)),U!==void 0){const z=U.normalized,Y=U.itemSize,j=e.get(U);if(j===void 0)continue;const le=j.buffer,ce=j.type,X=j.bytesPerElement,ie=ce===t.INT||ce===t.UNSIGNED_INT||U.gpuType===OC;if(U.isInterleavedBufferAttribute){const fe=U.data,Q=fe.stride,ue=U.offset;if(fe.isInstancedInterleavedBuffer){for(let he=0;he<ne.locationSize;he++)M(ne.location+he,fe.meshPerAttribute);V.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=fe.meshPerAttribute*fe.count)}else for(let he=0;he<ne.locationSize;he++)S(ne.location+he);t.bindBuffer(t.ARRAY_BUFFER,le);for(let he=0;he<ne.locationSize;he++)A(ne.location+he,Y/ne.locationSize,ce,z,Q*X,(ue+Y/ne.locationSize*he)*X,ie)}else{if(U.isInstancedBufferAttribute){for(let fe=0;fe<ne.locationSize;fe++)M(ne.location+fe,U.meshPerAttribute);V.isInstancedMesh!==!0&&ee._maxInstanceCount===void 0&&(ee._maxInstanceCount=U.meshPerAttribute*U.count)}else for(let fe=0;fe<ne.locationSize;fe++)S(ne.location+fe);t.bindBuffer(t.ARRAY_BUFFER,le);for(let fe=0;fe<ne.locationSize;fe++)A(ne.location+fe,Y/ne.locationSize,ce,z,Y*X,Y/ne.locationSize*fe*X,ie)}}else if(J!==void 0){const z=J[K];if(z!==void 0)switch(z.length){case 2:t.vertexAttrib2fv(ne.location,z);break;case 3:t.vertexAttrib3fv(ne.location,z);break;case 4:t.vertexAttrib4fv(ne.location,z);break;default:t.vertexAttrib1fv(ne.location,z)}}}}C()}function P(){L();for(const V in r){const W=r[V];for(const G in W){const ee=W[G];for(const H in ee){const q=ee[H];for(const J in q)f(q[J].object),delete q[J];delete ee[H]}}delete r[V]}}function k(V){if(r[V.id]===void 0)return;const W=r[V.id];for(const G in W){const ee=W[G];for(const H in ee){const q=ee[H];for(const J in q)f(q[J].object),delete q[J];delete ee[H]}}delete r[V.id]}function O(V){for(const W in r){const G=r[W];for(const ee in G){const H=G[ee];if(H[V.id]===void 0)continue;const q=H[V.id];for(const J in q)f(q[J].object),delete q[J];delete H[V.id]}}}function R(V){for(const W in r){const G=r[W],ee=V.isInstancedMesh===!0?V.id:0,H=G[ee];if(H!==void 0){for(const q in H){const J=H[q];for(const K in J)f(J[K].object),delete J[K];delete H[q]}delete G[ee],Object.keys(G).length===0&&delete r[W]}}}function L(){B(),o=!0,s!==i&&(s=i,c(s.object))}function B(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:L,resetDefaultState:B,dispose:P,releaseStatesOfGeometry:k,releaseStatesOfObject:R,releaseStatesOfProgram:O,initAttributes:_,enableAttribute:S,disableUnusedAttributes:C}}function dTe(t,e,n){let r;function i(c){r=c}function s(c,f){t.drawArrays(r,c,f),n.update(f,r,1)}function o(c,f,p){p!==0&&(t.drawArraysInstanced(r,c,f,p),n.update(f,r,p))}function a(c,f,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,f,0,p);let x=0;for(let b=0;b<p;b++)x+=f[b];n.update(x,r,1)}function l(c,f,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],f[b],m[b]);else{x.multiDrawArraysInstancedWEBGL(r,c,0,f,0,m,0,p);let b=0;for(let _=0;_<p;_++)b+=f[_]*m[_];n.update(b,r,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function fTe(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const O=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(O.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(O){return!(O!==vl&&r.convert(O)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(O){const R=O===mh&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(O!==Wl&&r.convert(O)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&O!==Kl&&!R)}function l(O){if(O==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";O="mediump"}return O==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const f=l(c);f!==c&&(Mn("WebGLRenderer:",c,"not supported, using",f,"instead."),c=f);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),P=t.getParameter(t.MAX_SAMPLES),k=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:P,samples:k}}function hTe(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new cp,a=new Er,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,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,m){n=f(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?f(null):c();else{const C=s?0:r,A=C*4;let N=M.clippingState||null;l.value=N,N=f(b,m,A,x);for(let P=0;P!==A;++P)N[P]=n[P];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 f(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 t0=4,Oz=[.125,.215,.35,.446,.526,.582],Zg=20,pTe=256,R_=new nf,Lz=new kn;let uN=null,dN=0,fN=0,hN=!1;const mTe=new We;class IR{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=mTe}=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=Fz(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=zz(),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,d1(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===ph||e.mapping===y0?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:is,minFilter:is,generateMipmaps:!1,type:mh,format:vl,colorSpace:b0,depthBuffer:!1},i=jz(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=jz(e,n,r);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=gTe(s)),this._blurMaterial=vTe(s,e,n),this._ggxMaterial=xTe(s,e,n)}return i}_compileMaterial(e){const n=new qs(new Ar,e);this._renderer.compile(n,R_)}_sceneToCubeUV(e,n,r,i,s){const l=new ao(90,1,n,r),c=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],p=this._renderer,m=p.autoClear,x=p.toneMapping;p.getClearColor(Lz),p.toneMapping=mu,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(i),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new qs(new Vx,new Ip({name:"PMREM.Background",side:Zl,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(Lz),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+f[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+f[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+f[A]));const P=this._cubeSize;d1(i,N*P,A>2?P:0,P,P),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===ph||e.mapping===y0;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Fz()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=zz());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;d1(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,R_)}_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),f=n/(this._lodMeshes.length-1),p=Math.sqrt(c*c-f*f),m=0+c*1.25,x=p*m,{_lodMax:b}=this,_=this._sizeLods[r],S=3*_*(r>b-t0?r-b+t0:0),M=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=b-n,d1(s,S,M,3*_,2*_),i.setRenderTarget(s),i.render(a,R_),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=b-r,d1(e,S,M,3*_,2*_),i.setRenderTarget(e),i.render(a,R_)}_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 f=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*Zg-1),_=s/b,S=isFinite(s)?1+Math.floor(f*_):Zg;S>Zg&&Mn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Zg}`);const M=[];let C=0;for(let O=0;O<Zg;++O){const R=O/_,L=Math.exp(-R*R/2);M.push(L),O===0?C+=L:O<S&&(C+=2*L)}for(let O=0;O<M.length;O++)M[O]=M[O]/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],P=3*N*(i>A-t0?i-A+t0:0),k=4*(this._cubeSize-N);d1(n,P,k,3*N,2*N),l.setRenderTarget(n),l.render(p,R_)}}function gTe(t){const e=[],n=[],r=[];let i=t;const s=t-t0+1+Oz.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);e.push(a);let l=1/a;o>t-t0?l=Oz[o-t+t0-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),f=-c,p=1+c,m=[f,f,p,f,p,p,f,f,p,p,f,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 k=0;k<x;k++){const O=k%3*2/3-1,R=k>2?0:-1,L=[O,R,0,O+2/3,R,0,O+2/3,R+1,0,O,R,0,O+2/3,R+1,0,O,R+1,0];C.set(L,_*b*k),A.set(m,S*b*k);const B=[k,k,k,k,k,k];N.set(B,M*b*k)}const P=new Ar;P.setAttribute("position",new $i(C,_)),P.setAttribute("uv",new $i(A,S)),P.setAttribute("faceIndex",new $i(N,M)),r.push(new qs(P,null)),i>t0&&i--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function jz(t,e,n){const r=new xu(t,e,n);return r.texture.mapping=eb,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function d1(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function xTe(t,e,n){return new _u({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:pTe,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:gE(),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:uh,depthTest:!1,depthWrite:!1})}function vTe(t,e,n){const r=new Float32Array(Zg),i=new We(0,1,0);return new _u({name:"SphericalGaussianBlur",defines:{n:Zg,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:gE(),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:uh,depthTest:!1,depthWrite:!1})}function zz(){return new _u({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:gE(),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:uh,depthTest:!1,depthWrite:!1})}function Fz(){return new _u({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:gE(),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:uh,depthTest:!1,depthWrite:!1})}function gE(){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 a9 extends xu{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 qw(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 Vx(5,5,5),s=new _u({name:"CubemapFromEquirect",uniforms:Dy(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Zl,blending:uh});s.uniforms.tEquirect.value=n;const o=new qs(i,s),a=n.minFilter;return n.minFilter===sh&&(n.minFilter=is),new VK(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 yTe(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===lS||x===cS)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 a9(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===lS||x===cS,_=x===ph||x===y0;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 IR(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 IR(t)),S=b?r.fromEquirectangular(m):r.fromCubemap(m),S.texture.pmremVersion=m.pmremVersion,n.set(m,S),m.addEventListener("dispose",f),S.texture):null}}}return m}function a(m,x){return x===lS?m.mapping=ph:x===cS&&(m.mapping=y0),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 f(m){const x=m.target;x.removeEventListener("dispose",f);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 bTe(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&&XS("WebGLRenderer: "+r+" extension not supported."),i}}}function _Te(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 P=C[A+0],k=C[A+1],O=C[A+2];m.push(P,k,k,O,O,P)}}else{const C=b.array;_=b.version;for(let A=0,N=C.length/3-1;A<N;A+=3){const P=A+0,k=A+1,O=A+2;m.push(P,k,k,O,O,P)}}const S=new(b.count>=65535?OD:ID)(m,1);S.version=_;const M=s.get(p);M&&e.remove(M),s.set(p,S)}function f(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:f}}function STe(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 f(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=f,this.renderMultiDrawInstances=p}function wTe(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 MTe(t,e,n){const r=new WeakMap,i=new hi;function s(o,a,l){const c=o.morphTargetInfluences,f=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,p=f!==void 0?f.length:0;let m=r.get(a);if(m===void 0||m.count!==p){let B=function(){R.dispose(),r.delete(a),a.removeEventListener("dispose",B)};var x=B;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 P=a.attributes.position.count*N,k=1;P>e.maxTextureSize&&(k=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const O=new Float32Array(P*k*4*p),R=new GC(O,P,k,p);R.type=Kl,R.needsUpdate=!0;const L=N*4;for(let V=0;V<p;V++){const W=M[V],G=C[V],ee=A[V],H=P*k*4*V;for(let q=0;q<W.count;q++){const J=q*L;b===!0&&(i.fromBufferAttribute(W,q),O[H+J+0]=i.x,O[H+J+1]=i.y,O[H+J+2]=i.z,O[H+J+3]=0),_===!0&&(i.fromBufferAttribute(G,q),O[H+J+4]=i.x,O[H+J+5]=i.y,O[H+J+6]=i.z,O[H+J+7]=0),S===!0&&(i.fromBufferAttribute(ee,q),O[H+J+8]=i.x,O[H+J+9]=i.y,O[H+J+10]=i.z,O[H+J+11]=ee.itemSize===4?i.w:1)}}m={count:p,texture:R,size:new $t(P,k)},r.set(a,m),a.addEventListener("dispose",B)}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 TTe(t,e,n,r,i){let s=new WeakMap;function o(c){const f=i.render.frame,p=c.geometry,m=e.get(c,p);if(s.get(m)!==f&&(e.update(m),s.set(m,f)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==f&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),s.set(c,f))),c.isSkinnedMesh){const x=c.skeleton;s.get(x)!==f&&(x.update(),s.set(x,f))}return m}function a(){s=new WeakMap}function l(c){const f=c.target;f.removeEventListener("dispose",l),r.releaseStatesOfObject(f),n.remove(f.instanceMatrix),f.instanceColor!==null&&n.remove(f.instanceColor)}return{update:o,dispose:a}}const CTe={[xD]:"LINEAR_TONE_MAPPING",[vD]:"REINHARD_TONE_MAPPING",[yD]:"CINEON_TONE_MAPPING",[PC]:"ACES_FILMIC_TONE_MAPPING",[_D]:"AGX_TONE_MAPPING",[SD]:"NEUTRAL_TONE_MAPPING",[bD]:"CUSTOM_TONE_MAPPING"};function ETe(t,e,n,r,i){const s=new xu(e,n,{type:t,depthBuffer:r,stencilBuffer:i}),o=new xu(e,n,{type:mh,depthBuffer:!1,stencilBuffer:!1}),a=new Ar;a.setAttribute("position",new On([-1,3,0,-1,-1,0,3,-1,0],3)),a.setAttribute("uv",new On([0,2,0,0,2,0],2));const l=new XD({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 qs(a,l),f=new nf(-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 P=S[N];P.setSize&&P.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 P=0;P<S.length;P++){const k=S[P];k.setSize&&k.setSize(A,N)}},this.begin=function(C,A){if(x||C.toneMapping===mu&&S.length===0)return!1;if(_=A,A!==null){const N=A.width,P=A.height;(s.width!==N||s.height!==P)&&this.setSize(N,P)}return M===!1&&C.setRenderTarget(s),b=C.toneMapping,C.toneMapping=mu,!0},this.hasRenderPass=function(){return M},this.end=function(C,A){C.toneMapping=b,x=!0;let N=s,P=o;for(let k=0;k<S.length;k++){const O=S[k];if(O.enabled!==!1&&(O.render(C,P,N,A),O.needsSwap!==!1)){const R=N;N=P,P=R}}if(p!==C.outputColorSpace||m!==C.toneMapping){p=C.outputColorSpace,m=C.toneMapping,l.defines={},li.getTransfer(p)===Hi&&(l.defines.SRGB_TRANSFER="");const k=CTe[m];k&&(l.defines[k]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=N.texture,C.setRenderTarget(_),C.render(c,f),_=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){s.dispose(),o.dispose(),a.dispose(),l.dispose()}}const eZ=new uo,OR=new ky(1,1),tZ=new GC,nZ=new WC,rZ=new qw,Uz=[],Bz=[],Hz=new Float32Array(16),Vz=new Float32Array(9),Gz=new Float32Array(4);function rb(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=Uz[i];if(s===void 0&&(s=new Float32Array(i),Uz[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 xE(t,e){let n=Bz[e];n===void 0&&(n=new Int32Array(e),Bz[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function ATe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function NTe(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 kTe(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 RTe(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 DTe(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;Gz.set(r),t.uniformMatrix2fv(this.addr,!1,Gz),ga(n,r)}}function PTe(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;Vz.set(r),t.uniformMatrix3fv(this.addr,!1,Vz),ga(n,r)}}function ITe(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;Hz.set(r),t.uniformMatrix4fv(this.addr,!1,Hz),ga(n,r)}}function OTe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function LTe(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 jTe(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 zTe(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 FTe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function UTe(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 BTe(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 HTe(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 VTe(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?(OR.compareFunction=n.isReversedDepthBuffer()?VC:HC,s=OR):s=eZ,n.setTexture2D(e||s,i)}function GTe(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||nZ,i)}function WTe(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||rZ,i)}function $Te(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||tZ,i)}function qTe(t){switch(t){case 5126:return ATe;case 35664:return NTe;case 35665:return kTe;case 35666:return RTe;case 35674:return DTe;case 35675:return PTe;case 35676:return ITe;case 5124:case 35670:return OTe;case 35667:case 35671:return LTe;case 35668:case 35672:return jTe;case 35669:case 35673:return zTe;case 5125:return FTe;case 36294:return UTe;case 36295:return BTe;case 36296:return HTe;case 35678:case 36198:case 36298:case 36306:case 35682:return VTe;case 35679:case 36299:case 36307:return GTe;case 35680:case 36300:case 36308:case 36293:return WTe;case 36289:case 36303:case 36311:case 36292:return $Te}}function XTe(t,e){t.uniform1fv(this.addr,e)}function YTe(t,e){const n=rb(e,this.size,2);t.uniform2fv(this.addr,n)}function KTe(t,e){const n=rb(e,this.size,3);t.uniform3fv(this.addr,n)}function ZTe(t,e){const n=rb(e,this.size,4);t.uniform4fv(this.addr,n)}function QTe(t,e){const n=rb(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function JTe(t,e){const n=rb(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function eCe(t,e){const n=rb(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function tCe(t,e){t.uniform1iv(this.addr,e)}function nCe(t,e){t.uniform2iv(this.addr,e)}function rCe(t,e){t.uniform3iv(this.addr,e)}function iCe(t,e){t.uniform4iv(this.addr,e)}function sCe(t,e){t.uniform1uiv(this.addr,e)}function oCe(t,e){t.uniform2uiv(this.addr,e)}function aCe(t,e){t.uniform3uiv(this.addr,e)}function lCe(t,e){t.uniform4uiv(this.addr,e)}function cCe(t,e,n){const r=this.cache,i=e.length,s=xE(n,i);ma(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));let o;this.type===t.SAMPLER_2D_SHADOW?o=OR:o=eZ;for(let a=0;a!==i;++a)n.setTexture2D(e[a]||o,s[a])}function uCe(t,e,n){const r=this.cache,i=e.length,s=xE(n,i);ma(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==i;++o)n.setTexture3D(e[o]||nZ,s[o])}function dCe(t,e,n){const r=this.cache,i=e.length,s=xE(n,i);ma(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==i;++o)n.setTextureCube(e[o]||rZ,s[o])}function fCe(t,e,n){const r=this.cache,i=e.length,s=xE(n,i);ma(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==i;++o)n.setTexture2DArray(e[o]||tZ,s[o])}function hCe(t){switch(t){case 5126:return XTe;case 35664:return YTe;case 35665:return KTe;case 35666:return ZTe;case 35674:return QTe;case 35675:return JTe;case 35676:return eCe;case 5124:case 35670:return tCe;case 35667:case 35671:return nCe;case 35668:case 35672:return rCe;case 35669:case 35673:return iCe;case 5125:return sCe;case 36294:return oCe;case 36295:return aCe;case 36296:return lCe;case 35678:case 36198:case 36298:case 36306:case 35682:return cCe;case 35679:case 36299:case 36307:return uCe;case 35680:case 36300:case 36308:case 36293:return dCe;case 36289:case 36303:case 36311:case 36292:return fCe}}class pCe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=qTe(n.type)}}class mCe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=hCe(n.type)}}class gCe{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 Wz(t,e){t.seq.push(e),t.map[e.id]=e}function xCe(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){Wz(n,c===void 0?new pCe(a,t,e):new mCe(a,t,e));break}else{let p=n.map[a];p===void 0&&(p=new gCe(a),Wz(n,p)),n=p}}}class p2{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);xCe(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 $z(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const vCe=37297;let yCe=0;function bCe(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 qz=new Er;function _Ce(t){li._getMatrix(qz,li.workingColorSpace,t);const e=`mat3( ${qz.elements.map(n=>n.toFixed(4))} )`;switch(li.getTransfer(t)){case GS:return[e,"LinearTransferOETF"];case Hi:return[e,"sRGBTransferOETF"];default:return Mn("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Xz(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+`

`+bCe(t.getShaderSource(e),a)}else return s}function SCe(t,e){const n=_Ce(e);return[`vec4 ${t}( vec4 value ) {`,`	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
`)}const wCe={[xD]:"Linear",[vD]:"Reinhard",[yD]:"Cineon",[PC]:"ACESFilmic",[_D]:"AgX",[SD]:"Neutral",[bD]:"Custom"};function MCe(t,e){const n=wCe[e];return n===void 0?(Mn("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const BM=new We;function TCe(){li.getLuminanceCoefficients(BM);const t=BM.x.toFixed(4),e=BM.y.toFixed(4),n=BM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
`)}function CCe(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(q_).join(`
`)}function ECe(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
`)}function ACe(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 q_(t){return t!==""}function Yz(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 Kz(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const NCe=/^[ \t]*#include +<([\w\d./]+)>/gm;function LR(t){return t.replace(NCe,RCe)}const kCe=new Map;function RCe(t,e){let n=Or[e];if(n===void 0){const r=kCe.get(e);if(r!==void 0)n=Or[r],Mn('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return LR(n)}const DCe=/#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 Zz(t){return t.replace(DCe,PCe)}function PCe(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 Qz(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 ICe={[z1]:"SHADOWMAP_TYPE_PCF",[Jg]:"SHADOWMAP_TYPE_VSM"};function OCe(t){return ICe[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const LCe={[ph]:"ENVMAP_TYPE_CUBE",[y0]:"ENVMAP_TYPE_CUBE",[eb]:"ENVMAP_TYPE_CUBE_UV"};function jCe(t){return t.envMap===!1?"ENVMAP_TYPE_CUBE":LCe[t.envMapMode]||"ENVMAP_TYPE_CUBE"}const zCe={[y0]:"ENVMAP_MODE_REFRACTION"};function FCe(t){return t.envMap===!1?"ENVMAP_MODE_REFLECTION":zCe[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}const UCe={[Ww]:"ENVMAP_BLENDING_MULTIPLY",[IY]:"ENVMAP_BLENDING_MIX",[OY]:"ENVMAP_BLENDING_ADD"};function BCe(t){return t.envMap===!1?"ENVMAP_BLENDING_NONE":UCe[t.combine]||"ENVMAP_BLENDING_NONE"}function HCe(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 VCe(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=OCe(n),c=jCe(n),f=FCe(n),p=BCe(n),m=HCe(n),x=CCe(n),b=ECe(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(q_).join(`
`),S.length>0&&(S+=`
`),M=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(q_).join(`
`),M.length>0&&(M+=`
`)):(S=[Qz(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 "+f:"",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(q_).join(`
`),M=[Qz(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 "+f:"",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!==mu?"#define TONE_MAPPING":"",n.toneMapping!==mu?Or.tonemapping_pars_fragment:"",n.toneMapping!==mu?MCe("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Or.colorspace_pars_fragment,SCe("linearToOutputTexel",n.outputColorSpace),TCe(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(q_).join(`
`)),o=LR(o),o=Yz(o,n),o=Kz(o,n),a=LR(a),a=Yz(a,n),a=Kz(a,n),o=Zz(o),a=Zz(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===TR?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===TR?"":"#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,P=$z(i,i.VERTEX_SHADER,A),k=$z(i,i.FRAGMENT_SHADER,N);i.attachShader(_,P),i.attachShader(_,k),n.index0AttributeName!==void 0?i.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function O(V){if(t.debug.checkShaderErrors){const W=i.getProgramInfoLog(_)||"",G=i.getShaderInfoLog(P)||"",ee=i.getShaderInfoLog(k)||"",H=W.trim(),q=G.trim(),J=ee.trim();let K=!0,ne=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(K=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,_,P,k);else{const U=Xz(i,P,"vertex"),z=Xz(i,k,"fragment");Wn("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`

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

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

	gl_Position = vec4( position, 1.0 );

}`,dEe=`
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 fEe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new FD(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 _u({vertexShader:uEe,fragmentShader:dEe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new qs(new Op(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class hEe extends Th{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,f=null,p=null,m=null,x=null,b=null;const _=typeof XRWebGLBinding<"u",S=new fEe,M={},C=n.getContextAttributes();let A=null,N=null;const P=[],k=[],O=new $t;let R=null;const L=new ao;L.viewport=new hi;const B=new ao;B.viewport=new hi;const V=[L,B],W=new GK;let G=null,ee=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let ie=P[X];return ie===void 0&&(ie=new h2,P[X]=ie),ie.getTargetRaySpace()},this.getControllerGrip=function(X){let ie=P[X];return ie===void 0&&(ie=new h2,P[X]=ie),ie.getGripSpace()},this.getHand=function(X){let ie=P[X];return ie===void 0&&(ie=new h2,P[X]=ie),ie.getHandSpace()};function H(X){const ie=k.indexOf(X.inputSource);if(ie===-1)return;const fe=P[ie];fe!==void 0&&(fe.update(X.inputSource,X.frame,c||o),fe.dispatchEvent({type:X.type,data:X.inputSource}))}function q(){i.removeEventListener("select",H),i.removeEventListener("selectstart",H),i.removeEventListener("selectend",H),i.removeEventListener("squeeze",H),i.removeEventListener("squeezestart",H),i.removeEventListener("squeezeend",H),i.removeEventListener("end",q),i.removeEventListener("inputsourceschange",J);for(let X=0;X<P.length;X++){const ie=k[X];ie!==null&&(k[X]=null,P[X].disconnect(ie))}G=null,ee=null,S.reset();for(const X in M)delete M[X];e.setRenderTarget(A),x=null,m=null,p=null,i=null,N=null,ce.stop(),r.isPresenting=!1,e.setPixelRatio(R),e.setSize(O.width,O.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,r.isPresenting===!0&&Mn("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){a=X,r.isPresenting===!0&&Mn("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(X){c=X},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(X){if(i=X,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",H),i.addEventListener("selectstart",H),i.addEventListener("selectend",H),i.addEventListener("squeeze",H),i.addEventListener("squeezestart",H),i.addEventListener("squeezeend",H),i.addEventListener("end",q),i.addEventListener("inputsourceschange",J),C.xrCompatible!==!0&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(O),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let fe=null,Q=null,ue=null;C.depth&&(ue=C.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,fe=C.stencil?Jm:gh,Q=C.stencil?Ey:md);const he={colorFormat:n.RGBA8,depthFormat:ue,scaleFactor:s};p=this.getBinding(),m=p.createProjectionLayer(he),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),N=new xu(m.textureWidth,m.textureHeight,{format:vl,type:Wl,depthTexture:new ky(m.textureWidth,m.textureHeight,Q,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:C.stencil,colorSpace:e.outputColorSpace,samples:C.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const fe={antialias:C.antialias,alpha:!0,depth:C.depth,stencil:C.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(i,n,fe),i.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),N=new xu(x.framebufferWidth,x.framebufferHeight,{format:vl,type:Wl,colorSpace:e.outputColorSpace,stencilBuffer:C.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}N.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),ce.setContext(i),ce.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function J(X){for(let ie=0;ie<X.removed.length;ie++){const fe=X.removed[ie],Q=k.indexOf(fe);Q>=0&&(k[Q]=null,P[Q].disconnect(fe))}for(let ie=0;ie<X.added.length;ie++){const fe=X.added[ie];let Q=k.indexOf(fe);if(Q===-1){for(let he=0;he<P.length;he++)if(he>=k.length){k.push(fe),Q=he;break}else if(k[he]===null){k[he]=fe,Q=he;break}if(Q===-1)break}const ue=P[Q];ue&&ue.connect(fe)}}const K=new We,ne=new We;function U(X,ie,fe){K.setFromMatrixPosition(ie.matrixWorld),ne.setFromMatrixPosition(fe.matrixWorld);const Q=K.distanceTo(ne),ue=ie.projectionMatrix.elements,he=fe.projectionMatrix.elements,se=ue[14]/(ue[10]-1),Ce=ue[14]/(ue[10]+1),de=(ue[9]+1)/ue[5],Me=(ue[9]-1)/ue[5],Te=(ue[8]-1)/ue[0],Pe=(he[8]+1)/he[0],oe=se*Te,Ve=se*Pe,He=Q/(-Te+Pe),ze=He*-Te;if(ie.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX(ze),X.translateZ(He),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert(),ue[10]===-1)X.projectionMatrix.copy(ie.projectionMatrix),X.projectionMatrixInverse.copy(ie.projectionMatrixInverse);else{const Ge=se+He,ae=Ce+He,Z=oe-ze,ge=Ve+(Q-ze),we=de*Ce/ae*Ge,_e=Me*Ce/ae*Ge;X.projectionMatrix.makePerspective(Z,ge,we,_e,Ge,ae),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}}function z(X,ie){ie===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(ie.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(i===null)return;let ie=X.near,fe=X.far;S.texture!==null&&(S.depthNear>0&&(ie=S.depthNear),S.depthFar>0&&(fe=S.depthFar)),W.near=B.near=L.near=ie,W.far=B.far=L.far=fe,(G!==W.near||ee!==W.far)&&(i.updateRenderState({depthNear:W.near,depthFar:W.far}),G=W.near,ee=W.far),W.layers.mask=X.layers.mask|6,L.layers.mask=W.layers.mask&-5,B.layers.mask=W.layers.mask&-3;const Q=X.parent,ue=W.cameras;z(W,Q);for(let he=0;he<ue.length;he++)z(ue[he],Q);ue.length===2?U(W,L,B):W.projectionMatrix.copy(L.projectionMatrix),Y(X,W,Q)};function Y(X,ie,fe){fe===null?X.matrix.copy(ie.matrixWorld):(X.matrix.copy(fe.matrixWorld),X.matrix.invert(),X.matrix.multiply(ie.matrixWorld)),X.matrix.decompose(X.position,X.quaternion,X.scale),X.updateMatrixWorld(!0),X.projectionMatrix.copy(ie.projectionMatrix),X.projectionMatrixInverse.copy(ie.projectionMatrixInverse),X.isPerspectiveCamera&&(X.fov=Ay*2*Math.atan(1/X.projectionMatrix.elements[5]),X.zoom=1)}this.getCamera=function(){return W},this.getFoveation=function(){if(!(m===null&&x===null))return l},this.setFoveation=function(X){l=X,m!==null&&(m.fixedFoveation=X),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=X)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(W)},this.getCameraTexture=function(X){return M[X]};let j=null;function le(X,ie){if(f=ie.getViewerPose(c||o),b=ie,f!==null){const fe=f.views;x!==null&&(e.setRenderTargetFramebuffer(N,x.framebuffer),e.setRenderTarget(N));let Q=!1;fe.length!==W.cameras.length&&(W.cameras.length=0,Q=!0);for(let Ce=0;Ce<fe.length;Ce++){const de=fe[Ce];let Me=null;if(x!==null)Me=x.getViewport(de);else{const Pe=p.getViewSubImage(m,de);Me=Pe.viewport,Ce===0&&(e.setRenderTargetTextures(N,Pe.colorTexture,Pe.depthStencilTexture),e.setRenderTarget(N))}let Te=V[Ce];Te===void 0&&(Te=new ao,Te.layers.enable(Ce),Te.viewport=new hi,V[Ce]=Te),Te.matrix.fromArray(de.transform.matrix),Te.matrix.decompose(Te.position,Te.quaternion,Te.scale),Te.projectionMatrix.fromArray(de.projectionMatrix),Te.projectionMatrixInverse.copy(Te.projectionMatrix).invert(),Te.viewport.set(Me.x,Me.y,Me.width,Me.height),Ce===0&&(W.matrix.copy(Te.matrix),W.matrix.decompose(W.position,W.quaternion,W.scale)),Q===!0&&W.cameras.push(Te)}const ue=i.enabledFeatures;if(ue&&ue.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){p=r.getBinding();const Ce=p.getDepthInformation(fe[0]);Ce&&Ce.isValid&&Ce.texture&&S.init(Ce,i.renderState)}if(ue&&ue.includes("camera-access")&&_){e.state.unbindTexture(),p=r.getBinding();for(let Ce=0;Ce<fe.length;Ce++){const de=fe[Ce].camera;if(de){let Me=M[de];Me||(Me=new FD,M[de]=Me);const Te=p.getCameraImage(de);Me.sourceTexture=Te}}}}for(let fe=0;fe<P.length;fe++){const Q=k[fe],ue=P[fe];Q!==null&&ue!==void 0&&ue.update(Q,ie,c||o)}j&&j(X,ie),ie.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ie}),b=null}const ce=new JK;ce.setAnimationLoop(le),this.setAnimationLoop=function(X){j=X},this.dispose=function(){}}}const Vg=new bu,pEe=new dr;function mEe(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,_K(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),f(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===Zl&&(S.bumpScale.value*=-1)),M.normalMap&&(S.normalMap.value=M.normalMap,n(M.normalMap,S.normalMapTransform),S.normalScale.value.copy(M.normalScale),M.side===Zl&&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,Vg.copy(N),Vg.x*=-1,Vg.y*=-1,Vg.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(Vg.y*=-1,Vg.z*=-1),S.envMapRotation.value.setFromMatrix4(pEe.makeRotationFromEuler(Vg)),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 f(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===Zl&&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 gEe(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=f(C),i[C.id]=N,C.addEventListener("dispose",S));const P=A.program;r.updateUBOMapping(C,P);const k=e.render.frame;s[C.id]!==k&&(m(C),s[C.id]=k)}function f(C){const A=p();C.__bindingPointIndex=A;const N=t.createBuffer(),P=C.__size,k=C.usage;return t.bindBuffer(t.UNIFORM_BUFFER,N),t.bufferData(t.UNIFORM_BUFFER,P,k),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,P=C.__cache;t.bindBuffer(t.UNIFORM_BUFFER,A);for(let k=0,O=N.length;k<O;k++){const R=Array.isArray(N[k])?N[k]:[N[k]];for(let L=0,B=R.length;L<B;L++){const V=R[L];if(x(V,k,L,P)===!0){const W=V.__offset,G=Array.isArray(V.value)?V.value:[V.value];let ee=0;for(let H=0;H<G.length;H++){const q=G[H],J=_(q);typeof q=="number"||typeof q=="boolean"?(V.__data[0]=q,t.bufferSubData(t.UNIFORM_BUFFER,W+ee,V.__data)):q.isMatrix3?(V.__data[0]=q.elements[0],V.__data[1]=q.elements[1],V.__data[2]=q.elements[2],V.__data[3]=0,V.__data[4]=q.elements[3],V.__data[5]=q.elements[4],V.__data[6]=q.elements[5],V.__data[7]=0,V.__data[8]=q.elements[6],V.__data[9]=q.elements[7],V.__data[10]=q.elements[8],V.__data[11]=0):(q.toArray(V.__data,ee),ee+=J.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,W,V.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function x(C,A,N,P){const k=C.value,O=A+"_"+N;if(P[O]===void 0)return typeof k=="number"||typeof k=="boolean"?P[O]=k:P[O]=k.clone(),!0;{const R=P[O];if(typeof k=="number"||typeof k=="boolean"){if(R!==k)return P[O]=k,!0}else if(R.equals(k)===!1)return R.copy(k),!0}return!1}function b(C){const A=C.uniforms;let N=0;const P=16;for(let O=0,R=A.length;O<R;O++){const L=Array.isArray(A[O])?A[O]:[A[O]];for(let B=0,V=L.length;B<V;B++){const W=L[B],G=Array.isArray(W.value)?W.value:[W.value];for(let ee=0,H=G.length;ee<H;ee++){const q=G[ee],J=_(q),K=N%P,ne=K%J.boundary,U=K+ne;N+=ne,U!==0&&P-U<J.storage&&(N+=P-U),W.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),W.__offset=N,N+=J.storage}}}const k=N%P;return k>0&&(N+=P-k),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?Mn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Mn("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 xEe=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 Hf=null;function vEe(){return Hf===null&&(Hf=new tf(xEe,16,16,Ex,mh),Hf.name="DFG_LUT",Hf.minFilter=is,Hf.magFilter=is,Hf.wrapS=Lc,Hf.wrapT=Lc,Hf.generateMipmaps=!1,Hf.needsUpdate=!0),Hf}class sZ{constructor(e={}){const{canvas:n=KY(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:m=!1,outputBufferType:x=Wl}=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([UC,FC,$w]),M=new Set([Wl,md,Cy,Ey,LC,jC]),C=new Uint32Array(4),A=new Int32Array(4);let N=null,P=null;const k=[],O=[];let R=null;this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=mu,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const L=this;let B=!1;this._outputColorSpace=xl;let V=0,W=0,G=null,ee=-1,H=null;const q=new hi,J=new hi;let K=null;const ne=new kn(0);let U=0,z=n.width,Y=n.height,j=1,le=null,ce=null;const X=new hi(0,0,z,Y),ie=new hi(0,0,z,Y);let fe=!1;const Q=new tb;let ue=!1,he=!1;const se=new dr,Ce=new We,de=new hi,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Te=!1;function Pe(){return G===null?j:1}let oe=r;function Ve(ye,et){return n.getContext(ye,et)}try{const ye={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:f,failIfMajorPerformanceCaveat:p};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Gw}`),n.addEventListener("webglcontextlost",Ae,!1),n.addEventListener("webglcontextrestored",Xe,!1),n.addEventListener("webglcontextcreationerror",Re,!1),oe===null){const et="webgl2";if(oe=Ve(et,ye),oe===null)throw Ve(et)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ye){throw Wn("WebGLRenderer: "+ye.message),ye}let He,ze,Ge,ae,Z,ge,we,_e,ve,Ue,Se,ke,qe,Je,nt,tt,be,Le,Ze,Ee,Ye,it,mt;function ft(){He=new bTe(oe),He.init(),Ye=new iZ(oe,He),ze=new fTe(oe,He,e,Ye),Ge=new lEe(oe,He),ze.reversedDepthBuffer&&m&&Ge.buffers.depth.setReversed(!0),ae=new wTe(oe),Z=new XCe,ge=new cEe(oe,He,Ge,Z,ze,Ye,ae),we=new yTe(L),_e=new AMe(oe),it=new uTe(oe,_e),ve=new _Te(oe,_e,ae,it),Ue=new TTe(oe,ve,_e,it,ae),Le=new MTe(oe,ze,ge),nt=new hTe(Z),Se=new qCe(L,we,He,ze,it,nt),ke=new mEe(L,Z),qe=new KCe,Je=new nEe(He),be=new cTe(L,we,Ge,Ue,b,l),tt=new aEe(L,Ue,ze),mt=new gEe(oe,ae,ze,Ge),Ze=new dTe(oe,He,ae),Ee=new STe(oe,He,ae),ae.programs=Se.programs,L.capabilities=ze,L.extensions=He,L.properties=Z,L.renderLists=qe,L.shadowMap=tt,L.state=Ge,L.info=ae}ft(),_!==Wl&&(R=new ETe(_,n.width,n.height,i,s));const Qe=new hEe(L,oe);this.xr=Qe,this.getContext=function(){return oe},this.getContextAttributes=function(){return oe.getContextAttributes()},this.forceContextLoss=function(){const ye=He.get("WEBGL_lose_context");ye&&ye.loseContext()},this.forceContextRestore=function(){const ye=He.get("WEBGL_lose_context");ye&&ye.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(ye){ye!==void 0&&(j=ye,this.setSize(z,Y,!1))},this.getSize=function(ye){return ye.set(z,Y)},this.setSize=function(ye,et,xt=!0){if(Qe.isPresenting){Mn("WebGLRenderer: Can't change size while VR device is presenting.");return}z=ye,Y=et,n.width=Math.floor(ye*j),n.height=Math.floor(et*j),xt===!0&&(n.style.width=ye+"px",n.style.height=et+"px"),R!==null&&R.setSize(n.width,n.height),this.setViewport(0,0,ye,et)},this.getDrawingBufferSize=function(ye){return ye.set(z*j,Y*j).floor()},this.setDrawingBufferSize=function(ye,et,xt){z=ye,Y=et,j=xt,n.width=Math.floor(ye*xt),n.height=Math.floor(et*xt),this.setViewport(0,0,ye,et)},this.setEffects=function(ye){if(_===Wl){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ye){for(let et=0;et<ye.length;et++)if(ye[et].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}R.setEffects(ye||[])},this.getCurrentViewport=function(ye){return ye.copy(q)},this.getViewport=function(ye){return ye.copy(X)},this.setViewport=function(ye,et,xt,vt){ye.isVector4?X.set(ye.x,ye.y,ye.z,ye.w):X.set(ye,et,xt,vt),Ge.viewport(q.copy(X).multiplyScalar(j).round())},this.getScissor=function(ye){return ye.copy(ie)},this.setScissor=function(ye,et,xt,vt){ye.isVector4?ie.set(ye.x,ye.y,ye.z,ye.w):ie.set(ye,et,xt,vt),Ge.scissor(J.copy(ie).multiplyScalar(j).round())},this.getScissorTest=function(){return fe},this.setScissorTest=function(ye){Ge.setScissorTest(fe=ye)},this.setOpaqueSort=function(ye){le=ye},this.setTransparentSort=function(ye){ce=ye},this.getClearColor=function(ye){return ye.copy(be.getClearColor())},this.setClearColor=function(){be.setClearColor(...arguments)},this.getClearAlpha=function(){return be.getClearAlpha()},this.setClearAlpha=function(){be.setClearAlpha(...arguments)},this.clear=function(ye=!0,et=!0,xt=!0){let vt=0;if(ye){let ut=!1;if(G!==null){const qt=G.texture.format;ut=S.has(qt)}if(ut){const qt=G.texture.type,en=M.has(qt),Qt=be.getClearColor(),Gt=be.getClearAlpha(),hn=Qt.r,Sn=Qt.g,Nn=Qt.b;en?(C[0]=hn,C[1]=Sn,C[2]=Nn,C[3]=Gt,oe.clearBufferuiv(oe.COLOR,0,C)):(A[0]=hn,A[1]=Sn,A[2]=Nn,A[3]=Gt,oe.clearBufferiv(oe.COLOR,0,A))}else vt|=oe.COLOR_BUFFER_BIT}et&&(vt|=oe.DEPTH_BUFFER_BIT),xt&&(vt|=oe.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),vt!==0&&oe.clear(vt)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Ae,!1),n.removeEventListener("webglcontextrestored",Xe,!1),n.removeEventListener("webglcontextcreationerror",Re,!1),be.dispose(),qe.dispose(),Je.dispose(),Z.dispose(),we.dispose(),Ue.dispose(),it.dispose(),mt.dispose(),Se.dispose(),Qe.dispose(),Qe.removeEventListener("sessionstart",Ht),Qe.removeEventListener("sessionend",rn),Ut.stop()};function Ae(ye){ye.preventDefault(),qS("WebGLRenderer: Context Lost."),B=!0}function Xe(){qS("WebGLRenderer: Context Restored."),B=!1;const ye=ae.autoReset,et=tt.enabled,xt=tt.autoUpdate,vt=tt.needsUpdate,ut=tt.type;ft(),ae.autoReset=ye,tt.enabled=et,tt.autoUpdate=xt,tt.needsUpdate=vt,tt.type=ut}function Re(ye){Wn("WebGLRenderer: A WebGL context could not be created. Reason: ",ye.statusMessage)}function Be(ye){const et=ye.target;et.removeEventListener("dispose",Be),ot(et)}function ot(ye){dt(ye),Z.remove(ye)}function dt(ye){const et=Z.get(ye).programs;et!==void 0&&(et.forEach(function(xt){Se.releaseProgram(xt)}),ye.isShaderMaterial&&Se.releaseShaderCache(ye))}this.renderBufferDirect=function(ye,et,xt,vt,ut,qt){et===null&&(et=Me);const en=ut.isMesh&&ut.matrixWorld.determinant()<0,Qt=It(ye,et,xt,vt,ut);Ge.setMaterial(vt,en);let Gt=xt.index,hn=1;if(vt.wireframe===!0){if(Gt=ve.getWireframeAttribute(xt),Gt===void 0)return;hn=2}const Sn=xt.drawRange,Nn=xt.attributes.position;let nn=Sn.start*hn,Gn=(Sn.start+Sn.count)*hn;qt!==null&&(nn=Math.max(nn,qt.start*hn),Gn=Math.min(Gn,(qt.start+qt.count)*hn)),Gt!==null?(nn=Math.max(nn,0),Gn=Math.min(Gn,Gt.count)):Nn!=null&&(nn=Math.max(nn,0),Gn=Math.min(Gn,Nn.count));const vr=Gn-nn;if(vr<0||vr===1/0)return;it.setup(ut,vt,Qt,xt,Gt);let sr,Yn=Ze;if(Gt!==null&&(sr=_e.get(Gt),Yn=Ee,Yn.setIndex(sr)),ut.isMesh)vt.wireframe===!0?(Ge.setLineWidth(vt.wireframeLinewidth*Pe()),Yn.setMode(oe.LINES)):Yn.setMode(oe.TRIANGLES);else if(ut.isLine){let fr=vt.linewidth;fr===void 0&&(fr=1),Ge.setLineWidth(fr*Pe()),ut.isLineSegments?Yn.setMode(oe.LINES):ut.isLineLoop?Yn.setMode(oe.LINE_LOOP):Yn.setMode(oe.LINE_STRIP)}else ut.isPoints?Yn.setMode(oe.POINTS):ut.isSprite&&Yn.setMode(oe.TRIANGLES);if(ut.isBatchedMesh)if(ut._multiDrawInstances!==null)XS("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Yn.renderMultiDrawInstances(ut._multiDrawStarts,ut._multiDrawCounts,ut._multiDrawCount,ut._multiDrawInstances);else if(He.get("WEBGL_multi_draw"))Yn.renderMultiDraw(ut._multiDrawStarts,ut._multiDrawCounts,ut._multiDrawCount);else{const fr=ut._multiDrawStarts,un=ut._multiDrawCounts,ls=ut._multiDrawCount,jn=Gt?_e.get(Gt).bytesPerElement:1,ys=Z.get(vt).currentProgram.getUniforms();for(let Ps=0;Ps<ls;Ps++)ys.setValue(oe,"_gl_DrawID",Ps),Yn.render(fr[Ps]/jn,un[Ps])}else if(ut.isInstancedMesh)Yn.renderInstances(nn,vr,ut.count);else if(xt.isInstancedBufferGeometry){const fr=xt._maxInstanceCount!==void 0?xt._maxInstanceCount:1/0,un=Math.min(xt.instanceCount,fr);Yn.renderInstances(nn,vr,un)}else Yn.render(nn,vr)};function Nt(ye,et,xt){ye.transparent===!0&&ye.side===au&&ye.forceSinglePass===!1?(ye.side=Zl,ye.needsUpdate=!0,Pt(ye,et,xt),ye.side=Ep,ye.needsUpdate=!0,Pt(ye,et,xt),ye.side=au):Pt(ye,et,xt)}this.compile=function(ye,et,xt=null){xt===null&&(xt=ye),P=Je.get(xt),P.init(et),O.push(P),xt.traverseVisible(function(ut){ut.isLight&&ut.layers.test(et.layers)&&(P.pushLight(ut),ut.castShadow&&P.pushShadow(ut))}),ye!==xt&&ye.traverseVisible(function(ut){ut.isLight&&ut.layers.test(et.layers)&&(P.pushLight(ut),ut.castShadow&&P.pushShadow(ut))}),P.setupLights();const vt=new Set;return ye.traverse(function(ut){if(!(ut.isMesh||ut.isPoints||ut.isLine||ut.isSprite))return;const qt=ut.material;if(qt)if(Array.isArray(qt))for(let en=0;en<qt.length;en++){const Qt=qt[en];Nt(Qt,xt,ut),vt.add(Qt)}else Nt(qt,xt,ut),vt.add(qt)}),P=O.pop(),vt},this.compileAsync=function(ye,et,xt=null){const vt=this.compile(ye,et,xt);return new Promise(ut=>{function qt(){if(vt.forEach(function(en){Z.get(en).currentProgram.isReady()&&vt.delete(en)}),vt.size===0){ut(ye);return}setTimeout(qt,10)}He.get("KHR_parallel_shader_compile")!==null?qt():setTimeout(qt,10)})};let Dt=null;function St(ye){Dt&&Dt(ye)}function Ht(){Ut.stop()}function rn(){Ut.start()}const Ut=new JK;Ut.setAnimationLoop(St),typeof self<"u"&&Ut.setContext(self),this.setAnimationLoop=function(ye){Dt=ye,Qe.setAnimationLoop(ye),ye===null?Ut.stop():Ut.start()},Qe.addEventListener("sessionstart",Ht),Qe.addEventListener("sessionend",rn),this.render=function(ye,et){if(et!==void 0&&et.isCamera!==!0){Wn("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(B===!0)return;const xt=Qe.enabled===!0&&Qe.isPresenting===!0,vt=R!==null&&(G===null||xt)&&R.begin(L,G);if(ye.matrixWorldAutoUpdate===!0&&ye.updateMatrixWorld(),et.parent===null&&et.matrixWorldAutoUpdate===!0&&et.updateMatrixWorld(),Qe.enabled===!0&&Qe.isPresenting===!0&&(R===null||R.isCompositing()===!1)&&(Qe.cameraAutoUpdate===!0&&Qe.updateCamera(et),et=Qe.getCamera()),ye.isScene===!0&&ye.onBeforeRender(L,ye,et,G),P=Je.get(ye,O.length),P.init(et),O.push(P),se.multiplyMatrices(et.projectionMatrix,et.matrixWorldInverse),Q.setFromProjectionMatrix(se,uu,et.reversedDepth),he=this.localClippingEnabled,ue=nt.init(this.clippingPlanes,he),N=qe.get(ye,k.length),N.init(),k.push(N),Qe.enabled===!0&&Qe.isPresenting===!0){const en=L.xr.getDepthSensingMesh();en!==null&&Ft(en,et,-1/0,L.sortObjects)}Ft(ye,et,0,L.sortObjects),N.finish(),L.sortObjects===!0&&N.sort(le,ce),Te=Qe.enabled===!1||Qe.isPresenting===!1||Qe.hasDepthSensing()===!1,Te&&be.addToRenderList(N,ye),this.info.render.frame++,ue===!0&&nt.beginShadows();const ut=P.state.shadowsArray;if(tt.render(ut,ye,et),ue===!0&&nt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(vt&&R.hasRenderPass())===!1){const en=N.opaque,Qt=N.transmissive;if(P.setupLights(),et.isArrayCamera){const Gt=et.cameras;if(Qt.length>0)for(let hn=0,Sn=Gt.length;hn<Sn;hn++){const Nn=Gt[hn];Kt(en,Qt,ye,Nn)}Te&&be.render(ye);for(let hn=0,Sn=Gt.length;hn<Sn;hn++){const Nn=Gt[hn];Bt(N,ye,Nn,Nn.viewport)}}else Qt.length>0&&Kt(en,Qt,ye,et),Te&&be.render(ye),Bt(N,ye,et)}G!==null&&W===0&&(ge.updateMultisampleRenderTarget(G),ge.updateRenderTargetMipmap(G)),vt&&R.end(L),ye.isScene===!0&&ye.onAfterRender(L,ye,et),it.resetDefaultState(),ee=-1,H=null,O.pop(),O.length>0?(P=O[O.length-1],ue===!0&&nt.setGlobalState(L.clippingPlanes,P.state.camera)):P=null,k.pop(),k.length>0?N=k[k.length-1]:N=null};function Ft(ye,et,xt,vt){if(ye.visible===!1)return;if(ye.layers.test(et.layers)){if(ye.isGroup)xt=ye.renderOrder;else if(ye.isLOD)ye.autoUpdate===!0&&ye.update(et);else if(ye.isLight)P.pushLight(ye),ye.castShadow&&P.pushShadow(ye);else if(ye.isSprite){if(!ye.frustumCulled||Q.intersectsSprite(ye)){vt&&de.setFromMatrixPosition(ye.matrixWorld).applyMatrix4(se);const en=Ue.update(ye),Qt=ye.material;Qt.visible&&N.push(ye,en,Qt,xt,de.z,null)}}else if((ye.isMesh||ye.isLine||ye.isPoints)&&(!ye.frustumCulled||Q.intersectsObject(ye))){const en=Ue.update(ye),Qt=ye.material;if(vt&&(ye.boundingSphere!==void 0?(ye.boundingSphere===null&&ye.computeBoundingSphere(),de.copy(ye.boundingSphere.center)):(en.boundingSphere===null&&en.computeBoundingSphere(),de.copy(en.boundingSphere.center)),de.applyMatrix4(ye.matrixWorld).applyMatrix4(se)),Array.isArray(Qt)){const Gt=en.groups;for(let hn=0,Sn=Gt.length;hn<Sn;hn++){const Nn=Gt[hn],nn=Qt[Nn.materialIndex];nn&&nn.visible&&N.push(ye,en,nn,xt,de.z,Nn)}}else Qt.visible&&N.push(ye,en,Qt,xt,de.z,null)}}const qt=ye.children;for(let en=0,Qt=qt.length;en<Qt;en++)Ft(qt[en],et,xt,vt)}function Bt(ye,et,xt,vt){const{opaque:ut,transmissive:qt,transparent:en}=ye;P.setupLightsView(xt),ue===!0&&nt.setGlobalState(L.clippingPlanes,xt),vt&&Ge.viewport(q.copy(vt)),ut.length>0&&dn(ut,et,xt),qt.length>0&&dn(qt,et,xt),en.length>0&&dn(en,et,xt),Ge.buffers.depth.setTest(!0),Ge.buffers.depth.setMask(!0),Ge.buffers.color.setMask(!0),Ge.setPolygonOffset(!1)}function Kt(ye,et,xt,vt){if((xt.isScene===!0?xt.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[vt.id]===void 0){const nn=He.has("EXT_color_buffer_half_float")||He.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[vt.id]=new xu(1,1,{generateMipmaps:!0,type:nn?mh:Wl,minFilter:sh,samples:ze.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:li.workingColorSpace})}const qt=P.state.transmissionRenderTarget[vt.id],en=vt.viewport||q;qt.setSize(en.z*L.transmissionResolutionScale,en.w*L.transmissionResolutionScale);const Qt=L.getRenderTarget(),Gt=L.getActiveCubeFace(),hn=L.getActiveMipmapLevel();L.setRenderTarget(qt),L.getClearColor(ne),U=L.getClearAlpha(),U<1&&L.setClearColor(16777215,.5),L.clear(),Te&&be.render(xt);const Sn=L.toneMapping;L.toneMapping=mu;const Nn=vt.viewport;if(vt.viewport!==void 0&&(vt.viewport=void 0),P.setupLightsView(vt),ue===!0&&nt.setGlobalState(L.clippingPlanes,vt),dn(ye,xt,vt),ge.updateMultisampleRenderTarget(qt),ge.updateRenderTargetMipmap(qt),He.has("WEBGL_multisampled_render_to_texture")===!1){let nn=!1;for(let Gn=0,vr=et.length;Gn<vr;Gn++){const sr=et[Gn],{object:Yn,geometry:fr,material:un,group:ls}=sr;if(un.side===au&&Yn.layers.test(vt.layers)){const jn=un.side;un.side=Zl,un.needsUpdate=!0,Rt(Yn,xt,vt,fr,un,ls),un.side=jn,un.needsUpdate=!0,nn=!0}}nn===!0&&(ge.updateMultisampleRenderTarget(qt),ge.updateRenderTargetMipmap(qt))}L.setRenderTarget(Qt,Gt,hn),L.setClearColor(ne,U),Nn!==void 0&&(vt.viewport=Nn),L.toneMapping=Sn}function dn(ye,et,xt){const vt=et.isScene===!0?et.overrideMaterial:null;for(let ut=0,qt=ye.length;ut<qt;ut++){const en=ye[ut],{object:Qt,geometry:Gt,group:hn}=en;let Sn=en.material;Sn.allowOverride===!0&&vt!==null&&(Sn=vt),Qt.layers.test(xt.layers)&&Rt(Qt,et,xt,Gt,Sn,hn)}}function Rt(ye,et,xt,vt,ut,qt){ye.onBeforeRender(L,et,xt,vt,ut,qt),ye.modelViewMatrix.multiplyMatrices(xt.matrixWorldInverse,ye.matrixWorld),ye.normalMatrix.getNormalMatrix(ye.modelViewMatrix),ut.onBeforeRender(L,et,xt,vt,ye,qt),ut.transparent===!0&&ut.side===au&&ut.forceSinglePass===!1?(ut.side=Zl,ut.needsUpdate=!0,L.renderBufferDirect(xt,et,vt,ut,ye,qt),ut.side=Ep,ut.needsUpdate=!0,L.renderBufferDirect(xt,et,vt,ut,ye,qt),ut.side=au):L.renderBufferDirect(xt,et,vt,ut,ye,qt),ye.onAfterRender(L,et,xt,vt,ut,qt)}function Pt(ye,et,xt){et.isScene!==!0&&(et=Me);const vt=Z.get(ye),ut=P.state.lights,qt=P.state.shadowsArray,en=ut.state.version,Qt=Se.getParameters(ye,ut.state,qt,et,xt),Gt=Se.getProgramCacheKey(Qt);let hn=vt.programs;vt.environment=ye.isMeshStandardMaterial||ye.isMeshLambertMaterial||ye.isMeshPhongMaterial?et.environment:null,vt.fog=et.fog;const Sn=ye.isMeshStandardMaterial||ye.isMeshLambertMaterial&&!ye.envMap||ye.isMeshPhongMaterial&&!ye.envMap;vt.envMap=we.get(ye.envMap||vt.environment,Sn),vt.envMapRotation=vt.environment!==null&&ye.envMap===null?et.environmentRotation:ye.envMapRotation,hn===void 0&&(ye.addEventListener("dispose",Be),hn=new Map,vt.programs=hn);let Nn=hn.get(Gt);if(Nn!==void 0){if(vt.currentProgram===Nn&&vt.lightsStateVersion===en)return ln(ye,Qt),Nn}else Qt.uniforms=Se.getUniforms(ye),ye.onBeforeCompile(Qt,L),Nn=Se.acquireProgram(Qt,Gt),hn.set(Gt,Nn),vt.uniforms=Qt.uniforms;const nn=vt.uniforms;return(!ye.isShaderMaterial&&!ye.isRawShaderMaterial||ye.clipping===!0)&&(nn.clippingPlanes=nt.uniform),ln(ye,Qt),vt.needsLights=gt(ye),vt.lightsStateVersion=en,vt.needsLights&&(nn.ambientLightColor.value=ut.state.ambient,nn.lightProbe.value=ut.state.probe,nn.directionalLights.value=ut.state.directional,nn.directionalLightShadows.value=ut.state.directionalShadow,nn.spotLights.value=ut.state.spot,nn.spotLightShadows.value=ut.state.spotShadow,nn.rectAreaLights.value=ut.state.rectArea,nn.ltc_1.value=ut.state.rectAreaLTC1,nn.ltc_2.value=ut.state.rectAreaLTC2,nn.pointLights.value=ut.state.point,nn.pointLightShadows.value=ut.state.pointShadow,nn.hemisphereLights.value=ut.state.hemi,nn.directionalShadowMatrix.value=ut.state.directionalShadowMatrix,nn.spotLightMatrix.value=ut.state.spotLightMatrix,nn.spotLightMap.value=ut.state.spotLightMap,nn.pointShadowMatrix.value=ut.state.pointShadowMatrix),vt.currentProgram=Nn,vt.uniformsList=null,Nn}function Lt(ye){if(ye.uniformsList===null){const et=ye.currentProgram.getUniforms();ye.uniformsList=p2.seqWithValue(et.seq,ye.uniforms)}return ye.uniformsList}function ln(ye,et){const xt=Z.get(ye);xt.outputColorSpace=et.outputColorSpace,xt.batching=et.batching,xt.batchingColor=et.batchingColor,xt.instancing=et.instancing,xt.instancingColor=et.instancingColor,xt.instancingMorph=et.instancingMorph,xt.skinning=et.skinning,xt.morphTargets=et.morphTargets,xt.morphNormals=et.morphNormals,xt.morphColors=et.morphColors,xt.morphTargetsCount=et.morphTargetsCount,xt.numClippingPlanes=et.numClippingPlanes,xt.numIntersection=et.numClipIntersection,xt.vertexAlphas=et.vertexAlphas,xt.vertexTangents=et.vertexTangents,xt.toneMapping=et.toneMapping}function It(ye,et,xt,vt,ut){et.isScene!==!0&&(et=Me),ge.resetTextureUnits();const qt=et.fog,en=vt.isMeshStandardMaterial||vt.isMeshLambertMaterial||vt.isMeshPhongMaterial?et.environment:null,Qt=G===null?L.outputColorSpace:G.isXRRenderTarget===!0?G.texture.colorSpace:b0,Gt=vt.isMeshStandardMaterial||vt.isMeshLambertMaterial&&!vt.envMap||vt.isMeshPhongMaterial&&!vt.envMap,hn=we.get(vt.envMap||en,Gt),Sn=vt.vertexColors===!0&&!!xt.attributes.color&&xt.attributes.color.itemSize===4,Nn=!!xt.attributes.tangent&&(!!vt.normalMap||vt.anisotropy>0),nn=!!xt.morphAttributes.position,Gn=!!xt.morphAttributes.normal,vr=!!xt.morphAttributes.color;let sr=mu;vt.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&(sr=L.toneMapping);const Yn=xt.morphAttributes.position||xt.morphAttributes.normal||xt.morphAttributes.color,fr=Yn!==void 0?Yn.length:0,un=Z.get(vt),ls=P.state.lights;if(ue===!0&&(he===!0||ye!==H)){const ji=ye===H&&vt.id===ee;nt.setState(vt,ye,ji)}let jn=!1;vt.version===un.__version?(un.needsLights&&un.lightsStateVersion!==ls.state.version||un.outputColorSpace!==Qt||ut.isBatchedMesh&&un.batching===!1||!ut.isBatchedMesh&&un.batching===!0||ut.isBatchedMesh&&un.batchingColor===!0&&ut.colorTexture===null||ut.isBatchedMesh&&un.batchingColor===!1&&ut.colorTexture!==null||ut.isInstancedMesh&&un.instancing===!1||!ut.isInstancedMesh&&un.instancing===!0||ut.isSkinnedMesh&&un.skinning===!1||!ut.isSkinnedMesh&&un.skinning===!0||ut.isInstancedMesh&&un.instancingColor===!0&&ut.instanceColor===null||ut.isInstancedMesh&&un.instancingColor===!1&&ut.instanceColor!==null||ut.isInstancedMesh&&un.instancingMorph===!0&&ut.morphTexture===null||ut.isInstancedMesh&&un.instancingMorph===!1&&ut.morphTexture!==null||un.envMap!==hn||vt.fog===!0&&un.fog!==qt||un.numClippingPlanes!==void 0&&(un.numClippingPlanes!==nt.numPlanes||un.numIntersection!==nt.numIntersection)||un.vertexAlphas!==Sn||un.vertexTangents!==Nn||un.morphTargets!==nn||un.morphNormals!==Gn||un.morphColors!==vr||un.toneMapping!==sr||un.morphTargetsCount!==fr)&&(jn=!0):(jn=!0,un.__version=vt.version);let ys=un.currentProgram;jn===!0&&(ys=Pt(vt,et,ut));let Ps=!1,Li=!1,bs=!1;const Sr=ys.getUniforms(),pi=un.uniforms;if(Ge.useProgram(ys.program)&&(Ps=!0,Li=!0,bs=!0),vt.id!==ee&&(ee=vt.id,Li=!0),Ps||H!==ye){Ge.buffers.depth.getReversed()&&ye.reversedDepth!==!0&&(ye._reversedDepth=!0,ye.updateProjectionMatrix()),Sr.setValue(oe,"projectionMatrix",ye.projectionMatrix),Sr.setValue(oe,"viewMatrix",ye.matrixWorldInverse);const ta=Sr.map.cameraPosition;ta!==void 0&&ta.setValue(oe,Ce.setFromMatrixPosition(ye.matrixWorld)),ze.logarithmicDepthBuffer&&Sr.setValue(oe,"logDepthBufFC",2/(Math.log(ye.far+1)/Math.LN2)),(vt.isMeshPhongMaterial||vt.isMeshToonMaterial||vt.isMeshLambertMaterial||vt.isMeshBasicMaterial||vt.isMeshStandardMaterial||vt.isShaderMaterial)&&Sr.setValue(oe,"isOrthographic",ye.isOrthographicCamera===!0),H!==ye&&(H=ye,Li=!0,bs=!0)}if(un.needsLights&&(ls.state.directionalShadowMap.length>0&&Sr.setValue(oe,"directionalShadowMap",ls.state.directionalShadowMap,ge),ls.state.spotShadowMap.length>0&&Sr.setValue(oe,"spotShadowMap",ls.state.spotShadowMap,ge),ls.state.pointShadowMap.length>0&&Sr.setValue(oe,"pointShadowMap",ls.state.pointShadowMap,ge)),ut.isSkinnedMesh){Sr.setOptional(oe,ut,"bindMatrix"),Sr.setOptional(oe,ut,"bindMatrixInverse");const ji=ut.skeleton;ji&&(ji.boneTexture===null&&ji.computeBoneTexture(),Sr.setValue(oe,"boneTexture",ji.boneTexture,ge))}ut.isBatchedMesh&&(Sr.setOptional(oe,ut,"batchingTexture"),Sr.setValue(oe,"batchingTexture",ut._matricesTexture,ge),Sr.setOptional(oe,ut,"batchingIdTexture"),Sr.setValue(oe,"batchingIdTexture",ut._indirectTexture,ge),Sr.setOptional(oe,ut,"batchingColorTexture"),ut._colorsTexture!==null&&Sr.setValue(oe,"batchingColorTexture",ut._colorsTexture,ge));const Is=xt.morphAttributes;if((Is.position!==void 0||Is.normal!==void 0||Is.color!==void 0)&&Le.update(ut,xt,ys),(Li||un.receiveShadow!==ut.receiveShadow)&&(un.receiveShadow=ut.receiveShadow,Sr.setValue(oe,"receiveShadow",ut.receiveShadow)),(vt.isMeshStandardMaterial||vt.isMeshLambertMaterial||vt.isMeshPhongMaterial)&&vt.envMap===null&&et.environment!==null&&(pi.envMapIntensity.value=et.environmentIntensity),pi.dfgLUT!==void 0&&(pi.dfgLUT.value=vEe()),Li&&(Sr.setValue(oe,"toneMappingExposure",L.toneMappingExposure),un.needsLights&&Oe(pi,bs),qt&&vt.fog===!0&&ke.refreshFogUniforms(pi,qt),ke.refreshMaterialUniforms(pi,vt,j,Y,P.state.transmissionRenderTarget[ye.id]),p2.upload(oe,Lt(un),pi,ge)),vt.isShaderMaterial&&vt.uniformsNeedUpdate===!0&&(p2.upload(oe,Lt(un),pi,ge),vt.uniformsNeedUpdate=!1),vt.isSpriteMaterial&&Sr.setValue(oe,"center",ut.center),Sr.setValue(oe,"modelViewMatrix",ut.modelViewMatrix),Sr.setValue(oe,"normalMatrix",ut.normalMatrix),Sr.setValue(oe,"modelMatrix",ut.matrixWorld),vt.isShaderMaterial||vt.isRawShaderMaterial){const ji=vt.uniformsGroups;for(let ta=0,va=ji.length;ta<va;ta++){const Ra=ji[ta];mt.update(Ra,ys),mt.bind(Ra,ys)}}return ys}function Oe(ye,et){ye.ambientLightColor.needsUpdate=et,ye.lightProbe.needsUpdate=et,ye.directionalLights.needsUpdate=et,ye.directionalLightShadows.needsUpdate=et,ye.pointLights.needsUpdate=et,ye.pointLightShadows.needsUpdate=et,ye.spotLights.needsUpdate=et,ye.spotLightShadows.needsUpdate=et,ye.rectAreaLights.needsUpdate=et,ye.hemisphereLights.needsUpdate=et}function gt(ye){return ye.isMeshLambertMaterial||ye.isMeshToonMaterial||ye.isMeshPhongMaterial||ye.isMeshStandardMaterial||ye.isShadowMaterial||ye.isShaderMaterial&&ye.lights===!0}this.getActiveCubeFace=function(){return V},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return G},this.setRenderTargetTextures=function(ye,et,xt){const vt=Z.get(ye);vt.__autoAllocateDepthBuffer=ye.resolveDepthBuffer===!1,vt.__autoAllocateDepthBuffer===!1&&(vt.__useRenderToTexture=!1),Z.get(ye.texture).__webglTexture=et,Z.get(ye.depthTexture).__webglTexture=vt.__autoAllocateDepthBuffer?void 0:xt,vt.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ye,et){const xt=Z.get(ye);xt.__webglFramebuffer=et,xt.__useDefaultFramebuffer=et===void 0};const _t=oe.createFramebuffer();this.setRenderTarget=function(ye,et=0,xt=0){G=ye,V=et,W=xt;let vt=null,ut=!1,qt=!1;if(ye){const Qt=Z.get(ye);if(Qt.__useDefaultFramebuffer!==void 0){Ge.bindFramebuffer(oe.FRAMEBUFFER,Qt.__webglFramebuffer),q.copy(ye.viewport),J.copy(ye.scissor),K=ye.scissorTest,Ge.viewport(q),Ge.scissor(J),Ge.setScissorTest(K),ee=-1;return}else if(Qt.__webglFramebuffer===void 0)ge.setupRenderTarget(ye);else if(Qt.__hasExternalTextures)ge.rebindTextures(ye,Z.get(ye.texture).__webglTexture,Z.get(ye.depthTexture).__webglTexture);else if(ye.depthBuffer){const Sn=ye.depthTexture;if(Qt.__boundDepthTexture!==Sn){if(Sn!==null&&Z.has(Sn)&&(ye.width!==Sn.image.width||ye.height!==Sn.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ge.setupDepthRenderbuffer(ye)}}const Gt=ye.texture;(Gt.isData3DTexture||Gt.isDataArrayTexture||Gt.isCompressedArrayTexture)&&(qt=!0);const hn=Z.get(ye).__webglFramebuffer;ye.isWebGLCubeRenderTarget?(Array.isArray(hn[et])?vt=hn[et][xt]:vt=hn[et],ut=!0):ye.samples>0&&ge.useMultisampledRTT(ye)===!1?vt=Z.get(ye).__webglMultisampledFramebuffer:Array.isArray(hn)?vt=hn[xt]:vt=hn,q.copy(ye.viewport),J.copy(ye.scissor),K=ye.scissorTest}else q.copy(X).multiplyScalar(j).floor(),J.copy(ie).multiplyScalar(j).floor(),K=fe;if(xt!==0&&(vt=_t),Ge.bindFramebuffer(oe.FRAMEBUFFER,vt)&&Ge.drawBuffers(ye,vt),Ge.viewport(q),Ge.scissor(J),Ge.setScissorTest(K),ut){const Qt=Z.get(ye.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_CUBE_MAP_POSITIVE_X+et,Qt.__webglTexture,xt)}else if(qt){const Qt=et;for(let Gt=0;Gt<ye.textures.length;Gt++){const hn=Z.get(ye.textures[Gt]);oe.framebufferTextureLayer(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0+Gt,hn.__webglTexture,xt,Qt)}}else if(ye!==null&&xt!==0){const Qt=Z.get(ye.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,Qt.__webglTexture,xt)}ee=-1},this.readRenderTargetPixels=function(ye,et,xt,vt,ut,qt,en,Qt=0){if(!(ye&&ye.isWebGLRenderTarget)){Wn("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Gt=Z.get(ye).__webglFramebuffer;if(ye.isWebGLCubeRenderTarget&&en!==void 0&&(Gt=Gt[en]),Gt){Ge.bindFramebuffer(oe.FRAMEBUFFER,Gt);try{const hn=ye.textures[Qt],Sn=hn.format,Nn=hn.type;if(ye.textures.length>1&&oe.readBuffer(oe.COLOR_ATTACHMENT0+Qt),!ze.textureFormatReadable(Sn)){Wn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ze.textureTypeReadable(Nn)){Wn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}et>=0&&et<=ye.width-vt&&xt>=0&&xt<=ye.height-ut&&oe.readPixels(et,xt,vt,ut,Ye.convert(Sn),Ye.convert(Nn),qt)}finally{const hn=G!==null?Z.get(G).__webglFramebuffer:null;Ge.bindFramebuffer(oe.FRAMEBUFFER,hn)}}},this.readRenderTargetPixelsAsync=async function(ye,et,xt,vt,ut,qt,en,Qt=0){if(!(ye&&ye.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Gt=Z.get(ye).__webglFramebuffer;if(ye.isWebGLCubeRenderTarget&&en!==void 0&&(Gt=Gt[en]),Gt)if(et>=0&&et<=ye.width-vt&&xt>=0&&xt<=ye.height-ut){Ge.bindFramebuffer(oe.FRAMEBUFFER,Gt);const hn=ye.textures[Qt],Sn=hn.format,Nn=hn.type;if(ye.textures.length>1&&oe.readBuffer(oe.COLOR_ATTACHMENT0+Qt),!ze.textureFormatReadable(Sn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ze.textureTypeReadable(Nn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const nn=oe.createBuffer();oe.bindBuffer(oe.PIXEL_PACK_BUFFER,nn),oe.bufferData(oe.PIXEL_PACK_BUFFER,qt.byteLength,oe.STREAM_READ),oe.readPixels(et,xt,vt,ut,Ye.convert(Sn),Ye.convert(Nn),0);const Gn=G!==null?Z.get(G).__webglFramebuffer:null;Ge.bindFramebuffer(oe.FRAMEBUFFER,Gn);const vr=oe.fenceSync(oe.SYNC_GPU_COMMANDS_COMPLETE,0);return oe.flush(),await Dwe(oe,vr,4),oe.bindBuffer(oe.PIXEL_PACK_BUFFER,nn),oe.getBufferSubData(oe.PIXEL_PACK_BUFFER,0,qt),oe.deleteBuffer(nn),oe.deleteSync(vr),qt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ye,et=null,xt=0){const vt=Math.pow(2,-xt),ut=Math.floor(ye.image.width*vt),qt=Math.floor(ye.image.height*vt),en=et!==null?et.x:0,Qt=et!==null?et.y:0;ge.setTexture2D(ye,0),oe.copyTexSubImage2D(oe.TEXTURE_2D,xt,0,0,en,Qt,ut,qt),Ge.unbindTexture()};const Vt=oe.createFramebuffer(),vn=oe.createFramebuffer();this.copyTextureToTexture=function(ye,et,xt=null,vt=null,ut=0,qt=0){let en,Qt,Gt,hn,Sn,Nn,nn,Gn,vr;const sr=ye.isCompressedTexture?ye.mipmaps[qt]:ye.image;if(xt!==null)en=xt.max.x-xt.min.x,Qt=xt.max.y-xt.min.y,Gt=xt.isBox3?xt.max.z-xt.min.z:1,hn=xt.min.x,Sn=xt.min.y,Nn=xt.isBox3?xt.min.z:0;else{const pi=Math.pow(2,-ut);en=Math.floor(sr.width*pi),Qt=Math.floor(sr.height*pi),ye.isDataArrayTexture?Gt=sr.depth:ye.isData3DTexture?Gt=Math.floor(sr.depth*pi):Gt=1,hn=0,Sn=0,Nn=0}vt!==null?(nn=vt.x,Gn=vt.y,vr=vt.z):(nn=0,Gn=0,vr=0);const Yn=Ye.convert(et.format),fr=Ye.convert(et.type);let un;et.isData3DTexture?(ge.setTexture3D(et,0),un=oe.TEXTURE_3D):et.isDataArrayTexture||et.isCompressedArrayTexture?(ge.setTexture2DArray(et,0),un=oe.TEXTURE_2D_ARRAY):(ge.setTexture2D(et,0),un=oe.TEXTURE_2D),oe.pixelStorei(oe.UNPACK_FLIP_Y_WEBGL,et.flipY),oe.pixelStorei(oe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,et.premultiplyAlpha),oe.pixelStorei(oe.UNPACK_ALIGNMENT,et.unpackAlignment);const ls=oe.getParameter(oe.UNPACK_ROW_LENGTH),jn=oe.getParameter(oe.UNPACK_IMAGE_HEIGHT),ys=oe.getParameter(oe.UNPACK_SKIP_PIXELS),Ps=oe.getParameter(oe.UNPACK_SKIP_ROWS),Li=oe.getParameter(oe.UNPACK_SKIP_IMAGES);oe.pixelStorei(oe.UNPACK_ROW_LENGTH,sr.width),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,sr.height),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,hn),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,Sn),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,Nn);const bs=ye.isDataArrayTexture||ye.isData3DTexture,Sr=et.isDataArrayTexture||et.isData3DTexture;if(ye.isDepthTexture){const pi=Z.get(ye),Is=Z.get(et),ji=Z.get(pi.__renderTarget),ta=Z.get(Is.__renderTarget);Ge.bindFramebuffer(oe.READ_FRAMEBUFFER,ji.__webglFramebuffer),Ge.bindFramebuffer(oe.DRAW_FRAMEBUFFER,ta.__webglFramebuffer);for(let va=0;va<Gt;va++)bs&&(oe.framebufferTextureLayer(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,Z.get(ye).__webglTexture,ut,Nn+va),oe.framebufferTextureLayer(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,Z.get(et).__webglTexture,qt,vr+va)),oe.blitFramebuffer(hn,Sn,en,Qt,nn,Gn,en,Qt,oe.DEPTH_BUFFER_BIT,oe.NEAREST);Ge.bindFramebuffer(oe.READ_FRAMEBUFFER,null),Ge.bindFramebuffer(oe.DRAW_FRAMEBUFFER,null)}else if(ut!==0||ye.isRenderTargetTexture||Z.has(ye)){const pi=Z.get(ye),Is=Z.get(et);Ge.bindFramebuffer(oe.READ_FRAMEBUFFER,Vt),Ge.bindFramebuffer(oe.DRAW_FRAMEBUFFER,vn);for(let ji=0;ji<Gt;ji++)bs?oe.framebufferTextureLayer(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,pi.__webglTexture,ut,Nn+ji):oe.framebufferTexture2D(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,pi.__webglTexture,ut),Sr?oe.framebufferTextureLayer(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,Is.__webglTexture,qt,vr+ji):oe.framebufferTexture2D(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,Is.__webglTexture,qt),ut!==0?oe.blitFramebuffer(hn,Sn,en,Qt,nn,Gn,en,Qt,oe.COLOR_BUFFER_BIT,oe.NEAREST):Sr?oe.copyTexSubImage3D(un,qt,nn,Gn,vr+ji,hn,Sn,en,Qt):oe.copyTexSubImage2D(un,qt,nn,Gn,hn,Sn,en,Qt);Ge.bindFramebuffer(oe.READ_FRAMEBUFFER,null),Ge.bindFramebuffer(oe.DRAW_FRAMEBUFFER,null)}else Sr?ye.isDataTexture||ye.isData3DTexture?oe.texSubImage3D(un,qt,nn,Gn,vr,en,Qt,Gt,Yn,fr,sr.data):et.isCompressedArrayTexture?oe.compressedTexSubImage3D(un,qt,nn,Gn,vr,en,Qt,Gt,Yn,sr.data):oe.texSubImage3D(un,qt,nn,Gn,vr,en,Qt,Gt,Yn,fr,sr):ye.isDataTexture?oe.texSubImage2D(oe.TEXTURE_2D,qt,nn,Gn,en,Qt,Yn,fr,sr.data):ye.isCompressedTexture?oe.compressedTexSubImage2D(oe.TEXTURE_2D,qt,nn,Gn,sr.width,sr.height,Yn,sr.data):oe.texSubImage2D(oe.TEXTURE_2D,qt,nn,Gn,en,Qt,Yn,fr,sr);oe.pixelStorei(oe.UNPACK_ROW_LENGTH,ls),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,jn),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,ys),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,Ps),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,Li),qt===0&&et.generateMipmaps&&oe.generateMipmap(un),Ge.unbindTexture()},this.initRenderTarget=function(ye){Z.get(ye).__webglFramebuffer===void 0&&ge.setupRenderTarget(ye)},this.initTexture=function(ye){ye.isCubeTexture?ge.setTextureCube(ye,0):ye.isData3DTexture?ge.setTexture3D(ye,0):ye.isDataArrayTexture||ye.isCompressedArrayTexture?ge.setTexture2DArray(ye,0):ge.setTexture2D(ye,0),Ge.unbindTexture()},this.resetState=function(){V=0,W=0,G=null,Ge.reset(),it.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return uu}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 yEe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:PC,AddEquation:Bm,AddOperation:OY,AdditiveAnimationBlendMode:kD,AdditiveBlending:yR,AgXToneMapping:_D,AlphaFormat:AD,AlwaysCompare:XY,AlwaysDepth:p5,AlwaysStencilFunc:MR,AmbientLight:FK,AnimationAction:XK,AnimationClip:tw,AnimationLoader:S4e,AnimationMixer:Q4e,AnimationObjectGroup:K4e,AnimationUtils:v4e,ArcCurve:dK,ArrayCamera:GK,ArrowHelper:yMe,AttachedBindMode:SR,Audio:$K,AudioAnalyser:U4e,AudioContext:n9,AudioListener:j4e,AudioLoader:P4e,AxesHelper:bMe,BackSide:Zl,BasicDepthPacking:UY,BasicShadowMap:mY,BatchedMesh:oK,BezierInterpolant:DK,Bone:jD,BooleanKeyframeTrack:Gx,Box2:iMe,Box3:Lo,Box3Helper:xMe,BoxGeometry:Vx,BoxHelper:gMe,BufferAttribute:$i,BufferGeometry:Ar,BufferGeometryLoader:HK,ByteType:MD,Cache:oh,Camera:hE,CameraHelper:mMe,CanvasTexture:z3e,CapsuleGeometry:QC,CatmullRomCurve3:fK,CineonToneMapping:yD,CircleGeometry:JC,ClampToEdgeWrapping:Lc,Clock:KK,Color:kn,ColorKeyframeTrack:QD,ColorManagement:li,Compatibility:Ewe,CompressedArrayTexture:L3e,CompressedCubeTexture:j3e,CompressedTexture:ZC,CompressedTextureLoader:w4e,ConeGeometry:Yw,ConstantAlphaFactor:DY,ConstantColorFactor:kY,Controls:SMe,CubeCamera:VK,CubeDepthTexture:uK,CubeReflectionMapping:ph,CubeRefractionMapping:y0,CubeTexture:qw,CubeTextureLoader:M4e,CubeUVReflectionMapping:eb,CubicBezierCurve:HD,CubicBezierCurve3:hK,CubicInterpolant:kK,CullFaceBack:vR,CullFaceFront:pY,CullFaceFrontBack:USe,CullFaceNone:hY,Curve:uf,CurvePath:mK,CustomBlending:gY,CustomToneMapping:bD,CylinderGeometry:Xw,Cylindrical:rMe,Data3DTexture:WC,DataArrayTexture:GC,DataTexture:tf,DataTextureLoader:T4e,DataUtils:c3e,DecrementStencilOp:iwe,DecrementWrapStencilOp:owe,DefaultLoadingManager:IK,DepthFormat:gh,DepthStencilFormat:Jm,DepthTexture:ky,DetachedBindMode:LY,DirectionalLight:zK,DirectionalLightHelper:pMe,DiscreteInterpolant:RK,DodecahedronGeometry:eE,DoubleSide:au,DstAlphaFactor:TY,DstColorFactor:EY,DynamicCopyUsage:_we,DynamicDrawUsage:mwe,DynamicReadUsage:vwe,EdgesGeometry:UD,EllipseCurve:tE,EqualCompare:WY,EqualDepth:g5,EqualStencilFunc:uwe,EquirectangularReflectionMapping:lS,EquirectangularRefractionMapping:cS,Euler:bu,EventDispatcher:Th,ExternalTexture:FD,ExtrudeGeometry:nE,FileLoader:Ap,Float16BufferAttribute:g3e,Float32BufferAttribute:On,FloatType:Kl,Fog:qC,FogExp2:$C,FramebufferTexture:O3e,FrontSide:Ep,Frustum:tb,FrustumArray:KC,GLBufferAttribute:nMe,GLSL1:wwe,GLSL3:TR,GreaterCompare:$Y,GreaterDepth:v5,GreaterEqualCompare:VC,GreaterEqualDepth:x5,GreaterEqualStencilFunc:pwe,GreaterStencilFunc:fwe,GridHelper:fMe,Group:S1,HalfFloatType:mh,HemisphereLight:OK,HemisphereLightHelper:dMe,IcosahedronGeometry:rE,ImageBitmapLoader:D4e,ImageLoader:nw,ImageUtils:JY,IncrementStencilOp:rwe,IncrementWrapStencilOp:swe,InstancedBufferAttribute:Nx,InstancedBufferGeometry:mE,InstancedInterleavedBuffer:rT,InstancedMesh:sK,Int16BufferAttribute:p3e,Int32BufferAttribute:m3e,Int8BufferAttribute:d3e,IntType:OC,InterleavedBuffer:XC,InterleavedBufferAttribute:du,Interpolant:nb,InterpolateBezier:wR,InterpolateDiscrete:HS,InterpolateLinear:Q5,InterpolateSmooth:f2,InterpolationSamplingMode:Cwe,InterpolationSamplingType:Twe,InvertStencilOp:awe,KeepStencilOp:Yg,KeyframeTrack:vd,LOD:rK,LatheGeometry:iE,Layers:Ny,LessCompare:GY,LessDepth:m5,LessEqualCompare:HC,LessEqualDepth:Cx,LessEqualStencilFunc:dwe,LessStencilFunc:cwe,Light:H0,LightProbe:BK,Line:S0,Line3:ZK,LineBasicMaterial:ec,LineCurve:VD,LineCurve3:pK,LineDashedMaterial:AK,LineLoop:aK,LineSegments:Ch,LinearFilter:is,LinearInterpolant:ZD,LinearMipMapLinearFilter:WSe,LinearMipMapNearestFilter:GSe,LinearMipmapLinearFilter:sh,LinearMipmapNearestFilter:uS,LinearSRGBColorSpace:b0,LinearToneMapping:xD,LinearTransfer:GS,Loader:Hc,LoaderUtils:kR,LoadingManager:JD,LoopOnce:jY,LoopPingPong:FY,LoopRepeat:zY,MOUSE:qg,Material:Ml,MaterialBlending:BSe,MaterialLoader:pE,MathUtils:QY,Matrix2:o9,Matrix3:Er,Matrix4:dr,MaxEquation:bY,Mesh:qs,MeshBasicMaterial:Ip,MeshDepthMaterial:dE,MeshDistanceMaterial:fE,MeshLambertMaterial:CK,MeshMatcapMaterial:EK,MeshNormalMaterial:TK,MeshPhongMaterial:wK,MeshPhysicalMaterial:SK,MeshStandardMaterial:YD,MeshToonMaterial:MK,MinEquation:yY,MirroredRepeatWrapping:BS,MixOperation:IY,MultiplyBlending:_R,MultiplyOperation:Ww,NearestFilter:Oo,NearestMipMapLinearFilter:VSe,NearestMipMapNearestFilter:HSe,NearestMipmapLinearFilter:b1,NearestMipmapNearestFilter:wD,NeutralToneMapping:SD,NeverCompare:VY,NeverDepth:h5,NeverStencilFunc:lwe,NoBlending:uh,NoColorSpace:fp,NoNormalPacking:QSe,NoToneMapping:mu,NormalAnimationBlendMode:BC,NormalBlending:mx,NormalGAPacking:ewe,NormalRGPacking:JSe,NotEqualCompare:qY,NotEqualDepth:y5,NotEqualStencilFunc:hwe,NumberKeyframeTrack:JS,Object3D:_i,ObjectLoader:k4e,ObjectSpaceNormalMap:HY,OctahedronGeometry:Kw,OneFactor:SY,OneMinusConstantAlphaFactor:PY,OneMinusConstantColorFactor:RY,OneMinusDstAlphaFactor:CY,OneMinusDstColorFactor:AY,OneMinusSrcAlphaFactor:f5,OneMinusSrcColorFactor:MY,OrthographicCamera:nf,PCFShadowMap:z1,PCFSoftShadowMap:aS,PMREMGenerator:IR,Path:nT,PerspectiveCamera:ao,Plane:cp,PlaneGeometry:Op,PlaneHelper:vMe,PointLight:jK,PointLightHelper:cMe,Points:lK,PointsMaterial:zD,PolarGridHelper:hMe,PolyhedronGeometry:B0,PositionalAudio:F4e,PropertyBinding:yi,PropertyMixer:qK,QuadraticBezierCurve:GD,QuadraticBezierCurve3:WD,Quaternion:Ya,QuaternionKeyframeTrack:Qw,QuaternionLinearInterpolant:PK,R11_EAC_Format:E5,RED_GREEN_RGTC2_Format:K5,RED_RGTC1_Format:X5,REVISION:Gw,RG11_EAC_Format:N5,RGBADepthPacking:BY,RGBAFormat:vl,RGBAIntegerFormat:UC,RGBA_ASTC_10x10_Format:H5,RGBA_ASTC_10x5_Format:F5,RGBA_ASTC_10x6_Format:U5,RGBA_ASTC_10x8_Format:B5,RGBA_ASTC_12x10_Format:V5,RGBA_ASTC_12x12_Format:G5,RGBA_ASTC_4x4_Format:R5,RGBA_ASTC_5x4_Format:D5,RGBA_ASTC_5x5_Format:P5,RGBA_ASTC_6x5_Format:I5,RGBA_ASTC_6x6_Format:O5,RGBA_ASTC_8x5_Format:L5,RGBA_ASTC_8x6_Format:j5,RGBA_ASTC_8x8_Format:z5,RGBA_BPTC_Format:W5,RGBA_ETC2_EAC_Format:C5,RGBA_PVRTC_2BPPV1_Format:w5,RGBA_PVRTC_4BPPV1_Format:S5,RGBA_S3TC_DXT1_Format:fS,RGBA_S3TC_DXT3_Format:hS,RGBA_S3TC_DXT5_Format:pS,RGBDepthPacking:KSe,RGBFormat:ND,RGBIntegerFormat:$Se,RGB_BPTC_SIGNED_Format:$5,RGB_BPTC_UNSIGNED_Format:q5,RGB_ETC1_Format:M5,RGB_ETC2_Format:T5,RGB_PVRTC_2BPPV1_Format:_5,RGB_PVRTC_4BPPV1_Format:b5,RGB_S3TC_DXT1_Format:dS,RGDepthPacking:ZSe,RGFormat:Ex,RGIntegerFormat:FC,RawShaderMaterial:XD,Ray:Hx,Raycaster:YK,RectAreaLight:UK,RedFormat:zC,RedIntegerFormat:$w,ReinhardToneMapping:vD,RenderTarget:DD,RenderTarget3D:J4e,RepeatWrapping:US,ReplaceStencilOp:nwe,ReverseSubtractEquation:vY,RingGeometry:sE,SIGNED_R11_EAC_Format:A5,SIGNED_RED_GREEN_RGTC2_Format:Z5,SIGNED_RED_RGTC1_Format:Y5,SIGNED_RG11_EAC_Format:k5,SRGBColorSpace:xl,SRGBTransfer:Hi,Scene:PD,ShaderChunk:Or,ShaderLib:Zd,ShaderMaterial:_u,ShadowMaterial:bK,Shape:i0,ShapeGeometry:oE,ShapePath:_Me,ShapeUtils:ef,ShortType:TD,Skeleton:YC,SkeletonHelper:lMe,SkinnedMesh:iK,Source:e0,Sphere:Jo,SphereGeometry:Zw,Spherical:DR,SphericalHarmonics3:t9,SplineCurve:$D,SpotLight:LK,SpotLightHelper:aMe,Sprite:nK,SpriteMaterial:LD,SrcAlphaFactor:d5,SrcAlphaSaturateFactor:NY,SrcColorFactor:wY,StaticCopyUsage:bwe,StaticDrawUsage:WS,StaticReadUsage:xwe,StereoCamera:I4e,StreamCopyUsage:Swe,StreamDrawUsage:gwe,StreamReadUsage:ywe,StringKeyframeTrack:Wx,SubtractEquation:xY,SubtractiveBlending:bR,TOUCH:Xg,TangentSpaceNormalMap:U0,TetrahedronGeometry:aE,Texture:uo,TextureLoader:C4e,TextureUtils:EMe,Timer:WK,TimestampQuery:Mwe,TorusGeometry:lE,TorusKnotGeometry:cE,Triangle:Ic,TriangleFanDrawMode:YSe,TriangleStripDrawMode:XSe,TrianglesDrawMode:qSe,TubeGeometry:uE,UVMapping:IC,Uint16BufferAttribute:ID,Uint32BufferAttribute:OD,Uint8BufferAttribute:f3e,Uint8ClampedBufferAttribute:h3e,Uniform:s9,UniformsGroup:tMe,UniformsLib:Tn,UniformsUtils:QS,UnsignedByteType:Wl,UnsignedInt101111Type:ED,UnsignedInt248Type:Ey,UnsignedInt5999Type:CD,UnsignedIntType:md,UnsignedShort4444Type:LC,UnsignedShort5551Type:jC,UnsignedShortType:Cy,VSMShadowMap:Jg,Vector2:$t,Vector3:We,Vector4:hi,VectorKeyframeTrack:ew,VideoFrameTexture:I3e,VideoTexture:cK,WebGL3DRenderTarget:e3e,WebGLArrayRenderTarget:Jwe,WebGLCoordinateSystem:uu,WebGLCubeRenderTarget:a9,WebGLRenderTarget:xu,WebGLRenderer:sZ,WebGLUtils:iZ,WebGPUCoordinateSystem:Ax,WebXRController:h2,WireframeGeometry:qD,WrapAroundEnding:VS,ZeroCurvatureEnding:ex,ZeroFactor:_Y,ZeroSlopeEnding:tx,ZeroStencilOp:twe,createCanvasElement:KY,error:Wn,getConsoleFunction:Rwe,log:qS,setConsoleFunction:kwe,warn:Mn,warnOnce:XS},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 rF;function bEe(){if(rF)return xN;rF=1;var t=mw(),e=Rre();function n(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}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,f,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(k){if(!C){if(C=!0,A=k,k=m(k),x!==void 0&&_.hasValue){var O=_.value;if(x(O,k))return N=O}return N=k}if(O=N,r(A,k))return O;var R=m(k);return x!==void 0&&x(O,R)?(A=k,O):(A=k,N=R)}var C=!1,A,N,P=p===void 0?null:p;return[function(){return M(f())},P===null?void 0:function(){return M(P())}]},[f,p,m,x]);var S=i(c,b[0],b[1]);return o(function(){_.hasValue=!0,_.value=S},[S]),l(S),S},xN}var iF;function _Ee(){return iF||(iF=1,gN.exports=bEe()),gN.exports}var SEe=_Ee();const wEe=Oy(SEe),sF=t=>{let e;const n=new Set,r=(c,f)=>{const p=typeof c=="function"?c(e):c;if(!Object.is(p,e)){const m=e;e=f??(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},MEe=(t=>t?sF(t):sF),{useSyncExternalStoreWithSelector:TEe}=wEe,CEe=t=>t;function EEe(t,e=CEe,n){const r=TEe(t.subscribe,t.getState,t.getInitialState,e,n);return ni.useDebugValue(r),r}const oF=(t,e)=>{const n=MEe(t),r=(i,s=e)=>EEe(n,i,s);return Object.assign(r,n),r},AEe=((t,e)=>t?oF(t,e):oF),NEe=t=>typeof t=="object"&&typeof t.then=="function",HM=[];function kEe(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 REe(t,e=null,n=!1,r={}){e===null&&(e=[t]);for(const s of HM)if(kEe(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=HM.indexOf(i);s!==-1&&HM.splice(s,1)},promise:(NEe(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(HM.push(i),!n)throw i.promise}const DEe=(t,e,n)=>REe(t,e,!1,n);var jR=dU();const PEe=Oy(jR);function l9(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=e?t.return:t.child;for(;r;){const i=l9(r,e,n);if(i)return i;r=e?null:r.sibling}}function oZ(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const c9=oZ(w.createContext(null));class aZ extends w.Component{render(){return w.createElement(c9.Provider,{value:this._reactInternals},this.props.children)}}function lZ(){const t=w.useContext(c9);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=l9(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 IEe=Symbol.for("react.context"),OEe=t=>t!==null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===IEe;function LEe(){const t=lZ(),[e]=w.useState(()=>new Map);e.clear();let n=t;for(;n;){const r=n.type;OEe(r)&&r!==c9&&!e.has(r)&&e.set(r,w.use(oZ(r))),n=n.return}return e}function jEe(){const t=LEe();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(aZ,{...e})),[t])}function cZ(t){let e=t.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const uZ=t=>t&&t.isOrthographicCamera,zEe=t=>t&&t.hasOwnProperty("current"),FEe=t=>t!=null&&(typeof t=="string"||typeof t=="number"||t.isColor),Jw=((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 dZ(t){const e=w.useRef(t);return Jw(()=>void(e.current=t),[t]),e}function UEe(){const t=lZ(),e=jEe();return w.useMemo(()=>({children:n})=>{const i=!!l9(t,!0,s=>s.type===w.StrictMode)?w.StrictMode:w.Fragment;return d.jsx(i,{children:d.jsx(e,{children:n})})},[t,e])}function BEe({set:t}){return Jw(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const HEe=(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 fZ(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 f1(t){var e;return(e=t.__r3f)==null?void 0:e.root.getState()}const so={obj:t=>t===Object(t)&&!so.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(so.str(t)||so.num(t)||so.boo(t))return t===e;const s=so.obj(t);if(s&&r==="reference")return t===e;const o=so.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(!so.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(so.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 VEe(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 hZ=["children","key","ref"];function GEe(t){const e={};for(const n in t)hZ.includes(n)||(e[n]=t[n]);return e}function iT(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:GEe(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=s)),s}function rw(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 aF=/-\d+$/;function sT(t,e){if(so.str(e.props.attach)){if(aF.test(e.props.attach)){const i=e.props.attach.replace(aF,""),{root:s,key:o}=rw(t.object,i);Array.isArray(s[o])||(s[o]=[])}const{root:n,key:r}=rw(t.object,e.props.attach);e.previousAttach=n[r],n[r]=e.object}else so.fun(e.props.attach)&&(e.previousAttach=e.props.attach(t.object,e.object))}function oT(t,e){if(so.str(e.props.attach)){const{root:n,key:r}=rw(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 zR=[...hZ,"args","dispose","attach","object","onUpdate","dispose"],lF=new Map;function WEe(t){let e=lF.get(t.constructor);try{e||(e=new t.constructor,lF.set(t.constructor,e))}catch{}return e}function $Ee(t,e){const n={};for(const r in e)if(!zR.includes(r)&&!so.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(zR.includes(r)||e.hasOwnProperty(r))continue;const{root:i,key:s}=rw(t.object,r);if(i.constructor&&i.constructor.length===0){const o=WEe(i);so.und(o)||(n[s]=o[s])}else n[s]=0}return n}const qEe=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],XEe=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Hm(t,e){var n;const r=t.__r3f,i=r&&cZ(r).getState(),s=r==null?void 0:r.eventCount;for(const a in e){let l=e[a];if(zR.includes(a))continue;if(r&&XEe.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:f,target:p}=rw(t,a);if(p===void 0&&(typeof c!="object"||c===null))throw Error(`R3F: Cannot set "${a}". Ensure it is an object before setting "${f}".`);if(p instanceof Ny&&l instanceof Ny)p.mask=l.mask;else if(p instanceof kn&&FEe(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[f]=l,i&&!i.linear&&qEe.includes(f)&&(o=c[f])!=null&&o.isTexture&&c[f].format===vl&&c[f].type===Wl&&(c[f].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&&ib(r),t}function ib(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 YEe(t,e){t.manual||(uZ(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 Nc=t=>t==null?void 0:t.isObject3D;function VM(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function pZ(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function KEe(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)=>{pZ(n.capturedMap,e,r,i)})}function ZEe(t){function e(l){const{internal:c}=t.getState(),f=l.offsetX-c.initialClick[0],p=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(f*f+p*p))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(f=>{var p;return(p=c.__r3f)==null?void 0:p.handlers["onPointer"+f]}))}function r(l,c){const f=t.getState(),p=new Set,m=[],x=c?c(f.internal.interaction):f.internal.interaction;for(let M=0;M<x.length;M++){const C=f1(x[M]);C&&(C.raycaster.camera=void 0)}f.previousRoot||f.events.compute==null||f.events.compute(l,f);function b(M){const C=f1(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=f1(M.object),N=f1(C.object);return!A||!N?M.distance-C.distance:N.events.priority-A.events.priority||M.distance-C.distance}).filter(M=>{const C=VM(M);return p.has(C)?!1:(p.add(C),!0)});f.events.filter&&(_=f.events.filter(_,f));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&&f.internal.capturedMap.has(l.pointerId))for(let M of f.internal.capturedMap.get(l.pointerId).values())p.has(VM(M.intersection))||m.push(M.intersection);return m}function i(l,c,f,p){if(l.length){const m={stopped:!1};for(const x of l){let b=f1(x.object);if(b||x.object.traverseAncestors(_=>{const S=f1(_);if(S)return b=S,!1}),b){const{raycaster:_,pointer:S,camera:M,internal:C}=b,A=new We(S.x,S.y,0).unproject(M),N=L=>{var B,V;return(B=(V=C.capturedMap.get(L))==null?void 0:V.has(x.eventObject))!=null?B:!1},P=L=>{const B={intersection:x,target:c.target};C.capturedMap.has(L)?C.capturedMap.get(L).set(x.eventObject,B):C.capturedMap.set(L,new Map([[x.eventObject,B]])),c.target.setPointerCapture(L)},k=L=>{const B=C.capturedMap.get(L);B&&pZ(C.capturedMap,x.eventObject,B,L)};let O={};for(let L in c){let B=c[L];typeof B!="function"&&(O[L]=B)}let R={...x,...O,pointer:S,intersections:l,stopped:m.stopped,delta:f,unprojectedPoint:A,ray:_.ray,camera:M,stopPropagation(){const L="pointerId"in c&&C.capturedMap.get(c.pointerId);if((!L||L.has(x.eventObject))&&(R.stopped=m.stopped=!0,C.hovered.size&&Array.from(C.hovered.values()).find(B=>B.eventObject===x.eventObject))){const B=l.slice(0,l.indexOf(x));s([...B,x])}},target:{hasPointerCapture:N,setPointerCapture:P,releasePointerCapture:k},currentTarget:{hasPointerCapture:N,setPointerCapture:P,releasePointerCapture:k},nativeEvent:c};if(p(R),m.stopped===!0)break}}}return l}function s(l){const{internal:c}=t.getState();for(const f of c.hovered.values())if(!l.length||!l.find(p=>p.object===f.object&&p.index===f.index&&p.instanceId===f.instanceId)){const m=f.eventObject.__r3f;if(c.hovered.delete(VM(f)),m!=null&&m.eventCount){const x=m.handlers,b={...f,intersections:l};x.onPointerOut==null||x.onPointerOut(b),x.onPointerLeave==null||x.onPointerLeave(b)}}}function o(l,c){for(let f=0;f<c.length;f++){const p=c[f].__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:f}=t.getState();"pointerId"in c&&f.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{f.capturedMap.has(c.pointerId)&&(f.capturedMap.delete(c.pointerId),s([]))})}}return function(f){const{onPointerMissed:p,internal:m}=t.getState();m.lastEvent.current=f;const x=l==="onPointerMove",b=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",S=r(f,x?n:void 0),M=b?e(f):0;l==="onPointerDown"&&(m.initialClick=[f.offsetX,f.offsetY],m.initialHits=S.map(A=>A.eventObject)),b&&!S.length&&M<=2&&(o(f,m.interaction),p&&p(f)),x&&s(S);function C(A){const N=A.eventObject,P=N.__r3f;if(!(P!=null&&P.eventCount))return;const k=P.handlers;if(x){if(k.onPointerOver||k.onPointerEnter||k.onPointerOut||k.onPointerLeave){const O=VM(A),R=m.hovered.get(O);R?R.stopped&&A.stopPropagation():(m.hovered.set(O,A),k.onPointerOver==null||k.onPointerOver(A),k.onPointerEnter==null||k.onPointerEnter(A))}k.onPointerMove==null||k.onPointerMove(A)}else{const O=k[l];O?(!b||m.initialHits.includes(N))&&(o(f,m.interaction.filter(R=>!m.initialHits.includes(R))),O(A)):b&&m.initialHits.includes(N)&&o(f,m.interaction.filter(R=>!m.initialHits.includes(R)))}}i(S,f,M,C)}}return{handlePointer:a}}const cF=t=>!!(t!=null&&t.render),mZ=w.createContext(null),QEe=(t,e)=>{const n=AEe((a,l)=>{const c=new We,f=new We,p=new We;function m(M=l().camera,C=f,A=l().size){const{width:N,height:P,top:k,left:O}=A,R=N/P;C.isVector3?p.copy(C):p.set(...C);const L=M.getWorldPosition(c).distanceTo(p);if(uZ(M))return{width:N/M.zoom,height:P/M.zoom,top:k,left:O,factor:1,distance:L,aspect:R};{const B=M.fov*Math.PI/180,V=2*Math.tan(B/2)*L,W=V*(N/P);return{width:W,height:V,top:k,left:O,factor:N/W,distance:L,aspect:R}}}let x;const b=M=>a(C=>({performance:{...C.performance,current:M}})),_=new $t;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 KK,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 P=l().camera,k={width:M,height:C,top:A,left:N};a(O=>({size:k,viewport:{...O.viewport,...m(P,f,k)}}))},setDpr:M=>a(C=>{const A=fZ(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((P,k)=>P.priority-k.priority),()=>{const P=l().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(C>0?1:0),P.subscribers=P.subscribers.filter(k=>k.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:f,set:p}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){i=l,s=c.dpr,YEe(a,l),c.dpr>0&&f.setPixelRatio(c.dpr);const m=typeof HTMLCanvasElement<"u"&&f.domElement instanceof HTMLCanvasElement;f.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 gZ(){const t=w.useContext(mZ);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function kc(t=n=>n,e){return gZ()(t,e)}function vE(t,e=0){const n=gZ(),r=n.getState().internal.subscribe,i=dZ(t);return Jw(()=>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 JEe=1,eAe=8,tAe=32,nAe=2;var rAe={version:"9.5.0"};function iAe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uF={exports:{}},dF={exports:{}},fF;function sAe(){return fF||(fF=1,(function(t){t.exports=function(e){function n(g,v,E,D){return new lb(g,v,E,D)}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,D=v;;){var $=E.return;if($===null)break;var re=$.alternate;if(re===null){if(D=$.return,D!==null){E=D;continue}break}if($.child===re.child){for(re=$.child;re;){if(re===E)return o($),g;if(re===D)return o($),v;re=re.sibling}throw Error(i(188))}if(E.return!==D.return)E=$,D=re;else{for(var Ie=!1,ct=$.child;ct;){if(ct===E){Ie=!0,E=$,D=re;break}if(ct===D){Ie=!0,D=$,E=re;break}ct=ct.sibling}if(!Ie){for(ct=re.child;ct;){if(ct===E){Ie=!0,E=re,D=$;break}if(ct===D){Ie=!0,D=re,E=$;break}ct=ct.sibling}if(!Ie)throw Error(i(189))}}if(E.alternate!==D)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 f(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===Sf?null:g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case Ih:return"Fragment";case Lh:return"Profiler";case Oh:return"StrictMode";case ov:return"Suspense";case Dd:return"SuspenseList";case sg:return"Activity"}if(typeof g=="object")switch(g.$$typeof){case Ph:return"Portal";case hc:return g.displayName||"Context";case ig:return(g._context.displayName||"Context")+".Consumer";case Qp:var v=g.render;return g=g.displayName,g||(g=v.displayName||v.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case av:return v=g.displayName||null,v!==null?v:p(g.type)||"Memo";case ja:v=g._payload,g=g._init;try{return p(g(v))}catch{}}return null}function m(g){return{current:g}}function x(g){0>Bh||(g.current=bv[Bh],bv[Bh]=null,Bh--)}function b(g,v){Bh++,bv[Bh]=g.current,g.current=v}function _(g){return g>>>=0,g===0?32:31-(_v(g)/$3|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 D=g.pendingLanes;if(D===0)return 0;var $=0,re=g.suspendedLanes,Ie=g.pingedLanes;g=g.warmLanes;var ct=D&134217727;return ct!==0?(D=ct&~re,D!==0?$=S(D):(Ie&=ct,Ie!==0?$=S(Ie):E||(E=ct&~g,E!==0&&($=S(E))))):(ct=D&~re,ct!==0?$=S(ct):Ie!==0?$=S(Ie):E||(E=D&~g,E!==0&&($=S(E)))),$===0?0:v!==0&&v!==$&&(v&re)===0&&(re=$&-$,E=v&-v,re>=E||re===32&&(E&4194048)!==0)?v:$}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=sm;return sm<<=1,(sm&62914560)===0&&(sm=4194304),g}function P(g){for(var v=[],E=0;31>E;E++)v.push(g);return v}function k(g,v){g.pendingLanes|=v,v!==268435456&&(g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0)}function O(g,v,E,D,$,re){var Ie=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 ct=g.entanglements,jt=g.expirationTimes,tn=g.hiddenUpdates;for(E=Ie&~E;0<E;){var yn=31-ol(E),on=1<<yn;ct[yn]=0,jt[yn]=-1;var Rn=tn[yn];if(Rn!==null)for(tn[yn]=null,yn=0;yn<Rn.length;yn++){var yr=Rn[yn];yr!==null&&(yr.lane&=-536870913)}E&=~on}D!==0&&R(g,D,0),re!==0&&$===0&&g.tag!==0&&(g.suspendedLanes|=re&~(Ie&~v))}function R(g,v,E){g.pendingLanes|=v,g.suspendedLanes&=~v;var D=31-ol(v);g.entangledLanes|=v,g.entanglements[D]=g.entanglements[D]|1073741824|E&261930}function L(g,v){var E=g.entangledLanes|=v;for(g=g.entanglements;E;){var D=31-ol(E),$=1<<D;$&v|g[D]&v&&(g[D]|=v),E&=~$}}function B(g,v){var E=v&-v;return E=(E&42)!==0?1:V(E),(E&(g.suspendedLanes|v))!==0?0:E}function V(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 W(g){return g&=-g,2<g?8<g?(g&134217727)!==0?32:268435456:8:2}function G(g){if(typeof qb=="function"&&Y3(g),al&&typeof al.setStrictMode=="function")try{al.setStrictMode(Vh,g)}catch{}}function ee(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}function H(g){if(Ev===void 0)try{throw Error()}catch(E){var v=E.stack.trim().match(/\n( *(at )?)/);Ev=v&&v[1]||"",Fu=-1<E.stack.indexOf(`
    at`)?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Ev+g+Fu}function q(g,v){if(!g||pg)return"";pg=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var D={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(yr){var Rn=yr}Reflect.construct(g,[],on)}else{try{on.call()}catch(yr){Rn=yr}g.call(on.prototype)}}else{try{throw Error()}catch(yr){Rn=yr}(on=g())&&typeof on.catch=="function"&&on.catch(function(){})}}catch(yr){if(yr&&Rn&&typeof yr.stack=="string")return[yr.stack,Rn.stack]}return[null,null]}};D.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var $=Object.getOwnPropertyDescriptor(D.DetermineComponentFrameRoot,"name");$&&$.configurable&&Object.defineProperty(D.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var re=D.DetermineComponentFrameRoot(),Ie=re[0],ct=re[1];if(Ie&&ct){var jt=Ie.split(`
`),tn=ct.split(`
`);for($=D=0;D<jt.length&&!jt[D].includes("DetermineComponentFrameRoot");)D++;for(;$<tn.length&&!tn[$].includes("DetermineComponentFrameRoot");)$++;if(D===jt.length||$===tn.length)for(D=jt.length-1,$=tn.length-1;1<=D&&0<=$&&jt[D]!==tn[$];)$--;for(;1<=D&&0<=$;D--,$--)if(jt[D]!==tn[$]){if(D!==1||$!==1)do if(D--,$--,0>$||jt[D]!==tn[$]){var yn=`
`+jt[D].replace(" at new "," at ");return g.displayName&&yn.includes("<anonymous>")&&(yn=yn.replace("<anonymous>",g.displayName)),yn}while(1<=D&&0<=$);break}}}finally{pg=!1,Error.prepareStackTrace=E}return(E=g?g.displayName||g.name:"")?H(E):""}function J(g,v){switch(g.tag){case 26:case 27:case 5:return H(g.type);case 16:return H("Lazy");case 13:return g.child!==v&&v!==null?H("Suspense Fallback"):H("Suspense");case 19:return H("SuspenseList");case 0:case 15:return q(g.type,!1);case 11:return q(g.type.render,!1);case 1:return q(g.type,!0);case 31:return H("Activity");default:return""}}function K(g){try{var v="",E=null;do v+=J(g,E),E=g,g=g.return;while(g);return v}catch(D){return`
Error generating stack: `+D.message+`
`+D.stack}}function ne(g,v){if(typeof g=="object"&&g!==null){var E=Xb.get(g);return E!==void 0?E:(v={value:g,source:v,stack:K(v)},Xb.set(g,v),v)}return{value:g,source:v,stack:K(v)}}function U(g,v){Ld[Uu++]=mg,Ld[Uu++]=Ui,Ui=g,mg=v}function z(g,v,E){gc[Pl++]=sa,gc[Pl++]=Yc,gc[Pl++]=xc,xc=g;var D=sa;g=Yc;var $=32-ol(D)-1;D&=~(1<<$),E+=1;var re=32-ol(v)+$;if(30<re){var Ie=$-$%5;re=(D&(1<<Ie)-1).toString(32),D>>=Ie,$-=Ie,sa=1<<32-ol(v)+$|E<<$|D,Yc=re+g}else sa=1<<re|E<<$|D,Yc=g}function Y(g){g.return!==null&&(U(g,1),z(g,1,0))}function j(g){for(;g===Ui;)Ui=Ld[--Uu],Ld[Uu]=null,mg=Ld[--Uu],Ld[Uu]=null;for(;g===xc;)xc=gc[--Pl],gc[Pl]=null,Yc=gc[--Pl],gc[Pl]=null,sa=gc[--Pl],gc[Pl]=null}function le(g,v){gc[Pl++]=sa,gc[Pl++]=Yc,gc[Pl++]=xc,sa=v.id,Yc=v.overflow,xc=g}function ce(g,v){b(oa,v),b(jd,g),b(Go,null),g=l3(v),x(Go),b(Go,g)}function X(){x(Go),x(jd),x(oa)}function ie(g){g.memoizedState!==null&&b(gg,g);var v=Go.current,E=tm(v,g.type);v!==E&&(b(jd,g),b(Go,E))}function fe(g){jd.current===g&&(x(Go),x(jd)),gg.current===g&&(x(gg),Qs?Fh._currentValue=zh:Fh._currentValue2=zh)}function Q(g){var v=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Me(ne(v,g)),Av}function ue(g,v){if(!ds)throw Error(i(175));I3(g.stateNode,g.type,g.memoizedProps,v,g)||Q(g,!0)}function he(g){for(ko=g.return;ko;)switch(ko.tag){case 5:case 31:case 13:Fa=!1;return;case 27:case 3:Fa=!0;return;default:ko=ko.return}}function se(g){if(!ds||g!==ko)return!1;if(!qr)return he(g),qr=!0,!1;var v=g.tag;if(No?v!==3&&v!==27&&(v!==5||im(g.type)&&!za(g.type,g.memoizedProps))&&fs&&Q(g):v!==3&&(v!==5||im(g.type)&&!za(g.type,g.memoizedProps))&&fs&&Q(g),he(g),v===13){if(!ds)throw Error(i(316));if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));fs=Lb(g)}else if(v===31){if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));fs=L3(g)}else fs=No&&v===27?C3(g.type,fs):ko?T3(g.stateNode):null;return!0}function Ce(){ds&&(fs=ko=null,qr=!1)}function de(){var g=Bu;return g!==null&&(ul===null?ul=g:ul.push.apply(ul,g),Bu=null),g}function Me(g){Bu===null?Bu=[g]:Bu.push(g)}function Te(g,v,E){Qs?(b(vc,v._currentValue),v._currentValue=E):(b(vc,v._currentValue2),v._currentValue2=E)}function Pe(g){var v=vc.current;Qs?g._currentValue=v:g._currentValue2=v,x(vc)}function oe(g,v,E){for(;g!==null;){var D=g.alternate;if((g.childLanes&v)!==v?(g.childLanes|=v,D!==null&&(D.childLanes|=v)):D!==null&&(D.childLanes&v)!==v&&(D.childLanes|=v),g===E)break;g=g.return}}function Ve(g,v,E,D){var $=g.child;for($!==null&&($.return=g);$!==null;){var re=$.dependencies;if(re!==null){var Ie=$.child;re=re.firstContext;e:for(;re!==null;){var ct=re;re=$;for(var jt=0;jt<v.length;jt++)if(ct.context===v[jt]){re.lanes|=E,ct=re.alternate,ct!==null&&(ct.lanes|=E),oe(re.return,E,g),D||(Ie=null);break e}re=ct.next}}else if($.tag===18){if(Ie=$.return,Ie===null)throw Error(i(341));Ie.lanes|=E,re=Ie.alternate,re!==null&&(re.lanes|=E),oe(Ie,E,g),Ie=null}else Ie=$.child;if(Ie!==null)Ie.return=$;else for(Ie=$;Ie!==null;){if(Ie===g){Ie=null;break}if($=Ie.sibling,$!==null){$.return=Ie.return,Ie=$;break}Ie=Ie.return}$=Ie}}function He(g,v,E,D){g=null;for(var $=v,re=!1;$!==null;){if(!re){if(($.flags&524288)!==0)re=!0;else if(($.flags&262144)!==0)break}if($.tag===10){var Ie=$.alternate;if(Ie===null)throw Error(i(387));if(Ie=Ie.memoizedProps,Ie!==null){var ct=$.type;eo($.pendingProps.value,Ie.value)||(g!==null?g.push(ct):g=[ct])}}else if($===gg.current){if(Ie=$.alternate,Ie===null)throw Error(i(387));Ie.memoizedState.memoizedState!==$.memoizedState.memoizedState&&(g!==null?g.push(Fh):g=[Fh])}$=$.return}g!==null&&Ve(v,g,E,D),v.flags|=262144}function ze(g){for(g=g.firstContext;g!==null;){var v=g.context;if(!eo(Qs?v._currentValue:v._currentValue2,g.memoizedValue))return!0;g=g.next}return!1}function Ge(g){Yi=g,Kc=null,g=g.dependencies,g!==null&&(g.firstContext=null)}function ae(g){return ge(Yi,g)}function Z(g,v){return Yi===null&&Ge(g),ge(g,v)}function ge(g,v){var E=Qs?v._currentValue:v._currentValue2;if(v={context:v,memoizedValue:E,next:null},Kc===null){if(g===null)throw Error(i(308));Kc=v,g.dependencies={lanes:0,firstContext:v},g.flags|=524288}else Kc=Kc.next=v;return E}function we(){return{controller:new K3,data:new Map,refCount:0}}function _e(g){g.refCount--,g.refCount===0&&Wo(kE,function(){g.controller.abort()})}function ve(){}function Ue(g){g!==Ai&&g.next===null&&(Ai===null?xg=Ai=g:Ai=Ai.next=g),yc=!0,Sa||(Sa=!0,be())}function Se(g,v){if(!Nv&&yc){Nv=!0;do for(var E=!1,D=xg;D!==null;){if(g!==0){var $=D.pendingLanes;if($===0)var re=0;else{var Ie=D.suspendedLanes,ct=D.pingedLanes;re=(1<<31-ol(42|g)+1)-1,re&=$&~(Ie&~ct),re=re&201326741?re&201326741|1:re?re|2:0}re!==0&&(E=!0,tt(D,re))}else re=Xr,re=M(D,D===Ir?re:0,D.cancelPendingCommit!==null||D.timeoutHandle!==sl),(re&3)===0||C(D,re)||(E=!0,tt(D,re));D=D.next}while(E);Nv=!1}}function ke(){qe()}function qe(){yc=Sa=!1;var g=0;Ef!==0&&jh()&&(g=Ef);for(var v=_a(),E=null,D=xg;D!==null;){var $=D.next,re=Je(D,v);re===0?(D.next=null,E===null?xg=$:E.next=$,$===null&&(Ai=E)):(E=D,(g!==0||(re&3)!==0)&&(yc=!0)),D=$}yo!==0&&yo!==5||Se(g),Ef!==0&&(Ef=0)}function Je(g,v){for(var E=g.suspendedLanes,D=g.pingedLanes,$=g.expirationTimes,re=g.pendingLanes&-62914561;0<re;){var Ie=31-ol(re),ct=1<<Ie,jt=$[Ie];jt===-1?((ct&E)===0||(ct&D)!==0)&&($[Ie]=A(ct,v)):jt<=v&&(g.expiredLanes|=ct),re&=~ct}if(v=Ir,E=Xr,E=M(g,g===v?E:0,g.cancelPendingCommit!==null||g.timeoutHandle!==sl),D=g.callbackNode,E===0||g===v&&(ki===2||ki===9)||g.cancelPendingCommit!==null)return D!==null&&D!==null&&wv(D),g.callbackNode=null,g.callbackPriority=0;if((E&3)===0||C(g,E)){if(v=E&-E,v===g.callbackPriority)return v;switch(D!==null&&wv(D),W(E)){case 2:case 8:E=X3;break;case 32:E=hg;break;case 268435456:E=Tv;break;default:E=hg}return D=nt.bind(null,g),E=fg(E,D),g.callbackPriority=v,g.callbackNode=E,v}return D!==null&&D!==null&&wv(D),g.callbackPriority=2,g.callbackNode=null,2}function nt(g,v){if(yo!==0&&yo!==5)return g.callbackNode=null,g.callbackPriority=0,null;var E=g.callbackNode;if(Lu()&&g.callbackNode!==E)return null;var D=Xr;return D=M(g,g===Ir?D:0,g.cancelPendingCommit!==null||g.timeoutHandle!==sl),D===0?null:(Xc(g,D,v),Je(g,_a()),g.callbackNode!=null&&g.callbackNode===E?nt.bind(null,g):null)}function tt(g,v){if(Lu())return null;Xc(g,v,!0)}function be(){bb?_b(function(){(Br&6)!==0?fg(Mv,ke):qe()}):fg(Mv,ke)}function Le(){if(Ef===0){var g=zd;g===0&&(g=Sv,Sv<<=1,(Sv&261888)===0&&(Sv=256)),Ef=g}return Ef}function Ze(g,v){if(om===null){var E=om=[];Yb=0,zd=Le(),Ro={status:"pending",value:void 0,then:function(D){E.push(D)}}}return Yb++,v.then(Ee,Ee),v}function Ee(){if(--Yb===0&&om!==null){Ro!==null&&(Ro.status="fulfilled");var g=om;om=null,zd=0,Ro=null;for(var v=0;v<g.length;v++)(0,g[v])()}}function Ye(g,v){var E=[],D={status:"pending",value:null,reason:null,then:function($){E.push($)}};return g.then(function(){D.status="fulfilled",D.value=v;for(var $=0;$<E.length;$++)(0,E[$])(v)},function($){for(D.status="rejected",D.reason=$,$=0;$<E.length;$++)(0,E[$])(void 0)}),D}function it(){var g=Af.current;return g!==null?g:Ir.pooledCache}function mt(g,v){v===null?b(Af,Af.current):b(Af,v.pool)}function ft(){var g=it();return g===null?null:{parent:Qs?hs._currentValue:hs._currentValue2,pool:g}}function Qe(g,v){if(eo(g,v))return!0;if(typeof g!="object"||g===null||typeof v!="object"||v===null)return!1;var E=Object.keys(g),D=Object.keys(v);if(E.length!==D.length)return!1;for(D=0;D<E.length;D++){var $=E[D];if(!NE.call(v,$)||!eo(g[$],v[$]))return!1}return!0}function Ae(g){return g=g.status,g==="fulfilled"||g==="rejected"}function Xe(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,ot(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(D){if(v.status==="pending"){var $=v;$.status="fulfilled",$.value=D}},function(D){if(v.status==="pending"){var $=v;$.status="rejected",$.reason=D}})}switch(v.status){case"fulfilled":return v.value;case"rejected":throw g=v.reason,ot(g),g}throw Ua=v,Do}}function Re(g){try{var v=g._init;return v(g._payload)}catch(E){throw E!==null&&typeof E=="object"&&typeof E.then=="function"?(Ua=E,Do):E}}function Be(){if(Ua===null)throw Error(i(459));var g=Ua;return Ua=null,g}function ot(g){if(g===Do||g===_c)throw Error(i(483))}function dt(g){var v=Gh;return Gh+=1,Nf===null&&(Nf=[]),Xe(Nf,g,v)}function Nt(g,v){v=v.props.ref,g.ref=v!==void 0?v:null}function Dt(g,v){throw v.$$typeof===Dh?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(At,Mt){if(g){var Ot=At.deletions;Ot===null?(At.deletions=[Mt],At.flags|=16):Ot.push(Mt)}}function E(At,Mt){if(!g)return null;for(;Mt!==null;)v(At,Mt),Mt=Mt.sibling;return null}function D(At){for(var Mt=new Map;At!==null;)At.key!==null?Mt.set(At.key,At):Mt.set(At.index,At),At=At.sibling;return Mt}function $(At,Mt){return At=Rl(At,Mt),At.index=0,At.sibling=null,At}function re(At,Mt,Ot){return At.index=Ot,g?(Ot=At.alternate,Ot!==null?(Ot=Ot.index,Ot<Mt?(At.flags|=67108866,Mt):Ot):(At.flags|=67108866,Mt)):(At.flags|=1048576,Mt)}function Ie(At){return g&&At.alternate===null&&(At.flags|=67108866),At}function ct(At,Mt,Ot,gn){return Mt===null||Mt.tag!==6?(Mt=cb(Ot,At.mode,gn),Mt.return=At,Mt):(Mt=$(Mt,Ot),Mt.return=At,Mt)}function jt(At,Mt,Ot,gn){var Jn=Ot.type;return Jn===Ih?yn(At,Mt,Ot.props.children,gn,Ot.key):Mt!==null&&(Mt.elementType===Jn||typeof Jn=="object"&&Jn!==null&&Jn.$$typeof===ja&&Re(Jn)===Mt.type)?(Mt=$(Mt,Ot.props),Nt(Mt,Ot),Mt.return=At,Mt):(Mt=Rd(Ot.type,Ot.key,Ot.props,null,At.mode,gn),Nt(Mt,Ot),Mt.return=At,Mt)}function tn(At,Mt,Ot,gn){return Mt===null||Mt.tag!==4||Mt.stateNode.containerInfo!==Ot.containerInfo||Mt.stateNode.implementation!==Ot.implementation?(Mt=db(Ot,At.mode,gn),Mt.return=At,Mt):(Mt=$(Mt,Ot.children||[]),Mt.return=At,Mt)}function yn(At,Mt,Ot,gn,Jn){return Mt===null||Mt.tag!==7?(Mt=fc(Ot,At.mode,gn,Jn),Mt.return=At,Mt):(Mt=$(Mt,Ot),Mt.return=At,Mt)}function on(At,Mt,Ot){if(typeof Mt=="string"&&Mt!==""||typeof Mt=="number"||typeof Mt=="bigint")return Mt=cb(""+Mt,At.mode,Ot),Mt.return=At,Mt;if(typeof Mt=="object"&&Mt!==null){switch(Mt.$$typeof){case ju:return Ot=Rd(Mt.type,Mt.key,Mt.props,null,At.mode,Ot),Nt(Ot,Mt),Ot.return=At,Ot;case Ph:return Mt=db(Mt,At.mode,Ot),Mt.return=At,Mt;case ja:return Mt=Re(Mt),on(At,Mt,Ot)}if(wf(Mt)||f(Mt))return Mt=fc(Mt,At.mode,Ot,null),Mt.return=At,Mt;if(typeof Mt.then=="function")return on(At,dt(Mt),Ot);if(Mt.$$typeof===hc)return on(At,Z(At,Mt),Ot);Dt(At,Mt)}return null}function Rn(At,Mt,Ot,gn){var Jn=Mt!==null?Mt.key:null;if(typeof Ot=="string"&&Ot!==""||typeof Ot=="number"||typeof Ot=="bigint")return Jn!==null?null:ct(At,Mt,""+Ot,gn);if(typeof Ot=="object"&&Ot!==null){switch(Ot.$$typeof){case ju:return Ot.key===Jn?jt(At,Mt,Ot,gn):null;case Ph:return Ot.key===Jn?tn(At,Mt,Ot,gn):null;case ja:return Ot=Re(Ot),Rn(At,Mt,Ot,gn)}if(wf(Ot)||f(Ot))return Jn!==null?null:yn(At,Mt,Ot,gn,null);if(typeof Ot.then=="function")return Rn(At,Mt,dt(Ot),gn);if(Ot.$$typeof===hc)return Rn(At,Mt,Z(At,Ot),gn);Dt(At,Ot)}return null}function yr(At,Mt,Ot,gn,Jn){if(typeof gn=="string"&&gn!==""||typeof gn=="number"||typeof gn=="bigint")return At=At.get(Ot)||null,ct(Mt,At,""+gn,Jn);if(typeof gn=="object"&&gn!==null){switch(gn.$$typeof){case ju:return At=At.get(gn.key===null?Ot:gn.key)||null,jt(Mt,At,gn,Jn);case Ph:return At=At.get(gn.key===null?Ot:gn.key)||null,tn(Mt,At,gn,Jn);case ja:return gn=Re(gn),yr(At,Mt,Ot,gn,Jn)}if(wf(gn)||f(gn))return At=At.get(Ot)||null,yn(Mt,At,gn,Jn,null);if(typeof gn.then=="function")return yr(At,Mt,Ot,dt(gn),Jn);if(gn.$$typeof===hc)return yr(At,Mt,Ot,Z(Mt,gn),Jn);Dt(Mt,gn)}return null}function ro(At,Mt,Ot,gn){for(var Jn=null,ks=null,nr=Mt,si=Mt=0,$o=null;nr!==null&&si<Ot.length;si++){nr.index>si?($o=nr,nr=null):$o=nr.sibling;var mi=Rn(At,nr,Ot[si],gn);if(mi===null){nr===null&&(nr=$o);break}g&&nr&&mi.alternate===null&&v(At,nr),Mt=re(mi,Mt,si),ks===null?Jn=mi:ks.sibling=mi,ks=mi,nr=$o}if(si===Ot.length)return E(At,nr),qr&&U(At,si),Jn;if(nr===null){for(;si<Ot.length;si++)nr=on(At,Ot[si],gn),nr!==null&&(Mt=re(nr,Mt,si),ks===null?Jn=nr:ks.sibling=nr,ks=nr);return qr&&U(At,si),Jn}for(nr=D(nr);si<Ot.length;si++)$o=yr(nr,At,si,Ot[si],gn),$o!==null&&(g&&$o.alternate!==null&&nr.delete($o.key===null?si:$o.key),Mt=re($o,Mt,si),ks===null?Jn=$o:ks.sibling=$o,ks=$o);return g&&nr.forEach(function(Mc){return v(At,Mc)}),qr&&U(At,si),Jn}function pm(At,Mt,Ot,gn){if(Ot==null)throw Error(i(151));for(var Jn=null,ks=null,nr=Mt,si=Mt=0,$o=null,mi=Ot.next();nr!==null&&!mi.done;si++,mi=Ot.next()){nr.index>si?($o=nr,nr=null):$o=nr.sibling;var Mc=Rn(At,nr,mi.value,gn);if(Mc===null){nr===null&&(nr=$o);break}g&&nr&&Mc.alternate===null&&v(At,nr),Mt=re(Mc,Mt,si),ks===null?Jn=Mc:ks.sibling=Mc,ks=Mc,nr=$o}if(mi.done)return E(At,nr),qr&&U(At,si),Jn;if(nr===null){for(;!mi.done;si++,mi=Ot.next())mi=on(At,mi.value,gn),mi!==null&&(Mt=re(mi,Mt,si),ks===null?Jn=mi:ks.sibling=mi,ks=mi);return qr&&U(At,si),Jn}for(nr=D(nr);!mi.done;si++,mi=Ot.next())mi=yr(nr,At,si,mi.value,gn),mi!==null&&(g&&mi.alternate!==null&&nr.delete(mi.key===null?si:mi.key),Mt=re(mi,Mt,si),ks===null?Jn=mi:ks.sibling=mi,ks=mi);return g&&nr.forEach(function(RE){return v(At,RE)}),qr&&U(At,si),Jn}function jf(At,Mt,Ot,gn){if(typeof Ot=="object"&&Ot!==null&&Ot.type===Ih&&Ot.key===null&&(Ot=Ot.props.children),typeof Ot=="object"&&Ot!==null){switch(Ot.$$typeof){case ju:e:{for(var Jn=Ot.key;Mt!==null;){if(Mt.key===Jn){if(Jn=Ot.type,Jn===Ih){if(Mt.tag===7){E(At,Mt.sibling),gn=$(Mt,Ot.props.children),gn.return=At,At=gn;break e}}else if(Mt.elementType===Jn||typeof Jn=="object"&&Jn!==null&&Jn.$$typeof===ja&&Re(Jn)===Mt.type){E(At,Mt.sibling),gn=$(Mt,Ot.props),Nt(gn,Ot),gn.return=At,At=gn;break e}E(At,Mt);break}else v(At,Mt);Mt=Mt.sibling}Ot.type===Ih?(gn=fc(Ot.props.children,At.mode,gn,Ot.key),gn.return=At,At=gn):(gn=Rd(Ot.type,Ot.key,Ot.props,null,At.mode,gn),Nt(gn,Ot),gn.return=At,At=gn)}return Ie(At);case Ph:e:{for(Jn=Ot.key;Mt!==null;){if(Mt.key===Jn)if(Mt.tag===4&&Mt.stateNode.containerInfo===Ot.containerInfo&&Mt.stateNode.implementation===Ot.implementation){E(At,Mt.sibling),gn=$(Mt,Ot.children||[]),gn.return=At,At=gn;break e}else{E(At,Mt);break}else v(At,Mt);Mt=Mt.sibling}gn=db(Ot,At.mode,gn),gn.return=At,At=gn}return Ie(At);case ja:return Ot=Re(Ot),jf(At,Mt,Ot,gn)}if(wf(Ot))return ro(At,Mt,Ot,gn);if(f(Ot)){if(Jn=f(Ot),typeof Jn!="function")throw Error(i(150));return Ot=Jn.call(Ot),pm(At,Mt,Ot,gn)}if(typeof Ot.then=="function")return jf(At,Mt,dt(Ot),gn);if(Ot.$$typeof===hc)return jf(At,Mt,Z(At,Ot),gn);Dt(At,Ot)}return typeof Ot=="string"&&Ot!==""||typeof Ot=="number"||typeof Ot=="bigint"?(Ot=""+Ot,Mt!==null&&Mt.tag===6?(E(At,Mt.sibling),gn=$(Mt,Ot),gn.return=At,At=gn):(E(At,Mt),gn=cb(Ot,At.mode,gn),gn.return=At,At=gn),Ie(At)):E(At,Mt)}return function(At,Mt,Ot,gn){try{Gh=0;var Jn=jf(At,Mt,Ot,gn);return Nf=null,Jn}catch(nr){if(nr===Do||nr===_c)throw nr;var ks=n(29,nr,null,At.mode);return ks.lanes=gn,ks.return=At,ks}finally{}}}function Ht(){for(var g=Vu,v=Wh=Vu=0;v<g;){var E=la[v];la[v++]=null;var D=la[v];la[v++]=null;var $=la[v];la[v++]=null;var re=la[v];if(la[v++]=null,D!==null&&$!==null){var Ie=D.pending;Ie===null?$.next=$:($.next=Ie.next,Ie.next=$),D.pending=$}re!==0&&Bt(E,$,re)}}function rn(g,v,E,D){la[Vu++]=g,la[Vu++]=v,la[Vu++]=E,la[Vu++]=D,Wh|=D,g.lanes|=D,g=g.alternate,g!==null&&(g.lanes|=D)}function Ut(g,v,E,D){return rn(g,v,E,D),Kt(g)}function Ft(g,v){return rn(g,null,null,v),Kt(g)}function Bt(g,v,E){g.lanes|=E;var D=g.alternate;D!==null&&(D.lanes|=E);for(var $=!1,re=g.return;re!==null;)re.childLanes|=E,D=re.alternate,D!==null&&(D.childLanes|=E),re.tag===22&&(g=re.stateNode,g===null||g._visibility&1||($=!0)),g=re,re=re.return;return g.tag===3?(re=g.stateNode,$&&v!==null&&($=31-ol(E),g=re.hiddenUpdates,D=g[$],D===null?g[$]=[v]:D.push(v),v.lane=E|536870912),re):null}function Kt(g){if(50<ui)throw ui=0,wg=null,Error(i(185));for(var v=g.return;v!==null;)g=v,v=g.return;return g.tag===3?g.stateNode:null}function dn(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rt(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 Pt(g){return{lane:g,tag:0,payload:null,callback:null,next:null}}function Lt(g,v,E){var D=g.updateQueue;if(D===null)return null;if(D=D.shared,(Br&2)!==0){var $=D.pending;return $===null?v.next=v:(v.next=$.next,$.next=v),D.pending=v,v=Kt(g),Bt(g,null,E),v}return rn(g,D,v,E),Kt(g)}function ln(g,v,E){if(v=v.updateQueue,v!==null&&(v=v.shared,(E&4194048)!==0)){var D=v.lanes;D&=g.pendingLanes,E|=D,v.lanes=E,L(g,E)}}function It(g,v){var E=g.updateQueue,D=g.alternate;if(D!==null&&(D=D.updateQueue,E===D)){var $=null,re=null;if(E=E.firstBaseUpdate,E!==null){do{var Ie={lane:E.lane,tag:E.tag,payload:E.payload,callback:null,next:null};re===null?$=re=Ie:re=re.next=Ie,E=E.next}while(E!==null);re===null?$=re=v:re=re.next=v}else $=re=v;E={baseState:D.baseState,firstBaseUpdate:$,lastBaseUpdate:re,shared:D.shared,callbacks:D.callbacks},g.updateQueue=E;return}g=E.lastBaseUpdate,g===null?E.firstBaseUpdate=v:g.next=v,E.lastBaseUpdate=v}function Oe(){if(Rv){var g=Ro;if(g!==null)throw g}}function gt(g,v,E,D){Rv=!1;var $=g.updateQueue;Il=!1;var re=$.firstBaseUpdate,Ie=$.lastBaseUpdate,ct=$.shared.pending;if(ct!==null){$.shared.pending=null;var jt=ct,tn=jt.next;jt.next=null,Ie===null?re=tn:Ie.next=tn,Ie=jt;var yn=g.alternate;yn!==null&&(yn=yn.updateQueue,ct=yn.lastBaseUpdate,ct!==Ie&&(ct===null?yn.firstBaseUpdate=tn:ct.next=tn,yn.lastBaseUpdate=jt))}if(re!==null){var on=$.baseState;Ie=0,yn=tn=jt=null,ct=re;do{var Rn=ct.lane&-536870913,yr=Rn!==ct.lane;if(yr?(Xr&Rn)===Rn:(D&Rn)===Rn){Rn!==0&&Rn===zd&&(Rv=!0),yn!==null&&(yn=yn.next={lane:0,tag:ct.tag,payload:ct.payload,callback:null,next:null});e:{var ro=g,pm=ct;Rn=v;var jf=E;switch(pm.tag){case 1:if(ro=pm.payload,typeof ro=="function"){on=ro.call(jf,on,Rn);break e}on=ro;break e;case 3:ro.flags=ro.flags&-65537|128;case 0:if(ro=pm.payload,Rn=typeof ro=="function"?ro.call(jf,on,Rn):ro,Rn==null)break e;on=sv({},on,Rn);break e;case 2:Il=!0}}Rn=ct.callback,Rn!==null&&(g.flags|=64,yr&&(g.flags|=8192),yr=$.callbacks,yr===null?$.callbacks=[Rn]:yr.push(Rn))}else yr={lane:Rn,tag:ct.tag,payload:ct.payload,callback:ct.callback,next:null},yn===null?(tn=yn=yr,jt=on):yn=yn.next=yr,Ie|=Rn;if(ct=ct.next,ct===null){if(ct=$.shared.pending,ct===null)break;yr=ct,ct=yr.next,yr.next=null,$.lastBaseUpdate=yr,$.shared.pending=null}}while(!0);yn===null&&(jt=on),$.baseState=jt,$.firstBaseUpdate=tn,$.lastBaseUpdate=yn,re===null&&($.shared.lanes=0),Ud|=Ie,g.lanes=Ie,g.memoizedState=on}}function _t(g,v){if(typeof g!="function")throw Error(i(191,g));g.call(v)}function Vt(g,v){var E=g.callbacks;if(E!==null)for(g.callbacks=null,g=0;g<E.length;g++)_t(E[g],v)}function vn(g,v){g=Wu,b(kf,g),b($h,v),Wu=g|v.baseLanes}function ye(){b(kf,Wu),b($h,$h.current)}function et(){Wu=kf.current,x($h),x(kf)}function xt(g){var v=g.alternate;b(Us,Us.current&1),b(ll,g),cl===null&&(v===null||$h.current!==null||v.memoizedState!==null)&&(cl=g)}function vt(g){b(Us,Us.current),b(ll,g),cl===null&&(cl=g)}function ut(g){g.tag===22?(b(Us,Us.current),b(ll,g),cl===null&&(cl=g)):qt()}function qt(){b(Us,Us.current),b(ll,ll.current)}function en(g){x(ll),cl===g&&(cl=null),x(Us)}function Qt(g){for(var v=g;v!==null;){if(v.tag===13){var E=v.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||Tf(E)||hv(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 Gt(){throw Error(i(321))}function hn(g,v){if(v===null)return!1;for(var E=0;E<v.length&&E<g.length;E++)if(!eo(g[E],v[E]))return!1;return!0}function Sn(g,v,E,D,$,re){return Fd=re,Tr=v,v.memoizedState=null,v.updateQueue=null,v.lanes=0,Kn.H=g===null||g.memoizedState===null?Es:Gu,ei=!1,re=E(D,$),ei=!1,Nr&&(re=nn(v,E,D,$)),Nn(g),re}function Nn(g){Kn.H=Ol;var v=Vn!==null&&Vn.next!==null;if(Fd=0,mr=Vn=Tr=null,Pr=!1,Sc=0,Zc=null,v)throw Error(i(300));g===null||es||(g=g.dependencies,g!==null&&ze(g)&&(es=!0))}function nn(g,v,E,D){Tr=g;var $=0;do{if(Nr&&(Zc=null),Sc=0,Nr=!1,25<=$)throw Error(i(301));if($+=1,mr=Vn=null,g.updateQueue!=null){var re=g.updateQueue;re.lastEffect=null,re.events=null,re.stores=null,re.memoCache!=null&&(re.memoCache.index=0)}Kn.H=Rf,re=v(E,D)}while(Nr);return re}function Gn(){var g=Kn.H,v=g.useState()[0];return v=typeof v.then=="function"?jn(v):v,g=g.useState()[0],(Vn!==null?Vn.memoizedState:null)!==g&&(Tr.flags|=1024),v}function vr(){var g=wa!==0;return wa=0,g}function sr(g,v,E){v.updateQueue=g.updateQueue,v.flags&=-2053,g.lanes&=~E}function Yn(g){if(Pr){for(g=g.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}Pr=!1}Fd=0,mr=Vn=Tr=null,Nr=!1,Sc=wa=0,Zc=null}function fr(){var g={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mr===null?Tr.memoizedState=mr=g:mr=mr.next=g,mr}function un(){if(Vn===null){var g=Tr.alternate;g=g!==null?g.memoizedState:null}else g=Vn.next;var v=mr===null?Tr.memoizedState:mr.next;if(v!==null)mr=v,Vn=g;else{if(g===null)throw Tr.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},mr===null?Tr.memoizedState=mr=g:mr=mr.next=g}return mr}function ls(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function jn(g){var v=Sc;return Sc+=1,Zc===null&&(Zc=[]),g=Xe(Zc,g,v),v=Tr,(mr===null?v.memoizedState:mr.next)===null&&(v=v.alternate,Kn.H=v===null||v.memoizedState===null?Es:Gu),g}function ys(g){if(g!==null&&typeof g=="object"){if(typeof g.then=="function")return jn(g);if(g.$$typeof===hc)return ae(g)}throw Error(i(438,String(g)))}function Ps(g){var v=null,E=Tr.updateQueue;if(E!==null&&(v=E.memoCache),v==null){var D=Tr.alternate;D!==null&&(D=D.updateQueue,D!==null&&(D=D.memoCache,D!=null&&(v={data:D.data.map(function($){return $.slice()}),index:0})))}if(v==null&&(v={data:[],index:0}),E===null&&(E=ls(),Tr.updateQueue=E),E.memoCache=v,E=v.data[v.index],E===void 0)for(E=v.data[v.index]=Array(g),D=0;D<g;D++)E[D]=hb;return v.index++,E}function Li(g,v){return typeof v=="function"?v(g):v}function bs(g){var v=un();return Sr(v,Vn,g)}function Sr(g,v,E){var D=g.queue;if(D===null)throw Error(i(311));D.lastRenderedReducer=E;var $=g.baseQueue,re=D.pending;if(re!==null){if($!==null){var Ie=$.next;$.next=re.next,re.next=Ie}v.baseQueue=$=re,D.pending=null}if(re=g.baseState,$===null)g.memoizedState=re;else{v=$.next;var ct=Ie=null,jt=null,tn=v,yn=!1;do{var on=tn.lane&-536870913;if(on!==tn.lane?(Xr&on)===on:(Fd&on)===on){var Rn=tn.revertLane;if(Rn===0)jt!==null&&(jt=jt.next={lane:0,revertLane:0,gesture:null,action:tn.action,hasEagerState:tn.hasEagerState,eagerState:tn.eagerState,next:null}),on===zd&&(yn=!0);else if((Fd&Rn)===Rn){tn=tn.next,Rn===zd&&(yn=!0);continue}else on={lane:0,revertLane:tn.revertLane,gesture:null,action:tn.action,hasEagerState:tn.hasEagerState,eagerState:tn.eagerState,next:null},jt===null?(ct=jt=on,Ie=re):jt=jt.next=on,Tr.lanes|=Rn,Ud|=Rn;on=tn.action,ei&&E(re,on),re=tn.hasEagerState?tn.eagerState:E(re,on)}else Rn={lane:on,revertLane:tn.revertLane,gesture:tn.gesture,action:tn.action,hasEagerState:tn.hasEagerState,eagerState:tn.eagerState,next:null},jt===null?(ct=jt=Rn,Ie=re):jt=jt.next=Rn,Tr.lanes|=on,Ud|=on;tn=tn.next}while(tn!==null&&tn!==v);if(jt===null?Ie=re:jt.next=ct,!eo(re,g.memoizedState)&&(es=!0,yn&&(E=Ro,E!==null)))throw E;g.memoizedState=re,g.baseState=Ie,g.baseQueue=jt,D.lastRenderedState=re}return $===null&&(D.lanes=0),[g.memoizedState,D.dispatch]}function pi(g){var v=un(),E=v.queue;if(E===null)throw Error(i(311));E.lastRenderedReducer=g;var D=E.dispatch,$=E.pending,re=v.memoizedState;if($!==null){E.pending=null;var Ie=$=$.next;do re=g(re,Ie.action),Ie=Ie.next;while(Ie!==$);eo(re,v.memoizedState)||(es=!0),v.memoizedState=re,v.baseQueue===null&&(v.baseState=re),E.lastRenderedState=re}return[re,D]}function Is(g,v,E){var D=Tr,$=un(),re=qr;if(re){if(E===void 0)throw Error(i(407));E=E()}else E=v();var Ie=!eo((Vn||$).memoizedState,E);if(Ie&&($.memoizedState=E,es=!0),$=$.queue,Wr(va.bind(null,D,$,g),[g]),$.getSnapshot!==v||Ie||mr!==null&&mr.memoizedState.tag&1){if(D.flags|=2048,_s(9,{destroy:void 0},ta.bind(null,D,$,E,v),null),Ir===null)throw Error(i(349));re||(Fd&127)!==0||ji(D,v,E)}return E}function ji(g,v,E){g.flags|=16384,g={getSnapshot:v,value:E},v=Tr.updateQueue,v===null?(v=ls(),Tr.updateQueue=v,v.stores=[g]):(E=v.stores,E===null?v.stores=[g]:E.push(g))}function ta(g,v,E,D){v.value=E,v.getSnapshot=D,Ra(v)&&tc(g)}function va(g,v,E){return E(function(){Ra(v)&&tc(g)})}function Ra(g){var v=g.getSnapshot;g=g.value;try{var E=v();return!eo(g,E)}catch{return!0}}function tc(g){var v=Ft(g,2);v!==null&&Ts(v,g,2)}function Tl(g){var v=fr();if(typeof g=="function"){var E=g;if(g=E(),ei){G(!0);try{E()}finally{G(!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,D){return g.baseState=E,Sr(g,Vn,typeof D=="function"?D:Li)}function Os(g,v,E,D,$){if(Ah(g))throw Error(i(485));if(g=v.action,g!==null){var re={payload:$,action:g,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Ie){re.listeners.push(Ie)}};Kn.T!==null?E(!0):re.isTransition=!1,D(re),E=v.pending,E===null?(re.next=v.pending=re,nc(v,re)):(re.next=E.next,v.pending=E.next=re)}}function nc(g,v){var E=v.action,D=v.payload,$=g.state;if(v.isTransition){var re=Kn.T,Ie={};Kn.T=Ie;try{var ct=E($,D),jt=Kn.S;jt!==null&&jt(Ie,ct),Qa(g,v,ct)}catch(tn){Pa(g,v,tn)}finally{re!==null&&Ie.types!==null&&(re.types=Ie.types),Kn.T=re}}else try{re=E($,D),Qa(g,v,re)}catch(tn){Pa(g,v,tn)}}function Qa(g,v,E){E!==null&&typeof E=="object"&&typeof E.then=="function"?E.then(function(D){Da(g,v,D)},function(D){return Pa(g,v,D)}):Da(g,v,E)}function Da(g,v,E){v.status="fulfilled",v.value=E,Vc(v),g.state=E,v=g.pending,v!==null&&(E=v.next,E===v?g.pending=null:(E=E.next,v.next=E,nc(g,E)))}function Pa(g,v,E){var D=g.pending;if(g.pending=null,D!==null){D=D.next;do v.status="rejected",v.reason=E,Vc(v),v=v.next;while(v!==D)}g.action=null}function Vc(g){g=g.listeners;for(var v=0;v<g.length;v++)(0,g[v])()}function Gc(g,v){return v}function rc(g,v){if(qr){var E=Ir.formState;if(E!==null){e:{var D=Tr;if(qr){if(fs){var $=M3(fs,Fa);if($){fs=T3($),D=Db($);break e}}Q(D)}D=!1}D&&(v=E[0])}}E=fr(),E.memoizedState=E.baseState=v,D={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gc,lastRenderedState:v},E.queue=D,E=Al.bind(null,Tr,D),D.dispatch=E,D=Tl(!1);var re=Lp.bind(null,Tr,!1,D.queue);return D=fr(),$={state:v,dispatch:null,action:g,pending:null},D.queue=$,E=Os.bind(null,Tr,$,re,E),$.dispatch=E,D.memoizedState=g,[v,E,!1]}function na(g){var v=un();return ho(v,Vn,g)}function ho(g,v,E){if(v=Sr(g,v,Gc)[0],g=bs(Li)[0],typeof v=="object"&&v!==null&&typeof v.then=="function")try{var D=jn(v)}catch(Ie){throw Ie===Do?_c:Ie}else D=v;v=un();var $=v.queue,re=$.dispatch;return E!==v.memoizedState&&(Tr.flags|=2048,_s(9,{destroy:void 0},jo.bind(null,$,E),null)),[D,re,g]}function jo(g,v){g.action=v}function Cl(g){var v=un(),E=Vn;if(E!==null)return ho(v,E,g);un(),v=v.memoizedState,E=un();var D=E.queue.dispatch;return E.memoizedState=g,[v,D,!1]}function _s(g,v,E,D){return g={tag:g,create:E,deps:D,inst:v,next:null},v=Tr.updateQueue,v===null&&(v=ls(),Tr.updateQueue=v),E=v.lastEffect,E===null?v.lastEffect=g.next=g:(D=E.next,E.next=g,g.next=D,v.lastEffect=g),g}function Ja(){return un().memoizedState}function el(g,v,E,D){var $=fr();Tr.flags|=g,$.memoizedState=_s(1|v,{destroy:void 0},E,D===void 0?null:D)}function Wc(g,v,E,D){var $=un();D=D===void 0?null:D;var re=$.memoizedState.inst;Vn!==null&&D!==null&&hn(D,Vn.memoizedState.deps)?$.memoizedState=_s(v,re,E,D):(Tr.flags|=g,$.memoizedState=_s(1|v,re,E,D))}function ii(g,v){el(8390656,8,g,v)}function Wr(g,v){Wc(2048,8,g,v)}function ra(g){Tr.flags|=4;var v=Tr.updateQueue;if(v===null)v=ls(),Tr.updateQueue=v,v.events=[g];else{var E=v.events;E===null?v.events=[g]:E.push(g)}}function wr(g){var v=un().memoizedState;return ra({ref:v,nextImpl:g}),function(){if((Br&2)!==0)throw Error(i(440));return v.impl.apply(void 0,arguments)}}function wi(g,v){return Wc(4,2,g,v)}function zi(g,v){return Wc(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 Ia(g,v,E){E=E!=null?E.concat([g]):null,Wc(4,4,Kr.bind(null,v,g),E)}function El(){}function ic(g,v){var E=un();v=v===void 0?null:v;var D=E.memoizedState;return v!==null&&hn(v,D[1])?D[0]:(E.memoizedState=[g,v],g)}function To(g,v){var E=un();v=v===void 0?null:v;var D=E.memoizedState;if(v!==null&&hn(v,D[1]))return D[0];if(D=g(),ei){G(!0);try{g()}finally{G(!1)}}return E.memoizedState=[D,v],D}function gi(g,v,E){return E===void 0||(Fd&1073741824)!==0&&(Xr&261930)===0?g.memoizedState=v:(g.memoizedState=E,g=Ad(),Tr.lanes|=g,Ud|=g,E)}function Eh(g,v,E,D){return eo(E,v)?E:$h.current!==null?(g=gi(g,E,D),eo(g,v)||(es=!0),g):(Fd&42)===0||(Fd&1073741824)!==0&&(Xr&261930)===0?(es=!0,g.memoizedState=E):(g=Ad(),Tr.lanes|=g,Ud|=g,v)}function yd(g,v,E,D,$){var re=pc();$r(re!==0&&8>re?re:8);var Ie=Kn.T,ct={};Kn.T=ct,Lp(g,!1,v,E);try{var jt=$(),tn=Kn.S;if(tn!==null&&tn(ct,jt),jt!==null&&typeof jt=="object"&&typeof jt.then=="function"){var yn=Ye(jt,D);Co(g,v,yn,us(g))}else Co(g,v,D,us(g))}catch(on){Co(g,v,{then:function(){},status:"rejected",reason:on},us())}finally{$r(re),Ie!==null&&ct.types!==null&&(Ie.types=ct.types),Kn.T=Ie}}function bd(g){var v=g.memoizedState;if(v!==null)return v;v={memoizedState:zh,baseState:zh,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:zh},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 df(){return ae(Fh)}function ba(){return un().memoizedState}function qi(){return un().memoizedState}function Ys(g){for(var v=g.return;v!==null;){switch(v.tag){case 24:case 3:var E=us();g=Pt(E);var D=Lt(v,g,E);D!==null&&(Ts(D,v,E),ln(D,v,E)),v={cache:we()},g.payload=v;return}v=v.return}}function Ss(g,v,E){var D=us();E={lane:D,revertLane:0,gesture:null,action:E,hasEagerState:!1,eagerState:null,next:null},Ah(g)?V0(v,E):(E=Ut(g,v,E,D),E!==null&&(Ts(E,g,D),ff(E,v,D)))}function Al(g,v,E){var D=us();Co(g,v,E,D)}function Co(g,v,E,D){var $={lane:D,revertLane:0,gesture:null,action:E,hasEagerState:!1,eagerState:null,next:null};if(Ah(g))V0(v,$);else{var re=g.alternate;if(g.lanes===0&&(re===null||re.lanes===0)&&(re=v.lastRenderedReducer,re!==null))try{var Ie=v.lastRenderedState,ct=re(Ie,E);if($.hasEagerState=!0,$.eagerState=ct,eo(ct,Ie))return rn(g,v,$,0),Ir===null&&Ht(),!1}catch{}finally{}if(E=Ut(g,v,$,D),E!==null)return Ts(E,g,D),ff(E,v,D),!0}return!1}function Lp(g,v,E,D){if(D={lane:2,revertLane:Le(),gesture:null,action:D,hasEagerState:!1,eagerState:null,next:null},Ah(g)){if(v)throw Error(i(479))}else v=Ut(g,E,D,2),v!==null&&Ts(v,g,2)}function Ah(g){var v=g.alternate;return g===Tr||v!==null&&v===Tr}function V0(g,v){Nr=Pr=!0;var E=g.pending;E===null?v.next=v:(v.next=E.next,E.next=v),g.pending=v}function ff(g,v,E){if((E&4194048)!==0){var D=v.lanes;D&=g.pendingLanes,E|=D,v.lanes=E,L(g,E)}}function _d(g,v,E,D){v=g.memoizedState,E=E(D,v),E=E==null?v:sv({},v,E),g.memoizedState=E,g.lanes===0&&(g.updateQueue.baseState=E)}function jp(g,v,E,D,$,re,Ie){return g=g.stateNode,typeof g.shouldComponentUpdate=="function"?g.shouldComponentUpdate(D,re,Ie):v.prototype&&v.prototype.isPureReactComponent?!Qe(E,D)||!Qe($,re):!0}function zp(g,v,E,D){g=v.state,typeof v.componentWillReceiveProps=="function"&&v.componentWillReceiveProps(E,D),typeof v.UNSAFE_componentWillReceiveProps=="function"&&v.UNSAFE_componentWillReceiveProps(E,D),v.state!==g&&vg.enqueueReplaceState(v,v.state,null)}function Sd(g,v){var E=v;if("ref"in v){E={};for(var D in v)D!=="ref"&&(E[D]=v[D])}if(g=g.defaultProps){E===v&&(E=sv({},E));for(var $ in g)E[$]===void 0&&(E[$]=g[$])}return E}function sc(g,v){try{var E=g.onUncaughtError;E(v.value,{componentStack:v.stack})}catch(D){setTimeout(function(){throw D})}}function oc(g,v,E){try{var D=g.onCaughtError;D(E.value,{componentStack:E.stack,errorBoundary:v.tag===1?v.stateNode:null})}catch($){setTimeout(function(){throw $})}}function wd(g,v,E){return E=Pt(E),E.tag=3,E.payload={element:null},E.callback=function(){sc(g,v)},E}function G0(g){return g=Pt(g),g.tag=3,g}function Fp(g,v,E,D){var $=E.type.getDerivedStateFromError;if(typeof $=="function"){var re=D.value;g.payload=function(){return $(re)},g.callback=function(){oc(v,E,D)}}var Ie=E.stateNode;Ie!==null&&typeof Ie.componentDidCatch=="function"&&(g.callback=function(){oc(v,E,D),typeof $!="function"&&(Bd===null?Bd=new Set([this]):Bd.add(this));var ct=D.stack;this.componentDidCatch(D.value,{componentStack:ct!==null?ct:""})})}function W0(g,v,E,D,$){if(E.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){if(v=E.alternate,v!==null&&He(v,E,$,!0),E=ll.current,E!==null){switch(E.tag){case 31:case 13:return cl===null?Xp():E.alternate===null&&Ns===0&&(Ns=3),E.flags&=-257,E.flags|=65536,E.lanes=$,D===Hu?E.flags|=16384:(v=E.updateQueue,v===null?E.updateQueue=new Set([D]):v.add(D),Zp(g,D,$)),!1;case 22:return E.flags|=65536,D===Hu?E.flags|=16384:(v=E.updateQueue,v===null?(v={transitions:null,markerInstances:null,retryQueue:new Set([D])},E.updateQueue=v):(E=v.retryQueue,E===null?v.retryQueue=new Set([D]):E.add(D)),Zp(g,D,$)),!1}throw Error(i(435,E.tag))}return Zp(g,D,$),Xp(),!1}if(qr)return v=ll.current,v!==null?((v.flags&65536)===0&&(v.flags|=256),v.flags|=65536,v.lanes=$,D!==Av&&(g=Error(i(422),{cause:D}),Me(ne(g,E)))):(D!==Av&&(v=Error(i(423),{cause:D}),Me(ne(v,E))),g=g.current.alternate,g.flags|=65536,$&=-$,g.lanes|=$,D=ne(D,E),$=wd(g.stateNode,D,$),It(g,$),Ns!==4&&(Ns=2)),!1;var re=Error(i(520),{cause:D});if(re=ne(re,E),bg===null?bg=[re]:bg.push(re),Ns!==4&&(Ns=2),v===null)return!0;D=ne(D,E),E=v;do{switch(E.tag){case 3:return E.flags|=65536,g=$&-$,E.lanes|=g,g=wd(E.stateNode,D,g),It(E,g),!1;case 1:if(v=E.type,re=E.stateNode,(E.flags&128)===0&&(typeof v.getDerivedStateFromError=="function"||re!==null&&typeof re.componentDidCatch=="function"&&(Bd===null||!Bd.has(re))))return E.flags|=65536,$&=-$,E.lanes|=$,$=G0($),Fp($,g,E,D),It(E,$),!1}E=E.return}while(E!==null);return!1}function Ks(g,v,E,D){v.child=g===null?Kb(v,null,E,D):aa(v,g.child,E,D)}function $0(g,v,E,D,$){E=E.render;var re=v.ref;if("ref"in D){var Ie={};for(var ct in D)ct!=="ref"&&(Ie[ct]=D[ct])}else Ie=D;return Ge(v),D=Sn(g,v,E,Ie,re,$),ct=vr(),g!==null&&!es?(sr(g,v,$),Ke(g,v,$)):(qr&&ct&&Y(v),v.flags|=1,Ks(g,v,D,$),v.child)}function q0(g,v,E,D,$){if(g===null){var re=E.type;return typeof re=="function"&&!kh(re)&&re.defaultProps===void 0&&E.compare===null?(v.tag=15,v.type=re,X0(g,v,re,D,$)):(g=Rd(E.type,null,D,v,v.mode,$),g.ref=v.ref,g.return=v,v.child=g)}if(re=g.child,!ht(g,$)){var Ie=re.memoizedProps;if(E=E.compare,E=E!==null?E:Qe,E(Ie,D)&&g.ref===v.ref)return Ke(g,v,$)}return v.flags|=1,g=Rl(re,D),g.ref=v.ref,g.return=v,v.child=g}function X0(g,v,E,D,$){if(g!==null){var re=g.memoizedProps;if(Qe(re,D)&&g.ref===v.ref)if(es=!1,v.pendingProps=D=re,ht(g,$))(g.flags&131072)!==0&&(es=!0);else return v.lanes=g.lanes,Ke(g,v,$)}return Td(g,v,E,D,$)}function Y0(g,v,E,D){var $=D.children,re=g!==null?g.memoizedState:null;if(g===null&&v.stateNode===null&&(v.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),D.mode==="hidden"){if((v.flags&128)!==0){if(re=re!==null?re.baseLanes|E:E,g!==null){for(D=v.child=g.child,$=0;D!==null;)$=$|D.lanes|D.childLanes,D=D.sibling;D=$&~re}else D=0,v.child=null;return Md(g,v,re,E,D)}if((E&536870912)!==0)v.memoizedState={baseLanes:0,cachePool:null},g!==null&&mt(v,re!==null?re.cachePool:null),re!==null?vn(v,re):ye(),ut(v);else return D=v.lanes=536870912,Md(g,v,re!==null?re.baseLanes|E:E,E,D)}else re!==null?(mt(v,re.cachePool),vn(v,re),qt(),v.memoizedState=null):(g!==null&&mt(v,null),ye(),qt());return Ks(g,v,$,E),v.child}function Cu(g,v){return g!==null&&g.tag===22||v.stateNode!==null||(v.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.sibling}function Md(g,v,E,D,$){var re=it();return re=re===null?null:{parent:Qs?hs._currentValue:hs._currentValue2,pool:re},v.memoizedState={baseLanes:E,cachePool:re},g!==null&&mt(v,null),ye(),ut(v),g!==null&&He(g,v,D,!0),v.childLanes=$,null}function Up(g,v){return v=Au({mode:v.mode,children:v.children},g.mode),v.ref=g.ref,g.child=v,v.return=g,v}function Bp(g,v,E){return aa(v,g.child,null,E),g=Up(v,v.pendingProps),g.flags|=2,en(v),v.memoizedState=null,g}function K0(g,v,E){var D=v.pendingProps,$=(v.flags&128)!==0;if(v.flags&=-129,g===null){if(qr){if(D.mode==="hidden")return g=Up(v,D),v.lanes=536870912,Cu(null,g);if(vt(v),(g=fs)?(g=Ib(g,Fa),g!==null&&(v.memoizedState={dehydrated:g,treeContext:xc!==null?{id:sa,overflow:Yc}:null,retryLane:536870912,hydrationErrors:null},E=ub(g),E.return=v,v.child=E,ko=v,fs=null)):g=null,g===null)throw Q(v);return v.lanes=536870912,null}return Up(v,D)}var re=g.memoizedState;if(re!==null){var Ie=re.dehydrated;if(vt(v),$)if(v.flags&256)v.flags&=-257,v=Bp(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||He(g,v,E,!1),$=(E&g.childLanes)!==0,es||$){if(D=Ir,D!==null&&(Ie=B(D,E),Ie!==0&&Ie!==re.retryLane))throw re.retryLane=Ie,Ft(g,Ie),Ts(D,g,Ie),Ba;Xp(),v=Bp(g,v,E)}else g=re.treeContext,ds&&(fs=N3(Ie),ko=v,qr=!0,Bu=null,Fa=!1,g!==null&&le(v,g)),v=Up(v,D),v.flags|=4096;return v}return g=Rl(g.child,{mode:D.mode,children:D.children}),g.ref=v.ref,v.child=g,g.return=v,g}function ac(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 Td(g,v,E,D,$){return Ge(v),E=Sn(g,v,E,D,void 0,$),D=vr(),g!==null&&!es?(sr(g,v,$),Ke(g,v,$)):(qr&&D&&Y(v),v.flags|=1,Ks(g,v,E,$),v.child)}function Ls(g,v,E,D,$,re){return Ge(v),v.updateQueue=null,E=nn(v,D,E,$),Nn(g),D=vr(),g!==null&&!es?(sr(g,v,re),Ke(g,v,re)):(qr&&D&&Y(v),v.flags|=1,Ks(g,v,E,re),v.child)}function Eu(g,v,E,D,$){if(Ge(v),v.stateNode===null){var re=zu,Ie=E.contextType;typeof Ie=="object"&&Ie!==null&&(re=ae(Ie)),re=new E(D,re),v.memoizedState=re.state!==null&&re.state!==void 0?re.state:null,re.updater=vg,v.stateNode=re,re._reactInternals=v,re=v.stateNode,re.props=D,re.state=v.memoizedState,re.refs={},dn(v),Ie=E.contextType,re.context=typeof Ie=="object"&&Ie!==null?ae(Ie):zu,re.state=v.memoizedState,Ie=E.getDerivedStateFromProps,typeof Ie=="function"&&(_d(v,E,Ie,D),re.state=v.memoizedState),typeof E.getDerivedStateFromProps=="function"||typeof re.getSnapshotBeforeUpdate=="function"||typeof re.UNSAFE_componentWillMount!="function"&&typeof re.componentWillMount!="function"||(Ie=re.state,typeof re.componentWillMount=="function"&&re.componentWillMount(),typeof re.UNSAFE_componentWillMount=="function"&&re.UNSAFE_componentWillMount(),Ie!==re.state&&vg.enqueueReplaceState(re,re.state,null),gt(v,D,re,$),Oe(),re.state=v.memoizedState),typeof re.componentDidMount=="function"&&(v.flags|=4194308),D=!0}else if(g===null){re=v.stateNode;var ct=v.memoizedProps,jt=Sd(E,ct);re.props=jt;var tn=re.context,yn=E.contextType;Ie=zu,typeof yn=="object"&&yn!==null&&(Ie=ae(yn));var on=E.getDerivedStateFromProps;yn=typeof on=="function"||typeof re.getSnapshotBeforeUpdate=="function",ct=v.pendingProps!==ct,yn||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ct||tn!==Ie)&&zp(v,re,D,Ie),Il=!1;var Rn=v.memoizedState;re.state=Rn,gt(v,D,re,$),Oe(),tn=v.memoizedState,ct||Rn!==tn||Il?(typeof on=="function"&&(_d(v,E,on,D),tn=v.memoizedState),(jt=Il||jp(v,E,jt,D,Rn,tn,Ie))?(yn||typeof re.UNSAFE_componentWillMount!="function"&&typeof re.componentWillMount!="function"||(typeof re.componentWillMount=="function"&&re.componentWillMount(),typeof re.UNSAFE_componentWillMount=="function"&&re.UNSAFE_componentWillMount()),typeof re.componentDidMount=="function"&&(v.flags|=4194308)):(typeof re.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=D,v.memoizedState=tn),re.props=D,re.state=tn,re.context=Ie,D=jt):(typeof re.componentDidMount=="function"&&(v.flags|=4194308),D=!1)}else{re=v.stateNode,Rt(g,v),Ie=v.memoizedProps,yn=Sd(E,Ie),re.props=yn,on=v.pendingProps,Rn=re.context,tn=E.contextType,jt=zu,typeof tn=="object"&&tn!==null&&(jt=ae(tn)),ct=E.getDerivedStateFromProps,(tn=typeof ct=="function"||typeof re.getSnapshotBeforeUpdate=="function")||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(Ie!==on||Rn!==jt)&&zp(v,re,D,jt),Il=!1,Rn=v.memoizedState,re.state=Rn,gt(v,D,re,$),Oe();var yr=v.memoizedState;Ie!==on||Rn!==yr||Il||g!==null&&g.dependencies!==null&&ze(g.dependencies)?(typeof ct=="function"&&(_d(v,E,ct,D),yr=v.memoizedState),(yn=Il||jp(v,E,yn,D,Rn,yr,jt)||g!==null&&g.dependencies!==null&&ze(g.dependencies))?(tn||typeof re.UNSAFE_componentWillUpdate!="function"&&typeof re.componentWillUpdate!="function"||(typeof re.componentWillUpdate=="function"&&re.componentWillUpdate(D,yr,jt),typeof re.UNSAFE_componentWillUpdate=="function"&&re.UNSAFE_componentWillUpdate(D,yr,jt)),typeof re.componentDidUpdate=="function"&&(v.flags|=4),typeof re.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof re.componentDidUpdate!="function"||Ie===g.memoizedProps&&Rn===g.memoizedState||(v.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||Ie===g.memoizedProps&&Rn===g.memoizedState||(v.flags|=1024),v.memoizedProps=D,v.memoizedState=yr),re.props=D,re.state=yr,re.context=jt,D=yn):(typeof re.componentDidUpdate!="function"||Ie===g.memoizedProps&&Rn===g.memoizedState||(v.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||Ie===g.memoizedProps&&Rn===g.memoizedState||(v.flags|=1024),D=!1)}return re=D,ac(g,v),D=(v.flags&128)!==0,re||D?(re=v.stateNode,E=D&&typeof E.getDerivedStateFromError!="function"?null:re.render(),v.flags|=1,g!==null&&D?(v.child=aa(v,g.child,null,$),v.child=aa(v,null,E,$)):Ks(g,v,E,$),v.memoizedState=re.state,g=v.child):g=Ke(g,v,$),g}function ws(g,v,E,D){return Ce(),v.flags|=256,Ks(g,v,E,D),v.child}function Hp(g){return{baseLanes:g,cachePool:ft()}}function Nh(g,v,E){return g=g!==null?g.childLanes&~E:0,v&&(g|=Ha),g}function Cd(g,v,E){var D=v.pendingProps,$=!1,re=(v.flags&128)!==0,Ie;if((Ie=re)||(Ie=g!==null&&g.memoizedState===null?!1:(Us.current&2)!==0),Ie&&($=!0,v.flags&=-129),Ie=(v.flags&32)!==0,v.flags&=-33,g===null){if(qr){if($?xt(v):qt(),(g=fs)?(g=P3(g,Fa),g!==null&&(v.memoizedState={dehydrated:g,treeContext:xc!==null?{id:sa,overflow:Yc}:null,retryLane:536870912,hydrationErrors:null},E=ub(g),E.return=v,v.child=E,ko=v,fs=null)):g=null,g===null)throw Q(v);return hv(g)?v.lanes=32:v.lanes=536870912,null}var ct=D.children;return D=D.fallback,$?(qt(),$=v.mode,ct=Au({mode:"hidden",children:ct},$),D=fc(D,$,E,null),ct.return=v,D.return=v,ct.sibling=D,v.child=ct,D=v.child,D.memoizedState=Hp(E),D.childLanes=Nh(g,Ie,E),v.memoizedState=qh,Cu(null,D)):(xt(v),Vp(v,ct))}var jt=g.memoizedState;if(jt!==null&&(ct=jt.dehydrated,ct!==null)){if(re)v.flags&256?(xt(v),v.flags&=-257,v=$c(g,v,E)):v.memoizedState!==null?(qt(),v.child=g.child,v.flags|=128,v=null):(qt(),ct=D.fallback,$=v.mode,D=Au({mode:"visible",children:D.children},$),ct=fc(ct,$,E,null),ct.flags|=2,D.return=v,ct.return=v,D.sibling=ct,v.child=D,aa(v,g.child,null,E),D=v.child,D.memoizedState=Hp(E),D.childLanes=Nh(g,Ie,E),v.memoizedState=qh,v=Cu(null,D));else if(xt(v),hv(ct))Ie=pv(ct).digest,D=Error(i(419)),D.stack="",D.digest=Ie,Me({value:D,source:null,stack:null}),v=$c(g,v,E);else if(es||He(g,v,E,!1),Ie=(E&g.childLanes)!==0,es||Ie){if(Ie=Ir,Ie!==null&&(D=B(Ie,E),D!==0&&D!==jt.retryLane))throw jt.retryLane=D,Ft(g,D),Ts(Ie,g,D),Ba;Tf(ct)||Xp(),v=$c(g,v,E)}else Tf(ct)?(v.flags|=192,v.child=g.child,v=null):(g=jt.treeContext,ds&&(fs=k3(ct),ko=v,qr=!0,Bu=null,Fa=!1,g!==null&&le(v,g)),v=Vp(v,D.children),v.flags|=4096);return v}return $?(qt(),ct=D.fallback,$=v.mode,jt=g.child,re=jt.sibling,D=Rl(jt,{mode:"hidden",children:D.children}),D.subtreeFlags=jt.subtreeFlags&65011712,re!==null?ct=Rl(re,ct):(ct=fc(ct,$,E,null),ct.flags|=2),ct.return=v,D.return=v,D.sibling=ct,v.child=D,Cu(null,D),D=v.child,ct=g.child.memoizedState,ct===null?ct=Hp(E):($=ct.cachePool,$!==null?(jt=Qs?hs._currentValue:hs._currentValue2,$=$.parent!==jt?{parent:jt,pool:jt}:$):$=ft(),ct={baseLanes:ct.baseLanes|E,cachePool:$}),D.memoizedState=ct,D.childLanes=Nh(g,Ie,E),v.memoizedState=qh,Cu(g.child,D)):(xt(v),E=g.child,g=E.sibling,E=Rl(E,{mode:"visible",children:D.children}),E.return=v,E.sibling=null,g!==null&&(Ie=v.deletions,Ie===null?(v.deletions=[g],v.flags|=16):Ie.push(g)),v.child=E,v.memoizedState=null,E)}function Vp(g,v){return v=Au({mode:"visible",children:v},g.mode),v.return=g,g.child=v}function Au(g,v){return g=n(22,g,null,v),g.lanes=0,g}function $c(g,v,E){return aa(v,g.child,null,E),g=Vp(v,v.pendingProps.children),g.flags|=2,v.memoizedState=null,g}function xe(g,v,E){g.lanes|=v;var D=g.alternate;D!==null&&(D.lanes|=v),oe(g.return,v,E)}function De(g,v,E,D,$,re){var Ie=g.memoizedState;Ie===null?g.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:D,tail:E,tailMode:$,treeForkCount:re}:(Ie.isBackwards=v,Ie.rendering=null,Ie.renderingStartTime=0,Ie.last=D,Ie.tail=E,Ie.tailMode=$,Ie.treeForkCount=re)}function $e(g,v,E){var D=v.pendingProps,$=D.revealOrder,re=D.tail;D=D.children;var Ie=Us.current,ct=(Ie&2)!==0;if(ct?(Ie=Ie&1|2,v.flags|=128):Ie&=1,b(Us,Ie),Ks(g,v,D,E),D=qr?mg:0,!ct&&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($){case"forwards":for(E=v.child,$=null;E!==null;)g=E.alternate,g!==null&&Qt(g)===null&&($=E),E=E.sibling;E=$,E===null?($=v.child,v.child=null):($=E.sibling,E.sibling=null),De(v,!1,$,E,re,D);break;case"backwards":case"unstable_legacy-backwards":for(E=null,$=v.child,v.child=null;$!==null;){if(g=$.alternate,g!==null&&Qt(g)===null){v.child=$;break}g=$.sibling,$.sibling=E,E=$,$=g}De(v,!0,E,null,re,D);break;case"together":De(v,!1,null,null,void 0,D);break;default:v.memoizedState=null}return v.child}function Ke(g,v,E){if(g!==null&&(v.dependencies=g.dependencies),Ud|=v.lanes,(E&v.childLanes)===0)if(g!==null){if(He(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=Rl(g,g.pendingProps),v.child=E,E.return=v;g.sibling!==null;)g=g.sibling,E=E.sibling=Rl(g,g.pendingProps),E.return=v;E.sibling=null}return v.child}function ht(g,v){return(g.lanes&v)!==0?!0:(g=g.dependencies,!!(g!==null&&ze(g)))}function Tt(g,v,E){switch(v.tag){case 3:ce(v,v.stateNode.containerInfo),Te(v,hs,g.memoizedState.cache),Ce();break;case 27:case 5:ie(v);break;case 4:ce(v,v.stateNode.containerInfo);break;case 10:Te(v,v.type,v.memoizedProps.value);break;case 31:if(v.memoizedState!==null)return v.flags|=128,vt(v),null;break;case 13:var D=v.memoizedState;if(D!==null)return D.dehydrated!==null?(xt(v),v.flags|=128,null):(E&v.child.childLanes)!==0?Cd(g,v,E):(xt(v),g=Ke(g,v,E),g!==null?g.sibling:null);xt(v);break;case 19:var $=(g.flags&128)!==0;if(D=(E&v.childLanes)!==0,D||(He(g,v,E,!1),D=(E&v.childLanes)!==0),$){if(D)return $e(g,v,E);v.flags|=128}if($=v.memoizedState,$!==null&&($.rendering=null,$.tail=null,$.lastEffect=null),b(Us,Us.current),D)break;return null;case 22:return v.lanes=0,Y0(g,v,E,v.pendingProps);case 24:Te(v,hs,g.memoizedState.cache)}return Ke(g,v,E)}function Xt(g,v,E){if(g!==null)if(g.memoizedProps!==v.pendingProps)es=!0;else{if(!ht(g,E)&&(v.flags&128)===0)return es=!1,Tt(g,v,E);es=(g.flags&131072)!==0}else es=!1,qr&&(v.flags&1048576)!==0&&z(v,mg,v.index);switch(v.lanes=0,v.tag){case 16:e:{var D=v.pendingProps;if(g=Re(v.elementType),v.type=g,typeof g=="function")kh(g)?(D=Sd(g,D),v.tag=1,v=Eu(null,v,g,D,E)):(v.tag=0,v=Td(null,v,g,D,E));else{if(g!=null){var $=g.$$typeof;if($===Qp){v.tag=11,v=$0(null,v,g,D,E);break e}else if($===av){v.tag=14,v=q0(null,v,g,D,E);break e}}throw v=p(g)||g,Error(i(306,v,""))}}return v;case 0:return Td(g,v,v.type,v.pendingProps,E);case 1:return D=v.type,$=Sd(D,v.pendingProps),Eu(g,v,D,$,E);case 3:e:{if(ce(v,v.stateNode.containerInfo),g===null)throw Error(i(387));var re=v.pendingProps;$=v.memoizedState,D=$.element,Rt(g,v),gt(v,re,null,E);var Ie=v.memoizedState;if(re=Ie.cache,Te(v,hs,re),re!==$.cache&&Ve(v,[hs],E,!0),Oe(),re=Ie.element,ds&&$.isDehydrated)if($={element:re,isDehydrated:!1,cache:Ie.cache},v.updateQueue.baseState=$,v.memoizedState=$,v.flags&256){v=ws(g,v,re,E);break e}else if(re!==D){D=ne(Error(i(424)),v),Me(D),v=ws(g,v,re,E);break e}else for(ds&&(fs=A3(v.stateNode.containerInfo),ko=v,qr=!0,Bu=null,Fa=!0),E=Kb(v,null,re,E),v.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(Ce(),re===D){v=Ke(g,v,E);break e}Ks(g,v,re,E)}v=v.child}return v;case 26:if(mc)return ac(g,v),g===null?(E=Fb(v.type,null,v.pendingProps,null))?v.memoizedState=E:qr||(v.stateNode=vv(v.type,v.pendingProps,oa.current,v)):v.memoizedState=Fb(v.type,g.memoizedProps,v.pendingProps,g.memoizedState),null;case 27:if(No)return ie(v),g===null&&No&&qr&&(D=v.stateNode=yv(v.type,v.pendingProps,oa.current,Go.current,!1),ko=v,Fa=!0,fs=Pb(v.type,D,fs)),Ks(g,v,v.pendingProps.children,E),ac(g,v),g===null&&(v.flags|=4194304),v.child;case 5:return g===null&&qr&&(H3(v.type,v.pendingProps,Go.current),($=D=fs)&&(D=R3(D,v.type,v.pendingProps,Fa),D!==null?(v.stateNode=D,ko=v,fs=E3(D),Fa=!1,$=!0):$=!1),$||Q(v)),ie(v),$=v.type,re=v.pendingProps,Ie=g!==null?g.memoizedProps:null,D=re.children,za($,re)?D=null:Ie!==null&&za($,Ie)&&(v.flags|=32),v.memoizedState!==null&&($=Sn(g,v,Gn,null,null,E),Qs?Fh._currentValue=$:Fh._currentValue2=$),ac(g,v),Ks(g,v,D,E),v.child;case 6:return g===null&&qr&&(zb(v.pendingProps,Go.current),(g=E=fs)&&(E=D3(E,v.pendingProps,Fa),E!==null?(v.stateNode=E,ko=v,fs=null,g=!0):g=!1),g||Q(v)),null;case 13:return Cd(g,v,E);case 4:return ce(v,v.stateNode.containerInfo),D=v.pendingProps,g===null?v.child=aa(v,null,D,E):Ks(g,v,D,E),v.child;case 11:return $0(g,v,v.type,v.pendingProps,E);case 7:return Ks(g,v,v.pendingProps,E),v.child;case 8:return Ks(g,v,v.pendingProps.children,E),v.child;case 12:return Ks(g,v,v.pendingProps.children,E),v.child;case 10:return D=v.pendingProps,Te(v,v.type,D.value),Ks(g,v,D.children,E),v.child;case 9:return $=v.type._context,D=v.pendingProps.children,Ge(v),$=ae($),D=D($),v.flags|=1,Ks(g,v,D,E),v.child;case 14:return q0(g,v,v.type,v.pendingProps,E);case 15:return X0(g,v,v.type,v.pendingProps,E);case 19:return $e(g,v,E);case 31:return K0(g,v,E);case 22:return Y0(g,v,E,v.pendingProps);case 24:return Ge(v),D=ae(hs),g===null?($=it(),$===null&&($=Ir,re=we(),$.pooledCache=re,re.refCount++,re!==null&&($.pooledCacheLanes|=E),$=re),v.memoizedState={parent:D,cache:$},dn(v),Te(v,hs,$)):((g.lanes&E)!==0&&(Rt(g,v),gt(v,null,null,E),Oe()),$=g.memoizedState,re=v.memoizedState,$.parent!==D?($={parent:D,cache:D},v.memoizedState=$,v.lanes===0&&(v.memoizedState=v.updateQueue.baseState=$),Te(v,hs,D)):(D=re.cache,Te(v,hs,D),D!==$.cache&&Ve(v,[hs],E,!0))),Ks(g,v,v.pendingProps.children,E),v.child;case 29:throw v.pendingProps}throw Error(i(156,v.tag))}function Jt(g){g.flags|=4}function cn(g){Dl&&(g.flags|=8)}function Cn(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 An(g,v,E,D){if(Qr)for(E=v.child;E!==null;){if(E.tag===5||E.tag===6)ag(g,E.stateNode);else if(!(E.tag===4||No&&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(Dl)for(var $=v.child;$!==null;){if($.tag===5){var re=$.stateNode;E&&D&&(re=w3(re,$.type,$.memoizedProps)),ag(g,re)}else if($.tag===6)re=$.stateNode,E&&D&&(re=Rb(re,$.memoizedProps)),ag(g,re);else if($.tag!==4){if($.tag===22&&$.memoizedState!==null)re=$.child,re!==null&&(re.return=$),An(g,$,!0,!0);else if($.child!==null){$.child.return=$,$=$.child;continue}}if($===v)break;for(;$.sibling===null;){if($.return===null||$.return===v)return;$=$.return}$.sibling.return=$.return,$=$.sibling}}function Pn(g,v,E,D){var $=!1;if(Dl)for(var re=v.child;re!==null;){if(re.tag===5){var Ie=re.stateNode;E&&D&&(Ie=w3(Ie,re.type,re.memoizedProps)),Nb(g,Ie)}else if(re.tag===6)Ie=re.stateNode,E&&D&&(Ie=Rb(Ie,re.memoizedProps)),Nb(g,Ie);else if(re.tag!==4){if(re.tag===22&&re.memoizedState!==null)$=re.child,$!==null&&($.return=re),Pn(g,re,!0,!0),$=!0;else if(re.child!==null){re.child.return=re,re=re.child;continue}}if(re===v)break;for(;re.sibling===null;){if(re.return===null||re.return===v)return $;re=re.return}re.sibling.return=re.return,re=re.sibling}return $}function ar(g,v){if(Dl&&Cn(g,v)){g=v.stateNode;var E=g.containerInfo,D=Ab();Pn(D,v,!1,!1),g.pendingChildren=D,Jt(v),S3(E,D)}}function Jr(g,v,E,D){if(Qr)g.memoizedProps!==D&&Jt(v);else if(Dl){var $=g.stateNode,re=g.memoizedProps;if((g=Cn(g,v))||re!==D){var Ie=Go.current;re=_3($,E,re,D,!g,null),re===$?v.stateNode=$:(cn(v),il(re,E,D,Ie)&&Jt(v),v.stateNode=re,g&&An(re,v,!1,!1))}else v.stateNode=$}}function lr(g,v,E,D,$){if((g.mode&32)!==0&&(E===null?lg(v,D):rm(v,E,D))){if(g.flags|=16777216,($&335544128)===$||xb(v,D))if(Cs(g.stateNode,v,D))g.flags|=8192;else if(Zr())g.flags|=8192;else throw Ua=Hu,kv}else g.flags&=-16777217}function xr(g,v){if(Vb(v)){if(g.flags|=16777216,!Gb(v))if(Zr())g.flags|=8192;else throw Ua=Hu,kv}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,fm|=v)}function Ln(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 D=null;E!==null;)E.alternate!==null&&(D=E),E=E.sibling;D===null?v||g.tail===null?g.tail=null:g.tail.sibling=null:D.sibling=null}}function Qn(g){var v=g.alternate!==null&&g.alternate.child===g.child,E=0,D=0;if(v)for(var $=g.child;$!==null;)E|=$.lanes|$.childLanes,D|=$.subtreeFlags&65011712,D|=$.flags&65011712,$.return=g,$=$.sibling;else for($=g.child;$!==null;)E|=$.lanes|$.childLanes,D|=$.subtreeFlags,D|=$.flags,$.return=g,$=$.sibling;return g.subtreeFlags|=D,g.childLanes=E,v}function Ji(g,v,E){var D=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 Qn(v),null;case 1:return Qn(v),null;case 3:return E=v.stateNode,D=null,g!==null&&(D=g.memoizedState.cache),v.memoizedState.cache!==D&&(v.flags|=2048),Pe(hs),X(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(g===null||g.child===null)&&(se(v)?Jt(v):g===null||g.memoizedState.isDehydrated&&(v.flags&256)===0||(v.flags|=1024,de())),ar(g,v),Qn(v),null;case 26:if(mc){var $=v.type,re=v.memoizedState;return g===null?(Jt(v),re!==null?(Qn(v),xr(v,re)):(Qn(v),lr(v,$,null,D,E))):re?re!==g.memoizedState?(Jt(v),Qn(v),xr(v,re)):(Qn(v),v.flags&=-16777217):(re=g.memoizedProps,Qr?re!==D&&Jt(v):Jr(g,v,$,D),Qn(v),lr(v,$,re,D,E)),null}case 27:if(No){if(fe(v),E=oa.current,$=v.type,g!==null&&v.stateNode!=null)Qr?g.memoizedProps!==D&&Jt(v):Jr(g,v,$,D);else{if(!D){if(v.stateNode===null)throw Error(i(166));return Qn(v),null}g=Go.current,se(v)?ue(v,g):(g=yv($,D,E,g,!0),v.stateNode=g,Jt(v))}return Qn(v),null}case 5:if(fe(v),$=v.type,g!==null&&v.stateNode!=null)Jr(g,v,$,D);else{if(!D){if(v.stateNode===null)throw Error(i(166));return Qn(v),null}if(re=Go.current,se(v))ue(v,re),F3(v.stateNode,$,D,re)&&(v.flags|=64);else{var Ie=mb($,D,oa.current,re,v);cn(v),An(Ie,v,!1,!1),v.stateNode=Ie,il(Ie,$,D,re)&&Jt(v)}}return Qn(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!==D&&Jt(v):Dl&&(E!==D?(g=oa.current,E=Go.current,cn(v),v.stateNode=Id(D,g,E,v)):v.stateNode=g.stateNode);else{if(typeof D!="string"&&v.stateNode===null)throw Error(i(166));if(g=oa.current,E=Go.current,se(v)){if(!ds)throw Error(i(176));if(g=v.stateNode,E=v.memoizedProps,D=null,$=ko,$!==null)switch($.tag){case 27:case 5:D=$.memoizedProps}CE(g,E,v,D)||Q(v,!0)}else cn(v),v.stateNode=Id(D,g,E,v)}return Qn(v),null;case 31:if(E=v.memoizedState,g===null||g.memoizedState!==null){if(D=se(v),E!==null){if(g===null){if(!D)throw Error(i(318));if(!ds)throw Error(i(556));if(g=v.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(557));Ob(g,v)}else Ce(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;Qn(v),g=!1}else E=de(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=E),g=!0;if(!g)return v.flags&256?(en(v),v):(en(v),null);if((v.flags&128)!==0)throw Error(i(558))}return Qn(v),null;case 13:if(D=v.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if($=se(v),D!==null&&D.dehydrated!==null){if(g===null){if(!$)throw Error(i(318));if(!ds)throw Error(i(344));if($=v.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(i(317));O3($,v)}else Ce(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;Qn(v),$=!1}else $=de(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=$),$=!0;if(!$)return v.flags&256?(en(v),v):(en(v),null)}return en(v),(v.flags&128)!==0?(v.lanes=E,v):(E=D!==null,g=g!==null&&g.memoizedState!==null,E&&(D=v.child,$=null,D.alternate!==null&&D.alternate.memoizedState!==null&&D.alternate.memoizedState.cachePool!==null&&($=D.alternate.memoizedState.cachePool.pool),re=null,D.memoizedState!==null&&D.memoizedState.cachePool!==null&&(re=D.memoizedState.cachePool.pool),re!==$&&(D.flags|=2048)),E!==g&&E&&(v.child.flags|=8192),$n(v,v.updateQueue),Qn(v),null);case 4:return X(),ar(g,v),g===null&&Fi(v.stateNode.containerInfo),Qn(v),null;case 10:return Pe(v.type),Qn(v),null;case 19:if(x(Us),D=v.memoizedState,D===null)return Qn(v),null;if($=(v.flags&128)!==0,re=D.rendering,re===null)if($)Ln(D,!1);else{if(Ns!==0||g!==null&&(g.flags&128)!==0)for(g=v.child;g!==null;){if(re=Qt(g),re!==null){for(v.flags|=128,Ln(D,!1),g=re.updateQueue,v.updateQueue=g,$n(v,g),v.subtreeFlags=0,g=E,E=v.child;E!==null;)nv(E,g),E=E.sibling;return b(Us,Us.current&1|2),qr&&U(v,D.treeForkCount),v.child}g=g.sibling}D.tail!==null&&_a()>Lf&&(v.flags|=128,$=!0,Ln(D,!1),v.lanes=4194304)}else{if(!$)if(g=Qt(re),g!==null){if(v.flags|=128,$=!0,g=g.updateQueue,v.updateQueue=g,$n(v,g),Ln(D,!0),D.tail===null&&D.tailMode==="hidden"&&!re.alternate&&!qr)return Qn(v),null}else 2*_a()-D.renderingStartTime>Lf&&E!==536870912&&(v.flags|=128,$=!0,Ln(D,!1),v.lanes=4194304);D.isBackwards?(re.sibling=v.child,v.child=re):(g=D.last,g!==null?g.sibling=re:v.child=re,D.last=re)}return D.tail!==null?(g=D.tail,D.rendering=g,D.tail=g.sibling,D.renderingStartTime=_a(),g.sibling=null,E=Us.current,b(Us,$?E&1|2:E&1),qr&&U(v,D.treeForkCount),g):(Qn(v),null);case 22:case 23:return en(v),et(),D=v.memoizedState!==null,g!==null?g.memoizedState!==null!==D&&(v.flags|=8192):D&&(v.flags|=8192),D?(E&536870912)!==0&&(v.flags&128)===0&&(Qn(v),v.subtreeFlags&6&&(v.flags|=8192)):Qn(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),D=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(D=v.memoizedState.cachePool.pool),D!==E&&(v.flags|=2048),g!==null&&x(Af),null;case 24:return E=null,g!==null&&(E=g.memoizedState.cache),v.memoizedState.cache!==E&&(v.flags|=2048),Pe(hs),Qn(v),null;case 25:return null;case 30:return null}throw Error(i(156,v.tag))}function js(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(hs),X(),g=v.flags,(g&65536)!==0&&(g&128)===0?(v.flags=g&-65537|128,v):null;case 26:case 27:case 5:return fe(v),null;case 31:if(v.memoizedState!==null){if(en(v),v.alternate===null)throw Error(i(340));Ce()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 13:if(en(v),g=v.memoizedState,g!==null&&g.dehydrated!==null){if(v.alternate===null)throw Error(i(340));Ce()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 19:return x(Us),null;case 4:return X(),null;case 10:return Pe(v.type),null;case 22:case 23:return en(v),et(),g!==null&&x(Af),g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 24:return Pe(hs),null;case 25:return null;default:return null}}function xi(g,v){switch(j(v),v.tag){case 3:Pe(hs),X();break;case 26:case 27:case 5:fe(v);break;case 4:X();break;case 31:v.memoizedState!==null&&en(v);break;case 13:en(v);break;case 19:x(Us);break;case 10:Pe(v.type);break;case 22:case 23:en(v),et(),g!==null&&x(Af);break;case 24:Pe(hs)}}function ci(g,v){try{var E=v.updateQueue,D=E!==null?E.lastEffect:null;if(D!==null){var $=D.next;E=$;do{if((E.tag&g)===g){D=void 0;var re=E.create,Ie=E.inst;D=re(),Ie.destroy=D}E=E.next}while(E!==$)}}catch(ct){cr(v,v.return,ct)}}function cs(g,v,E){try{var D=v.updateQueue,$=D!==null?D.lastEffect:null;if($!==null){var re=$.next;D=re;do{if((D.tag&g)===g){var Ie=D.inst,ct=Ie.destroy;if(ct!==void 0){Ie.destroy=void 0,$=v;var jt=E,tn=ct;try{tn()}catch(yn){cr($,jt,yn)}}}D=D.next}while(D!==re)}}catch(yn){cr(v,v.return,yn)}}function zs(g){var v=g.updateQueue;if(v!==null){var E=g.stateNode;try{Vt(v,E)}catch(D){cr(g,g.return,D)}}}function ia(g,v,E){E.props=Sd(g.type,g.memoizedProps),E.state=g.memoizedState;try{E.componentWillUnmount()}catch(D){cr(g,v,D)}}function zo(g,v){try{var E=g.ref;if(E!==null){switch(g.tag){case 26:case 27:case 5:var D=em(g.stateNode);break;case 30:D=g.stateNode;break;default:D=g.stateNode}typeof E=="function"?g.refCleanup=E(D):E.current=D}}catch($){cr(g,v,$)}}function Wi(g,v){var E=g.ref,D=g.refCleanup;if(E!==null)if(typeof D=="function")try{D()}catch($){cr(g,v,$)}finally{g.refCleanup=null,g=g.alternate,g!=null&&(g.refCleanup=null)}else if(typeof E=="function")try{E(null)}catch($){cr(g,v,$)}else E.current=null}function Zs(g){var v=g.type,E=g.memoizedProps,D=g.stateNode;try{h3(D,v,E,g)}catch($){cr(g,g.return,$)}}function Fo(g,v,E){try{p3(g.stateNode,g.type,E,v,g)}catch(D){cr(g,g.return,D)}}function Oa(g){return g.tag===5||g.tag===3||(mc?g.tag===26:!1)||(No?g.tag===27&&Uh(g.type):!1)||g.tag===4}function po(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||Oa(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(No&&g.tag===27&&Uh(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 mo(g,v,E){var D=g.tag;if(D===5||D===6)g=g.stateNode,v?g3(E,g,v):Mb(E,g);else if(D!==4&&(No&&D===27&&Uh(g.type)&&(E=g.stateNode,v=null),g=g.child,g!==null))for(mo(g,v,E),g=g.sibling;g!==null;)mo(g,v,E),g=g.sibling}function Eo(g,v,E){var D=g.tag;if(D===5||D===6)g=g.stateNode,v?m3(E,g,v):wb(E,g);else if(D!==4&&(No&&D===27&&Uh(g.type)&&(E=g.stateNode),g=g.child,g!==null))for(Eo(g,v,E),g=g.sibling;g!==null;)Eo(g,v,E),g=g.sibling}function qc(g,v,E){g=g.containerInfo;try{kb(g,E)}catch(D){cr(v,v.return,D)}}function Uo(g){var v=g.stateNode,E=g.memoizedProps;try{xo(g.type,E,v,g)}catch(D){cr(g,g.return,D)}}function $x(g,v){for(lv(g.containerInfo),to=v;to!==null;)if(g=to,v=g.child,(g.subtreeFlags&1028)!==0&&v!==null)v.return=g,to=v;else for(;to!==null;){g=to;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 D=0;D<v.length;D++){var $=v[D];$.ref.impl=$.nextImpl}break;case 11:case 15:break;case 1:if((v&1024)!==0&&E!==null){v=void 0,D=g,$=E.memoizedProps,E=E.memoizedState;var re=D.stateNode;try{var Ie=Sd(D.type,$);v=re.getSnapshotBeforeUpdate(Ie,E),re.__reactInternalSnapshotBeforeUpdate=v}catch(ct){cr(D,D.return,ct)}}break;case 3:(v&1024)!==0&&Qr&&Eb(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,to=v;break}to=g.return}}function t3(g,v,E){var D=E.flags;switch(E.tag){case 0:case 11:case 15:La(g,E),D&4&&ci(5,E);break;case 1:if(La(g,E),D&4)if(g=E.stateNode,v===null)try{g.componentDidMount()}catch(Ie){cr(E,E.return,Ie)}else{var $=Sd(E.type,v.memoizedProps);v=v.memoizedState;try{g.componentDidUpdate($,v,g.__reactInternalSnapshotBeforeUpdate)}catch(Ie){cr(E,E.return,Ie)}}D&64&&zs(E),D&512&&zo(E,E.return);break;case 3:if(La(g,E),D&64&&(D=E.updateQueue,D!==null)){if(g=null,E.child!==null)switch(E.child.tag){case 27:case 5:g=em(E.child.stateNode);break;case 1:g=E.child.stateNode}try{Vt(D,g)}catch(Ie){cr(E,E.return,Ie)}}break;case 27:No&&v===null&&D&4&&Uo(E);case 26:case 5:if(La(g,E),v===null){if(D&4)Zs(E);else if(D&64){g=E.type,v=E.memoizedProps,$=E.stateNode;try{j3($,g,v,E)}catch(Ie){cr(E,E.return,Ie)}}}D&512&&zo(E,E.return);break;case 12:La(g,E);break;case 31:La(g,E),D&4&&cc(g,E);break;case 13:La(g,E),D&4&&Q0(g,E),D&64&&(D=E.memoizedState,D!==null&&(D=D.dehydrated,D!==null&&(E=wE.bind(null,E),mv(D,E))));break;case 22:if(D=E.memoizedState!==null||Bs,!D){v=v!==null&&v.memoizedState!==null||Hs,$=Bs;var re=Hs;Bs=D,(Hs=v)&&!re?dc(g,E,(E.subtreeFlags&8772)!==0):La(g,E),Bs=$,Hs=re}break;case 30:break;default:La(g,E)}}function ob(g){var v=g.alternate;v!==null&&(g.alternate=null,ob(v)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(v=g.stateNode,v!==null&&cv(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 lc(g,v,E){for(E=E.child;E!==null;)Z0(g,v,E),E=E.sibling}function Z0(g,v,E){if(al&&typeof al.onCommitFiberUnmount=="function")try{al.onCommitFiberUnmount(Vh,E)}catch{}switch(E.tag){case 26:if(mc){Hs||Wi(E,v),lc(g,v,E),E.memoizedState?Cf(E.memoizedState):E.stateNode&&Hb(E.stateNode);break}case 27:if(No){Hs||Wi(E,v);var D=As,$=no;Uh(E.type)&&(As=E.stateNode,no=!1),lc(g,v,E),Vo(E.stateNode),As=D,no=$;break}case 5:Hs||Wi(E,v);case 6:if(Qr){if(D=As,$=no,As=null,lc(g,v,E),As=D,no=$,As!==null)if(no)try{Tb(As,E.stateNode)}catch(re){cr(E,v,re)}else try{x3(As,E.stateNode)}catch(re){cr(E,v,re)}}else lc(g,v,E);break;case 18:Qr&&As!==null&&(no?gv(As,E.stateNode):jb(As,E.stateNode));break;case 4:Qr?(D=As,$=no,As=E.stateNode.containerInfo,no=!0,lc(g,v,E),As=D,no=$):(Dl&&qc(E.stateNode,E,Ab()),lc(g,v,E));break;case 0:case 11:case 14:case 15:cs(2,E,v),Hs||cs(4,E,v),lc(g,v,E);break;case 1:Hs||(Wi(E,v),D=E.stateNode,typeof D.componentWillUnmount=="function"&&ia(E,v,D)),lc(g,v,E);break;case 21:lc(g,v,E);break;case 22:Hs=(D=Hs)||E.memoizedState!==null,lc(g,v,E),Hs=D;break;default:lc(g,v,E)}}function cc(g,v){if(ds&&v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null))){g=g.dehydrated;try{EE(g)}catch(E){cr(v,v.return,E)}}}function Q0(g,v){if(ds&&v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null&&(g=g.dehydrated,g!==null))))try{AE(g)}catch(E){cr(v,v.return,E)}}function uc(g){switch(g.tag){case 31:case 13:case 19:var v=g.stateNode;return v===null&&(v=g.stateNode=new Qb),v;case 22:return g=g.stateNode,v=g._retryCache,v===null&&(v=g._retryCache=new Qb),v;default:throw Error(i(435,g.tag))}}function Ed(g,v){var E=uc(g);v.forEach(function(D){if(!E.has(D)){E.add(D);var $=ME.bind(null,g,D);D.then($,$)}})}function Bo(g,v){var E=v.deletions;if(E!==null)for(var D=0;D<E.length;D++){var $=E[D],re=g,Ie=v;if(Qr){var ct=Ie;e:for(;ct!==null;){switch(ct.tag){case 27:if(No){if(Uh(ct.type)){As=ct.stateNode,no=!1;break e}break}case 5:As=ct.stateNode,no=!1;break e;case 3:case 4:As=ct.stateNode.containerInfo,no=!0;break e}ct=ct.return}if(As===null)throw Error(i(160));Z0(re,Ie,$),As=null,no=!1}else Z0(re,Ie,$);re=$.alternate,re!==null&&(re.return=null),$.return=null}if(v.subtreeFlags&13886)for(v=v.child;v!==null;)J0(v,g),v=v.sibling}function J0(g,v){var E=g.alternate,D=g.flags;switch(g.tag){case 0:case 11:case 14:case 15:Bo(v,g),Ho(g),D&4&&(cs(3,g,g.return),ci(3,g),cs(5,g,g.return));break;case 1:Bo(v,g),Ho(g),D&512&&(Hs||E===null||Wi(E,E.return)),D&64&&Bs&&(g=g.updateQueue,g!==null&&(D=g.callbacks,D!==null&&(E=g.shared.hiddenCallbacks,g.shared.hiddenCallbacks=E===null?D:E.concat(D))));break;case 26:if(mc){var $=Ni;if(Bo(v,g),Ho(g),D&512&&(Hs||E===null||Wi(E,E.return)),D&4){D=E!==null?E.memoizedState:null;var re=g.memoizedState;E===null?re===null?g.stateNode===null?g.stateNode=V3($,g.type,g.memoizedProps,g):Bb($,g.type,g.stateNode):g.stateNode=Ub($,re,g.memoizedProps):D!==re?(D===null?E.stateNode!==null&&Hb(E.stateNode):Cf(D),re===null?Bb($,g.type,g.stateNode):Ub($,re,g.memoizedProps)):re===null&&g.stateNode!==null&&Fo(g,g.memoizedProps,E.memoizedProps)}break}case 27:if(No){Bo(v,g),Ho(g),D&512&&(Hs||E===null||Wi(E,E.return)),E!==null&&D&4&&Fo(g,g.memoizedProps,E.memoizedProps);break}case 5:if(Bo(v,g),Ho(g),D&512&&(Hs||E===null||Wi(E,E.return)),Qr){if(g.flags&32){$=g.stateNode;try{Cb($)}catch(on){cr(g,g.return,on)}}D&4&&g.stateNode!=null&&($=g.memoizedProps,Fo(g,$,E!==null?E.memoizedProps:$)),D&1024&&(am=!0)}else Dl&&g.alternate!==null&&(g.alternate.stateNode=g.stateNode);break;case 6:if(Bo(v,g),Ho(g),D&4&&Qr){if(g.stateNode===null)throw Error(i(162));D=g.memoizedProps,E=E!==null?E.memoizedProps:D,$=g.stateNode;try{f3($,E,D)}catch(on){cr(g,g.return,on)}}break;case 3:if(mc?(G3(),$=Ni,Ni=dg(v.containerInfo),Bo(v,g),Ni=$):Bo(v,g),Ho(g),D&4){if(Qr&&ds&&E!==null&&E.memoizedState.isDehydrated)try{z3(v.containerInfo)}catch(on){cr(g,g.return,on)}if(Dl){D=v.containerInfo,E=v.pendingChildren;try{kb(D,E)}catch(on){cr(g,g.return,on)}}}am&&(am=!1,qx(g));break;case 4:mc?(E=Ni,Ni=dg(g.stateNode.containerInfo),Bo(v,g),Ho(g),Ni=E):(Bo(v,g),Ho(g)),D&4&&Dl&&qc(g.stateNode,g,g.stateNode.pendingChildren);break;case 12:Bo(v,g),Ho(g);break;case 31:Bo(v,g),Ho(g),D&4&&(D=g.updateQueue,D!==null&&(g.updateQueue=null,Ed(g,D)));break;case 13:Bo(v,g),Ho(g),g.child.flags&8192&&g.memoizedState!==null!=(E!==null&&E.memoizedState!==null)&&(_g=_a()),D&4&&(D=g.updateQueue,D!==null&&(g.updateQueue=null,Ed(g,D)));break;case 22:$=g.memoizedState!==null;var Ie=E!==null&&E.memoizedState!==null,ct=Bs,jt=Hs;if(Bs=ct||$,Hs=jt||Ie,Bo(v,g),Hs=jt,Bs=ct,Ho(g),D&8192&&(v=g.stateNode,v._visibility=$?v._visibility&-2:v._visibility|1,$&&(E===null||Ie||Bs||Hs||hf(g)),Qr)){e:if(E=null,Qr)for(v=g;;){if(v.tag===5||mc&&v.tag===26){if(E===null){Ie=E=v;try{re=Ie.stateNode,$?TE(re):y3(Ie.stateNode,Ie.memoizedProps)}catch(on){cr(Ie,Ie.return,on)}}}else if(v.tag===6){if(E===null){Ie=v;try{var tn=Ie.stateNode;$?v3(tn):b3(tn,Ie.memoizedProps)}catch(on){cr(Ie,Ie.return,on)}}}else if(v.tag===18){if(E===null){Ie=v;try{var yn=Ie.stateNode;$?U3(yn):B3(Ie.stateNode)}catch(on){cr(Ie,Ie.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}}D&4&&(D=g.updateQueue,D!==null&&(E=D.retryQueue,E!==null&&(D.retryQueue=null,Ed(g,E))));break;case 19:Bo(v,g),Ho(g),D&4&&(D=g.updateQueue,D!==null&&(g.updateQueue=null,Ed(g,D)));break;case 30:break;case 21:break;default:Bo(v,g),Ho(g)}}function Ho(g){var v=g.flags;if(v&2){try{for(var E,D=g.return;D!==null;){if(Oa(D)){E=D;break}D=D.return}if(Qr){if(E==null)throw Error(i(160));switch(E.tag){case 27:if(No){var $=E.stateNode,re=po(g);Eo(g,re,$);break}case 5:var Ie=E.stateNode;E.flags&32&&(Cb(Ie),E.flags&=-33);var ct=po(g);Eo(g,ct,Ie);break;case 3:case 4:var jt=E.stateNode.containerInfo,tn=po(g);mo(g,tn,jt);break;default:throw Error(i(161))}}}catch(yn){cr(g,g.return,yn)}g.flags&=-3}v&4096&&(g.flags&=-4097)}function qx(g){if(g.subtreeFlags&1024)for(g=g.child;g!==null;){var v=g;qx(v),v.tag===5&&v.flags&1024&&yb(v.stateNode),g=g.sibling}}function La(g,v){if(v.subtreeFlags&8772)for(v=v.child;v!==null;)t3(g,v.alternate,v),v=v.sibling}function hf(g){for(g=g.child;g!==null;){var v=g;switch(v.tag){case 0:case 11:case 14:case 15:cs(4,v,v.return),hf(v);break;case 1:Wi(v,v.return);var E=v.stateNode;typeof E.componentWillUnmount=="function"&&ia(v,v.return,E),hf(v);break;case 27:No&&Vo(v.stateNode);case 26:case 5:Wi(v,v.return),hf(v);break;case 22:v.memoizedState===null&&hf(v);break;case 30:hf(v);break;default:hf(v)}g=g.sibling}}function dc(g,v,E){for(E=E&&(v.subtreeFlags&8772)!==0,v=v.child;v!==null;){var D=v.alternate,$=g,re=v,Ie=re.flags;switch(re.tag){case 0:case 11:case 15:dc($,re,E),ci(4,re);break;case 1:if(dc($,re,E),D=re,$=D.stateNode,typeof $.componentDidMount=="function")try{$.componentDidMount()}catch(tn){cr(D,D.return,tn)}if(D=re,$=D.updateQueue,$!==null){var ct=D.stateNode;try{var jt=$.shared.hiddenCallbacks;if(jt!==null)for($.shared.hiddenCallbacks=null,$=0;$<jt.length;$++)_t(jt[$],ct)}catch(tn){cr(D,D.return,tn)}}E&&Ie&64&&zs(re),zo(re,re.return);break;case 27:No&&Uo(re);case 26:case 5:dc($,re,E),E&&D===null&&Ie&4&&Zs(re),zo(re,re.return);break;case 12:dc($,re,E);break;case 31:dc($,re,E),E&&Ie&4&&cc($,re);break;case 13:dc($,re,E),E&&Ie&4&&Q0($,re);break;case 22:re.memoizedState===null&&dc($,re,E),zo(re,re.return);break;case 30:break;default:dc($,re,E)}v=v.sibling}}function pf(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&&_e(E))}function ab(g,v){g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&_e(g))}function Ms(g,v,E,D){if(v.subtreeFlags&10256)for(v=v.child;v!==null;)Xx(g,v,E,D),v=v.sibling}function Xx(g,v,E,D){var $=v.flags;switch(v.tag){case 0:case 11:case 15:Ms(g,v,E,D),$&2048&&ci(9,v);break;case 1:Ms(g,v,E,D);break;case 3:Ms(g,v,E,D),$&2048&&(g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&_e(g)));break;case 12:if($&2048){Ms(g,v,E,D),g=v.stateNode;try{var re=v.memoizedProps,Ie=re.id,ct=re.onPostCommit;typeof ct=="function"&&ct(Ie,v.alternate===null?"mount":"update",g.passiveEffectDuration,-0)}catch(jt){cr(v,v.return,jt)}}else Ms(g,v,E,D);break;case 31:Ms(g,v,E,D);break;case 13:Ms(g,v,E,D);break;case 23:break;case 22:re=v.stateNode,Ie=v.alternate,v.memoizedState!==null?re._visibility&2?Ms(g,v,E,D):Gp(g,v):re._visibility&2?Ms(g,v,E,D):(re._visibility|=2,tl(g,v,E,D,(v.subtreeFlags&10256)!==0||!1)),$&2048&&pf(Ie,v);break;case 24:Ms(g,v,E,D),$&2048&&ab(v.alternate,v);break;default:Ms(g,v,E,D)}}function tl(g,v,E,D,$){for($=$&&((v.subtreeFlags&10256)!==0||!1),v=v.child;v!==null;){var re=g,Ie=v,ct=E,jt=D,tn=Ie.flags;switch(Ie.tag){case 0:case 11:case 15:tl(re,Ie,ct,jt,$),ci(8,Ie);break;case 23:break;case 22:var yn=Ie.stateNode;Ie.memoizedState!==null?yn._visibility&2?tl(re,Ie,ct,jt,$):Gp(re,Ie):(yn._visibility|=2,tl(re,Ie,ct,jt,$)),$&&tn&2048&&pf(Ie.alternate,Ie);break;case 24:tl(re,Ie,ct,jt,$),$&&tn&2048&&ab(Ie.alternate,Ie);break;default:tl(re,Ie,ct,jt,$)}v=v.sibling}}function Gp(g,v){if(v.subtreeFlags&10256)for(v=v.child;v!==null;){var E=g,D=v,$=D.flags;switch(D.tag){case 22:Gp(E,D),$&2048&&pf(D.alternate,D);break;case 24:Gp(E,D),$&2048&&ab(D.alternate,D);break;default:Gp(E,D)}v=v.sibling}}function Nu(g,v,E){if(g.subtreeFlags&Ll)for(g=g.child;g!==null;)mf(g,v,E),g=g.sibling}function mf(g,v,E){switch(g.tag){case 26:if(Nu(g,v,E),g.flags&Ll)if(g.memoizedState!==null)W3(E,Ni,g.memoizedState,g.memoizedProps);else{var D=g.stateNode,$=g.type;g=g.memoizedProps,((v&335544128)===v||xb($,g))&&uv(E,D,$,g)}break;case 5:Nu(g,v,E),g.flags&Ll&&(D=g.stateNode,$=g.type,g=g.memoizedProps,((v&335544128)===v||xb($,g))&&uv(E,D,$,g));break;case 3:case 4:mc?(D=Ni,Ni=dg(g.stateNode.containerInfo),Nu(g,v,E),Ni=D):Nu(g,v,E);break;case 22:g.memoizedState===null&&(D=g.alternate,D!==null&&D.memoizedState!==null?(D=Ll,Ll=16777216,Nu(g,v,E),Ll=D):Nu(g,v,E));break;default:Nu(g,v,E)}}function Yx(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 Wp(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var E=0;E<v.length;E++){var D=v[E];to=D,Nl(D,g)}Yx(g)}if(g.subtreeFlags&10256)for(g=g.child;g!==null;)Kx(g),g=g.sibling}function Kx(g){switch(g.tag){case 0:case 11:case 15:Wp(g),g.flags&2048&&cs(9,g,g.return);break;case 3:Wp(g);break;case 12:Wp(g);break;case 22:var v=g.stateNode;g.memoizedState!==null&&v._visibility&2&&(g.return===null||g.return.tag!==13)?(v._visibility&=-3,eg(g)):Wp(g);break;default:Wp(g)}}function eg(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var E=0;E<v.length;E++){var D=v[E];to=D,Nl(D,g)}Yx(g)}for(g=g.child;g!==null;){switch(v=g,v.tag){case 0:case 11:case 15:cs(8,v,v.return),eg(v);break;case 22:E=v.stateNode,E._visibility&2&&(E._visibility&=-3,eg(v));break;default:eg(v)}g=g.sibling}}function Nl(g,v){for(;to!==null;){var E=to;switch(E.tag){case 0:case 11:case 15:cs(8,E,v);break;case 23:case 22:if(E.memoizedState!==null&&E.memoizedState.cachePool!==null){var D=E.memoizedState.cachePool.pool;D!=null&&D.refCount++}break;case 24:_e(E.memoizedState.cache)}if(D=E.child,D!==null)D.return=E,to=D;else e:for(E=g;to!==null;){D=to;var $=D.sibling,re=D.return;if(ob(D),D===E){to=null;break e}if($!==null){$.return=re,to=$;break e}to=re}}}function gf(g){var v=Mr(g);if(v!=null){if(typeof v.memoizedProps["data-testname"]!="string")throw Error(i(364));return v}if(g=Js(g),g===null)throw Error(i(362));return g.stateNode.current}function xf(g,v){var E=g.tag;switch(v.$$typeof){case wc:if(g.type===v.value)return!0;break;case cm:e:{for(v=v.value,g=[g,0],E=0;E<g.length;){var D=g[E++],$=D.tag,re=g[E++],Ie=v[re];if($!==5&&$!==26&&$!==27||!Mf(D)){for(;Ie!=null&&xf(D,Ie);)re++,Ie=v[re];if(re===v.length){v=!0;break e}else for(D=D.child;D!==null;)g.push(D,re),D=D.sibling}}v=!1}return v;case um:if((E===5||E===26||E===27)&&Sb(g.stateNode,v.value))return!0;break;case Df:if((E===5||E===6||E===26||E===27)&&(g=cg(g),g!==null&&0<=g.indexOf(v.value)))return!0;break;case yg: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 $p(g){switch(g.$$typeof){case wc:return"<"+(p(g.value)||"Unknown")+">";case cm:return":has("+($p(g)||"")+")";case um:return'[role="'+g.value+'"]';case Df:return'"'+g.value+'"';case yg:return'[data-testname="'+g.value+'"]';default:throw Error(i(365))}}function qp(g,v){var E=[];g=[g,0];for(var D=0;D<g.length;){var $=g[D++],re=$.tag,Ie=g[D++],ct=v[Ie];if(re!==5&&re!==26&&re!==27||!Mf($)){for(;ct!=null&&xf($,ct);)Ie++,ct=v[Ie];if(Ie===v.length)E.push($);else for($=$.child;$!==null;)g.push($,Ie),$=$.sibling}}return E}function nl(g,v){if(!Ao)throw Error(i(363));g=gf(g),g=qp(g,v),v=[],g=Array.from(g);for(var E=0;E<g.length;){var D=g[E++],$=D.tag;if($===5||$===26||$===27)Mf(D)||v.push(D.stateNode);else for(D=D.child;D!==null;)g.push(D),D=D.sibling}return v}function us(){return(Br&2)!==0&&Xr!==0?Xr&-Xr:Kn.T!==null?Le():nm()}function Ad(){if(Ha===0)if((Xr&536870912)===0||qr){var g=Hh;Hh<<=1,(Hh&3932160)===0&&(Hh=262144),Ha=g}else Ha=536870912;return g=ll.current,g!==null&&(g.flags|=32),Ha}function Ts(g,v,E){(g===Ir&&(ki===2||ki===9)||g.cancelPendingCommit!==null)&&(Fs(g,0),Ru(g,Xr,Ha,!1)),k(g,E),((Br&2)===0||g!==Ir)&&(g===Ir&&((Br&2)===0&&(Of|=E),Ns===4&&Ru(g,Xr,Ha,!1)),Ue(g))}function Xc(g,v,E){if((Br&6)!==0)throw Error(i(327));var D=!E&&(v&127)===0&&(v&g.expiredLanes)===0||C(g,v),$=D?i3(g,v):Du(g,v,!0),re=D;do{if($===0){Pf&&!D&&Ru(g,v,0,!1);break}else{if(E=g.current.alternate,re&&!n3(E)){$=Du(g,v,!1),re=!1;continue}if($===2){if(re=v,g.errorRecoveryDisabledLanes&re)var Ie=0;else Ie=g.pendingLanes&-536870913,Ie=Ie!==0?Ie:Ie&536870912?536870912:0;if(Ie!==0){v=Ie;e:{var ct=g;$=bg;var jt=ds&&ct.current.memoizedState.isDehydrated;if(jt&&(Fs(ct,Ie).flags|=256),Ie=Du(ct,Ie,!1),Ie!==2){if(If&&!jt){ct.errorRecoveryDisabledLanes|=re,Of|=re,$=4;break e}re=ul,ul=$,re!==null&&(ul===null?ul=re:ul.push.apply(ul,re))}$=Ie}if(re=!1,$!==2)continue}}if($===1){Fs(g,0),Ru(g,v,0,!0);break}e:{switch(D=g,re=$,re){case 0:case 1:throw Error(i(345));case 4:if((v&4194048)!==v)break;case 6:Ru(D,v,Ha,!Qc);break e;case 2:ul=null;break;case 3:case 5:break;default:throw Error(i(329))}if((v&62914560)===v&&($=_g+300-_a(),10<$)){if(Ru(D,v,Ha,!Qc),M(D,0,!0)!==0)break e;$u=v,D.timeoutHandle=gb(ku.bind(null,D,E,ul,Sg,Dv,v,Ha,Of,fm,Qc,re,"Throttled",-0,0),$);break e}ku(D,E,ul,Sg,Dv,v,Ha,Of,fm,Qc,re,null,-0,0)}}break}while(!0);Ue(g)}function ku(g,v,E,D,$,re,Ie,ct,jt,tn,yn,on,Rn,yr){if(g.timeoutHandle=sl,on=v.subtreeFlags,on&8192||(on&16785408)===16785408){on=vb(),mf(v,re,on);var ro=(re&62914560)===re?_g-_a():(re&4194048)===re?Yh-_a():0;if(ro=d3(on,ro),ro!==null){$u=re,g.cancelPendingCommit=ro(Iu.bind(null,g,v,re,E,D,$,Ie,ct,jt,yn,on,null,Rn,yr)),Ru(g,re,Ie,!tn);return}}Iu(g,v,re,E,D,$,Ie,ct,jt)}function n3(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 D=0;D<E.length;D++){var $=E[D],re=$.getSnapshot;$=$.value;try{if(!eo(re(),$))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 Ru(g,v,E,D){v&=~dm,v&=~Of,g.suspendedLanes|=v,g.pingedLanes&=~v,D&&(g.warmLanes|=v),D=g.expirationTimes;for(var $=v;0<$;){var re=31-ol($),Ie=1<<re;D[re]=-1,$&=~Ie}E!==0&&R(g,E,v)}function Zx(){return(Br&6)===0?(Se(0),!1):!0}function Qx(){if(Hr!==null){if(ki===0)var g=Hr.return;else g=Hr,Kc=Yi=null,Yn(g),Nf=null,Gh=0,g=Hr;for(;g!==null;)xi(g.alternate,g),g=g.return;Hr=null}}function Fs(g,v){var E=g.timeoutHandle;E!==sl&&(g.timeoutHandle=sl,u3(E)),E=g.cancelPendingCommit,E!==null&&(g.cancelPendingCommit=null,E()),$u=0,Qx(),Ir=g,Hr=E=Rl(g.current,null),Xr=v,ki=0,vo=null,Qc=!1,Pf=C(g,v),If=!1,fm=Ha=dm=Of=Ud=Ns=0,ul=bg=null,Dv=!1,(v&8)!==0&&(v|=v&32);var D=g.entangledLanes;if(D!==0)for(g=g.entanglements,D&=v;0<D;){var $=31-ol(D),re=1<<$;v|=g[$],D&=~re}return Wu=v,Ht(),E}function Xi(g,v){Tr=null,Kn.H=Ol,v===Do||v===_c?(v=Be(),ki=3):v===kv?(v=Be(),ki=4):ki=v===Ba?8:v!==null&&typeof v=="object"&&typeof v.then=="function"?6:1,vo=v,Hr===null&&(Ns=1,sc(g,ne(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 Nd(){var g=Kn.H;return Kn.H=Ol,g===null?Ol:g}function kl(){var g=Kn.A;return Kn.A=lm,g}function Xp(){Ns=4,Qc||(Xr&4194048)!==Xr&&ll.current!==null||(Pf=!0),(Ud&134217727)===0&&(Of&134217727)===0||Ir===null||Ru(Ir,Xr,Ha,!1)}function Du(g,v,E){var D=Br;Br|=2;var $=Nd(),re=kl();(Ir!==g||Xr!==v)&&(Sg=null,Fs(g,v)),v=!1;var Ie=Ns;e:do try{if(ki!==0&&Hr!==null){var ct=Hr,jt=vo;switch(ki){case 8:Qx(),Ie=6;break e;case 3:case 2:case 9:case 6:ll.current===null&&(v=!0);var tn=ki;if(ki=0,vo=null,Pu(g,ct,jt,tn),E&&Pf){Ie=0;break e}break;default:tn=ki,ki=0,vo=null,Pu(g,ct,jt,tn)}}r3(),Ie=Ns;break}catch(yn){Xi(g,yn)}while(!0);return v&&g.shellSuspendCounter++,Kc=Yi=null,Br=D,Kn.H=$,Kn.A=re,Hr===null&&(Ir=null,Xr=0,Ht()),Ie}function r3(){for(;Hr!==null;)vf(Hr)}function i3(g,v){var E=Br;Br|=2;var D=Nd(),$=kl();Ir!==g||Xr!==v?(Sg=null,Lf=_a()+500,Fs(g,v)):Pf=C(g,v);e:do try{if(ki!==0&&Hr!==null){v=Hr;var re=vo;t:switch(ki){case 1:ki=0,vo=null,Pu(g,v,re,1);break;case 2:case 9:if(Ae(re)){ki=0,vo=null,Jx(v);break}v=function(){ki!==2&&ki!==9||Ir!==g||(ki=7),Ue(g)},re.then(v,v);break e;case 3:ki=7;break e;case 4:ki=5;break e;case 7:Ae(re)?(ki=0,vo=null,Jx(v)):(ki=0,vo=null,Pu(g,v,re,7));break;case 5:var Ie=null;switch(Hr.tag){case 26:Ie=Hr.memoizedState;case 5:case 27:var ct=Hr,jt=ct.type,tn=ct.pendingProps;if(Ie?Gb(Ie):Cs(ct.stateNode,jt,tn)){ki=0,vo=null;var yn=ct.sibling;if(yn!==null)Hr=yn;else{var on=ct.return;on!==null?(Hr=on,Kp(on)):Hr=null}break t}}ki=0,vo=null,Pu(g,v,re,5);break;case 6:ki=0,vo=null,Pu(g,v,re,6);break;case 8:Qx(),Ns=6;break e;default:throw Error(i(462))}}Yp();break}catch(Rn){Xi(g,Rn)}while(!0);return Kc=Yi=null,Kn.H=D,Kn.A=$,Br=E,Hr!==null?0:(Ir=null,Xr=0,Ht(),Ns)}function Yp(){for(;Hr!==null&&!q3();)vf(Hr)}function vf(g){var v=Xt(g.alternate,g,Wu);g.memoizedProps=g.pendingProps,v===null?Kp(g):Hr=v}function Jx(g){var v=g,E=v.alternate;switch(v.tag){case 15:case 0:v=Ls(E,v,v.pendingProps,v.type,void 0,Xr);break;case 11:v=Ls(E,v,v.pendingProps,v.type.render,v.ref,Xr);break;case 5:Yn(v);default:xi(E,v),v=Hr=nv(v,Wu),v=Xt(E,v,Wu)}g.memoizedProps=g.pendingProps,v===null?Kp(g):Hr=v}function Pu(g,v,E,D){Kc=Yi=null,Yn(v),Nf=null,Gh=0;var $=v.return;try{if(W0(g,$,v,E,Xr)){Ns=1,sc(g,ne(E,g.current)),Hr=null;return}}catch(re){if($!==null)throw Hr=$,re;Ns=1,sc(g,ne(E,g.current)),Hr=null;return}v.flags&32768?(qr||D===1?g=!0:Pf||(Xr&536870912)!==0?g=!1:(Qc=g=!0,(D===2||D===9||D===3||D===6)&&(D=ll.current,D!==null&&D.tag===13&&(D.flags|=16384))),yf(v,g)):Kp(v)}function Kp(g){var v=g;do{if((v.flags&32768)!==0){yf(v,Qc);return}g=v.return;var E=Ji(v.alternate,v,Wu);if(E!==null){Hr=E;return}if(v=v.sibling,v!==null){Hr=v;return}Hr=v=g}while(v!==null);Ns===0&&(Ns=5)}function yf(g,v){do{var E=js(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);Ns=6,Hr=null}function Iu(g,v,E,D,$,re,Ie,ct,jt){g.cancelPendingCommit=null;do Lu();while(yo!==0);if((Br&6)!==0)throw Error(i(327));if(v!==null){if(v===g.current)throw Error(i(177));if(re=v.lanes|v.childLanes,re|=Wh,O(g,E,re,Ie,ct,jt),g===Ir&&(Hr=Ir=null,Xr=0),Kh=v,Hd=g,$u=E,hm=re,Pv=$,Jb=D,(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?(g.callbackNode=null,g.callbackPriority=0,go(hg,function(){return tg(),null})):(g.callbackNode=null,g.callbackPriority=0),D=(v.flags&13878)!==0,(v.subtreeFlags&13878)!==0||D){D=Kn.T,Kn.T=null,$=pc(),$r(2),Ie=Br,Br|=4;try{$x(g,v,E)}finally{Br=Ie,$r($),Kn.T=D}}yo=1,kd(),Ou(),ev()}}function kd(){if(yo===1){yo=0;var g=Hd,v=Kh,E=(v.flags&13878)!==0;if((v.subtreeFlags&13878)!==0||E){E=Kn.T,Kn.T=null;var D=pc();$r(2);var $=Br;Br|=4;try{J0(v,g),c3(g.containerInfo)}finally{Br=$,$r(D),Kn.T=E}}g.current=v,yo=2}}function Ou(){if(yo===2){yo=0;var g=Hd,v=Kh,E=(v.flags&8772)!==0;if((v.subtreeFlags&8772)!==0||E){E=Kn.T,Kn.T=null;var D=pc();$r(2);var $=Br;Br|=4;try{t3(g,v.alternate,v)}finally{Br=$,$r(D),Kn.T=E}}yo=3}}function ev(){if(yo===4||yo===3){yo=0,$b();var g=Hd,v=Kh,E=$u,D=Jb;(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?yo=5:(yo=0,Kh=Hd=null,tv(g,g.pendingLanes));var $=g.pendingLanes;if($===0&&(Bd=null),W(E),v=v.stateNode,al&&typeof al.onCommitFiberRoot=="function")try{al.onCommitFiberRoot(Vh,v,void 0,(v.current.flags&128)===128)}catch{}if(D!==null){v=Kn.T,$=pc(),$r(2),Kn.T=null;try{for(var re=g.onRecoverableError,Ie=0;Ie<D.length;Ie++){var ct=D[Ie];re(ct.value,{componentStack:ct.stack})}}finally{Kn.T=v,$r($)}}($u&3)!==0&&Lu(),Ue(g),$=g.pendingLanes,(E&261930)!==0&&($&42)!==0?g===wg?ui++:(ui=0,wg=g):ui=0,ds&&ug(),Se(0)}}function tv(g,v){(g.pooledCacheLanes&=v)===0&&(v=g.pooledCache,v!=null&&(g.pooledCache=null,_e(v)))}function Lu(){return kd(),Ou(),ev(),tg()}function tg(){if(yo!==5)return!1;var g=Hd,v=hm;hm=0;var E=W($u),D=32>E?32:E;E=Kn.T;var $=pc();try{$r(D),Kn.T=null,D=Pv,Pv=null;var re=Hd,Ie=$u;if(yo=0,Kh=Hd=null,$u=0,(Br&6)!==0)throw Error(i(331));var ct=Br;if(Br|=4,Kx(re.current),Xx(re,re.current,Ie,D),Br=ct,Se(0,!1),al&&typeof al.onPostCommitFiberRoot=="function")try{al.onPostCommitFiberRoot(Vh,re)}catch{}return!0}finally{$r($),Kn.T=E,tv(g,v)}}function bf(g,v,E){v=ne(E,v),v=wd(g.stateNode,v,2),g=Lt(g,v,2),g!==null&&(k(g,2),Ue(g))}function cr(g,v,E){if(g.tag===3)bf(g,g,E);else for(;v!==null;){if(v.tag===3){bf(v,g,E);break}else if(v.tag===1){var D=v.stateNode;if(typeof v.type.getDerivedStateFromError=="function"||typeof D.componentDidCatch=="function"&&(Bd===null||!Bd.has(D))){g=ne(E,g),E=G0(2),D=Lt(v,E,2),D!==null&&(Fp(E,D,v,g),k(D,2),Ue(D));break}}v=v.return}}function Zp(g,v,E){var D=g.pingCache;if(D===null){D=g.pingCache=new jl;var $=new Set;D.set(v,$)}else $=D.get(v),$===void 0&&($=new Set,D.set(v,$));$.has(E)||(If=!0,$.add(E),g=s3.bind(null,g,v,E),v.then(g,g))}function s3(g,v,E){var D=g.pingCache;D!==null&&D.delete(v),g.pingedLanes|=g.suspendedLanes&E,g.warmLanes&=~E,Ir===g&&(Xr&E)===E&&(Ns===4||Ns===3&&(Xr&62914560)===Xr&&300>_a()-_g?(Br&2)===0&&Fs(g,0):dm|=E,fm===Xr&&(fm=0)),Ue(g)}function o3(g,v){v===0&&(v=N()),g=Ft(g,v),g!==null&&(k(g,v),Ue(g))}function wE(g){var v=g.memoizedState,E=0;v!==null&&(E=v.retryLane),o3(g,E)}function ME(g,v){var E=0;switch(g.tag){case 31:case 13:var D=g.stateNode,$=g.memoizedState;$!==null&&(E=$.retryLane);break;case 19:D=g.stateNode;break;case 22:D=g.stateNode._retryCache;break;default:throw Error(i(314))}D!==null&&D.delete(v),o3(g,E)}function go(g,v){return fg(g,v)}function lb(g,v,E,D){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=D,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kh(g){return g=g.prototype,!(!g||!g.isReactComponent)}function Rl(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 nv(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 Rd(g,v,E,D,$,re){var Ie=0;if(D=g,typeof g=="function")kh(g)&&(Ie=1);else if(typeof g=="string")Ie=mc&&No?xv(g,E,Go.current)?26:Wb(g)?27:5:mc?xv(g,E,Go.current)?26:5:No&&Wb(g)?27:5;else e:switch(g){case sg:return g=n(31,E,v,$),g.elementType=sg,g.lanes=re,g;case Ih:return fc(E.children,$,re,v);case Oh:Ie=8,$|=24;break;case Lh:return g=n(12,E,v,$|2),g.elementType=Lh,g.lanes=re,g;case ov:return g=n(13,E,v,$),g.elementType=ov,g.lanes=re,g;case Dd:return g=n(19,E,v,$),g.elementType=Dd,g.lanes=re,g;default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case hc:Ie=10;break e;case ig:Ie=9;break e;case Qp:Ie=11;break e;case av:Ie=14;break e;case ja:Ie=16,D=null;break e}Ie=29,E=Error(i(130,g===null?"null":typeof g,"")),D=null}return v=n(Ie,E,v,$),v.elementType=g,v.type=D,v.lanes=re,v}function fc(g,v,E,D){return g=n(7,g,D,v),g.lanes=E,g}function cb(g,v,E){return g=n(6,g,null,v),g.lanes=E,g}function ub(g){var v=n(18,null,null,0);return v.stateNode=g,v}function db(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 a3(g,v,E,D,$,re,Ie,ct,jt){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=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=D,this.onUncaughtError=$,this.onCaughtError=re,this.onRecoverableError=Ie,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=jt,this.incompleteTransitions=new Map}function _f(g,v,E,D,$,re,Ie,ct,jt,tn,yn,on){return g=new a3(g,v,E,Ie,jt,tn,yn,on,ct),v=1,re===!0&&(v|=24),re=n(3,null,null,v),g.current=re,re.stateNode=g,v=we(),v.refCount++,g.pooledCache=v,v.refCount++,re.memoizedState={element:D,isDehydrated:E,cache:v},dn(re),g}function rv(g){return g?(g=zu,g):zu}function ng(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:em(g.stateNode)}function fb(g,v,E,D,$,re){$=rv($),D.context===null?D.context=$:D.pendingContext=$,D=Pt(v),D.payload={element:E},re=re===void 0?null:re,re!==null&&(D.callback=re),E=Lt(g,D,v),E!==null&&(Ts(E,g,v),ln(E,g,v))}function Rh(g,v){if(g=g.memoizedState,g!==null&&g.dehydrated!==null){var E=g.retryLane;g.retryLane=E!==0&&E<v?E:v}}function rg(g,v){Rh(g,v),(g=g.alternate)&&Rh(g,v)}var Dr={},iv=ni,rl=PEe,sv=Object.assign,Dh=Symbol.for("react.element"),ju=Symbol.for("react.transitional.element"),Ph=Symbol.for("react.portal"),Ih=Symbol.for("react.fragment"),Oh=Symbol.for("react.strict_mode"),Lh=Symbol.for("react.profiler"),ig=Symbol.for("react.consumer"),hc=Symbol.for("react.context"),Qp=Symbol.for("react.forward_ref"),ov=Symbol.for("react.suspense"),Dd=Symbol.for("react.suspense_list"),av=Symbol.for("react.memo"),ja=Symbol.for("react.lazy"),sg=Symbol.for("react.activity"),hb=Symbol.for("react.memo_cache_sentinel"),Pd=Symbol.iterator,Sf=Symbol.for("react.client.reference"),wf=Array.isArray,Kn=iv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pb=e.rendererVersion,og=e.rendererPackageName,Jp=e.extraDevToolsConfig,em=e.getPublicInstance,l3=e.getRootHostContext,tm=e.getChildHostContext,lv=e.prepareForCommit,c3=e.resetAfterCommit,mb=e.createInstance;e.cloneMutableInstance;var ag=e.appendInitialChild,il=e.finalizeInitialChildren,za=e.shouldSetTextContent,Id=e.createTextInstance;e.cloneMutableTextInstance;var gb=e.scheduleTimeout,u3=e.cancelTimeout,sl=e.noTimeout,Qs=e.isPrimaryRenderer;e.warnsIfNotActing;var Qr=e.supportsMutation,Dl=e.supportsPersistence,ds=e.supportsHydration,Mr=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Fi=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var $r=e.setCurrentUpdatePriority,pc=e.getCurrentUpdatePriority,nm=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var jh=e.shouldAttemptEagerTransition,cv=e.detachDeletedInstance;e.requestPostPaintCallback;var lg=e.maySuspendCommit,rm=e.maySuspendCommitOnUpdate,xb=e.maySuspendCommitInSyncRender,Cs=e.preloadInstance,vb=e.startSuspendingCommit,uv=e.suspendInstance;e.suspendOnActiveViewTransition;var d3=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var zh=e.NotPendingTransition,Fh=e.HostTransitionContext,yb=e.resetFormInstance;e.bindToConsole;var bb=e.supportsMicrotasks,_b=e.scheduleMicrotask,Ao=e.supportsTestSelectors,Js=e.findFiberRoot,dv=e.getBoundingRect,cg=e.getTextContent,Mf=e.isHiddenSubtree,Sb=e.matchAccessibilityRole,Od=e.setFocusIfFocusable,fv=e.setupIntersectionObserver,wb=e.appendChild,Mb=e.appendChildToContainer,f3=e.commitTextUpdate,h3=e.commitMount,p3=e.commitUpdate,m3=e.insertBefore,g3=e.insertInContainerBefore,x3=e.removeChild,Tb=e.removeChildFromContainer,Cb=e.resetTextContent,TE=e.hideInstance,v3=e.hideTextInstance,y3=e.unhideInstance,b3=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 Eb=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var _3=e.cloneInstance,Ab=e.createContainerChildSet,Nb=e.appendChildToContainerChildSet,S3=e.finalizeContainerChildren,kb=e.replaceContainerChildren,w3=e.cloneHiddenInstance,Rb=e.cloneHiddenTextInstance,Tf=e.isSuspenseInstancePending,hv=e.isSuspenseInstanceFallback,pv=e.getSuspenseInstanceFallbackErrorDetails,mv=e.registerSuspenseInstanceRetry,M3=e.canHydrateFormStateMarker,Db=e.isFormStateMarkerMatching,T3=e.getNextHydratableSibling,C3=e.getNextHydratableSiblingAfterSingleton,E3=e.getFirstHydratableChild,A3=e.getFirstHydratableChildWithinContainer,N3=e.getFirstHydratableChildWithinActivityInstance,k3=e.getFirstHydratableChildWithinSuspenseInstance,Pb=e.getFirstHydratableChildWithinSingleton,R3=e.canHydrateInstance,D3=e.canHydrateTextInstance,Ib=e.canHydrateActivityInstance,P3=e.canHydrateSuspenseInstance,I3=e.hydrateInstance,CE=e.hydrateTextInstance,Ob=e.hydrateActivityInstance,O3=e.hydrateSuspenseInstance,L3=e.getNextHydratableInstanceAfterActivityInstance,Lb=e.getNextHydratableInstanceAfterSuspenseInstance,j3=e.commitHydratedInstance,z3=e.commitHydratedContainer,EE=e.commitHydratedActivityInstance,AE=e.commitHydratedSuspenseInstance,F3=e.finalizeHydratedChildren,ug=e.flushHydrationEvents;e.clearActivityBoundary;var jb=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var gv=e.clearSuspenseBoundaryFromContainer,U3=e.hideDehydratedBoundary,B3=e.unhideDehydratedBoundary,im=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var H3=e.validateHydratableInstance,zb=e.validateHydratableTextInstance,mc=e.supportsResources,xv=e.isHostHoistableType,dg=e.getHoistableRoot,Fb=e.getResource,Ub=e.acquireResource,Cf=e.releaseResource,V3=e.hydrateHoistable,Bb=e.mountHoistable,Hb=e.unmountHoistable,vv=e.createHoistableInstance,G3=e.prepareToCommitHoistables,Vb=e.mayResourceSuspendCommit,Gb=e.preloadResource,W3=e.suspendResource,No=e.supportsSingletons,yv=e.resolveSingletonInstance,xo=e.acquireSingletonInstance,Vo=e.releaseSingletonInstance,Wb=e.isHostSingletonType,Uh=e.isSingletonScope,bv=[],Bh=-1,zu={},ol=Math.clz32?Math.clz32:_,_v=Math.log,$3=Math.LN2,Sv=256,Hh=262144,sm=4194304,fg=rl.unstable_scheduleCallback,wv=rl.unstable_cancelCallback,q3=rl.unstable_shouldYield,$b=rl.unstable_requestPaint,_a=rl.unstable_now,Mv=rl.unstable_ImmediatePriority,X3=rl.unstable_UserBlockingPriority,hg=rl.unstable_NormalPriority,Tv=rl.unstable_IdlePriority,qb=rl.log,Y3=rl.unstable_setDisableYieldValue,Vh=null,al=null,eo=typeof Object.is=="function"?Object.is:ee,Cv=typeof reportError=="function"?reportError:function(g){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var v=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof g=="object"&&g!==null&&typeof g.message=="string"?String(g.message):String(g),error:g});if(!window.dispatchEvent(v))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",g);return}console.error(g)},NE=Object.prototype.hasOwnProperty,Ev,Fu,pg=!1,Xb=new WeakMap,Ld=[],Uu=0,Ui=null,mg=0,gc=[],Pl=0,xc=null,sa=1,Yc="",Go=m(null),jd=m(null),oa=m(null),gg=m(null),ko=null,fs=null,qr=!1,Bu=null,Fa=!1,Av=Error(i(519)),vc=m(null),Yi=null,Kc=null,K3=typeof AbortController<"u"?AbortController:function(){var g=[],v=this.signal={aborted:!1,addEventListener:function(E,D){g.push(D)}};this.abort=function(){v.aborted=!0,g.forEach(function(E){return E()})}},Wo=rl.unstable_scheduleCallback,kE=rl.unstable_NormalPriority,hs={$$typeof:hc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},xg=null,Ai=null,Sa=!1,yc=!1,Nv=!1,Ef=0,om=null,Yb=0,zd=0,Ro=null,bc=Kn.S;Kn.S=function(g,v){Yh=_a(),typeof v=="object"&&v!==null&&typeof v.then=="function"&&Ze(g,v),bc!==null&&bc(g,v)};var Af=m(null),Do=Error(i(460)),kv=Error(i(474)),_c=Error(i(542)),Hu={then:function(){}},Ua=null,Nf=null,Gh=0,aa=St(!0),Kb=St(!1),la=[],Vu=0,Wh=0,Il=!1,Rv=!1,$h=m(null),kf=m(0),ll=m(null),cl=null,Us=m(0),Fd=0,Tr=null,Vn=null,mr=null,Pr=!1,Nr=!1,ei=!1,wa=0,Sc=0,Zc=null,Zb=0,Ol={readContext:ae,use:ys,useCallback:Gt,useContext:Gt,useEffect:Gt,useImperativeHandle:Gt,useLayoutEffect:Gt,useInsertionEffect:Gt,useMemo:Gt,useReducer:Gt,useRef:Gt,useState:Gt,useDebugValue:Gt,useDeferredValue:Gt,useTransition:Gt,useSyncExternalStore:Gt,useId:Gt,useHostTransitionStatus:Gt,useFormState:Gt,useActionState:Gt,useOptimistic:Gt,useMemoCache:Gt,useCacheRefresh:Gt};Ol.useEffectEvent=Gt;var Es={readContext:ae,use:ys,useCallback:function(g,v){return fr().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=fr();v=v===void 0?null:v;var D=g();if(ei){G(!0);try{g()}finally{G(!1)}}return E.memoizedState=[D,v],D},useReducer:function(g,v,E){var D=fr();if(E!==void 0){var $=E(v);if(ei){G(!0);try{E(v)}finally{G(!1)}}}else $=v;return D.memoizedState=D.baseState=$,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:$},D.queue=g,g=g.dispatch=Ss.bind(null,Tr,g),[D.memoizedState,g]},useRef:function(g){var v=fr();return g={current:g},v.memoizedState=g},useState:function(g){g=Tl(g);var v=g.queue,E=Al.bind(null,Tr,v);return v.dispatch=E,[g.memoizedState,E]},useDebugValue:El,useDeferredValue:function(g,v){var E=fr();return gi(E,g,v)},useTransition:function(){var g=Tl(!1);return g=yd.bind(null,Tr,g.queue,!0,!1),fr().memoizedState=g,[!1,g]},useSyncExternalStore:function(g,v,E){var D=Tr,$=fr();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(D,v,E)}$.memoizedState=E;var re={value:E,getSnapshot:v};return $.queue=re,ii(va.bind(null,D,re,g),[g]),D.flags|=2048,_s(9,{destroy:void 0},ta.bind(null,D,re,E,v),null),E},useId:function(){var g=fr(),v=Ir.identifierPrefix;if(qr){var E=Yc,D=sa;E=(D&~(1<<32-ol(D)-1)).toString(32)+E,v="_"+v+"R_"+E,E=wa++,0<E&&(v+="H"+E.toString(32)),v+="_"}else E=Zb++,v="_"+v+"r_"+E.toString(32)+"_";return g.memoizedState=v},useHostTransitionStatus:df,useFormState:rc,useActionState:rc,useOptimistic:function(g){var v=fr();v.memoizedState=v.baseState=g;var E={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return v.queue=E,v=Lp.bind(null,Tr,!0,E),E.dispatch=v,[g,v]},useMemoCache:Ps,useCacheRefresh:function(){return fr().memoizedState=Ys.bind(null,Tr)},useEffectEvent:function(g){var v=fr(),E={impl:g};return v.memoizedState=E,function(){if((Br&2)!==0)throw Error(i(440));return E.impl.apply(void 0,arguments)}}},Gu={readContext:ae,use:ys,useCallback:ic,useContext:ae,useEffect:Wr,useImperativeHandle:Ia,useInsertionEffect:wi,useLayoutEffect:zi,useMemo:To,useReducer:bs,useRef:Ja,useState:function(){return bs(Li)},useDebugValue:El,useDeferredValue:function(g,v){var E=un();return Eh(E,Vn.memoizedState,g,v)},useTransition:function(){var g=bs(Li)[0],v=un().memoizedState;return[typeof g=="boolean"?g:jn(g),v]},useSyncExternalStore:Is,useId:ba,useHostTransitionStatus:df,useFormState:na,useActionState:na,useOptimistic:function(g,v){var E=un();return ya(E,Vn,g,v)},useMemoCache:Ps,useCacheRefresh:qi};Gu.useEffectEvent=wr;var Rf={readContext:ae,use:ys,useCallback:ic,useContext:ae,useEffect:Wr,useImperativeHandle:Ia,useInsertionEffect:wi,useLayoutEffect:zi,useMemo:To,useReducer:pi,useRef:Ja,useState:function(){return pi(Li)},useDebugValue:El,useDeferredValue:function(g,v){var E=un();return Vn===null?gi(E,g,v):Eh(E,Vn.memoizedState,g,v)},useTransition:function(){var g=pi(Li)[0],v=un().memoizedState;return[typeof g=="boolean"?g:jn(g),v]},useSyncExternalStore:Is,useId:ba,useHostTransitionStatus:df,useFormState:Cl,useActionState:Cl,useOptimistic:function(g,v){var E=un();return Vn!==null?ya(E,Vn,g,v):(E.baseState=g,[g,E.queue.dispatch])},useMemoCache:Ps,useCacheRefresh:qi};Rf.useEffectEvent=wr;var vg={enqueueSetState:function(g,v,E){g=g._reactInternals;var D=us(),$=Pt(D);$.payload=v,E!=null&&($.callback=E),v=Lt(g,$,D),v!==null&&(Ts(v,g,D),ln(v,g,D))},enqueueReplaceState:function(g,v,E){g=g._reactInternals;var D=us(),$=Pt(D);$.tag=1,$.payload=v,E!=null&&($.callback=E),v=Lt(g,$,D),v!==null&&(Ts(v,g,D),ln(v,g,D))},enqueueForceUpdate:function(g,v){g=g._reactInternals;var E=us(),D=Pt(E);D.tag=2,v!=null&&(D.callback=v),v=Lt(g,D,E),v!==null&&(Ts(v,g,E),ln(v,g,E))}},Ba=Error(i(461)),es=!1,qh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},Bs=!1,Hs=!1,am=!1,Qb=typeof WeakSet=="function"?WeakSet:Set,to=null,As=null,no=!1,Ni=null,Ll=8192,lm={getCacheForType:function(g){var v=ae(hs),E=v.data.get(g);return E===void 0&&(E=g(),v.data.set(g,E)),E},cacheSignal:function(){return ae(hs).controller.signal}},wc=0,cm=1,um=2,yg=3,Df=4;if(typeof Symbol=="function"&&Symbol.for){var Xh=Symbol.for;wc=Xh("selector.component"),cm=Xh("selector.has_pseudo_class"),um=Xh("selector.role"),yg=Xh("selector.test_id"),Df=Xh("selector.text")}var jl=typeof WeakMap=="function"?WeakMap:Map,Br=0,Ir=null,Hr=null,Xr=0,ki=0,vo=null,Qc=!1,Pf=!1,If=!1,Wu=0,Ns=0,Ud=0,Of=0,dm=0,Ha=0,fm=0,bg=null,ul=null,Dv=!1,_g=0,Yh=0,Lf=1/0,Sg=null,Bd=null,yo=0,Hd=null,Kh=null,$u=0,hm=0,Pv=null,Jb=null,ui=0,wg=null;return Dr.attemptContinuousHydration=function(g){if(g.tag===13||g.tag===31){var v=Ft(g,67108864);v!==null&&Ts(v,g,67108864),rg(g,67108864)}},Dr.attemptHydrationAtCurrentPriority=function(g){if(g.tag===13||g.tag===31){var v=us();v=V(v);var E=Ft(g,v);E!==null&&Ts(E,g,v),rg(g,v)}},Dr.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}Ue(g),(Br&6)===0&&(Lf=_a()+500,Se(0))}}break;case 31:case 13:v=Ft(g,2),v!==null&&Ts(v,g,2),Zx(),rg(g,2)}},Dr.batchedUpdates=function(g,v){return g(v)},Dr.createComponentSelector=function(g){return{$$typeof:wc,value:g}},Dr.createContainer=function(g,v,E,D,$,re,Ie,ct,jt,tn){return _f(g,v,!1,null,E,D,re,null,Ie,ct,jt,tn)},Dr.createHasPseudoClassSelector=function(g){return{$$typeof:cm,value:g}},Dr.createHydrationContainer=function(g,v,E,D,$,re,Ie,ct,jt,tn,yn,on,Rn,yr){var ro;return g=_f(E,D,!0,g,$,re,ct,yr,jt,tn,yn,on),g.context=rv(null),E=g.current,D=us(),D=V(D),$=Pt(D),$.callback=(ro=v)!=null?ro:null,Lt(E,$,D),v=D,g.current.lanes=v,k(g,v),Ue(g),g},Dr.createPortal=function(g,v,E){var D=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ph,key:D==null?null:""+D,children:g,containerInfo:v,implementation:E}},Dr.createRoleSelector=function(g){return{$$typeof:um,value:g}},Dr.createTestNameSelector=function(g){return{$$typeof:yg,value:g}},Dr.createTextSelector=function(g){return{$$typeof:Df,value:g}},Dr.defaultOnCaughtError=function(g){console.error(g)},Dr.defaultOnRecoverableError=function(g){Cv(g)},Dr.defaultOnUncaughtError=function(g){Cv(g)},Dr.deferredUpdates=function(g){var v=Kn.T,E=pc();try{return $r(32),Kn.T=null,g()}finally{$r(E),Kn.T=v}},Dr.discreteUpdates=function(g,v,E,D,$){var re=Kn.T,Ie=pc();try{return $r(2),Kn.T=null,g(v,E,D,$)}finally{$r(Ie),Kn.T=re,Br===0&&(Lf=_a()+500)}},Dr.findAllNodes=nl,Dr.findBoundingRects=function(g,v){if(!Ao)throw Error(i(363));v=nl(g,v),g=[];for(var E=0;E<v.length;E++)g.push(dv(v[E]));for(v=g.length-1;0<v;v--){E=g[v];for(var D=E.x,$=D+E.width,re=E.y,Ie=re+E.height,ct=v-1;0<=ct;ct--)if(v!==ct){var jt=g[ct],tn=jt.x,yn=tn+jt.width,on=jt.y,Rn=on+jt.height;if(D>=tn&&re>=on&&$<=yn&&Ie<=Rn){g.splice(v,1);break}else if(D!==tn||E.width!==jt.width||Rn<re||on>Ie){if(!(re!==on||E.height!==jt.height||yn<D||tn>$)){tn>D&&(jt.width+=tn-D,jt.x=D),yn<$&&(jt.width=$-tn),g.splice(v,1);break}}else{on>re&&(jt.height+=on-re,jt.y=re),Rn<Ie&&(jt.height=Ie-on),g.splice(v,1);break}}}return g},Dr.findHostInstance=ng,Dr.findHostInstanceWithNoPortals=function(g){return g=a(g),g=g!==null?c(g):null,g===null?null:em(g.stateNode)},Dr.findHostInstanceWithWarning=function(g){return ng(g)},Dr.flushPassiveEffects=Lu,Dr.flushSyncFromReconciler=function(g){var v=Br;Br|=1;var E=Kn.T,D=pc();try{if($r(2),Kn.T=null,g)return g()}finally{$r(D),Kn.T=E,Br=v,(Br&6)===0&&Se(0)}},Dr.flushSyncWork=Zx,Dr.focusWithin=function(g,v){if(!Ao)throw Error(i(363));for(g=gf(g),v=qp(g,v),v=Array.from(v),g=0;g<v.length;){var E=v[g++],D=E.tag;if(!Mf(E)){if((D===5||D===26||D===27)&&Od(E.stateNode))return!0;for(E=E.child;E!==null;)v.push(E),E=E.sibling}}return!1},Dr.getFindAllNodesFailureDescription=function(g,v){if(!Ao)throw Error(i(363));var E=0,D=[];g=[gf(g),0];for(var $=0;$<g.length;){var re=g[$++],Ie=re.tag,ct=g[$++],jt=v[ct];if((Ie!==5&&Ie!==26&&Ie!==27||!Mf(re))&&(xf(re,jt)&&(D.push($p(jt)),ct++,ct>E&&(E=ct)),ct<v.length))for(re=re.child;re!==null;)g.push(re,ct),re=re.sibling}if(E<v.length){for(g=[];E<v.length;E++)g.push($p(v[E]));return`findAllNodes was able to match part of the selector:
  `+(D.join(" > ")+`

No matching component was found for:
  `)+g.join(" > ")}return null},Dr.getPublicRootInstance=function(g){if(g=g.current,!g.child)return null;switch(g.child.tag){case 27:case 5:return em(g.child.stateNode);default:return g.child.stateNode}},Dr.injectIntoDevTools=function(){var g={bundleType:0,version:pb,rendererPackageName:og,currentDispatcherRef:Kn,reconcilerVersion:"19.2.0"};if(Jp!==null&&(g.rendererConfig=Jp),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")g=!1;else{var v=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(v.isDisabled||!v.supportsFiber)g=!0;else{try{Vh=v.inject(g),al=v}catch{}g=!!v.checkDCE}}return g},Dr.isAlreadyRendering=function(){return(Br&6)!==0},Dr.observeVisibleRects=function(g,v,E,D){if(!Ao)throw Error(i(363));g=nl(g,v);var $=fv(g,E,D).disconnect;return{disconnect:function(){$()}}},Dr.shouldError=function(){return null},Dr.shouldSuspend=function(){return!1},Dr.startHostTransition=function(g,v,E,D){if(g.tag!==5)throw Error(i(476));var $=bd(g).queue;yd(g,$,v,zh,E===null?r:function(){var re=bd(g);return re.next===null&&(re=g.alternate.memoizedState),Co(g,re.next.queue,{},us()),E(D)})},Dr.updateContainer=function(g,v,E,D){var $=v.current,re=us();return fb($,re,g,v,E,D),re},Dr.updateContainerSync=function(g,v,E,D){return fb(v.current,2,g,v,E,D),2},Dr},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})(dF)),dF.exports}var hF;function oAe(){return hF||(hF=1,uF.exports=sAe()),uF.exports}var aAe=oAe();const lAe=iAe(aAe);function cAe(t){const e=lAe(t);return e.injectIntoDevTools(),e}const xZ=0,Py={},uAe=/^three(?=[A-Z])/,yE=t=>`${t[0].toUpperCase()}${t.slice(1)}`;let dAe=0;const fAe=t=>typeof t=="function";function hAe(t){if(fAe(t)){const e=`${dAe++}`;return Py[e]=t,e}else Object.assign(Py,t)}function vZ(t,e){const n=yE(t),r=Py[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 pAe(t,e,n){var r;return t=yE(t)in Py?t:t.replace(uAe,""),vZ(t,e),t==="primitive"&&(r=e.object)!=null&&r.__r3f&&delete e.object.__r3f,iT(e.object,n,t,e)}function mAe(t){if(!t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?oT(t.parent,t):Nc(t.object)&&(t.object.visible=!1),t.isHidden=!0,ib(t)}}function yZ(t){if(t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?sT(t.parent,t):Nc(t.object)&&t.props.visible!==!1&&(t.object.visible=!0),t.isHidden=!1,ib(t)}}function u9(t,e,n){const r=e.root.getState();if(!(!t.parent&&t.object!==r.scene)){if(!e.object){var i,s;const o=Py[yE(e.type)];e.object=(i=e.props.object)!=null?i:new o(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(Hm(e.object,e.props),e.props.attach)sT(t,e);else if(Nc(e.object)&&Nc(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)u9(e,o);ib(e)}}function vN(t,e){e&&(e.parent=t,t.children.push(e),u9(t,e))}function pF(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),u9(t,e,n)}function bZ(t){if(typeof t.dispose=="function"){const e=()=>{try{t.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():jR.unstable_scheduleCallback(jR.unstable_IdlePriority,e)}}function FR(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?oT(t,e):Nc(e.object)&&Nc(t.object)&&(t.object.remove(e.object),KEe(cZ(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];FR(e,o,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&bZ(e.object),n===void 0&&ib(e)}function gAe(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 m2=[];function xAe(){for(const[n]of m2){const r=n.parent;if(r){n.props.attach?oT(r,n):Nc(n.object)&&Nc(r.object)&&r.object.remove(n.object);for(const i of n.children)i.props.attach?oT(n,i):Nc(i.object)&&Nc(n.object)&&n.object.remove(i.object)}n.isHidden&&yZ(n),n.object.__r3f&&delete n.object.__r3f,n.type!=="primitive"&&bZ(n.object)}for(const[n,r,i]of m2){n.props=r;const s=n.parent;if(s){var t,e;const o=Py[yE(n.type)];n.object=(t=n.props.object)!=null?t:new o(...(e=n.props.args)!=null?e:[]),n.object.__r3f=n,gAe(i,n.object),Hm(n.object,n.props),n.props.attach?sT(s,n):Nc(n.object)&&Nc(s.object)&&s.object.add(n.object);for(const a of n.children)a.props.attach?sT(n,a):Nc(a.object)&&Nc(n.object)&&n.object.add(a.object);ib(n)}}m2.length=0}const yN=()=>{},mF={};let GM=xZ;const vAe=0,yAe=4,UR=cAe({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:pAe,removeChild:FR,appendChild:vN,appendInitialChild:vN,insertBefore:pF,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||FR(n,e)},insertInContainerBefore(t,e,n){const r=t.getState().scene.__r3f;!e||!n||!r||pF(r,e,n)},getRootHostContext:()=>mF,getChildHostContext:()=>mF,commitUpdate(t,e,n,r,i){var s,o,a;vZ(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((f,p)=>{var m;return f!==((m=n.args)==null?void 0:m[p])}))&&(l=!0),l)m2.push([t,{...r},i]);else{const f=$Ee(t,r);Object.keys(f).length&&(Object.assign(t.props,f),Hm(t.object,f))}(i.sibling===null||(i.flags&yAe)===vAe)&&xAe()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:t=>t==null?void 0:t.object,prepareForCommit:()=>null,preparePortalMount:t=>iT(t.getState().scene,t,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:mAe,unhideInstance:yZ,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){GM=t},getCurrentUpdatePriority(){return GM},resolveUpdatePriority(){var t;if(GM!==xZ)return GM;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 nAe;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return eAe;default:return tAe}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:rAe.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}),Rx=new Map,h1={objects:"shallow",strict:!1};function bAe(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 _Ae(t){const e=Rx.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||QEe(VR,xF),o=n||UR.createContainer(s,JEe,null,!1,null,"",i,i,i,null);e||Rx.set(t,{fiber:o,store:s});let a,l,c=!1,f=null;return{async configure(p={}){let m;f=new Promise(z=>m=z);let{gl:x,size:b,scene:_,events:S,onCreated:M,shadows:C=!1,linear:A=!1,flat:N=!1,legacy:P=!1,orthographic:k=!1,frameloop:O="always",dpr:R=[1,2],performance:L,raycaster:B,camera:V,onPointerMissed:W}=p,G=s.getState(),ee=G.gl;if(!G.gl){const z={canvas:t,powerPreference:"high-performance",antialias:!0,alpha:!0},Y=typeof x=="function"?await x(z):x;cF(Y)?ee=Y:ee=new sZ({...z,...x}),G.set({gl:ee})}let H=G.raycaster;H||G.set({raycaster:H=new YK});const{params:q,...J}=B||{};if(so.equ(J,H,h1)||Hm(H,{...J}),so.equ(q,H.params,h1)||Hm(H,{params:{...H.params,...q}}),!G.camera||G.camera===l&&!so.equ(l,V,h1)){l=V;const z=V==null?void 0:V.isCamera,Y=z?V:k?new nf(0,0,0,0,.1,1e3):new ao(75,0,.1,1e3);z||(Y.position.z=5,V&&(Hm(Y,V),Y.manual||("aspect"in V||"left"in V||"right"in V||"bottom"in V||"top"in V)&&(Y.manual=!0,Y.updateProjectionMatrix())),!G.camera&&!(V!=null&&V.rotation)&&Y.lookAt(0,0,0)),G.set({camera:Y}),H.camera=Y}if(!G.scene){let z;_!=null&&_.isScene?(z=_,iT(z,s,"",{})):(z=new PD,iT(z,s,"",{}),_&&Hm(z,_)),G.set({scene:z})}S&&!G.events.handlers&&G.set({events:S(s)});const K=bAe(t,b);if(so.equ(K,G.size,h1)||G.setSize(K.width,K.height,K.top,K.left),R&&G.viewport.dpr!==fZ(R)&&G.setDpr(R),G.frameloop!==O&&G.setFrameloop(O),G.onPointerMissed||G.set({onPointerMissed:W}),L&&!so.equ(L,G.performance,h1)&&G.set(z=>({performance:{...z.performance,...L}})),!G.xr){var ne;const z=(le,ce)=>{const X=s.getState();X.frameloop!=="never"&&xF(le,!0,X,ce)},Y=()=>{const le=s.getState();le.gl.xr.enabled=le.gl.xr.isPresenting,le.gl.xr.setAnimationLoop(le.gl.xr.isPresenting?z:null),le.gl.xr.isPresenting||VR(le)},j={connect(){const le=s.getState().gl;le.xr.addEventListener("sessionstart",Y),le.xr.addEventListener("sessionend",Y)},disconnect(){const le=s.getState().gl;le.xr.removeEventListener("sessionstart",Y),le.xr.removeEventListener("sessionend",Y)}};typeof((ne=ee.xr)==null?void 0:ne.addEventListener)=="function"&&j.connect(),G.set({xr:j})}if(ee.shadowMap){const z=ee.shadowMap.enabled,Y=ee.shadowMap.type;if(ee.shadowMap.enabled=!!C,so.boo(C))ee.shadowMap.type=aS;else if(so.str(C)){var U;const j={basic:mY,percentage:z1,soft:aS,variance:Jg};ee.shadowMap.type=(U=j[C])!=null?U:aS}else so.obj(C)&&Object.assign(ee.shadowMap,C);(z!==ee.shadowMap.enabled||Y!==ee.shadowMap.type)&&(ee.shadowMap.needsUpdate=!0)}return li.enabled=!P,c||(ee.outputColorSpace=A?b0:xl,ee.toneMapping=N?mu:PC),G.legacy!==P&&G.set(()=>({legacy:P})),G.linear!==A&&G.set(()=>({linear:A})),G.flat!==N&&G.set(()=>({flat:N})),x&&!so.fun(x)&&!cF(x)&&!so.equ(x,ee,h1)&&Hm(ee,x),a=M,c=!0,m(),this},render(p){return!c&&!f&&this.configure(),f.then(()=>{UR.updateContainer(d.jsx(SAe,{store:s,children:p,onCreated:a,rootElement:t}),o,null,()=>{})}),s},unmount(){_Z(t)}}}function SAe({store:t,children:e,onCreated:n,rootElement:r}){return Jw(()=>{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)},[]),d.jsx(mZ.Provider,{value:t,children:e})}function _Z(t,e){const n=Rx.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),UR.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(),VEe(i.scene),Rx.delete(t)}catch{}},500)})}}const wAe=new Set,MAe=new Set,TAe=new Set;function bN(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function vS(t,e){switch(t){case"before":return bN(wAe,e);case"after":return bN(MAe,e);case"tail":return bN(TAe,e)}}let _N,SN;function BR(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 aT=!1,HR=!1,wN,gF,p1;function SZ(t){gF=requestAnimationFrame(SZ),aT=!0,wN=0,vS("before",t),HR=!0;for(const n of Rx.values()){var e;p1=n.store.getState(),p1.internal.active&&(p1.frameloop==="always"||p1.internal.frames>0)&&!((e=p1.gl.xr)!=null&&e.isPresenting)&&(wN+=BR(t,p1))}if(HR=!1,vS("after",t),wN===0)return vS("tail",t),aT=!1,cancelAnimationFrame(gF)}function VR(t,e=1){var n;if(!t)return Rx.forEach(r=>VR(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):HR?t.internal.frames=2:t.internal.frames=1,aT||(aT=!0,requestAnimationFrame(SZ)))}function xF(t,e=!0,n,r){if(e&&vS("before",t),n)BR(t,n,r);else for(const i of Rx.values())BR(t,i.store.getState());e&&vS("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 CAe(t){const{handlePointer:e}=ZEe(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 vF(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function EAe({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,f=w.useRef(!1);w.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[p,m,x]=w.useMemo(()=>{const M=()=>{if(!a.current.element)return;const{left:C,top:A,width:N,height:P,bottom:k,right:O,x:R,y:L}=a.current.element.getBoundingClientRect(),B={left:C,top:A,width:N,height:P,bottom:k,right:O,x:R,y:L};a.current.element instanceof HTMLElement&&r&&(B.height=a.current.element.offsetHeight,B.width=a.current.element.offsetWidth),Object.freeze(B),f.current&&!RAe(a.current.lastBounds,B)&&o(a.current.lastBounds=B)};return[M,c?vF(M,c):M,l?vF(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=wZ(M),_())};return NAe(x,!!e),AAe(m),w.useEffect(()=>{b(),_()},[e,x,m]),w.useEffect(()=>b,[]),[S,s,p]}function AAe(t){w.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function NAe(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 wZ(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,...wZ(t.parentElement)]}const kAe=["x","y","top","bottom","left","right","width","height"],RAe=(t,e)=>kAe.every(n=>t[n]===e[n]);function DAe({ref:t,children:e,fallback:n,resize:r,style:i,gl:s,events:o=CAe,eventSource:a,eventPrefix:l,shadows:c,linear:f,flat:p,legacy:m,orthographic:x,frameloop:b,dpr:_,performance:S,raycaster:M,camera:C,scene:A,onPointerMissed:N,onCreated:P,...k}){w.useMemo(()=>hAe(yEe),[]);const O=UEe(),[R,L]=EAe({scroll:!0,debounce:{scroll:50,resize:0},...r}),B=w.useRef(null),V=w.useRef(null);w.useImperativeHandle(t,()=>B.current);const W=dZ(N),[G,ee]=w.useState(!1),[H,q]=w.useState(!1);if(G)throw G;if(H)throw H;const J=w.useRef(null);Jw(()=>{const ne=B.current;if(L.width>0&&L.height>0&&ne){J.current||(J.current=_Ae(ne));async function U(){await J.current.configure({gl:s,scene:A,events:o,shadows:c,linear:f,flat:p,legacy:m,orthographic:x,frameloop:b,dpr:_,performance:S,raycaster:M,camera:C,size:L,onPointerMissed:(...z)=>W.current==null?void 0:W.current(...z),onCreated:z=>{z.events.connect==null||z.events.connect(a?zEe(a)?a.current:a:V.current),l&&z.setEvents({compute:(Y,j)=>{const le=Y[l+"X"],ce=Y[l+"Y"];j.pointer.set(le/j.size.width*2-1,-(ce/j.size.height)*2+1),j.raycaster.setFromCamera(j.pointer,j.camera)}}),P==null||P(z)}}),J.current.render(d.jsx(O,{children:d.jsx(HEe,{set:q,children:d.jsx(w.Suspense,{fallback:d.jsx(BEe,{set:ee}),children:e??null})})}))}U()}}),w.useEffect(()=>{const ne=B.current;if(ne)return()=>_Z(ne)},[]);const K=a?"none":"auto";return d.jsx("div",{ref:V,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:K,...i},...k,children:d.jsx("div",{ref:R,style:{width:"100%",height:"100%"},children:d.jsx("canvas",{ref:B,style:{display:"block"},children:n})})})}function PAe(t){return d.jsx(aZ,{children:d.jsx(DAe,{...t})})}function xh(){return xh=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},xh.apply(null,arguments)}const e3=new We,d9=new We,IAe=new We,yF=new $t;function OAe(t,e,n){const r=e3.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 LAe(t,e){const n=e3.setFromMatrixPosition(t.matrixWorld),r=d9.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),s=e.getWorldDirection(IAe);return i.angleTo(s)>Math.PI/2}function jAe(t,e,n,r){const i=e3.setFromMatrixPosition(t.matrixWorld),s=i.clone();s.project(e),yF.set(s.x,s.y),n.setFromCamera(yF,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 zAe(t,e){if(e instanceof nf)return e.zoom;if(e instanceof ao){const n=e3.setFromMatrixPosition(t.matrixWorld),r=d9.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 FAe(t,e,n){if(e instanceof ao||e instanceof nf){const r=e3.setFromMatrixPosition(t.matrixWorld),i=d9.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 GR=t=>Math.abs(t)<1e-10?0:t;function MZ(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=GR(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const UAe=(t=>e=>MZ(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),BAe=(t=>(e,n)=>MZ(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 HAe(t){return t&&typeof t=="object"&&"current"in t}const f9=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:f=!1,occlude:p,onOcclude:m,castShadow:x,receiveShadow:b,material:_,geometry:S,zIndexRange:M=[16777271,0],calculatePosition:C=OAe,as:A="div",wrapperClass:N,pointerEvents:P="auto",...k},O)=>{const{gl:R,camera:L,scene:B,size:V,raycaster:W,events:G,viewport:ee}=kc(),[H]=w.useState(()=>document.createElement(A)),q=w.useRef(null),J=w.useRef(null),K=w.useRef(0),ne=w.useRef([0,0]),U=w.useRef(null),z=w.useRef(null),Y=(a==null?void 0:a.current)||G.connected||R.domElement.parentNode,j=w.useRef(null),le=w.useRef(!1),ce=w.useMemo(()=>p&&p!=="blending"||Array.isArray(p)&&p.length&&HAe(p[0]),[p]);w.useLayoutEffect(()=>{const ue=R.domElement;p&&p==="blending"?(ue.style.zIndex=`${Math.floor(M[0]/2)}`,ue.style.position="absolute",ue.style.pointerEvents="none"):(ue.style.zIndex=null,ue.style.position=null,ue.style.pointerEvents=null)},[p]),w.useLayoutEffect(()=>{if(J.current){const ue=q.current=hU.createRoot(H);if(B.updateMatrixWorld(),f)H.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const he=C(J.current,L,V);H.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${he[0]}px,${he[1]}px,0);transform-origin:0 0;`}return Y&&(i?Y.prepend(H):Y.appendChild(H)),()=>{Y&&Y.removeChild(H),ue.unmount()}}},[Y,f]),w.useLayoutEffect(()=>{N&&(H.className=N)},[N]);const X=w.useMemo(()=>f?{position:"absolute",top:0,left:0,width:V.width,height:V.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-V.height/2,left:-V.width/2,width:V.width,height:V.height},...n},[n,s,o,V,f]),ie=w.useMemo(()=>({position:"absolute",pointerEvents:P}),[P]);w.useLayoutEffect(()=>{if(le.current=!1,f){var ue;(ue=q.current)==null||ue.render(w.createElement("div",{ref:U,style:X},w.createElement("div",{ref:z,style:ie},w.createElement("div",{ref:O,className:r,style:n,children:t}))))}else{var he;(he=q.current)==null||he.render(w.createElement("div",{ref:O,style:X,className:r,children:t}))}});const fe=w.useRef(!0);vE(ue=>{if(J.current){L.updateMatrixWorld(),J.current.updateWorldMatrix(!0,!1);const he=f?ne.current:C(J.current,L,V);if(f||Math.abs(K.current-L.zoom)>e||Math.abs(ne.current[0]-he[0])>e||Math.abs(ne.current[1]-he[1])>e){const se=LAe(J.current,L);let Ce=!1;ce&&(Array.isArray(p)?Ce=p.map(Pe=>Pe.current):p!=="blending"&&(Ce=[B]));const de=fe.current;if(Ce){const Pe=jAe(J.current,L,W,Ce);fe.current=Pe&&!se}else fe.current=!se;de!==fe.current&&(m?m(!fe.current):H.style.display=fe.current?"block":"none");const Me=Math.floor(M[0]/2),Te=p?ce?[M[0],Me]:[Me-1,0]:M;if(H.style.zIndex=`${FAe(J.current,L,Te)}`,f){const[Pe,oe]=[V.width/2,V.height/2],Ve=L.projectionMatrix.elements[5]*oe,{isOrthographicCamera:He,top:ze,left:Ge,bottom:ae,right:Z}=L,ge=UAe(L.matrixWorldInverse),we=He?`scale(${Ve})translate(${GR(-(Z+Ge)/2)}px,${GR((ze+ae)/2)}px)`:`translateZ(${Ve}px)`;let _e=J.current.matrixWorld;c&&(_e=L.matrixWorldInverse.clone().transpose().copyPosition(_e).scale(J.current.scale),_e.elements[3]=_e.elements[7]=_e.elements[11]=0,_e.elements[15]=1),H.style.width=V.width+"px",H.style.height=V.height+"px",H.style.perspective=He?"":`${Ve}px`,U.current&&z.current&&(U.current.style.transform=`${we}${ge}translate(${Pe}px,${oe}px)`,z.current.style.transform=BAe(_e,1/((l||10)/400)))}else{const Pe=l===void 0?1:zAe(J.current,L)*l;H.style.transform=`translate3d(${he[0]}px,${he[1]}px,0) scale(${Pe})`}ne.current=he,K.current=L.zoom}}if(!ce&&j.current&&!le.current)if(f){if(U.current){const he=U.current.children[0];if(he!=null&&he.clientWidth&&he!=null&&he.clientHeight){const{isOrthographicCamera:se}=L;if(se||S)k.scale&&(Array.isArray(k.scale)?k.scale instanceof We?j.current.scale.copy(k.scale.clone().divideScalar(1)):j.current.scale.set(1/k.scale[0],1/k.scale[1],1/k.scale[2]):j.current.scale.setScalar(1/k.scale));else{const Ce=(l||10)/400,de=he.clientWidth*Ce,Me=he.clientHeight*Ce;j.current.scale.set(de,Me,1)}le.current=!0}}}else{const he=H.children[0];if(he!=null&&he.clientWidth&&he!=null&&he.clientHeight){const se=1/ee.factor,Ce=he.clientWidth*se,de=he.clientHeight*se;j.current.scale.set(Ce,de,1),le.current=!0}j.current.lookAt(ue.camera.position)}});const Q=w.useMemo(()=>({vertexShader:f?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);
        }
      `}),[f]);return w.createElement("group",xh({},k,{ref:J}),p&&!ce&&w.createElement("mesh",{castShadow:x,receiveShadow:b,ref:j},S||w.createElement("planeGeometry",null),_||w.createElement("shaderMaterial",{side:au,vertexShader:Q.vertexShader,fragmentShader:Q.fragmentShader})))}),TZ=parseInt(Gw.replace(/\D+/g,"")),CZ=TZ>=125?"uv1":"uv2";function VAe(t,e=Math.PI/3){const n=Math.cos(e),r=(1+1e-10)*100,i=[new We,new We,new We],s=new We,o=new We,a=new We,l=new We;function c(_){const S=~~(_.x*r),M=~~(_.y*r),C=~~(_.z*r);return`${S},${M},${C}`}const f=t.index?t.toNonIndexed():t,p=f.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 P=new We().crossVectors(s,o).normalize();for(let k=0;k<3;k++){const O=i[k],R=c(O);R in m||(m[R]=[]),m[R].push(P)}}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 P=0;P<3;P++){const k=i[P],O=c(k),R=m[O];l.set(0,0,0);for(let L=0,B=R.length;L<B;L++){const V=R[L];a.dot(V)>n&&l.add(V)}l.normalize(),b.setXYZ(M+P,l.x,l.y,l.z)}}return f.setAttribute("normal",b),f}var GAe=Object.defineProperty,WAe=(t,e,n)=>e in t?GAe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$Ae=(t,e,n)=>(WAe(t,e+"",n),n);class qAe{constructor(){$Ae(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 XAe=Object.defineProperty,YAe=(t,e,n)=>e in t?XAe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,rr=(t,e,n)=>(YAe(t,typeof e!="symbol"?e+"":e,n),n);const WM=new Hx,bF=new cp,KAe=Math.cos(70*(Math.PI/180)),_F=(t,e)=>(t%e+e)%e;let ZAe=class extends qAe{constructor(e,n){super(),rr(this,"object"),rr(this,"domElement"),rr(this,"enabled",!0),rr(this,"target",new We),rr(this,"minDistance",0),rr(this,"maxDistance",1/0),rr(this,"minZoom",0),rr(this,"maxZoom",1/0),rr(this,"minPolarAngle",0),rr(this,"maxPolarAngle",Math.PI),rr(this,"minAzimuthAngle",-1/0),rr(this,"maxAzimuthAngle",1/0),rr(this,"enableDamping",!1),rr(this,"dampingFactor",.05),rr(this,"enableZoom",!0),rr(this,"zoomSpeed",1),rr(this,"enableRotate",!0),rr(this,"rotateSpeed",1),rr(this,"enablePan",!0),rr(this,"panSpeed",1),rr(this,"screenSpacePanning",!0),rr(this,"keyPanSpeed",7),rr(this,"zoomToCursor",!1),rr(this,"autoRotate",!1),rr(this,"autoRotateSpeed",2),rr(this,"reverseOrbit",!1),rr(this,"reverseHorizontalOrbit",!1),rr(this,"reverseVerticalOrbit",!1),rr(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),rr(this,"mouseButtons",{LEFT:qg.ROTATE,MIDDLE:qg.DOLLY,RIGHT:qg.PAN}),rr(this,"touches",{ONE:Xg.ROTATE,TWO:Xg.DOLLY_PAN}),rr(this,"target0"),rr(this,"position0"),rr(this,"zoom0"),rr(this,"_domElementKeyEvents",null),rr(this,"getPolarAngle"),rr(this,"getAzimuthalAngle"),rr(this,"setPolarAngle"),rr(this,"setAzimuthalAngle"),rr(this,"getDistance"),rr(this,"getZoomScale"),rr(this,"listenToKeyEvents"),rr(this,"stopListenToKeyEvents"),rr(this,"saveState"),rr(this,"reset"),rr(this,"update"),rr(this,"connect"),rr(this,"dispose"),rr(this,"dollyIn"),rr(this,"dollyOut"),rr(this,"getScale"),rr(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=()=>f.phi,this.getAzimuthalAngle=()=>f.theta,this.setPolarAngle=be=>{let Le=_F(be,2*Math.PI),Ze=f.phi;Ze<0&&(Ze+=2*Math.PI),Le<0&&(Le+=2*Math.PI);let Ee=Math.abs(Le-Ze);2*Math.PI-Ee<Ee&&(Le<Ze?Le+=2*Math.PI:Ze+=2*Math.PI),p.phi=Le-Ze,r.update()},this.setAzimuthalAngle=be=>{let Le=_F(be,2*Math.PI),Ze=f.theta;Ze<0&&(Ze+=2*Math.PI),Le<0&&(Le+=2*Math.PI);let Ee=Math.abs(Le-Ze);2*Math.PI-Ee<Ee&&(Le<Ze?Le+=2*Math.PI:Ze+=2*Math.PI),p.theta=Le-Ze,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=be=>{be.addEventListener("keydown",ve),this._domElementKeyEvents=be},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 be=new We,Le=new We(0,1,0),Ze=new Ya().setFromUnitVectors(e.up,Le),Ee=Ze.clone().invert(),Ye=new We,it=new Ya,mt=2*Math.PI;return function(){const Qe=r.object.position;Ze.setFromUnitVectors(e.up,Le),Ee.copy(Ze).invert(),be.copy(Qe).sub(r.target),be.applyQuaternion(Ze),f.setFromVector3(be),r.autoRotate&&l===a.NONE&&ee(W()),r.enableDamping?(f.theta+=p.theta*r.dampingFactor,f.phi+=p.phi*r.dampingFactor):(f.theta+=p.theta,f.phi+=p.phi);let Ae=r.minAzimuthAngle,Xe=r.maxAzimuthAngle;isFinite(Ae)&&isFinite(Xe)&&(Ae<-Math.PI?Ae+=mt:Ae>Math.PI&&(Ae-=mt),Xe<-Math.PI?Xe+=mt:Xe>Math.PI&&(Xe-=mt),Ae<=Xe?f.theta=Math.max(Ae,Math.min(Xe,f.theta)):f.theta=f.theta>(Ae+Xe)/2?Math.max(Ae,f.theta):Math.min(Xe,f.theta)),f.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,f.phi)),f.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(x,r.dampingFactor):r.target.add(x),r.zoomToCursor&&L||r.object.isOrthographicCamera?f.radius=j(f.radius):f.radius=j(f.radius*m),be.setFromSpherical(f),be.applyQuaternion(Ee),Qe.copy(r.target).add(be),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 Re=!1;if(r.zoomToCursor&&L){let Be=null;if(r.object instanceof ao&&r.object.isPerspectiveCamera){const ot=be.length();Be=j(ot*m);const dt=ot-Be;r.object.position.addScaledVector(O,dt),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const ot=new We(R.x,R.y,0);ot.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),Re=!0;const dt=new We(R.x,R.y,0);dt.unproject(r.object),r.object.position.sub(dt).add(ot),r.object.updateMatrixWorld(),Be=be.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Be!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Be).add(r.object.position):(WM.origin.copy(r.object.position),WM.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(WM.direction))<KAe?e.lookAt(r.target):(bF.setFromNormalAndCoplanarPoint(r.object.up,r.target),WM.intersectPlane(bF,r.target))))}else r.object instanceof nf&&r.object.isOrthographicCamera&&(Re=m!==1,Re&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix()));return m=1,L=!1,Re||Ye.distanceToSquared(r.object.position)>c||8*(1-it.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Ye.copy(r.object.position),it.copy(r.object.quaternion),Re=!1,!0):!1}})(),this.connect=be=>{r.domElement=be,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",ke),r.domElement.addEventListener("pointerdown",Ge),r.domElement.addEventListener("pointercancel",Z),r.domElement.addEventListener("wheel",_e)},this.dispose=()=>{var be,Le,Ze,Ee,Ye,it;r.domElement&&(r.domElement.style.touchAction="auto"),(be=r.domElement)==null||be.removeEventListener("contextmenu",ke),(Le=r.domElement)==null||Le.removeEventListener("pointerdown",Ge),(Ze=r.domElement)==null||Ze.removeEventListener("pointercancel",Z),(Ee=r.domElement)==null||Ee.removeEventListener("wheel",_e),(Ye=r.domElement)==null||Ye.ownerDocument.removeEventListener("pointermove",ae),(it=r.domElement)==null||it.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,f=new DR,p=new DR;let m=1;const x=new We,b=new $t,_=new $t,S=new $t,M=new $t,C=new $t,A=new $t,N=new $t,P=new $t,k=new $t,O=new We,R=new $t;let L=!1;const B=[],V={};function W(){return 2*Math.PI/60/60*r.autoRotateSpeed}function G(){return Math.pow(.95,r.zoomSpeed)}function ee(be){r.reverseOrbit||r.reverseHorizontalOrbit?p.theta+=be:p.theta-=be}function H(be){r.reverseOrbit||r.reverseVerticalOrbit?p.phi+=be:p.phi-=be}const q=(()=>{const be=new We;return function(Ze,Ee){be.setFromMatrixColumn(Ee,0),be.multiplyScalar(-Ze),x.add(be)}})(),J=(()=>{const be=new We;return function(Ze,Ee){r.screenSpacePanning===!0?be.setFromMatrixColumn(Ee,1):(be.setFromMatrixColumn(Ee,0),be.crossVectors(r.object.up,be)),be.multiplyScalar(Ze),x.add(be)}})(),K=(()=>{const be=new We;return function(Ze,Ee){const Ye=r.domElement;if(Ye&&r.object instanceof ao&&r.object.isPerspectiveCamera){const it=r.object.position;be.copy(it).sub(r.target);let mt=be.length();mt*=Math.tan(r.object.fov/2*Math.PI/180),q(2*Ze*mt/Ye.clientHeight,r.object.matrix),J(2*Ee*mt/Ye.clientHeight,r.object.matrix)}else Ye&&r.object instanceof nf&&r.object.isOrthographicCamera?(q(Ze*(r.object.right-r.object.left)/r.object.zoom/Ye.clientWidth,r.object.matrix),J(Ee*(r.object.top-r.object.bottom)/r.object.zoom/Ye.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function ne(be){r.object instanceof ao&&r.object.isPerspectiveCamera||r.object instanceof nf&&r.object.isOrthographicCamera?m=be:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function U(be){ne(m/be)}function z(be){ne(m*be)}function Y(be){if(!r.zoomToCursor||!r.domElement)return;L=!0;const Le=r.domElement.getBoundingClientRect(),Ze=be.clientX-Le.left,Ee=be.clientY-Le.top,Ye=Le.width,it=Le.height;R.x=Ze/Ye*2-1,R.y=-(Ee/it)*2+1,O.set(R.x,R.y,1).unproject(r.object).sub(r.object.position).normalize()}function j(be){return Math.max(r.minDistance,Math.min(r.maxDistance,be))}function le(be){b.set(be.clientX,be.clientY)}function ce(be){Y(be),N.set(be.clientX,be.clientY)}function X(be){M.set(be.clientX,be.clientY)}function ie(be){_.set(be.clientX,be.clientY),S.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Le=r.domElement;Le&&(ee(2*Math.PI*S.x/Le.clientHeight),H(2*Math.PI*S.y/Le.clientHeight)),b.copy(_),r.update()}function fe(be){P.set(be.clientX,be.clientY),k.subVectors(P,N),k.y>0?U(G()):k.y<0&&z(G()),N.copy(P),r.update()}function Q(be){C.set(be.clientX,be.clientY),A.subVectors(C,M).multiplyScalar(r.panSpeed),K(A.x,A.y),M.copy(C),r.update()}function ue(be){Y(be),be.deltaY<0?z(G()):be.deltaY>0&&U(G()),r.update()}function he(be){let Le=!1;switch(be.code){case r.keys.UP:K(0,r.keyPanSpeed),Le=!0;break;case r.keys.BOTTOM:K(0,-r.keyPanSpeed),Le=!0;break;case r.keys.LEFT:K(r.keyPanSpeed,0),Le=!0;break;case r.keys.RIGHT:K(-r.keyPanSpeed,0),Le=!0;break}Le&&(be.preventDefault(),r.update())}function se(){if(B.length==1)b.set(B[0].pageX,B[0].pageY);else{const be=.5*(B[0].pageX+B[1].pageX),Le=.5*(B[0].pageY+B[1].pageY);b.set(be,Le)}}function Ce(){if(B.length==1)M.set(B[0].pageX,B[0].pageY);else{const be=.5*(B[0].pageX+B[1].pageX),Le=.5*(B[0].pageY+B[1].pageY);M.set(be,Le)}}function de(){const be=B[0].pageX-B[1].pageX,Le=B[0].pageY-B[1].pageY,Ze=Math.sqrt(be*be+Le*Le);N.set(0,Ze)}function Me(){r.enableZoom&&de(),r.enablePan&&Ce()}function Te(){r.enableZoom&&de(),r.enableRotate&&se()}function Pe(be){if(B.length==1)_.set(be.pageX,be.pageY);else{const Ze=tt(be),Ee=.5*(be.pageX+Ze.x),Ye=.5*(be.pageY+Ze.y);_.set(Ee,Ye)}S.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Le=r.domElement;Le&&(ee(2*Math.PI*S.x/Le.clientHeight),H(2*Math.PI*S.y/Le.clientHeight)),b.copy(_)}function oe(be){if(B.length==1)C.set(be.pageX,be.pageY);else{const Le=tt(be),Ze=.5*(be.pageX+Le.x),Ee=.5*(be.pageY+Le.y);C.set(Ze,Ee)}A.subVectors(C,M).multiplyScalar(r.panSpeed),K(A.x,A.y),M.copy(C)}function Ve(be){const Le=tt(be),Ze=be.pageX-Le.x,Ee=be.pageY-Le.y,Ye=Math.sqrt(Ze*Ze+Ee*Ee);P.set(0,Ye),k.set(0,Math.pow(P.y/N.y,r.zoomSpeed)),U(k.y),N.copy(P)}function He(be){r.enableZoom&&Ve(be),r.enablePan&&oe(be)}function ze(be){r.enableZoom&&Ve(be),r.enableRotate&&Pe(be)}function Ge(be){var Le,Ze;r.enabled!==!1&&(B.length===0&&((Le=r.domElement)==null||Le.ownerDocument.addEventListener("pointermove",ae),(Ze=r.domElement)==null||Ze.ownerDocument.addEventListener("pointerup",Z)),qe(be),be.pointerType==="touch"?Ue(be):ge(be))}function ae(be){r.enabled!==!1&&(be.pointerType==="touch"?Se(be):we(be))}function Z(be){var Le,Ze,Ee;Je(be),B.length===0&&((Le=r.domElement)==null||Le.releasePointerCapture(be.pointerId),(Ze=r.domElement)==null||Ze.ownerDocument.removeEventListener("pointermove",ae),(Ee=r.domElement)==null||Ee.ownerDocument.removeEventListener("pointerup",Z)),r.dispatchEvent(o),l=a.NONE}function ge(be){let Le;switch(be.button){case 0:Le=r.mouseButtons.LEFT;break;case 1:Le=r.mouseButtons.MIDDLE;break;case 2:Le=r.mouseButtons.RIGHT;break;default:Le=-1}switch(Le){case qg.DOLLY:if(r.enableZoom===!1)return;ce(be),l=a.DOLLY;break;case qg.ROTATE:if(be.ctrlKey||be.metaKey||be.shiftKey){if(r.enablePan===!1)return;X(be),l=a.PAN}else{if(r.enableRotate===!1)return;le(be),l=a.ROTATE}break;case qg.PAN:if(be.ctrlKey||be.metaKey||be.shiftKey){if(r.enableRotate===!1)return;le(be),l=a.ROTATE}else{if(r.enablePan===!1)return;X(be),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function we(be){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;ie(be);break;case a.DOLLY:if(r.enableZoom===!1)return;fe(be);break;case a.PAN:if(r.enablePan===!1)return;Q(be);break}}function _e(be){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(be.preventDefault(),r.dispatchEvent(s),ue(be),r.dispatchEvent(o))}function ve(be){r.enabled===!1||r.enablePan===!1||he(be)}function Ue(be){switch(nt(be),B.length){case 1:switch(r.touches.ONE){case Xg.ROTATE:if(r.enableRotate===!1)return;se(),l=a.TOUCH_ROTATE;break;case Xg.PAN:if(r.enablePan===!1)return;Ce(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case Xg.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Me(),l=a.TOUCH_DOLLY_PAN;break;case Xg.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Te(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Se(be){switch(nt(be),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Pe(be),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;oe(be),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;He(be),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;ze(be),r.update();break;default:l=a.NONE}}function ke(be){r.enabled!==!1&&be.preventDefault()}function qe(be){B.push(be)}function Je(be){delete V[be.pointerId];for(let Le=0;Le<B.length;Le++)if(B[Le].pointerId==be.pointerId){B.splice(Le,1);return}}function nt(be){let Le=V[be.pointerId];Le===void 0&&(Le=new $t,V[be.pointerId]=Le),Le.set(be.pageX,be.pageY)}function tt(be){const Le=be.pointerId===B[0].pointerId?B[1]:B[0];return V[Le.pointerId]}this.dollyIn=(be=G())=>{z(be),r.update()},this.dollyOut=(be=G())=>{U(be),r.update()},this.getScale=()=>m,this.setScale=be=>{ne(be),r.update()},this.getZoomScale=()=>G(),n!==void 0&&this.connect(n),this.update()}};const SF=new Lo,$M=new We;class h9 extends mE{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 On(e,3)),this.setAttribute("uv",new On(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 rT(n,6,1);return this.setAttribute("instanceStart",new du(r,3,0)),this.setAttribute("instanceEnd",new du(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 rT(r,n*2,1);return this.setAttribute("instanceColorStart",new du(i,n,0)),this.setAttribute("instanceColorEnd",new du(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 qD(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Lo);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),SF.setFromBufferAttribute(n),this.boundingBox.union(SF))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Jo),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++)$M.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared($M)),$M.fromBufferAttribute(n,s),i=Math.max(i,r.distanceToSquared($M));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class EZ extends h9{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 p9 extends _u{constructor(e){super({type:"LineMaterial",uniforms:QS.clone(QS.merge([Tn.common,Tn.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new $t(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 <${TZ>=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,wF=new We,MF=new We,Ga=new hi,Wa=new hi,Vf=new hi,CN=new We,EN=new dr,qa=new ZK,TF=new We,qM=new Lo,XM=new Jo,Gf=new hi;let nh,xx;function CF(t,e,n){return Gf.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Gf.multiplyScalar(1/Gf.w),Gf.x=xx/n.width,Gf.y=xx/n.height,Gf.applyMatrix4(t.projectionMatrixInverse),Gf.multiplyScalar(1/Gf.w),Math.abs(Math.max(Gf.x,Gf.y))}function QAe(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++){qa.start.fromBufferAttribute(i,a),qa.end.fromBufferAttribute(s,a),qa.applyMatrix4(n);const c=new We,f=new We;nh.distanceSqToSegment(qa.start,qa.end,f,c),f.distanceTo(c)<xx*.5&&e.push({point:f,pointOnLine:c,distance:nh.origin.distanceTo(f),object:t,face:null,faceIndex:a,uv:null,[CZ]:null})}}function JAe(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,f=Math.min(a.instanceCount,l.count),p=-e.near;nh.at(1,Vf),Vf.w=1,Vf.applyMatrix4(e.matrixWorldInverse),Vf.applyMatrix4(r),Vf.multiplyScalar(1/Vf.w),Vf.x*=s.x/2,Vf.y*=s.y/2,Vf.z=0,CN.copy(Vf),EN.multiplyMatrices(e.matrixWorldInverse,o);for(let m=0,x=f;m<x;m++){if(Ga.fromBufferAttribute(l,m),Wa.fromBufferAttribute(c,m),Ga.w=1,Wa.w=1,Ga.applyMatrix4(EN),Wa.applyMatrix4(EN),Ga.z>p&&Wa.z>p)continue;if(Ga.z>p){const A=Ga.z-Wa.z,N=(Ga.z-p)/A;Ga.lerp(Wa,N)}else if(Wa.z>p){const A=Wa.z-Ga.z,N=(Wa.z-p)/A;Wa.lerp(Ga,N)}Ga.applyMatrix4(r),Wa.applyMatrix4(r),Ga.multiplyScalar(1/Ga.w),Wa.multiplyScalar(1/Wa.w),Ga.x*=s.x/2,Ga.y*=s.y/2,Wa.x*=s.x/2,Wa.y*=s.y/2,qa.start.copy(Ga),qa.start.z=0,qa.end.copy(Wa),qa.end.z=0;const _=qa.closestPointToPointParameter(CN,!0);qa.at(_,TF);const S=QY.lerp(Ga.z,Wa.z,_),M=S>=-1&&S<=1,C=CN.distanceTo(TF)<xx*.5;if(M&&C){qa.start.fromBufferAttribute(l,m),qa.end.fromBufferAttribute(c,m),qa.start.applyMatrix4(o),qa.end.applyMatrix4(o);const A=new We,N=new We;nh.distanceSqToSegment(qa.start,qa.end,N,A),n.push({point:N,pointOnLine:A,distance:nh.origin.distanceTo(N),object:t,face:null,faceIndex:m,uv:null,[CZ]:null})}}}class AZ extends qs{constructor(e=new h9,n=new p9({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)wF.fromBufferAttribute(n,o),MF.fromBufferAttribute(r,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+wF.distanceTo(MF);const s=new rT(i,2,1);return e.setAttribute("instanceDistanceStart",new du(s,1,0)),e.setAttribute("instanceDistanceEnd",new du(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;nh=e.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;xx=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),XM.copy(a.boundingSphere).applyMatrix4(o);let c;if(r)c=xx*.5;else{const p=Math.max(i.near,XM.distanceToPoint(nh.origin));c=CF(i,p,l.resolution)}if(XM.radius+=c,nh.intersectsSphere(XM)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),qM.copy(a.boundingBox).applyMatrix4(o);let f;if(r)f=xx*.5;else{const p=Math.max(i.near,qM.distanceToPoint(nh.origin));f=CF(i,p,l.resolution)}qM.expandByScalar(f),nh.intersectsBox(qM)!==!1&&(r?QAe(this,n):JAe(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 e6e extends AZ{constructor(e=new EZ,n=new p9({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const t6e=w.forwardRef(function({points:e,color:n=16777215,vertexColors:r,linewidth:i,lineWidth:s,segments:o,dashed:a,...l},c){var f,p;const m=kc(M=>M.size),x=w.useMemo(()=>o?new AZ:new e6e,[o]),[b]=w.useState(()=>new p9),_=(r==null||(f=r[0])==null?void 0:f.length)===4?4:3,S=w.useMemo(()=>{const M=o?new h9:new EZ,C=e.map(A=>{const N=Array.isArray(A);return A instanceof We||A instanceof hi?[A.x,A.y,A.z]:A instanceof $t?[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 kn?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",xh({object:x,ref:c},l),w.createElement("primitive",{object:S,attach:"geometry"}),w.createElement("primitive",xh({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 n6e(){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 f=i.getTransferables;if(f===void 0&&(f=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),f&&(f=r("<"+a+">.getTransferables",f));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:f},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(f,function(p){return s(p instanceof Error?p:new Error(""+p))}):f(c)}catch(p){s(p)}function f(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,f){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:c},f||void 0)})}catch(c){postMessage({messageId:o,success:!1,error:c.stack})}})}function r6e(t){var e=function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,n);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var n=t.dependencies,r=t.init;n=Array.isArray(n)?n.map(function(s){return s&&(s=s.onMainThread||s,s._getInitResult&&(s=s._getInitResult())),s}):[];var i=Promise.all(n).then(function(s){return r.apply(null,s)});return e._getInitResult=function(){return i},i},e}var NZ=function(){var t=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),t=!0}catch(n){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+n.message+"]")}return NZ=function(){return t},t},i6e=0,s6e=0,AN=!1,yS=Object.create(null),bS=Object.create(null),WR=Object.create(null);function sb(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=r6e(t);i==null&&(i="#default");var o="workerModule"+ ++i6e,a=t.name||o,l=null;e=e&&e.map(function(f){return typeof f=="function"&&!f.workerModuleData&&(AN=!0,f=sb({workerId:i,name:"<"+a+"> function dependency: "+f.name,init:`function(){return (
`+g2(f)+`
)}`}),AN=!1),f&&f.workerModuleData&&(f=f.workerModuleData),f});function c(){for(var f=[],p=arguments.length;p--;)f[p]=arguments[p];if(!NZ())return s.apply(void 0,f);if(!l){l=EF(i,"registerModule",c.workerModuleData);var m=function(){l=null,bS[i].delete(m)};(bS[i]||(bS[i]=new Set)).add(m)}return l.then(function(x){var b=x.isCallable;if(b)return EF(i,"callModule",{id:o,args:f});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:g2(n),getTransferables:r&&g2(r)},c.onMainThread=s,c}function o6e(t){bS[t]&&bS[t].forEach(function(e){e()}),yS[t]&&(yS[t].terminate(),delete yS[t])}function g2(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function a6e(t){var e=yS[t];if(!e){var n=g2(n6e);e=yS[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=WR[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete WR[s],o(i)}}return e}function EF(t,e,n){return new Promise(function(r,i){var s=++s6e;WR[s]=function(o){o.success?r(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},a6e(t).postMessage({messageId:s,action:e,data:n})})}function kZ(){var t=(function(e){function n(ne,U,z,Y,j,le,ce,X){var ie=1-ce;X.x=ie*ie*ne+2*ie*ce*z+ce*ce*j,X.y=ie*ie*U+2*ie*ce*Y+ce*ce*le}function r(ne,U,z,Y,j,le,ce,X,ie,fe){var Q=1-ie;fe.x=Q*Q*Q*ne+3*Q*Q*ie*z+3*Q*ie*ie*j+ie*ie*ie*ce,fe.y=Q*Q*Q*U+3*Q*Q*ie*Y+3*Q*ie*ie*le+ie*ie*ie*X}function i(ne,U){for(var z=/([MLQCZ])([^MLQCZ]*)/g,Y,j,le,ce,X;Y=z.exec(ne);){var ie=Y[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(fe){return parseFloat(fe)});switch(Y[1]){case"M":ce=j=ie[0],X=le=ie[1];break;case"L":(ie[0]!==ce||ie[1]!==X)&&U("L",ce,X,ce=ie[0],X=ie[1]);break;case"Q":{U("Q",ce,X,ce=ie[2],X=ie[3],ie[0],ie[1]);break}case"C":{U("C",ce,X,ce=ie[4],X=ie[5],ie[0],ie[1],ie[2],ie[3]);break}case"Z":(ce!==j||X!==le)&&U("L",ce,X,j,le);break}}}function s(ne,U,z){z===void 0&&(z=16);var Y={x:0,y:0};i(ne,function(j,le,ce,X,ie,fe,Q,ue,he){switch(j){case"L":U(le,ce,X,ie);break;case"Q":{for(var se=le,Ce=ce,de=1;de<z;de++)n(le,ce,fe,Q,X,ie,de/(z-1),Y),U(se,Ce,Y.x,Y.y),se=Y.x,Ce=Y.y;break}case"C":{for(var Me=le,Te=ce,Pe=1;Pe<z;Pe++)r(le,ce,fe,Q,ue,he,X,ie,Pe/(z-1),Y),U(Me,Te,Y.x,Y.y),Me=Y.x,Te=Y.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 f(ne,U){var z=ne.getContext?ne.getContext("webgl",c):ne,Y=l.get(z);if(!Y){let Me=function(ze){var Ge=le[ze];if(!Ge&&(Ge=le[ze]=z.getExtension(ze),!Ge))throw new Error(ze+" not supported");return Ge},Te=function(ze,Ge){var ae=z.createShader(Ge);return z.shaderSource(ae,ze),z.compileShader(ae),ae},Pe=function(ze,Ge,ae,Z){if(!ce[ze]){var ge={},we={},_e=z.createProgram();z.attachShader(_e,Te(Ge,z.VERTEX_SHADER)),z.attachShader(_e,Te(ae,z.FRAGMENT_SHADER)),z.linkProgram(_e),ce[ze]={program:_e,transaction:function(Ue){z.useProgram(_e),Ue({setUniform:function(ke,qe){for(var Je=[],nt=arguments.length-2;nt-- >0;)Je[nt]=arguments[nt+2];var tt=we[qe]||(we[qe]=z.getUniformLocation(_e,qe));z["uniform"+ke].apply(z,[tt].concat(Je))},setAttribute:function(ke,qe,Je,nt,tt){var be=ge[ke];be||(be=ge[ke]={buf:z.createBuffer(),loc:z.getAttribLocation(_e,ke),data:null}),z.bindBuffer(z.ARRAY_BUFFER,be.buf),z.vertexAttribPointer(be.loc,qe,z.FLOAT,!1,0,0),z.enableVertexAttribArray(be.loc),j?z.vertexAttribDivisor(be.loc,nt):Me("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(be.loc,nt),tt!==be.data&&(z.bufferData(z.ARRAY_BUFFER,tt,Je),be.data=tt)}})}}}ce[ze].transaction(Z)},oe=function(ze,Ge){ie++;try{z.activeTexture(z.TEXTURE0+ie);var ae=X[ze];ae||(ae=X[ze]=z.createTexture(),z.bindTexture(z.TEXTURE_2D,ae),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MIN_FILTER,z.NEAREST),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MAG_FILTER,z.NEAREST)),z.bindTexture(z.TEXTURE_2D,ae),Ge(ae,ie)}finally{ie--}},Ve=function(ze,Ge,ae){var Z=z.createFramebuffer();fe.push(Z),z.bindFramebuffer(z.FRAMEBUFFER,Z),z.activeTexture(z.TEXTURE0+Ge),z.bindTexture(z.TEXTURE_2D,ze),z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,ze,0);try{ae(Z)}finally{z.deleteFramebuffer(Z),z.bindFramebuffer(z.FRAMEBUFFER,fe[--fe.length-1]||null)}},He=function(){le={},ce={},X={},ie=-1,fe.length=0};var Q=Me,ue=Te,he=Pe,se=oe,Ce=Ve,de=He,j=typeof WebGL2RenderingContext<"u"&&z instanceof WebGL2RenderingContext,le={},ce={},X={},ie=-1,fe=[];z.canvas.addEventListener("webglcontextlost",function(ze){He(),ze.preventDefault()},!1),l.set(z,Y={gl:z,isWebGL2:j,getExtension:Me,withProgram:Pe,withTexture:oe,withTextureFramebuffer:Ve,handleContextLoss:He})}U(Y)}function p(ne,U,z,Y,j,le,ce,X){ce===void 0&&(ce=15),X===void 0&&(X=null),f(ne,function(ie){var fe=ie.gl,Q=ie.withProgram,ue=ie.withTexture;ue("copy",function(he,se){fe.texImage2D(fe.TEXTURE_2D,0,fe.RGBA,j,le,0,fe.RGBA,fe.UNSIGNED_BYTE,U),Q("copy",o,a,function(Ce){var de=Ce.setUniform,Me=Ce.setAttribute;Me("aUV",2,fe.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),de("1i","image",se),fe.bindFramebuffer(fe.FRAMEBUFFER,X||null),fe.disable(fe.BLEND),fe.colorMask(ce&8,ce&4,ce&2,ce&1),fe.viewport(z,Y,j,le),fe.scissor(z,Y,j,le),fe.drawArrays(fe.TRIANGLES,0,3)})})})}function m(ne,U,z){var Y=ne.width,j=ne.height;f(ne,function(le){var ce=le.gl,X=new Uint8Array(Y*j*4);ce.readPixels(0,0,Y,j,ce.RGBA,ce.UNSIGNED_BYTE,X),ne.width=U,ne.height=z,p(ce,X,0,0,Y,j)})}var x=Object.freeze({__proto__:null,withWebGLContext:f,renderImageData:p,resizeWebGLCanvasWithoutClearing:m});function b(ne,U,z,Y,j,le){le===void 0&&(le=1);var ce=new Uint8Array(ne*U),X=Y[2]-Y[0],ie=Y[3]-Y[1],fe=[];s(z,function(Me,Te,Pe,oe){fe.push({x1:Me,y1:Te,x2:Pe,y2:oe,minX:Math.min(Me,Pe),minY:Math.min(Te,oe),maxX:Math.max(Me,Pe),maxY:Math.max(Te,oe)})}),fe.sort(function(Me,Te){return Me.maxX-Te.maxX});for(var Q=0;Q<ne;Q++)for(var ue=0;ue<U;ue++){var he=Ce(Y[0]+X*(Q+.5)/ne,Y[1]+ie*(ue+.5)/U),se=Math.pow(1-Math.abs(he)/j,le)/2;he<0&&(se=1-se),se=Math.max(0,Math.min(255,Math.round(se*255))),ce[ue*ne+Q]=se}return ce;function Ce(Me,Te){for(var Pe=1/0,oe=1/0,Ve=fe.length;Ve--;){var He=fe[Ve];if(He.maxX+oe<=Me)break;if(Me+oe>He.minX&&Te-oe<He.maxY&&Te+oe>He.minY){var ze=M(Me,Te,He.x1,He.y1,He.x2,He.y2);ze<Pe&&(Pe=ze,oe=Math.sqrt(Pe))}}return de(Me,Te)&&(oe=-oe),oe}function de(Me,Te){for(var Pe=0,oe=fe.length;oe--;){var Ve=fe[oe];if(Ve.maxX<=Me)break;var He=Ve.y1>Te!=Ve.y2>Te&&Me<(Ve.x2-Ve.x1)*(Te-Ve.y1)/(Ve.y2-Ve.y1)+Ve.x1;He&&(Pe+=Ve.y1<Ve.y2?1:-1)}return Pe!==0}}function _(ne,U,z,Y,j,le,ce,X,ie,fe){le===void 0&&(le=1),X===void 0&&(X=0),ie===void 0&&(ie=0),fe===void 0&&(fe=0),S(ne,U,z,Y,j,le,ce,null,X,ie,fe)}function S(ne,U,z,Y,j,le,ce,X,ie,fe,Q){le===void 0&&(le=1),ie===void 0&&(ie=0),fe===void 0&&(fe=0),Q===void 0&&(Q=0);for(var ue=b(ne,U,z,Y,j,le),he=new Uint8Array(ue.length*4),se=0;se<ue.length;se++)he[se*4+Q]=ue[se];p(ce,he,ie,fe,ne,U,1<<3-Q,X)}function M(ne,U,z,Y,j,le){var ce=j-z,X=le-Y,ie=ce*ce+X*X,fe=ie?Math.max(0,Math.min(1,((ne-z)*ce+(U-Y)*X)/ie)):0,Q=ne-(z+fe*ce),ue=U-(Y+fe*X);return Q*Q+ue*ue}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);}",P="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);}",k=new Float32Array([0,0,2,0,0,2]),O=null,R=!1,L={},B=new WeakMap;function V(ne){if(!R&&!H(ne))throw new Error("WebGL generation not supported")}function W(ne,U,z,Y,j,le,ce){if(le===void 0&&(le=1),ce===void 0&&(ce=null),!ce&&(ce=O,!ce)){var X=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!X)throw new Error("OffscreenCanvas or DOM canvas not supported");ce=O=X.getContext("webgl",{depth:!1})}V(ce);var ie=new Uint8Array(ne*U*4);f(ce,function(he){var se=he.gl,Ce=he.withTexture,de=he.withTextureFramebuffer;Ce("readable",function(Me,Te){se.texImage2D(se.TEXTURE_2D,0,se.RGBA,ne,U,0,se.RGBA,se.UNSIGNED_BYTE,null),de(Me,Te,function(Pe){ee(ne,U,z,Y,j,le,se,Pe,0,0,0),se.readPixels(0,0,ne,U,se.RGBA,se.UNSIGNED_BYTE,ie)})})});for(var fe=new Uint8Array(ne*U),Q=0,ue=0;Q<ie.length;Q+=4)fe[ue++]=ie[Q];return fe}function G(ne,U,z,Y,j,le,ce,X,ie,fe){le===void 0&&(le=1),X===void 0&&(X=0),ie===void 0&&(ie=0),fe===void 0&&(fe=0),ee(ne,U,z,Y,j,le,ce,null,X,ie,fe)}function ee(ne,U,z,Y,j,le,ce,X,ie,fe,Q){le===void 0&&(le=1),ie===void 0&&(ie=0),fe===void 0&&(fe=0),Q===void 0&&(Q=0),V(ce);var ue=[];s(z,function(he,se,Ce,de){ue.push(he,se,Ce,de)}),ue=new Float32Array(ue),f(ce,function(he){var se=he.gl,Ce=he.isWebGL2,de=he.getExtension,Me=he.withProgram,Te=he.withTexture,Pe=he.withTextureFramebuffer,oe=he.handleContextLoss;if(Te("rawDistances",function(Ve,He){(ne!==Ve._lastWidth||U!==Ve._lastHeight)&&se.texImage2D(se.TEXTURE_2D,0,se.RGBA,Ve._lastWidth=ne,Ve._lastHeight=U,0,se.RGBA,se.UNSIGNED_BYTE,null),Me("main",A,N,function(ze){var Ge=ze.setAttribute,ae=ze.setUniform,Z=!Ce&&de("ANGLE_instanced_arrays"),ge=!Ce&&de("EXT_blend_minmax");Ge("aUV",2,se.STATIC_DRAW,0,k),Ge("aLineSegment",4,se.DYNAMIC_DRAW,1,ue),ae.apply(void 0,["4f","uGlyphBounds"].concat(Y)),ae("1f","uMaxDistance",j),ae("1f","uExponent",le),Pe(Ve,He,function(we){se.enable(se.BLEND),se.colorMask(!0,!0,!0,!0),se.viewport(0,0,ne,U),se.scissor(0,0,ne,U),se.blendFunc(se.ONE,se.ONE),se.blendEquationSeparate(se.FUNC_ADD,Ce?se.MAX:ge.MAX_EXT),se.clear(se.COLOR_BUFFER_BIT),Ce?se.drawArraysInstanced(se.TRIANGLES,0,3,ue.length/4):Z.drawArraysInstancedANGLE(se.TRIANGLES,0,3,ue.length/4)})}),Me("post",o,P,function(ze){ze.setAttribute("aUV",2,se.STATIC_DRAW,0,k),ze.setUniform("1i","tex",He),se.bindFramebuffer(se.FRAMEBUFFER,X),se.disable(se.BLEND),se.colorMask(Q===0,Q===1,Q===2,Q===3),se.viewport(ie,fe,ne,U),se.scissor(ie,fe,ne,U),se.drawArrays(se.TRIANGLES,0,3)})}),se.isContextLost())throw oe(),new Error("webgl context lost")})}function H(ne){var U=!ne||ne===O?L:ne.canvas||ne,z=B.get(U);if(z===void 0){R=!0;var Y=null;try{var j=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],le=W(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,ne);z=le&&j.length===le.length&&le.every(function(ce,X){return ce===j[X]}),z||(Y="bad trial run results",console.info(j,le))}catch(ce){z=!1,Y=ce.message}Y&&console.warn("WebGL SDF generation not supported:",Y),R=!1,B.set(U,z)}return z}var q=Object.freeze({__proto__:null,generate:W,generateIntoCanvas:G,generateIntoFramebuffer:ee,isSupported:H});function J(ne,U,z,Y,j,le){j===void 0&&(j=Math.max(Y[2]-Y[0],Y[3]-Y[1])/2),le===void 0&&(le=1);try{return W.apply(q,arguments)}catch(ce){return console.info("WebGL SDF generation failed, falling back to JS",ce),b.apply(C,arguments)}}function K(ne,U,z,Y,j,le,ce,X,ie,fe){j===void 0&&(j=Math.max(Y[2]-Y[0],Y[3]-Y[1])/2),le===void 0&&(le=1),X===void 0&&(X=0),ie===void 0&&(ie=0),fe===void 0&&(fe=0);try{return G.apply(q,arguments)}catch(Q){return console.info("WebGL SDF generation failed, falling back to JS",Q),_.apply(C,arguments)}}return e.forEachPathCommand=i,e.generate=J,e.generateIntoCanvas=K,e.javascript=C,e.pathToLineSegments=s,e.webgl=q,e.webglUtils=x,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}function l6e(){var t=(function(e){var n={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},i={};r.L=1,i[1]="L",Object.keys(n).forEach(function(oe,Ve){r[oe]=1<<Ve+1,i[r[oe]]=oe}),Object.freeze(r);var s=r.LRI|r.RLI|r.FSI,o=r.L|r.R|r.AL,a=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,l=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,c=r.S|r.WS|r.B|s|r.PDI|l,f=null;function p(){if(!f){f=new Map;var oe=function(He){if(n.hasOwnProperty(He)){var ze=0;n[He].split(",").forEach(function(Ge){var ae=Ge.split("+"),Z=ae[0],ge=ae[1];Z=parseInt(Z,36),ge=ge?parseInt(ge,36):0,f.set(ze+=Z,r[He]);for(var we=0;we<ge;we++)f.set(++ze,r[He])})}};for(var Ve in n)oe(Ve)}}function m(oe){return p(),f.get(oe.codePointAt(0))||r.L}function x(oe){return i[m(oe)]}var b={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function _(oe,Ve){var He=36,ze=0,Ge=new Map,ae=Ve&&new Map,Z;return oe.split(",").forEach(function ge(we){if(we.indexOf("+")!==-1)for(var _e=+we;_e--;)ge(Z);else{Z=we;var ve=we.split(">"),Ue=ve[0],Se=ve[1];Ue=String.fromCodePoint(ze+=parseInt(Ue,He)),Se=String.fromCodePoint(ze+=parseInt(Se,He)),Ge.set(Ue,Se),Ve&&ae.set(Se,Ue)}}),{map:Ge,reverseMap:ae}}var S,M,C;function A(){if(!S){var oe=_(b.pairs,!0),Ve=oe.map,He=oe.reverseMap;S=Ve,M=He,C=_(b.canonical,!1).map}}function N(oe){return A(),S.get(oe)||null}function P(oe){return A(),M.get(oe)||null}function k(oe){return A(),C.get(oe)||null}var O=r.L,R=r.R,L=r.EN,B=r.ES,V=r.ET,W=r.AN,G=r.CS,ee=r.B,H=r.S,q=r.ON,J=r.BN,K=r.NSM,ne=r.AL,U=r.LRO,z=r.RLO,Y=r.LRE,j=r.RLE,le=r.PDF,ce=r.LRI,X=r.RLI,ie=r.FSI,fe=r.PDI;function Q(oe,Ve){for(var He=125,ze=new Uint32Array(oe.length),Ge=0;Ge<oe.length;Ge++)ze[Ge]=m(oe[Ge]);var ae=new Map;function Z(qi,Ys){var Ss=ze[qi];ze[qi]=Ys,ae.set(Ss,ae.get(Ss)-1),Ss&a&&ae.set(a,ae.get(a)-1),ae.set(Ys,(ae.get(Ys)||0)+1),Ys&a&&ae.set(a,(ae.get(a)||0)+1)}for(var ge=new Uint8Array(oe.length),we=new Map,_e=[],ve=null,Ue=0;Ue<oe.length;Ue++)ve||_e.push(ve={start:Ue,end:oe.length-1,level:Ve==="rtl"?1:Ve==="ltr"?0:df(Ue,!1)}),ze[Ue]&ee&&(ve.end=Ue,ve=null);for(var Se=j|Y|z|U|s|fe|le|ee,ke=function(qi){return qi+(qi&1?1:2)},qe=function(qi){return qi+(qi&1?2:1)},Je=0;Je<_e.length;Je++){ve=_e[Je];var nt=[{_level:ve.level,_override:0,_isolate:0}],tt=void 0,be=0,Le=0,Ze=0;ae.clear();for(var Ee=ve.start;Ee<=ve.end;Ee++){var Ye=ze[Ee];if(tt=nt[nt.length-1],ae.set(Ye,(ae.get(Ye)||0)+1),Ye&a&&ae.set(a,(ae.get(a)||0)+1),Ye&Se)if(Ye&(j|Y)){ge[Ee]=tt._level;var it=(Ye===j?qe:ke)(tt._level);it<=He&&!be&&!Le?nt.push({_level:it,_override:0,_isolate:0}):be||Le++}else if(Ye&(z|U)){ge[Ee]=tt._level;var mt=(Ye===z?qe:ke)(tt._level);mt<=He&&!be&&!Le?nt.push({_level:mt,_override:Ye&z?R:O,_isolate:0}):be||Le++}else if(Ye&s){Ye&ie&&(Ye=df(Ee+1,!0)===1?X:ce),ge[Ee]=tt._level,tt._override&&Z(Ee,tt._override);var ft=(Ye===X?qe:ke)(tt._level);ft<=He&&be===0&&Le===0?(Ze++,nt.push({_level:ft,_override:0,_isolate:1,_isolInitIndex:Ee})):be++}else if(Ye&fe){if(be>0)be--;else if(Ze>0){for(Le=0;!nt[nt.length-1]._isolate;)nt.pop();var Qe=nt[nt.length-1]._isolInitIndex;Qe!=null&&(we.set(Qe,Ee),we.set(Ee,Qe)),nt.pop(),Ze--}tt=nt[nt.length-1],ge[Ee]=tt._level,tt._override&&Z(Ee,tt._override)}else Ye&le?(be===0&&(Le>0?Le--:!tt._isolate&&nt.length>1&&(nt.pop(),tt=nt[nt.length-1])),ge[Ee]=tt._level):Ye&ee&&(ge[Ee]=ve.level);else ge[Ee]=tt._level,tt._override&&Ye!==J&&Z(Ee,tt._override)}for(var Ae=[],Xe=null,Re=ve.start;Re<=ve.end;Re++){var Be=ze[Re];if(!(Be&l)){var ot=ge[Re],dt=Be&s,Nt=Be===fe;Xe&&ot===Xe._level?(Xe._end=Re,Xe._endsWithIsolInit=dt):Ae.push(Xe={_start:Re,_end:Re,_level:ot,_startsWithPDI:Nt,_endsWithIsolInit:dt})}}for(var Dt=[],St=0;St<Ae.length;St++){var Ht=Ae[St];if(!Ht._startsWithPDI||Ht._startsWithPDI&&!we.has(Ht._start)){for(var rn=[Xe=Ht],Ut=void 0;Xe&&Xe._endsWithIsolInit&&(Ut=we.get(Xe._end))!=null;)for(var Ft=St+1;Ft<Ae.length;Ft++)if(Ae[Ft]._start===Ut){rn.push(Xe=Ae[Ft]);break}for(var Bt=[],Kt=0;Kt<rn.length;Kt++)for(var dn=rn[Kt],Rt=dn._start;Rt<=dn._end;Rt++)Bt.push(Rt);for(var Pt=ge[Bt[0]],Lt=ve.level,ln=Bt[0]-1;ln>=0;ln--)if(!(ze[ln]&l)){Lt=ge[ln];break}var It=Bt[Bt.length-1],Oe=ge[It],gt=ve.level;if(!(ze[It]&s)){for(var _t=It+1;_t<=ve.end;_t++)if(!(ze[_t]&l)){gt=ge[_t];break}}Dt.push({_seqIndices:Bt,_sosType:Math.max(Lt,Pt)%2?R:O,_eosType:Math.max(gt,Oe)%2?R:O})}}for(var Vt=0;Vt<Dt.length;Vt++){var vn=Dt[Vt],ye=vn._seqIndices,et=vn._sosType,xt=vn._eosType,vt=ge[ye[0]]&1?R:O;if(ae.get(K))for(var ut=0;ut<ye.length;ut++){var qt=ye[ut];if(ze[qt]&K){for(var en=et,Qt=ut-1;Qt>=0;Qt--)if(!(ze[ye[Qt]]&l)){en=ze[ye[Qt]];break}Z(qt,en&(s|fe)?q:en)}}if(ae.get(L))for(var Gt=0;Gt<ye.length;Gt++){var hn=ye[Gt];if(ze[hn]&L)for(var Sn=Gt-1;Sn>=-1;Sn--){var Nn=Sn===-1?et:ze[ye[Sn]];if(Nn&o){Nn===ne&&Z(hn,W);break}}}if(ae.get(ne))for(var nn=0;nn<ye.length;nn++){var Gn=ye[nn];ze[Gn]&ne&&Z(Gn,R)}if(ae.get(B)||ae.get(G))for(var vr=1;vr<ye.length-1;vr++){var sr=ye[vr];if(ze[sr]&(B|G)){for(var Yn=0,fr=0,un=vr-1;un>=0&&(Yn=ze[ye[un]],!!(Yn&l));un--);for(var ls=vr+1;ls<ye.length&&(fr=ze[ye[ls]],!!(fr&l));ls++);Yn===fr&&(ze[sr]===B?Yn===L:Yn&(L|W))&&Z(sr,Yn)}}if(ae.get(L))for(var jn=0;jn<ye.length;jn++){var ys=ye[jn];if(ze[ys]&L){for(var Ps=jn-1;Ps>=0&&ze[ye[Ps]]&(V|l);Ps--)Z(ye[Ps],L);for(jn++;jn<ye.length&&ze[ye[jn]]&(V|l|L);jn++)ze[ye[jn]]!==L&&Z(ye[jn],L)}}if(ae.get(V)||ae.get(B)||ae.get(G))for(var Li=0;Li<ye.length;Li++){var bs=ye[Li];if(ze[bs]&(V|B|G)){Z(bs,q);for(var Sr=Li-1;Sr>=0&&ze[ye[Sr]]&l;Sr--)Z(ye[Sr],q);for(var pi=Li+1;pi<ye.length&&ze[ye[pi]]&l;pi++)Z(ye[pi],q)}}if(ae.get(L))for(var Is=0,ji=et;Is<ye.length;Is++){var ta=ye[Is],va=ze[ta];va&L?ji===O&&Z(ta,O):va&o&&(ji=va)}if(ae.get(a)){var Ra=R|L|W,tc=Ra|O,Tl=[];{for(var ya=[],Os=0;Os<ye.length;Os++)if(ze[ye[Os]]&a){var nc=oe[ye[Os]],Qa=void 0;if(N(nc)!==null)if(ya.length<63)ya.push({char:nc,seqIndex:Os});else break;else if((Qa=P(nc))!==null)for(var Da=ya.length-1;Da>=0;Da--){var Pa=ya[Da].char;if(Pa===Qa||Pa===P(k(nc))||N(k(Pa))===nc){Tl.push([ya[Da].seqIndex,Os]),ya.length=Da;break}}}Tl.sort(function(qi,Ys){return qi[0]-Ys[0]})}for(var Vc=0;Vc<Tl.length;Vc++){for(var Gc=Tl[Vc],rc=Gc[0],na=Gc[1],ho=!1,jo=0,Cl=rc+1;Cl<na;Cl++){var _s=ye[Cl];if(ze[_s]&tc){ho=!0;var Ja=ze[_s]&Ra?R:O;if(Ja===vt){jo=Ja;break}}}if(ho&&!jo){jo=et;for(var el=rc-1;el>=0;el--){var Wc=ye[el];if(ze[Wc]&tc){var ii=ze[Wc]&Ra?R:O;ii!==vt?jo=ii:jo=vt;break}}}if(jo){if(ze[ye[rc]]=ze[ye[na]]=jo,jo!==vt){for(var Wr=rc+1;Wr<ye.length;Wr++)if(!(ze[ye[Wr]]&l)){m(oe[ye[Wr]])&K&&(ze[ye[Wr]]=jo);break}}if(jo!==vt){for(var ra=na+1;ra<ye.length;ra++)if(!(ze[ye[ra]]&l)){m(oe[ye[ra]])&K&&(ze[ye[ra]]=jo);break}}}}for(var wr=0;wr<ye.length;wr++)if(ze[ye[wr]]&a){for(var wi=wr,zi=wr,Kr=et,Ia=wr-1;Ia>=0;Ia--)if(ze[ye[Ia]]&l)wi=Ia;else{Kr=ze[ye[Ia]]&Ra?R:O;break}for(var El=xt,ic=wr+1;ic<ye.length;ic++)if(ze[ye[ic]]&(a|l))zi=ic;else{El=ze[ye[ic]]&Ra?R:O;break}for(var To=wi;To<=zi;To++)ze[ye[To]]=Kr===El?Kr:vt;wr=zi}}}for(var gi=ve.start;gi<=ve.end;gi++){var Eh=ge[gi],yd=ze[gi];if(Eh&1?yd&(O|L|W)&&ge[gi]++:yd&R?ge[gi]++:yd&(W|L)&&(ge[gi]+=2),yd&l&&(ge[gi]=gi===0?ve.level:ge[gi-1]),gi===ve.end||m(oe[gi])&(H|ee))for(var bd=gi;bd>=0&&m(oe[bd])&c;bd--)ge[bd]=ve.level}}return{levels:ge,paragraphs:_e};function df(qi,Ys){for(var Ss=qi;Ss<oe.length;Ss++){var Al=ze[Ss];if(Al&(R|ne))return 1;if(Al&(ee|O)||Ys&&Al===fe)return 0;if(Al&s){var Co=ba(Ss);Ss=Co===-1?oe.length:Co}}return 0}function ba(qi){for(var Ys=1,Ss=qi+1;Ss<oe.length;Ss++){var Al=ze[Ss];if(Al&ee)break;if(Al&fe){if(--Ys===0)return Ss}else Al&s&&Ys++}return-1}}var ue="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",he;function se(){if(!he){var oe=_(ue,!0),Ve=oe.map,He=oe.reverseMap;He.forEach(function(ze,Ge){Ve.set(Ge,ze)}),he=Ve}}function Ce(oe){return se(),he.get(oe)||null}function de(oe,Ve,He,ze){var Ge=oe.length;He=Math.max(0,He==null?0:+He),ze=Math.min(Ge-1,ze==null?Ge-1:+ze);for(var ae=new Map,Z=He;Z<=ze;Z++)if(Ve[Z]&1){var ge=Ce(oe[Z]);ge!==null&&ae.set(Z,ge)}return ae}function Me(oe,Ve,He,ze){var Ge=oe.length;He=Math.max(0,He==null?0:+He),ze=Math.min(Ge-1,ze==null?Ge-1:+ze);var ae=[];return Ve.paragraphs.forEach(function(Z){var ge=Math.max(He,Z.start),we=Math.min(ze,Z.end);if(ge<we){for(var _e=Ve.levels.slice(ge,we+1),ve=we;ve>=ge&&m(oe[ve])&c;ve--)_e[ve]=Z.level;for(var Ue=Z.level,Se=1/0,ke=0;ke<_e.length;ke++){var qe=_e[ke];qe>Ue&&(Ue=qe),qe<Se&&(Se=qe|1)}for(var Je=Ue;Je>=Se;Je--)for(var nt=0;nt<_e.length;nt++)if(_e[nt]>=Je){for(var tt=nt;nt+1<_e.length&&_e[nt+1]>=Je;)nt++;nt>tt&&ae.push([tt+ge,nt+ge])}}}),ae}function Te(oe,Ve,He,ze){var Ge=Pe(oe,Ve,He,ze),ae=[].concat(oe);return Ge.forEach(function(Z,ge){ae[ge]=(Ve.levels[Z]&1?Ce(oe[Z]):null)||oe[Z]}),ae.join("")}function Pe(oe,Ve,He,ze){for(var Ge=Me(oe,Ve,He,ze),ae=[],Z=0;Z<oe.length;Z++)ae[Z]=Z;return Ge.forEach(function(ge){for(var we=ge[0],_e=ge[1],ve=ae.slice(we,_e+1),Ue=ve.length;Ue--;)ae[_e-Ue]=ve[Ue]}),ae}return e.closingToOpeningBracket=P,e.getBidiCharType=m,e.getBidiCharTypeName=x,e.getCanonicalBracket=k,e.getEmbeddingLevels=Q,e.getMirroredCharacter=Ce,e.getMirroredCharactersMap=de,e.getReorderSegments=Me,e.getReorderedIndices=Pe,e.getReorderedString=Te,e.openingToClosingBracket=N,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}const RZ=/\bvoid\s+main\s*\(\s*\)\s*{/g;function $R(t){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function n(r,i){let s=Or[i];return s?$R(s):r}return t.replace(e,n)}const $a=[];for(let t=0;t<256;t++)$a[t]=(t<16?"0":"")+t.toString(16);function c6e(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return($a[t&255]+$a[t>>8&255]+$a[t>>16&255]+$a[t>>24&255]+"-"+$a[e&255]+$a[e>>8&255]+"-"+$a[e>>16&15|64]+$a[e>>24&255]+"-"+$a[n&63|128]+$a[n>>8&255]+"-"+$a[n>>16&255]+$a[n>>24&255]+$a[r&255]+$a[r>>8&255]+$a[r>>16&255]+$a[r>>24&255]).toUpperCase()}const Gg=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},u6e=Date.now(),AF=new WeakMap,NF=new Map;let d6e=1e10;function qR(t,e){const n=m6e(e);let r=AF.get(t);if(r||AF.set(t,r=Object.create(null)),r[n])return new r[n];const i=`_onBeforeCompile${n}`,s=function(c,f){t.onBeforeCompile.call(this,c,f);const p=this.customProgramCacheKey()+"|"+c.vertexShader+"|"+c.fragmentShader;let m=NF[p];if(!m){const x=f6e(this,c,e,n);m=NF[p]=x}c.vertexShader=m.vertexShader,c.fragmentShader=m.fragmentShader,Gg(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-u6e}}),this[i]&&this[i](c)},o=function(){return a(e.chained?t:t.clone())},a=function(c){const f=Object.create(c,l);return Object.defineProperty(f,"baseMaterial",{value:t}),Object.defineProperty(f,"id",{value:d6e++}),f.uuid=c6e(),f.uniforms=Gg({},c.uniforms,e.uniforms),f.defines=Gg({},c.defines,e.defines),f.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",f.extensions=Gg({},c.extensions,e.extensions),f._listeners=void 0,f},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 f=this.baseMaterial;return c===f||f.isDerivedMaterial&&f.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&&(Gg(this.extensions,c.extensions),Gg(this.defines,c.defines),Gg(this.uniforms,QS.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=qR(t.isDerivedMaterial?t.getDepthMaterial():new dE({depthPacking:BY}),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=qR(t.isDerivedMaterial?t.getDistanceMaterial():new fE,e),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms),c}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:c,_distanceMaterial:f}=this;c&&c.dispose(),f&&f.dispose(),t.dispose.call(this)}}};return r[n]=o,new o}function f6e(t,{vertexShader:e,fragmentShader:n},r,i){let{vertexDefs:s,vertexMainIntro:o,vertexMainOutro:a,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:f,fragmentMainOutro:p,fragmentColorTransform:m,customRewriter:x,timeUniform:b}=r;if(s=s||"",o=o||"",a=a||"",c=c||"",f=f||"",p=p||"",(l||x)&&(e=$R(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=$R(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=kF(e,i,s,o,a),n=kF(n,i,c,f,p),{vertexShader:e,fragmentShader:n}}function kF(t,e,n,r,i){return(r||i||n)&&(t=t.replace(RZ,`
${n}
void troikaOrigMain${e}() {`),t+=`
void main() {
  ${r}
  troikaOrigMain${e}();
  ${i}
}`),t}function h6e(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let p6e=0;const RF=new Map;function m6e(t){const e=JSON.stringify(t,h6e);let n=RF.get(e);return n==null&&RF.set(e,n=++p6e),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 g6e(){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=[],f=0;f<l;f++){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 "],f={_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]&&(f[S.trim()]=e[S.trim()].parse(i,p[S].offset,p[S].length,f))}return f},_tabOffset:function(i,s,o){for(var a=e._bin,l=a.readUshort(i,o+4),c=o+12,f=0;f<l;f++){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,f={},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,f.scriptList=e._lctf.readScriptList(i,p+m),f.featureList=e._lctf.readFeatureList(i,p+x),f.lookupList=e._lctf.readLookupList(i,p+b,l),f},e._lctf.readLookupList=function(i,s,o){var a=e._bin,l=s,c=[],f=a.readUshort(i,s);s+=2;for(var p=0;p<f;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 f=a.readUshort(i,s);s+=2;for(var p=c.ltype,m=0;m<f;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 f=o.readUshort(i,s);s+=2;for(var p=0;p<f;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 f=0;f<c;f++){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 f=o.readUshort(i,s);s+=2,l.tab=[];for(var p=0;p<f;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 f=0;f<c;f++){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 f=o.readUshort(i,s);s+=2;for(var p=0;p<f;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=[],f=0;f<l.length-1;f++)c.push(a.readASCII(i,s+l[f],l[f+1]-l[f]));s+=l[l.length-1];var p=[];s=e.CFF.readIndex(i,s,p);var m=[];for(f=0;f<p.length-1;f++)m.push(e.CFF.readDict(i,s+p[f],s+p[f+1]));s+=p[p.length-1];var x=m[0],b=[];s=e.CFF.readIndex(i,s,b);var _=[];for(f=0;f<b.length-1;f++)_.push(a.readASCII(i,s+b[f],b[f+1]-b[f]));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(f=0;f<b.length-1;f++)S.push(a.readBytes(i,s+b[f],b[f+1]-b[f]));x.CharStrings=S}if(x.ROS){s=x.FDArray;var M=[];for(s=e.CFF.readIndex(i,s,M),x.FDArray=[],f=0;f<M.length-1;f++){var C=e.CFF.readDict(i,s+M[f],s+M[f+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,f=0;f<N+1;f++)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,f=l.length;c=f<1240?107:f<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 f=0;f<c;f++)a.push(i[s+f]);return a},e.CFF.readCharset=function(i,s,o){var a=e._bin,l=[".notdef"],c=i[s];if(s++,c==0)for(var f=0;f<o;f++){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),f=0;f<=m;f++)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 f=0;f<l;f++)o.push(i[s+f]);else if(c==2)for(f=0;f<l;f++)o.push(a.readUshort(i,s+2*f));else if(c==3)for(f=0;f<l;f++)o.push(16777215&a.readUint(i,s+3*f-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 f=1,p=null,m=null;l<=20&&(p=l,f=1),l==12&&(p=100*l+c,f=2),21<=l&&l<=27&&(p=l,f=1),l==28&&(m=a.readShort(i,s+1),f=3),29<=l&&l<=31&&(p=l,f=1),32<=l&&l<=246&&(m=l-139,f=1),247<=l&&l<=250&&(m=256*(l-247)+c+108,f=2),251<=l&&l<=254&&(m=256*-(l-251)-c-108,f=2),l==255&&(m=a.readInt(i,s+1)/65535,f=5),o.val=m??"o"+p,o.size=f},e.CFF.readCharString=function(i,s,o){for(var a=s+o,l=e._bin,c=[];s<a;){var f=i[s],p=i[s+1];i[s+2],i[s+3],i[s+4];var m=1,x=null,b=null;f<=20&&(x=f,m=1),f==12&&(x=100*f+p,m=2),f!=19&&f!=20||(x=f,m=2),21<=f&&f<=27&&(x=f,m=1),f==28&&(b=l.readShort(i,s+1),m=3),29<=f&&f<=31&&(x=f,m=1),32<=f&&f<=246&&(b=f-139,m=1),247<=f&&f<=250&&(b=256*(f-247)+p+108,m=2),251<=f&&f<=254&&(b=256*-(f-251)-p-108,m=2),f==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 f=i[s],p=i[s+1];i[s+2],i[s+3],i[s+4];var m=1,x=null,b=null;if(f==28&&(b=a.readShort(i,s+1),m=3),f==29&&(b=a.readInt(i,s+1),m=5),32<=f&&f<=246&&(b=f-139,m=1),247<=f&&f<=250&&(b=256*(f-247)+p+108,m=2),251<=f&&f<=254&&(b=256*-(f-251)-p-108,m=2),f==255)throw b=a.readInt(i,s+1)/65535,m=5,"unknown number";if(f==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"],P=0;P<_.length;P++)A+=N[_[P]];b=parseFloat(A)}f<=21&&(x=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][f],m=1,f==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 f=[];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=f.indexOf(b);if(S==-1){var M;S=l.tables.length,f.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 f=o.readUshort(i,s);s+=2;var p=f/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 f=s+12*c,p=o.readUint(i,f+0),m=o.readUint(i,f+4),x=o.readUint(i,f+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 f=0;f<c.noc;f++)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=[],f=0;f<m;f++){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),f++}}for(c.xs=[],f=0;f<m;f++){var S=(2&c.flags[f])!=0,M=(16&c.flags[f])!=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=[],f=0;f<m;f++)S=(4&c.flags[f])!=0,M=(32&c.flags[f])!=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(f=0;f<m;f++)C+=c.xs[f],A+=c.ys[f],c.xs[f]=C,c.ys[f]=A}else{var N;c.parts=[];do{N=o.readUshort(a,l),l+=2;var P={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(P),P.glyphIndex=o.readUshort(a,l),l+=2,1&N){var k=o.readShort(a,l);l+=2;var O=o.readShort(a,l);l+=2}else k=o.readInt8(a,l),l++,O=o.readInt8(a,l),l++;2&N?(P.m.tx=k,P.m.ty=O):(P.p1=k,P.p2=O),8&N?(P.m.a=P.m.d=o.readF2dot14(a,l),l+=2):64&N?(P.m.a=o.readF2dot14(a,l),l+=2,P.m.d=o.readF2dot14(a,l),l+=2):128&N&&(P.m.a=o.readF2dot14(a,l),l+=2,P.m.b=o.readF2dot14(a,l),l+=2,P.m.c=o.readF2dot14(a,l),l+=2,P.m.d=o.readF2dot14(a,l),l+=2)}while(32&N);if(256&N){var R=o.readUshort(a,l);for(l+=2,c.instr=[],f=0;f<R;f++)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,f={};if(f.fmt=l.readUshort(i,o),o+=2,s==1||s==2||s==3||s==7||s==8&&f.fmt<=2){var p=l.readUshort(i,o);o+=2,f.coverage=e._lctf.readCoverage(i,p+c)}if(s==1&&f.fmt==1){var m=l.readUshort(i,o);o+=2,m!=0&&(f.pos=e.GPOS.readValueRecord(i,o,m))}else if(s==2&&f.fmt>=1&&f.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(f.fmt==1){f.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=[],P=0;P<A;P++){var k=l.readUshort(i,C);C+=2,m!=0&&(W=e.GPOS.readValueRecord(i,C,m),C+=2*b),x!=0&&(G=e.GPOS.readValueRecord(i,C,x),C+=2*_),N.push({gid2:k,val1:W,val2:G})}f.pairsets.push(N)}}if(f.fmt==2){var O=l.readUshort(i,o);o+=2;var R=l.readUshort(i,o);o+=2;var L=l.readUshort(i,o);o+=2;var B=l.readUshort(i,o);for(o+=2,f.classDef1=e._lctf.readClassDef(i,c+O),f.classDef2=e._lctf.readClassDef(i,c+R),f.matrix=[],M=0;M<L;M++){var V=[];for(P=0;P<B;P++){var W=null,G=null;m!=0&&(W=e.GPOS.readValueRecord(i,o,m),o+=2*b),x!=0&&(G=e.GPOS.readValueRecord(i,o,x),o+=2*_),V.push({val1:W,val2:G})}f.matrix.push(V)}}}else if(s==4&&f.fmt==1)f.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),f.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),f.markClassCount=l.readUshort(i,o+4),f.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),f.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,f.markClassCount);else if(s==6&&f.fmt==1)f.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),f.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),f.markClassCount=l.readUshort(i,o+4),f.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),f.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,f.markClassCount);else{if(s==9&&f.fmt==1){var ee=l.readUshort(i,o);o+=2;var H=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=ee;else if(a.ltype!=ee)throw"invalid extension substitution";return e.GPOS.subt(i,a.ltype,c+H)}console.debug("unsupported GPOS table LookupType",s,"format",f.fmt)}return f},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,f=a.readUshort(i,s);s+=2;for(var p=0;p<f;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 f=0;f<c;f++){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,f={};if(f.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&&f.fmt<=2||s==6&&f.fmt<=2){var p=l.readUshort(i,o);o+=2,f.coverage=e._lctf.readCoverage(i,c+p)}if(s==1&&f.fmt>=1&&f.fmt<=2){if(f.fmt==1)f.delta=l.readShort(i,o),o+=2;else if(f.fmt==2){var m=l.readUshort(i,o);o+=2,f.newg=l.readUshorts(i,o,m),o+=2*f.newg.length}}else if(s==2&&f.fmt==1){m=l.readUshort(i,o),o+=2,f.seqs=[];for(var x=0;x<m;x++){var b=l.readUshort(i,o)+c;o+=2;var _=l.readUshort(i,b);f.seqs.push(l.readUshorts(i,b+2,_))}}else if(s==4)for(f.vals=[],m=l.readUshort(i,o),o+=2,x=0;x<m;x++){var S=l.readUshort(i,o);o+=2,f.vals.push(e.GSUB.readLigatureSet(i,c+S))}else if(s==5&&f.fmt==2){if(f.fmt==2){var M=l.readUshort(i,o);o+=2,f.cDef=e._lctf.readClassDef(i,c+M),f.scset=[];var C=l.readUshort(i,o);for(o+=2,x=0;x<C;x++){var A=l.readUshort(i,o);o+=2,f.scset.push(A==0?null:e.GSUB.readSubClassSet(i,c+A))}}}else if(s==6&&f.fmt==3){if(f.fmt==3){for(x=0;x<3;x++){m=l.readUshort(i,o),o+=2;for(var N=[],P=0;P<m;P++)N.push(e._lctf.readCoverage(i,c+l.readUshort(i,o+2*P)));o+=2*m,x==0&&(f.backCvg=N),x==1&&(f.inptCvg=N),x==2&&(f.ahedCvg=N)}m=l.readUshort(i,o),o+=2,f.lookupRec=e.GSUB.readSubstLookupRecords(i,o,m)}}else{if(s==7&&f.fmt==1){var k=l.readUshort(i,o);o+=2;var O=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=k;else if(a.ltype!=k)throw"invalid extension substitution";return e.GSUB.subt(i,a.ltype,c+O)}console.debug("unsupported GSUB table LookupType",s,"format",f.fmt)}return f},e.GSUB.readSubClassSet=function(i,s){var o=e._bin.readUshort,a=s,l=[],c=o(i,s);s+=2;for(var f=0;f<c;f++){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 f=0;f<l-1;f++)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 f=0;f<c;f++){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 f=o.readUshort(i,s);s+=2,c==1&&f--,a[l[c]]=o.readUshorts(i,s,f),s+=2*a[l[c]].length}return f=o.readUshort(i,s),s+=2,a.subst=o.readUshorts(i,s,2*f),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 f=0;f<c;f++){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:[]},f=0,p=0,m=0;m<a.maxp.numGlyphs;m++)m<a.hhea.numberOfHMetrics&&(f=l.readUshort(i,s),s+=2,p=l.readShort(i,s),s+=2),c.aWidth.push(f),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 f=l.readUshort(i,s);s+=2;for(var p={glyph1:[],rval:[]},m=0;m<f;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 f={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,f)}return f},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 f=0;f<c;f++){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=[],f=a.head.indexToLocFormat,p=a.maxp.numGlyphs+1;if(f==0)for(var m=0;m<p;m++)c.push(l.readUshort(i,s+(m<<1))<<1);if(f==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 f,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,P=p[M],k=m+12*c+A;if(b==0)N=a.readUnicode(i,k,C/2);else if(b==3&&_==0)N=a.readUnicode(i,k,C/2);else if(_==0)N=a.readASCII(i,k,C);else if(_==1)N=a.readUnicode(i,k,C/2);else if(_==3)N=a.readUnicode(i,k,C/2);else{if(b!=1)throw"unknown encoding "+_+", platformID: "+b;N=a.readASCII(i,k,C),console.debug("reading unknown MAC encoding "+_+" as ASCII")}var O="p"+b+","+S.toString(16);l[O]==null&&(l[O]={}),l[O][P!==void 0?P:M]=N,l[O]._lang=S}for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==1033)return l[R];for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==0)return l[R];for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==3084)return l[R];for(var R in l)if(l[R].postScriptName!=null)return l[R];for(var R in l){f=R;break}return console.debug("returning name table with languageID "+l[f]._lang),l[f]},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,f=0;f<l.endCount.length;f++)if(s<=l.endCount[f]){c=f;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(f=0;f<l.groups.length;f++){var p=l.groups[f];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,f=i.CFF.Private;if(c.ROS){for(var p=0;c.FDSelect[p+2]<=s;)p+=2;f=c.FDArray[c.FDSelect[p+1]].Private}e.U._drawCFF(i.CFF.CharStrings[s],l,c,f,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 f=c==a?l:c-1,p=c==l?a:c+1,m=1&i.flags[c],x=1&i.flags[f],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[f],i.ys[f])}else x?e.U.P.moveTo(s,i.xs[f],i.ys[f]):e.U.P.moveTo(s,(i.xs[f]+_)/2,(i.ys[f]+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 f=c.m,p=0;p<l.crds.length;p+=2){var m=l.crds[p],x=l.crds[p+1];o.crds.push(m*f.a+x*f.b+f.tx),o.crds.push(m*f.c+x*f.d+f.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 f,p=o.tabs[c];if(!p.coverage||(f=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[f];else if(o.ltype==4)for(var m=p.vals[f],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],P=p.scset[N],k=0;k<P.length;k++){var O=P[k],R=O.input;if(!(R.length>l)){for(S=!0,C=0;C<R.length;C++){var L=e._lctf.getInterval(p.cDef,i[s+1+C]);if(A==-1&&p.cDef[L+2]!=R[C]){S=!1;break}}if(S){var B=O.substLookupRecords;for(x=0;x<B.length;x+=2)B[x],B[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 V=p.lookupRec;for(k=0;k<V.length;k+=2){A=V[k];var W=a[V[k+1]];e.U._applySubs(i,s+A,W,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 f=s[c];if(f!=-1){for(var p=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,m=e.U.glyphToPath(i,f),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[f],c<s.length-1&&(l+=e.U.getPairAdjustment(i,f,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,f){i.cmds.push("C"),i.crds.push(s,o,a,l,c,f)},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,f=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,P=0,k=0,O=0,R=0,L=0,B=0,V={val:0,size:0};b<i.length;){e.CFF.getCharString(i,b,V);var W=V.val;if(b+=V.size,W=="o1"||W=="o18")c.length%2!=0&&!p&&(m=c.shift()+a.nominalWidthX),f+=c.length>>1,c.length=0,p=!0;else if(W=="o3"||W=="o23")c.length%2!=0&&!p&&(m=c.shift()+a.nominalWidthX),f+=c.length>>1,c.length=0,p=!0;else if(W=="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(W=="o5")for(;c.length>0;)_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S);else if(W=="o6"||W=="o7")for(var G=c.length,ee=W=="o6",H=0;H<G;H++){var q=c.shift();ee?_+=q:S+=q,ee=!ee,e.U.P.lineTo(l,_,S)}else if(W=="o8"||W=="o24"){G=c.length;for(var J=0;J+6<=G;)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),J+=6;W=="o24"&&(_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S))}else{if(W=="o11")break;if(W=="o1234"||W=="o1235"||W=="o1236"||W=="o1237")W=="o1234"&&(C=S,A=(M=_+c.shift())+c.shift(),B=N=C+c.shift(),k=N,R=S,_=(O=(P=(L=A+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,M,C,A,N,L,B),e.U.P.curveTo(l,P,k,O,R,_,S)),W=="o1235"&&(M=_+c.shift(),C=S+c.shift(),A=M+c.shift(),N=C+c.shift(),L=A+c.shift(),B=N+c.shift(),P=L+c.shift(),k=B+c.shift(),O=P+c.shift(),R=k+c.shift(),_=O+c.shift(),S=R+c.shift(),c.shift(),e.U.P.curveTo(l,M,C,A,N,L,B),e.U.P.curveTo(l,P,k,O,R,_,S)),W=="o1236"&&(M=_+c.shift(),C=S+c.shift(),A=M+c.shift(),B=N=C+c.shift(),k=N,O=(P=(L=A+c.shift())+c.shift())+c.shift(),R=k+c.shift(),_=O+c.shift(),e.U.P.curveTo(l,M,C,A,N,L,B),e.U.P.curveTo(l,P,k,O,R,_,S)),W=="o1237"&&(M=_+c.shift(),C=S+c.shift(),A=M+c.shift(),N=C+c.shift(),L=A+c.shift(),B=N+c.shift(),P=L+c.shift(),k=B+c.shift(),O=P+c.shift(),R=k+c.shift(),Math.abs(O-_)>Math.abs(R-S)?_=O+c.shift():S=R+c.shift(),e.U.P.curveTo(l,M,C,A,N,L,B),e.U.P.curveTo(l,P,k,O,R,_,S));else if(W=="o14"){if(c.length>0&&!p&&(m=c.shift()+o.nominalWidthX,p=!0),c.length==4){var K=c.shift(),ne=c.shift(),U=c.shift(),z=c.shift(),Y=e.CFF.glyphBySE(o,U),j=e.CFF.glyphBySE(o,z);e.U._drawCFF(o.CharStrings[Y],s,o,a,l),s.x=K,s.y=ne,e.U._drawCFF(o.CharStrings[j],s,o,a,l)}x&&(e.U.P.closePath(l),x=!1)}else if(W=="o19"||W=="o20")c.length%2!=0&&!p&&(m=c.shift()+a.nominalWidthX),f+=c.length>>1,c.length=0,p=!0,b+=f+7>>3;else if(W=="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(W=="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(W=="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(W=="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(W=="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(W=="o10"||W=="o29"){var le=W=="o10"?a:o;if(c.length==0)console.debug("error: empty stack");else{var ce=c.pop(),X=le.Subrs[ce+le.Bias];s.x=_,s.y=S,s.nStems=f,s.haveWidth=p,s.width=m,s.open=x,e.U._drawCFF(X,s,o,a,l),_=s.x,S=s.y,f=s.nStems,p=s.haveWidth,m=s.width,x=s.open}}else if(W=="o30"||W=="o31"){var ie=c.length,fe=(J=0,W=="o31");for(J+=ie-(G=-3&ie);J<G;)fe?(C=S,A=(M=_+c.shift())+c.shift(),S=(N=C+c.shift())+c.shift(),G-J==5?(_=A+c.shift(),J++):_=A,fe=!1):(M=_,C=S+c.shift(),A=M+c.shift(),N=C+c.shift(),_=A+c.shift(),G-J==5?(S=N+c.shift(),J++):S=N,fe=!0),e.U.P.curveTo(l,M,C,A,N,_,S),J+=4}else{if((W+"").charAt(0)=="o")throw console.debug("Unknown operation: "+W,i),W;c.push(W)}}}s.x=_,s.y=S,s.nStems=f,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 x6e(){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(W,G){for(var ee=new n(31),H=0;H<31;++H)ee[H]=G+=1<<W[H-1];var q=new r(ee[30]);for(H=1;H<30;++H)for(var J=ee[H];J<ee[H+1];++J)q[J]=J-ee[H]<<5|H;return[ee,q]},l=a(i,2),c=l[0],f=l[1];c[28]=258,f[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(W,G,ee){for(var H=W.length,q=0,J=new n(G);q<H;++q)++J[W[q]-1];var K,ne=new n(G);for(q=0;q<G;++q)ne[q]=ne[q-1]+J[q-1]<<1;{K=new n(1<<G);var U=15-G;for(q=0;q<H;++q)if(W[q])for(var z=q<<4|W[q],Y=G-W[q],j=ne[W[q]-1]++<<Y,le=j|(1<<Y)-1;j<=le;++j)K[m[j]>>>U]=z}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(W){for(var G=W[0],ee=1;ee<W.length;++ee)W[ee]>G&&(G=W[ee]);return G},P=function(W,G,ee){var H=G/8|0;return(W[H]|W[H+1]<<8)>>(7&G)&ee},k=function(W,G){var ee=G/8|0;return(W[ee]|W[ee+1]<<8|W[ee+2]<<16)>>(7&G)},O=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],R=function(W,G,ee){var H=new Error(G||O[W]);if(H.code=W,Error.captureStackTrace&&Error.captureStackTrace(H,R),!ee)throw H;return H},L=function(W,G,ee){var H=W.length;if(!H||ee&&!ee.l&&H<5)return G||new e(0);var q=!G||ee,J=!ee||ee.i;ee||(ee={}),G||(G=new e(3*H));var K,ne=function(tt){var be=G.length;if(tt>be){var Le=new e(Math.max(2*be,tt));Le.set(G),G=Le}},U=ee.f||0,z=ee.p||0,Y=ee.b||0,j=ee.l,le=ee.d,ce=ee.m,X=ee.n,ie=8*H;do{if(!j){ee.f=U=P(W,z,1);var fe=P(W,z+1,3);if(z+=3,!fe){var Q=W[(He=((K=z)/8|0)+(7&K&&1)+4)-4]|W[He-3]<<8,ue=He+Q;if(ue>H){J&&R(0);break}q&&ne(Y+Q),G.set(W.subarray(He,ue),Y),ee.b=Y+=Q,ee.p=z=8*ue;continue}if(fe==1)j=C,le=A,ce=9,X=5;else if(fe==2){var he=P(W,z,31)+257,se=P(W,z+10,15)+4,Ce=he+P(W,z+5,31)+1;z+=14;for(var de=new e(Ce),Me=new e(19),Te=0;Te<se;++Te)Me[o[Te]]=P(W,z+3*Te,7);z+=3*se;var Pe=N(Me),oe=(1<<Pe)-1,Ve=_(Me,Pe);for(Te=0;Te<Ce;){var He,ze=Ve[P(W,z,oe)];if(z+=15&ze,(He=ze>>>4)<16)de[Te++]=He;else{var Ge=0,ae=0;for(He==16?(ae=3+P(W,z,3),z+=2,Ge=de[Te-1]):He==17?(ae=3+P(W,z,7),z+=3):He==18&&(ae=11+P(W,z,127),z+=7);ae--;)de[Te++]=Ge}}var Z=de.subarray(0,he),ge=de.subarray(he);ce=N(Z),X=N(ge),j=_(Z,ce),le=_(ge,X)}else R(1);if(z>ie){J&&R(0);break}}q&&ne(Y+131072);for(var we=(1<<ce)-1,_e=(1<<X)-1,ve=z;;ve=z){var Ue=(Ge=j[k(W,z)&we])>>>4;if((z+=15&Ge)>ie){J&&R(0);break}if(Ge||R(2),Ue<256)G[Y++]=Ue;else{if(Ue==256){ve=z,j=null;break}var Se=Ue-254;if(Ue>264){var ke=i[Te=Ue-257];Se=P(W,z,(1<<ke)-1)+c[Te],z+=ke}var qe=le[k(W,z)&_e],Je=qe>>>4;if(qe||R(3),z+=15&qe,ge=p[Je],Je>3&&(ke=s[Je],ge+=k(W,z)&(1<<ke)-1,z+=ke),z>ie){J&&R(0);break}q&&ne(Y+131072);for(var nt=Y+Se;Y<nt;Y+=4)G[Y]=G[Y-ge],G[Y+1]=G[Y+1-ge],G[Y+2]=G[Y+2-ge],G[Y+3]=G[Y+3-ge];Y=nt}}ee.l=j,ee.p=ve,ee.b=Y,j&&(U=1,ee.m=ce,ee.d=le,ee.n=X)}while(!U);return Y==G.length?G:(function(tt,be,Le){(Le==null||Le>tt.length)&&(Le=tt.length);var Ze=new(tt instanceof n?n:tt instanceof r?r:e)(Le-be);return Ze.set(tt.subarray(be,Le)),Ze})(G,0,Y)},B=new e(0),V=typeof TextDecoder<"u"&&new TextDecoder;try{V.decode(B,{stream:!0})}catch{}return t.convert_streams=function(W){var G=new DataView(W),ee=0;function H(){var he=G.getUint16(ee);return ee+=2,he}function q(){var he=G.getUint32(ee);return ee+=4,he}function J(he){Q.setUint16(ue,he),ue+=2}function K(he){Q.setUint32(ue,he),ue+=4}for(var ne={signature:q(),flavor:q(),length:q(),numTables:H(),reserved:H(),totalSfntSize:q(),majorVersion:H(),minorVersion:H(),metaOffset:q(),metaLength:q(),metaOrigLength:q(),privOffset:q(),privLength:q()},U=0;Math.pow(2,U)<=ne.numTables;)U++;U--;for(var z=16*Math.pow(2,U),Y=16*ne.numTables-z,j=12,le=[],ce=0;ce<ne.numTables;ce++)le.push({tag:q(),offset:q(),compLength:q(),origLength:q(),origChecksum:q()}),j+=16;var X,ie=new Uint8Array(12+16*le.length+le.reduce((function(he,se){return he+se.origLength+4}),0)),fe=ie.buffer,Q=new DataView(fe),ue=0;return K(ne.flavor),J(ne.numTables),J(z),J(U),J(Y),le.forEach((function(he){K(he.tag),K(he.origChecksum),K(j),K(he.origLength),he.outOffset=j,(j+=he.origLength)%4!=0&&(j+=4-j%4)})),le.forEach((function(he){var se,Ce=W.slice(he.offset,he.offset+he.compLength);if(he.compLength!=he.origLength){var de=new Uint8Array(he.origLength);se=new Uint8Array(Ce,2),L(se,de)}else de=new Uint8Array(Ce);ie.set(de,he.outOffset);var Me=0;(j=he.outOffset+he.origLength)%4!=0&&(Me=4-j%4),ie.set(new Uint8Array(Me).buffer,he.outOffset+he.origLength),X=j+Me})),fe.slice(0,X)},Object.defineProperty(t,"__esModule",{value:!0}),t})({}).convert_streams}function v6e(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 f;function p(O){if(!f){const R={R:s,L:i,D:o,C:l,U:c,T:a};f=new Map;for(let L in r){let B=0;r[L].split(",").forEach(V=>{let[W,G]=V.split("+");W=parseInt(W,36),G=G?parseInt(G,36):0,f.set(B+=W,R[L]);for(let ee=G;ee--;)f.set(++B,R[L])})}}return f.get(O)||c}const m=1,x=2,b=3,_=4,S=[null,"isol","init","fina","medi"];function M(O){const R=new Uint8Array(O.length);let L=c,B=m,V=-1;for(let W=0;W<O.length;W++){const G=O.codePointAt(W);let ee=p(G)|0,H=m;ee&a||(L&(i|o|l)?ee&(s|o|l)?(H=b,(B===m||B===b)&&R[V]++):ee&(i|c)&&(B===x||B===_)&&R[V]--:L&(s|c)&&(B===x||B===_)&&R[V]--,B=R[W]=H,L=ee,V=W,G>65535&&W++)}return R}function C(O,R){const L=[];for(let V=0;V<R.length;V++){const W=R.codePointAt(V);W>65535&&V++,L.push(t.U.codeToGlyph(O,W))}const B=O.GSUB;if(B){const{lookupList:V,featureList:W}=B;let G;const ee=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,H=[];W.forEach(q=>{if(ee.test(q.tag))for(let J=0;J<q.tab.length;J++){if(H[q.tab[J]])continue;H[q.tab[J]]=!0;const K=V[q.tab[J]],ne=/^(isol|init|fina|medi)$/.test(q.tag);ne&&!G&&(G=M(R));for(let U=0;U<L.length;U++)(!G||!ne||S[G[U]]===q.tag)&&t.U._applySubs(L,U,K,V)}})}return L}function A(O,R){const L=new Int16Array(R.length*3);let B=0;for(;B<R.length;B++){const ee=R[B];if(ee===-1)continue;L[B*3+2]=O.hmtx.aWidth[ee];const H=O.GPOS;if(H){const q=H.lookupList;for(let J=0;J<q.length;J++){const K=q[J];for(let ne=0;ne<K.tabs.length;ne++){const U=K.tabs[ne];if(K.ltype===1){if(t._lctf.coverageIndex(U.coverage,ee)!==-1&&U.pos){G(U.pos,B);break}}else if(K.ltype===2){let z=null,Y=V();if(Y!==-1){const j=t._lctf.coverageIndex(U.coverage,R[Y]);if(j!==-1){if(U.fmt===1){const le=U.pairsets[j];for(let ce=0;ce<le.length;ce++)le[ce].gid2===ee&&(z=le[ce])}else if(U.fmt===2){const le=t.U._getGlyphClass(R[Y],U.classDef1),ce=t.U._getGlyphClass(ee,U.classDef2);z=U.matrix[le][ce]}if(z){z.val1&&G(z.val1,Y),z.val2&&G(z.val2,B);break}}}}else if(K.ltype===4){const z=t._lctf.coverageIndex(U.markCoverage,ee);if(z!==-1){const Y=V(W),j=Y===-1?-1:t._lctf.coverageIndex(U.baseCoverage,R[Y]);if(j!==-1){const le=U.markArray[z],ce=U.baseArray[j][le.markClass];L[B*3]=ce.x-le.x+L[Y*3]-L[Y*3+2],L[B*3+1]=ce.y-le.y+L[Y*3+1];break}}}else if(K.ltype===6){const z=t._lctf.coverageIndex(U.mark1Coverage,ee);if(z!==-1){const Y=V();if(Y!==-1){const j=R[Y];if(N(O,j)===3){const le=t._lctf.coverageIndex(U.mark2Coverage,j);if(le!==-1){const ce=U.mark1Array[z],X=U.mark2Array[le][ce.markClass];L[B*3]=X.x-ce.x+L[Y*3]-L[Y*3+2],L[B*3+1]=X.y-ce.y+L[Y*3+1];break}}}}}}}}else if(O.kern&&!O.cff){const q=V();if(q!==-1){const J=O.kern.glyph1.indexOf(R[q]);if(J!==-1){const K=O.kern.rval[J].glyph2.indexOf(ee);K!==-1&&(L[q*3+2]+=O.kern.rval[J].vals[K])}}}}return L;function V(ee){for(let H=B-1;H>=0;H--)if(R[H]!==-1&&(!ee||ee(R[H])))return H;return-1}function W(ee){return N(O,ee)===1}function G(ee,H){for(let q=0;q<3;q++)L[H*3+q]+=ee[q]||0}}function N(O,R){const L=O.GDEF&&O.GDEF.glyphClassDef;return L?t.U._getGlyphClass(R,L):0}function P(...O){for(let R=0;R<O.length;R++)if(typeof O[R]=="number")return O[R]}function k(O){const R=Object.create(null),L=O["OS/2"],B=O.hhea,V=O.head.unitsPerEm,W=P(L&&L.sTypoAscender,B&&B.ascender,V),G={unitsPerEm:V,ascender:W,descender:P(L&&L.sTypoDescender,B&&B.descender,0),capHeight:P(L&&L.sCapHeight,W),xHeight:P(L&&L.sxHeight,W),lineGap:P(L&&L.sTypoLineGap,B&&B.lineGap),supportsCodePoint(ee){return t.U.codeToGlyph(O,ee)>0},forEachGlyph(ee,H,q,J){let K=0;const ne=1/G.unitsPerEm*H,U=C(O,ee);let z=0;const Y=A(O,U);return U.forEach((j,le)=>{if(j!==-1){let ce=R[j];if(!ce){const{cmds:X,crds:ie}=t.U.glyphToPath(O,j);let fe="",Q=0;for(let de=0,Me=X.length;de<Me;de++){const Te=n[X[de]];fe+=X[de];for(let Pe=1;Pe<=Te;Pe++)fe+=(Pe>1?",":"")+ie[Q++]}let ue,he,se,Ce;if(ie.length){ue=he=1/0,se=Ce=-1/0;for(let de=0,Me=ie.length;de<Me;de+=2){let Te=ie[de],Pe=ie[de+1];Te<ue&&(ue=Te),Pe<he&&(he=Pe),Te>se&&(se=Te),Pe>Ce&&(Ce=Pe)}}else ue=se=he=Ce=0;ce=R[j]={index:j,advanceWidth:O.hmtx.aWidth[j],xMin:ue,yMin:he,xMax:se,yMax:Ce,path:fe}}J.call(null,ce,K+Y[le*3]*ne,Y[le*3+1]*ne,z),K+=Y[le*3+2]*ne,q&&(K+=q*H)}z+=ee.codePointAt(z)>65535?2:1}),K}};return G}return function(R){const L=new Uint8Array(R,0,4),B=t._bin.readASCII(L,0,4);if(B==="wOFF")R=e(R);else if(B==="wOF2")throw new Error("woff2 fonts not supported");return k(t.parse(R)[0])}}const y6e=sb({name:"Typr Font Parser",dependencies:[g6e,x6e,v6e],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 b6e(){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,P){A.push((+P).toString(36)+":"+N.toString(36))})),A.join(",")},e.prototype.deserialize=function(A){var N=this;this.buckets.clear(),A.split(",").forEach((function(P){var k=P.split(":");N.buckets.set(parseInt(k[0],36),parseInt(k[1],36))}))};var n=Math.pow(2,8),r=n-1,i=~r;function s(A){var N=(function(k){return k&i})(A).toString(16),P=(function(k){return(k&i)+n-1})(A).toString(16);return"codepoint-index/plane"+(A>>16)+"/"+N+"-"+P+".json"}function o(A,N){var P=A&r,k=N.codePointAt(P/6|0);return((k=(k||48)-48)&1<<P%6)!=0}function a(A,N){var P;(P=A,P.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(k){return k.split("-").map((function(O){return parseInt(O.trim(),16)}))}))).forEach((function(k){var O=k[0],R=k[1];R===void 0&&(R=O),N(O,R)}))}function l(A,N){a(A,(function(P,k){for(var O=P;O<=k;O++)N(O)}))}var c={},f={},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(P){return N.add(P)})),p.set(A,N)),N}var b,_=new Map;function S(A,N,P){return A[N]?N:A[P]?P:(function(k){for(var O in k)return O})(A)}function M(A,N){var P=N;if(!A.includes(P)){P=1/0;for(var k=0;k<A.length;k++)Math.abs(A[k]-N)<Math.abs(P-N)&&(P=A[k])}return P}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={},f={}},t.getFontsForString=function(A,N){N===void 0&&(N={});var P,k=N.lang;k===void 0&&(k=new RegExp("\\p{Script=Hangul}","u").test(P=A)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(P)?"ja":"en");var O=N.category;O===void 0&&(O="sans-serif");var R=N.style;R===void 0&&(R="normal");var L=N.weight;L===void 0&&(L=400);var B=(N.dataUrl||m).replace(/\/$/g,""),V=new Map,W=new Uint8Array(A.length),G={},ee={},H=new Array(A.length),q=new Map,J=!1;function K(z){var Y=_.get(z);return Y||(Y=fetch(B+"/"+z).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(B!==m)return J||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+B+'", trying default CDN. '+j.message),J=!0),B=m,_.delete(z),K(z);throw j})),_.set(z,Y)),Y}for(var ne=function(z){var Y=A.codePointAt(z),j=s(Y);H[z]=j,c[j]||q.has(j)||q.set(j,K(j).then((function(le){c[j]=le}))),Y>65535&&(z++,U=z)},U=0;U<A.length;U++)ne(U);return Promise.all(q.values()).then((function(){q.clear();for(var z=function(j){var le=A.codePointAt(j),ce=null,X=c[H[j]],ie=void 0;for(var fe in X){var Q=ee[fe];if(Q===void 0&&(Q=ee[fe]=new RegExp(fe).test(k||"en")),Q){for(var ue in ie=fe,X[fe])if(o(le,X[fe][ue])){ce=ue;break}break}}if(!ce){e:for(var he in X)if(he!==ie){for(var se in X[he])if(o(le,X[he][se])){ce=se;break e}}}ce||(console.debug("No font coverage for U+"+le.toString(16)),ce="latin"),H[j]=ce,f[ce]||q.has(ce)||q.set(ce,K("font-meta/"+ce+".json").then((function(Ce){f[ce]=Ce}))),le>65535&&(j++,Y=j)},Y=0;Y<A.length;Y++)z(Y);return Promise.all(q.values())})).then((function(){for(var z,Y=null,j=0;j<A.length;j++){var le=A.codePointAt(j);if(Y&&(C(le)||x(Y).has(le)))W[j]=W[j-1];else{Y=f[H[j]];var ce=G[Y.id];if(!ce){var X=Y.typeforms,ie=S(X,O,"sans-serif"),fe=S(X[ie],R,"normal"),Q=M((z=X[ie])===null||z===void 0?void 0:z[fe],L);ce=G[Y.id]=B+"/font-files/"+Y.id+"/"+ie+"."+fe+"."+Q+".woff"}var ue=V.get(ce);ue==null&&(ue=V.size,V.set(ce,ue)),W[j]=ue}le>65535&&(j++,W[j]=W[j-1])}return{fontUrls:Array.from(V.keys()),chars:W}}))},Object.defineProperty(t,"__esModule",{value:!0}),t})({})}function _6e(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 f=t(c.response);f.src=o,a(f)}catch(f){l(f)}},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(f=>f(c)),delete r[o]}))}return function(o,a,{lang:l,fonts:c=[],style:f="normal",weight:p="normal",unicodeFontsURL:m}={}){const x=new Uint8Array(o.length),b=[];o.length||C();const _=new Map,S=[];if(f!=="italic"&&(f="normal"),typeof p!="number"&&(p=p==="bold"?700:400),c&&!Array.isArray(c)&&(c=[c]),c=c.slice().filter(N=>!N.lang||N.lang.test(l)).reverse(),c.length){let O=0;(function R(L=0){for(let B=L,V=o.length;B<V;B++){const W=o.codePointAt(B);if(O===1&&b[x[B-1]].supportsCodePoint(W)||B>0&&/\s/.test(o[B]))x[B]=x[B-1],O===2&&(S[S.length-1][1]=B);else for(let G=x[B],ee=c.length;G<=ee;G++)if(G===ee){const H=O===2?S[S.length-1]:S[S.length]=[B,B];H[1]=B,O=2}else{x[B]=G;const{src:H,unicodeRange:q}=c[G];if(!q||A(W,q)){const J=n[H];if(!J){s(H,()=>{R(B)});return}if(J.supportsCodePoint(W)){let K=_.get(J);typeof K!="number"&&(K=b.length,b.push(J),_.set(J,K)),x[B]=K,O=1;break}}}W>65535&&B+1<V&&(x[B+1]=x[B],B++,O===2&&(S[S.length-1][1]=B))}M()})()}else S.push([0,o.length-1]),M();function M(){if(S.length){const N=S.map(P=>o.substring(P[0],P[1]+1)).join(`
`);e.getFontsForString(N,{lang:l||void 0,style:f,weight:p,dataUrl:m}).then(({fontUrls:P,chars:k})=>{const O=b.length;let R=0;S.forEach(B=>{for(let V=0,W=B[1]-B[0];V<=W;V++)x[B[0]+V]=k[R++]+O;R++});let L=0;P.forEach((B,V)=>{s(B,W=>{b[V+O]=W,++L===P.length&&C()})})})}else C()}function C(){a({chars:x,fonts:b})}function A(N,P){for(let k=0;k<P.length;k++){const[O,R=O]=P[k];if(O<=N&&N<=R)return!0}return!1}}}const S6e=sb({name:"FontResolver",dependencies:[_6e,y6e,b6e],init(t,e,n){return t(e,n())}});function w6e(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},P){const k=({chars:O,fonts:R})=>{let L,B;const V=[];for(let W=0;W<O.length;W++)O[W]!==B?(B=O[W],V.push(L={start:W,end:W,fontObj:R[O[W]]})):L.end=W;P(V)};A?k(A):t(b,k,{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:P=0,lineHeight:k="normal",maxWidth:O=1/0,direction:R,textAlign:L="left",textIndent:B=0,whiteSpace:V="normal",overflowWrap:W="normal",anchorX:G=0,anchorY:ee=0,metricsOnly:H=!1,unicodeFontsURL:q,preResolvedFonts:J=null,includeCaretPositions:K=!1,chunkedBoundsSize:ne=8192,colorRanges:U=null},z){const Y=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,P=+P,O=+O,k=k||"normal",B=+B,o({text:b,lang:S,style:N,weight:A,fonts:typeof _=="string"?[{src:_}]:_,unicodeFontsURL:q,preResolvedFonts:J},le=>{j.fontLoad=p()-Y;const ce=isFinite(O);let X=null,ie=null,fe=null,Q=null,ue=null,he=null,se=null,Ce=null,de=0,Me=0,Te=V!=="nowrap";const Pe=new Map,oe=p();let Ve=B,He=0,ze=new m;const Ge=[ze];le.forEach(_e=>{const{fontObj:ve}=_e,{ascender:Ue,descender:Se,unitsPerEm:ke,lineGap:qe,capHeight:Je,xHeight:nt}=ve;let tt=Pe.get(ve);if(!tt){const Ye=C/ke,it=k==="normal"?(Ue-Se+qe)*Ye:k*C,mt=(it-(Ue-Se)*Ye)/2,ft=Math.min(it,(Ue-Se)*Ye),Qe=(Ue+Se)/2*Ye+ft/2;tt={index:Pe.size,src:ve.src,fontObj:ve,fontSizeMult:Ye,unitsPerEm:ke,ascender:Ue*Ye,descender:Se*Ye,capHeight:Je*Ye,xHeight:nt*Ye,lineHeight:it,baseline:-mt-Ue*Ye,caretTop:Qe,caretBottom:Qe-ft},Pe.set(ve,tt)}const{fontSizeMult:be}=tt,Le=b.slice(_e.start,_e.end+1);let Ze,Ee;ve.forEachGlyph(Le,C,P,(Ye,it,mt,ft)=>{it+=He,ft+=_e.start,Ze=it,Ee=Ye;const Qe=b.charAt(ft),Ae=Ye.advanceWidth*be,Xe=ze.count;let Re;if("isEmpty"in Ye||(Ye.isWhitespace=!!Qe&&new RegExp(i).test(Qe),Ye.canBreakAfter=!!Qe&&s.test(Qe),Ye.isEmpty=Ye.xMin===Ye.xMax||Ye.yMin===Ye.yMax||r.test(Qe)),!Ye.isWhitespace&&!Ye.isEmpty&&Me++,Te&&ce&&!Ye.isWhitespace&&it+Ae+Ve>O&&Xe){if(ze.glyphAt(Xe-1).glyphObj.canBreakAfter)Re=new m,Ve=-it;else for(let ot=Xe;ot--;)if(ot===0&&W==="break-word"){Re=new m,Ve=-it;break}else if(ze.glyphAt(ot).glyphObj.canBreakAfter){Re=ze.splitAt(ot+1);const dt=Re.glyphAt(0).x;Ve-=dt;for(let Nt=Re.count;Nt--;)Re.glyphAt(Nt).x-=dt;break}Re&&(ze.isSoftWrapped=!0,ze=Re,Ge.push(ze),de=O)}let Be=ze.glyphAt(ze.count);Be.glyphObj=Ye,Be.x=it+Ve,Be.y=mt,Be.width=Ae,Be.charIndex=ft,Be.fontData=tt,Qe===`
`&&(ze=new m,Ge.push(ze),Ve=-(it+Ae+P*C)+B)}),He=Ze+Ee.advanceWidth*be+P*C});let ae=0;Ge.forEach(_e=>{let ve=!0;for(let Ue=_e.count;Ue--;){const Se=_e.glyphAt(Ue);ve&&!Se.glyphObj.isWhitespace&&(_e.width=Se.x+Se.width,_e.width>de&&(de=_e.width),ve=!1);let{lineHeight:ke,capHeight:qe,xHeight:Je,baseline:nt}=Se.fontData;ke>_e.lineHeight&&(_e.lineHeight=ke);const tt=nt-_e.baseline;tt<0&&(_e.baseline+=tt,_e.cap+=tt,_e.ex+=tt),_e.cap=Math.max(_e.cap,_e.baseline+qe),_e.ex=Math.max(_e.ex,_e.baseline+Je)}_e.baseline-=ae,_e.cap-=ae,_e.ex-=ae,ae+=_e.lineHeight});let Z=0,ge=0;if(G&&(typeof G=="number"?Z=-G:typeof G=="string"&&(Z=-de*(G==="left"?0:G==="center"?.5:G==="right"?1:c(G)))),ee&&(typeof ee=="number"?ge=-ee:typeof ee=="string"&&(ge=ee==="top"?0:ee==="top-baseline"?-Ge[0].baseline:ee==="top-cap"?-Ge[0].cap:ee==="top-ex"?-Ge[0].ex:ee==="middle"?ae/2:ee==="bottom"?ae:ee==="bottom-baseline"?-Ge[Ge.length-1].baseline:c(ee)*ae)),!H){const _e=e.getEmbeddingLevels(b,R);X=new Uint16Array(Me),ie=new Uint8Array(Me),fe=new Float32Array(Me*2),Q={},se=[1/0,1/0,-1/0,-1/0],Ce=[],K&&(he=new Float32Array(b.length*4)),U&&(ue=new Uint8Array(Me*3));let ve=0,Ue=-1,Se=-1,ke,qe;if(Ge.forEach((Je,nt)=>{let{count:tt,width:be}=Je;if(tt>0){let Le=0;for(let ft=tt;ft--&&Je.glyphAt(ft).glyphObj.isWhitespace;)Le++;let Ze=0,Ee=0;if(L==="center")Ze=(de-be)/2;else if(L==="right")Ze=de-be;else if(L==="justify"&&Je.isSoftWrapped){let ft=0;for(let Qe=tt-Le;Qe--;)Je.glyphAt(Qe).glyphObj.isWhitespace&&ft++;Ee=(de-be)/ft}if(Ee||Ze){let ft=0;for(let Qe=0;Qe<tt;Qe++){let Ae=Je.glyphAt(Qe);const Xe=Ae.glyphObj;Ae.x+=Ze+ft,Ee!==0&&Xe.isWhitespace&&Qe<tt-Le&&(ft+=Ee,Ae.width+=Ee)}}const Ye=e.getReorderSegments(b,_e,Je.glyphAt(0).charIndex,Je.glyphAt(Je.count-1).charIndex);for(let ft=0;ft<Ye.length;ft++){const[Qe,Ae]=Ye[ft];let Xe=1/0,Re=-1/0;for(let Be=0;Be<tt;Be++)if(Je.glyphAt(Be).charIndex>=Qe){let ot=Be,dt=Be;for(;dt<tt;dt++){let Nt=Je.glyphAt(dt);if(Nt.charIndex>Ae)break;dt<tt-Le&&(Xe=Math.min(Xe,Nt.x),Re=Math.max(Re,Nt.x+Nt.width))}for(let Nt=ot;Nt<dt;Nt++){const Dt=Je.glyphAt(Nt);Dt.x=Re-(Dt.x+Dt.width-Xe)}break}}let it;const mt=ft=>it=ft;for(let ft=0;ft<tt;ft++){const Qe=Je.glyphAt(ft);it=Qe.glyphObj;const Ae=it.index,Xe=_e.levels[Qe.charIndex]&1;if(Xe){const Re=e.getMirroredCharacter(b[Qe.charIndex]);Re&&Qe.fontData.fontObj.forEachGlyph(Re,0,0,mt)}if(K){const{charIndex:Re,fontData:Be}=Qe,ot=Qe.x+Z,dt=Qe.x+Qe.width+Z;he[Re*4]=Xe?dt:ot,he[Re*4+1]=Xe?ot:dt,he[Re*4+2]=Je.baseline+Be.caretBottom+ge,he[Re*4+3]=Je.baseline+Be.caretTop+ge;const Nt=Re-Ue;Nt>1&&f(he,Ue,Nt),Ue=Re}if(U){const{charIndex:Re}=Qe;for(;Re>Se;)Se++,U.hasOwnProperty(Se)&&(qe=U[Se])}if(!it.isWhitespace&&!it.isEmpty){const Re=ve++,{fontSizeMult:Be,src:ot,index:dt}=Qe.fontData,Nt=Q[ot]||(Q[ot]={});Nt[Ae]||(Nt[Ae]={path:it.path,pathBounds:[it.xMin,it.yMin,it.xMax,it.yMax]});const Dt=Qe.x+Z,St=Qe.y+Je.baseline+ge;fe[Re*2]=Dt,fe[Re*2+1]=St;const Ht=Dt+it.xMin*Be,rn=St+it.yMin*Be,Ut=Dt+it.xMax*Be,Ft=St+it.yMax*Be;Ht<se[0]&&(se[0]=Ht),rn<se[1]&&(se[1]=rn),Ut>se[2]&&(se[2]=Ut),Ft>se[3]&&(se[3]=Ft),Re%ne===0&&(ke={start:Re,end:Re,rect:[1/0,1/0,-1/0,-1/0]},Ce.push(ke)),ke.end++;const Bt=ke.rect;if(Ht<Bt[0]&&(Bt[0]=Ht),rn<Bt[1]&&(Bt[1]=rn),Ut>Bt[2]&&(Bt[2]=Ut),Ft>Bt[3]&&(Bt[3]=Ft),X[Re]=Ae,ie[Re]=dt,U){const Kt=Re*3;ue[Kt]=qe>>16&255,ue[Kt+1]=qe>>8&255,ue[Kt+2]=qe&255}}}}}),he){const Je=b.length-Ue;Je>1&&f(he,Ue,Je)}}const we=[];Pe.forEach(({index:_e,src:ve,unitsPerEm:Ue,ascender:Se,descender:ke,lineHeight:qe,capHeight:Je,xHeight:nt})=>{we[_e]={src:ve,unitsPerEm:Ue,ascender:Se,descender:ke,lineHeight:qe,capHeight:Je,xHeight:nt}}),j.typesetting=p()-oe,z({glyphIds:X,glyphFontIndices:ie,glyphPositions:fe,glyphData:Q,fontData:we,caretPositions:he,glyphColors:ue,chunkedBounds:Ce,fontSize:C,topBaseline:ge+Ge[0].baseline,blockBounds:[Z,ge-ae,Z+de,ge],visibleBounds:se,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 f(b,_,S){const M=b[_*4],C=b[_*4+1],A=b[_*4+2],N=b[_*4+3],P=(C-M)/S;for(let k=0;k<S;k++){const O=(_+k)*4;b[O]=M+P*k,b[O+1]=M+P*(k+1),b[O+2]=A,b[O+3]=N}}function p(){return(self.performance||Date).now()}function m(){this.data=[]}const x=["glyphObj","x","y","width","charIndex","fontData"];return m.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/x.length)},glyphAt(b){let _=m.flyweight;return _.data=this.data,_.index=b,_},splitAt(b){let _=new m;return _.data=this.data.splice(b*x.length),_}},m.flyweight=x.reduce((b,_,S,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 vx=()=>(self.performance||Date).now(),bE=kZ();let DF;function M6e(t,e,n,r,i,s,o,a,l,c,f=!0){return f?C6e(t,e,n,r,i,s,o,a,l,c).then(null,p=>(DF||(console.warn("WebGL SDF generation failed, falling back to JS",p),DF=!0),IF(t,e,n,r,i,s,o,a,l,c))):IF(t,e,n,r,i,s,o,a,l,c)}const x2=[],T6e=5;let XR=0;function DZ(){const t=vx();for(;x2.length&&vx()-t<T6e;)x2.shift()();XR=x2.length?setTimeout(DZ,0):0}const C6e=(...t)=>new Promise((e,n)=>{x2.push(()=>{const r=vx();try{bE.webgl.generateIntoCanvas(...t),e({timing:vx()-r})}catch(i){n(i)}}),XR||(XR=setTimeout(DZ,0))}),E6e=4,A6e=2e3,PF={};let N6e=0;function IF(t,e,n,r,i,s,o,a,l,c){const f="TroikaTextSDFGenerator_JS_"+N6e++%E6e;let p=PF[f];return p||(p=PF[f]={workerModule:sb({name:f,workerId:f,dependencies:[kZ,vx],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=vx(),_=new Uint8Array(m.length*4);for(let S=0;S<m.length;S++)_[S*4+c]=m[S];return bE.webglUtils.renderImageData(o,_,a,l,t,e,1<<3-c),x+=vx()-b,--p.requests===0&&(p.idleTimer=setTimeout(()=>{o6e(f)},A6e)),{timing:x}})}function k6e(t){t._warm||(bE.webgl.isSupported(t),t._warm=!0)}const R6e=bE.webglUtils.resizeWebGLCanvasWithoutClearing,X_={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},D6e=new kn;function m1(){return(self.performance||Date).now()}const OF=Object.create(null);function PZ(t,e){t=O6e({},t);const n=m1(),r=[];if(t.font&&r.push({label:"user",src:L6e(t.font)}),t.font=r,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||X_.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||X_.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=D6e.set(b).getHex()),m[x]=b}t.colorRanges=m}Object.freeze(t);const{textureWidth:i,sdfExponent:s}=X_,{sdfGlyphSize:o}=t,a=i/o*4;let l=OF[o];if(!l){const m=document.createElement("canvas");m.width=i,m.height=o*256/a,l=OF[o]={glyphCount:0,sdfGlyphSize:o,sdfCanvas:m,sdfTexture:new uo(m,void 0,void 0,void 0,is,is),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,P6e(l)}const{sdfTexture:c,sdfCanvas:f}=l;LZ(t).then(m=>{const{glyphIds:x,glyphFontIndices:b,fontData:_,glyphPositions:S,fontSize:M,timings:C}=m,A=[],N=new Float32Array(x.length*4);let P=0,k=0;const O=m1(),R=_.map(G=>{let ee=l.glyphsByFont.get(G.src);return ee||l.glyphsByFont.set(G.src,ee=new Map),ee});x.forEach((G,ee)=>{const H=b[ee],{src:q,unitsPerEm:J}=_[H];let K=R[H].get(G);if(!K){const{path:j,pathBounds:le}=m.glyphData[q][G],ce=Math.max(le[2]-le[0],le[3]-le[1])/o*(X_.sdfMargin*o+.5),X=l.glyphCount++,ie=[le[0]-ce,le[1]-ce,le[2]+ce,le[3]+ce];R[H].set(G,K={path:j,atlasIndex:X,sdfViewBox:ie}),A.push(K)}const{sdfViewBox:ne}=K,U=S[k++],z=S[k++],Y=M/J;N[P++]=U+ne[0]*Y,N[P++]=z+ne[1]*Y,N[P++]=U+ne[2]*Y,N[P++]=z+ne[3]*Y,x[ee]=K.atlasIndex}),C.quads=(C.quads||0)+(m1()-O);const L=m1();C.sdf={};const B=f.height,V=Math.ceil(l.glyphCount/a),W=Math.pow(2,Math.ceil(Math.log2(V*o)));W>B&&(console.info(`Increasing SDF texture size ${B}->${W}`),R6e(f,i,W),c.dispose()),Promise.all(A.map(G=>IZ(G,l,t.gpuAccelerateSDF).then(({timing:ee})=>{C.sdf[G.atlasIndex]=ee}))).then(()=>{A.length&&!l.contextLost&&(OZ(l),c.needsUpdate=!0),C.sdfTotal=m1()-L,C.total=m1()-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||k6e(f)})}function IZ({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}=X_,c=Math.max(n[2]-n[0],n[3]-n[1]),f=Math.floor(e/4),p=f%(a/r)*r,m=Math.floor(f/(a/r))*r,x=e%4;return M6e(r,r,t,n,c,l,i,p,m,x,o)}function P6e(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(IZ(s,t,!0))})}),Promise.all(r).then(()=>{OZ(t),t.sdfTexture.needsUpdate=!0})})}function I6e({font:t,characters:e,sdfGlyphSize:n},r){let i=Array.isArray(e)?e.join(`
`):""+e;PZ({font:t,sdfGlyphSize:n,text:i},r)}function O6e(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let YM;function L6e(t){return YM||(YM=typeof document>"u"?{}:document.createElement("a")),YM.href=t,YM.href}function OZ(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 j6e=sb({name:"Typesetter",dependencies:[w6e,S6e,l6e],init(t,e,n){return t(e,n())}}),LZ=sb({name:"Typesetter",dependencies:[j6e],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}});LZ.onMainThread;const LF={};function z6e(t){let e=LF[t];return e||(e=LF[t]=new Op(1,1,t,t).translate(.5,.5,0)),e}const F6e="aTroikaGlyphBounds",jF="aTroikaGlyphIndex",U6e="aTroikaGlyphColor";class B6e extends mE{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 Jo,this.boundingBox=new Lo}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=z6e(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(F6e,e,4),this.updateAttributeData(jF,n,1),this.updateAttributeData(U6e,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,f=i/2,p=i*2,m=Math.abs(n),x=e[0]/m,b=e[2]/m,_=s((x+f)/p)!==s((b+f)/p)?-m:o(l(x)*m,l(b)*m),S=s((x-f)/p)!==s((b-f)/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(jF).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 Nx(n,r)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const H6e=`
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;
`,V6e=`
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);
`,G6e=`
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;
}
`,W6e=`
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 $6e(t){const e=qR(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new $t},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 $t},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new kn},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Er},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:H6e,vertexTransform:V6e,fragmentDefs:G6e,fragmentColorTransform:W6e,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(RZ,`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 m9=new Ip({color:16777215,side:au,transparent:!0}),zF=8421504,FF=new dr,KM=new We,NN=new We,P_=[],q6e=new We,kN="+x+y";function UF(t){return Array.isArray(t)?t[0]:t}let jZ=()=>{const t=new qs(new Op(1,1),m9);return jZ=()=>t,t},zZ=()=>{const t=new qs(new Op(1,1,32,1),m9);return zZ=()=>t,t};const X6e={type:"syncstart"},Y6e={type:"synccomplete"},FZ=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],K6e=FZ.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let UZ=class extends qs{constructor(){const e=new B6e;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=zF,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(X6e),PZ({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(Y6e),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 $6e(e)}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=m9.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 UF(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return UF(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,f=0,p=0,m,x,b,_=0,S=0;if(n){let{outlineWidth:C,outlineOffsetX:A,outlineOffsetY:N,outlineBlur:P,outlineOpacity:k}=this;c=this._parsePercent(C)||0,f=Math.max(0,this._parsePercent(P)||0),m=k,_=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??zF),x=this.strokeOpacity,x==null&&(x=1)),m=this.fillOpacity;r.uTroikaEdgeOffset.value=c,r.uTroikaPositionOffset.value.set(_,S),r.uTroikaBlurRadius.value=f,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 kn;(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,f,p,m]=l;KM.set(0,0,0)[f]=c==="-"?1:-1,NN.set(0,0,0)[m]=p==="-"?-1:1,FF.lookAt(q6e,KM.cross(NN),NN),a.setFromMatrix4(FF)}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 $t){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 $t){return KM.copy(e),this.localPositionToTextCoords(this.worldToLocal(KM),n)}raycast(e,n){const{textRenderInfo:r,curveRadius:i}=this;if(r){const s=r.blockBounds,o=i?zZ():jZ(),a=o.geometry,{position:l,uv:c}=a.attributes;for(let f=0;f<c.count;f++){let p=s[0]+c.getX(f)*(s[2]-s[0]);const m=s[1]+c.getY(f)*(s[3]-s[1]);let x=0;i&&(x=i-Math.cos(p/i)*i,p=Math.sin(p/i)*i),l.setXYZ(f,p,m,x)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,P_.length=0,o.raycast(e,P_);for(let f=0;f<P_.length;f++)P_[f].object=this,n.push(P_[f])}}copy(e){const n=this.geometry;return super.copy(e),this.geometry=n,K6e.forEach(r=>{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};FZ.forEach(t=>{const e="_private_"+t;Object.defineProperty(UZ.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});new Lo;new kn;const wo=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 f=kc(({invalidate:b})=>b),[p]=w.useState(()=>new UZ),[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 DEe(()=>new Promise(b=>I6e({font:r,characters:o},b)),["troika-text",r,o]),w.useLayoutEffect(()=>void p.sync(()=>{f(),a&&a(p)})),w.useEffect(()=>()=>p.dispose(),[p]),w.createElement("primitive",xh({object:p,ref:c,font:r,text:x,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),m)}),w0=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 UD(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(t6e,xh({segments:!0,points:s,ref:i,raycast:()=>null},n))}),Z6e=w.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},f)=>{const p=kc(k=>k.invalidate),m=kc(k=>k.camera),x=kc(k=>k.gl),b=kc(k=>k.events),_=kc(k=>k.setEvents),S=kc(k=>k.set),M=kc(k=>k.get),C=kc(k=>k.performance),A=e||m,N=r||b.connected||x.domElement,P=w.useMemo(()=>new ZAe(A),[A]);return vE(()=>{P.enabled&&P.update()},-1),w.useEffect(()=>(s&&P.connect(s===!0?N:s),P.connect(N),()=>void P.dispose()),[s,N,n,P,p]),w.useEffect(()=>{const k=L=>{p(),n&&C.regress(),o&&o(L)},O=L=>{a&&a(L)},R=L=>{l&&l(L)};return P.addEventListener("change",k),P.addEventListener("start",O),P.addEventListener("end",R),()=>{P.removeEventListener("start",O),P.removeEventListener("end",R),P.removeEventListener("change",k)}},[o,a,l,P,p,_]),w.useEffect(()=>{if(t){const k=M().controls;return S({controls:P}),()=>S({controls:k})}},[t,P]),w.createElement("primitive",xh({ref:f,object:P,enableDamping:i},c))}),qf=1e-5;function Q6e(t,e,n){const r=new i0,i=n-qf;return r.absarc(qf,qf,qf,-Math.PI/2,-Math.PI,!0),r.absarc(qf,e-i*2,qf,Math.PI,Math.PI/2,!0),r.absarc(t-i*2,e-i*2,qf,Math.PI/2,0,!0),r.absarc(t-i*2,qf,qf,0,-Math.PI/2,!0),r}const cd=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,...f},p){return w.createElement("mesh",xh({ref:p},f),w.createElement(J6e,{args:[e,n,r],radius:i,steps:s,smoothness:o,bevelSegments:a,creaseAngle:l}),c)}),J6e=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},f){const p=w.useMemo(()=>Q6e(e,n,i),[e,n,i]),m=w.useMemo(()=>({depth:r-i*2,bevelEnabled:!0,bevelSegments:a*2,steps:s,bevelSize:i-qf,bevelThickness:i,curveSegments:o}),[r,i,o,a,s]),x=w.useRef(null);return w.useLayoutEffect(()=>{x.current&&(x.current.center(),VAe(x.current,l))},[p,m,l]),w.useImperativeHandle(f,()=>x.current),w.createElement("extrudeGeometry",xh({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 g9(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 BZ(t){if(!t)return null;const e=g9(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 f=Array.isArray(a==null?void 0:a.nodes)?a.nodes:[];for(const m of f){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),k=(Array.isArray(N==null?void 0:N.devices)?N.devices:[]).map((G,ee)=>{const H=vi(G),q=ee,J=`${b}-${q}`,K=l.get(J)??{role:"unassigned",gpu_index:q};return{hardware:{name:Ta(H==null?void 0:H.name),memory_total_gb:Lr(H==null?void 0:H.memory_total_gb)??0,pcie_gen:Lr(H==null?void 0:H.pcie_gen)??0,pcie_width:Lr(H==null?void 0:H.pcie_width)??0,serial:Ta(H==null?void 0:H.serial),uuid:Ta(H==null?void 0:H.uuid)},role:K,local_index:q}}),O=vi(N==null?void 0:N.interconnect),R=O?{nvlink:RN(O.nvlink),topology:Ta(O.topology),links_per_gpu:Lr(O.links_per_gpu)??0,speed_gbps:Lr(O.speed_gbps)??0,connections:Lr(O.connections)??0}:null,L=vi(x.software),B=vi(L==null?void 0:L.os),V=vi(L==null?void 0:L.container),W=vi(L==null?void 0:L.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:k,interconnect:R,os:Ta(B==null?void 0:B.platform),container:V?{runtime:Ta(V.runtime),is_container:RN(V.is_container)}:null,software:{cuda:Ta(W==null?void 0:W.cuda),pytorch:Ta(W==null?void 0:W.pytorch),python:Ta(W==null?void 0:W.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 eNe={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"},tNe={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 Tu(){return qn(as)?tNe:eNe}function nNe(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 rNe({position:t,gpu:e,nodeId:n,onHover:r,onUnhover:i,onClick:s,isHovered:o}){const a=Tu(),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:f,model:p}=nNe(e.hardware.name),m=.095;return d.jsxs("group",{position:t,children:[d.jsxs(cd,{args:[.95,.18,.6],radius:0,smoothness:4,onPointerOver:x=>{x.stopPropagation(),r()},onPointerOut:i,onClick:x=>{x.stopPropagation(),s()},children:[d.jsx("meshBasicMaterial",{color:o?a.gpuBodyHover:a.gpuBody}),d.jsx(w0,{color:a.platformBorder,threshold:1,scale:1.002})]}),e.role.role!=="unassigned"&&d.jsxs(d.Fragment,{children:[d.jsxs("mesh",{position:[-.34,m-.003,-.2],rotation:[-Math.PI/2,0,0],children:[d.jsx("planeGeometry",{args:[.055,.055]}),d.jsx("meshStandardMaterial",{color:l,side:au})]}),d.jsx(wo,{position:[-.285,m,-.2],rotation:[-Math.PI/2,0,0],fontSize:.04,color:a.textBlack,anchorX:"left",anchorY:"middle",children:c})]}),d.jsx(wo,{position:[0,m,-.04],rotation:[-Math.PI/2,0,0],fontSize:.055,color:a.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:f}),d.jsx(wo,{position:[0,m,.07],rotation:[-Math.PI/2,0,0],fontSize:.07,color:a.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:p}),d.jsx(wo,{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&&d.jsx(wo,{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&&d.jsx(wo,{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&&d.jsx(f9,{position:[0,.35,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:d.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[180px]",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:e.hardware.name}),d.jsxs("div",{className:"text-[10px] text-foreground space-y-0.5",children:[d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"VRAM"}),d.jsxs("span",{className:"font-mono",children:[e.hardware.memory_total_gb," GB"]})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"PCIe"}),d.jsxs("span",{className:"font-mono",children:["Gen",e.hardware.pcie_gen," x",e.hardware.pcie_width]})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Role"}),d.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})`]})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Node"}),d.jsxs("span",{className:"font-mono",children:["#",n]})]})]})]})})]})}function iNe({position:t,memoryGb:e,isHovered:n,onHover:r,onUnhover:i}){const s=Tu(),o=.063;return d.jsxs("group",{position:t,children:[d.jsxs(cd,{args:[.85,.12,.35],radius:0,smoothness:4,onPointerOver:a=>{a.stopPropagation(),r()},onPointerOut:i,children:[d.jsx("meshBasicMaterial",{color:n?s.moduleBodyHover:s.moduleBody}),d.jsx(w0,{color:s.platformBorder,threshold:1,scale:1.002})]}),d.jsx(wo,{position:[0,o,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:s.textBlack,anchorX:"center",anchorY:"middle",children:"VRAM"}),d.jsx(wo,{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 sNe(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 oNe({position:t,cpu:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=Tu(),a=sNe(e.model);return d.jsxs("group",{position:t,children:[d.jsxs(cd,{args:[.6,.08,.6],radius:0,smoothness:4,onPointerOver:l=>{l.stopPropagation(),r()},onPointerOut:i,onClick:l=>{l.stopPropagation(),s()},children:[d.jsx("meshBasicMaterial",{color:n?o.gpuBodyHover:o.chip}),d.jsx(w0,{color:o.platformBorder,threshold:1,scale:1.002})]}),d.jsxs("mesh",{position:[0,.041,0],children:[d.jsx("boxGeometry",{args:[.45,.005,.45]}),d.jsx("meshBasicMaterial",{color:o.platform}),d.jsx(w0,{color:o.platformBorder,threshold:1,scale:1.002})]}),d.jsx(wo,{position:[0,.05,-.12],rotation:[-Math.PI/2,0,0],fontSize:.032,color:o.textBlack,anchorX:"center",anchorY:"middle",children:a}),d.jsx(wo,{position:[0,.05,0],rotation:[-Math.PI/2,0,0],fontSize:.045,color:o.textBlack,anchorX:"center",anchorY:"middle",children:"CPU"}),d.jsx(wo,{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&&d.jsx(f9,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:d.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[180px]",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:e.model}),d.jsxs("div",{className:"text-[10px] text-foreground space-y-0.5",children:[d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Cores"}),d.jsx("span",{className:"font-mono",children:e.cores})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Threads"}),d.jsx("span",{className:"font-mono",children:e.logical_cores})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Sockets"}),d.jsx("span",{className:"font-mono",children:e.sockets})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Frequency"}),d.jsxs("span",{className:"font-mono",children:[(e.frequency_mhz/1e3).toFixed(2)," GHz"]})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Arch"}),d.jsx("span",{className:"font-mono",children:e.architecture})]})]})]})})]})}function aNe({position:t,memory:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=Tu(),a=.063;return d.jsxs("group",{position:t,children:[d.jsxs(cd,{args:[.6,.12,.35],radius:0,smoothness:4,onPointerOver:l=>{l.stopPropagation(),r()},onPointerOut:i,onClick:l=>{l.stopPropagation(),s()},children:[d.jsx("meshBasicMaterial",{color:n?o.moduleBodyHover:o.moduleBody}),d.jsx(w0,{color:o.platformBorder,threshold:1,scale:1.002})]}),d.jsx(wo,{position:[0,a,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:o.textBlack,anchorX:"center",anchorY:"middle",children:"RAM"}),d.jsx(wo,{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&&d.jsx(f9,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:d.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[140px]",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:"System Memory"}),d.jsx("div",{className:"text-[10px] text-foreground space-y-0.5",children:d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Total"}),d.jsxs("span",{className:"font-mono",children:[e.total_gb.toFixed(0)," GB"]})]})})]})})]})}function lNe({vramPositions:t,vramDepth:e,interconnect:n}){const r=Tu();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,f=t[0][2]-e/2-.18,p=.065;return d.jsxs("group",{children:[d.jsx(cd,{args:[l,.02,.035],radius:.002,smoothness:4,position:[a,p,f],children:d.jsx("meshBasicMaterial",{color:r.nvlink})}),t.map((m,x)=>{const b=m[2]-e/2,_=Math.abs(b-f),S=(b+f)/2;return d.jsx("group",{children:d.jsx(cd,{args:[.02,.02,_],radius:.001,smoothness:2,position:[m[0],p,S],children:d.jsx("meshBasicMaterial",{color:r.nvlink})})},x)}),d.jsx(wo,{position:[a,.035,f-.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 cNe({node:t,position:e,hoveredItem:n,setHoveredItem:r,setSelectedItem:i}){const s=Tu(),o=t.gpus.length,a=1.15,l=o*a,c=Math.max(l+1.8,3.5),f=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((P,k)=>[k*a-(l-a)/2,.14,_]),N=t.gpus.map((P,k)=>[k*a-(l-a)/2,.11,S]);return d.jsxs("group",{position:e,children:[d.jsxs(cd,{args:[c,.06,f],radius:0,smoothness:4,children:[d.jsx("meshBasicMaterial",{color:s.platform}),d.jsx(w0,{color:s.platformBorder,threshold:1,scale:1.002})]}),d.jsxs(wo,{position:[0,.04,-f/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)":""]}),d.jsx(wo,{position:[0,.04,-f/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((P,k)=>{const O=A[k],R=[e[0]+O[0],e[1]+O[1],e[2]+O[2]];return d.jsxs("group",{children:[d.jsx(rNe,{position:O,gpu:P,nodeId:t.node_id,isHovered:n===`gpu-${t.node_id}-${P.local_index}`,onHover:()=>r(`gpu-${t.node_id}-${P.local_index}`),onUnhover:()=>r(null),onClick:()=>i({type:"gpu",nodeId:t.node_id,gpuIndex:P.local_index,data:P,worldPosition:R})}),d.jsx(iNe,{position:N[k],memoryGb:P.hardware.memory_total_gb,isHovered:n===`vram-${t.node_id}-${P.local_index}`,onHover:()=>r(`vram-${t.node_id}-${P.local_index}`),onUnhover:()=>r(null)})]},k)}),d.jsx(lNe,{vramPositions:N,vramDepth:m,interconnect:t.interconnect}),(()=>{const P=[0,.09,C],k=[.75,.11,C],O=[e[0]+P[0],e[1]+P[1],e[2]+P[2]],R=[e[0]+k[0],e[1]+k[1],e[2]+k[2]];return d.jsxs(d.Fragment,{children:[d.jsx(oNe,{position:P,cpu:t.cpu,isHovered:n===`cpu-${t.node_id}`,onHover:()=>r(`cpu-${t.node_id}`),onUnhover:()=>r(null),onClick:()=>i({type:"cpu",nodeId:t.node_id,data:t.cpu,worldPosition:O})}),d.jsx(aNe,{position:k,memory:t.memory,isHovered:n===`mem-${t.node_id}`,onHover:()=>r(`mem-${t.node_id}`),onUnhover:()=>r(null),onClick:()=>i({type:"ram",nodeId:t.node_id,data:t.memory,worldPosition:R})})]})})(),(()=>{var J,K;const P=((J=t.gpus[0])==null?void 0:J.hardware.pcie_gen)??0,k=((K=t.gpus[0])==null?void 0:K.hardware.pcie_width)??0;if(P===0||o<1)return null;const O=[...A].sort((ne,U)=>ne[0]-U[0]),R=O[0][0],L=O[O.length-1][0],B=(R+L)/2,V=L-R,W=.065,G=M,ee=C-x/2,H=Math.abs(ee-G),q=(G+ee)/2;return d.jsxs("group",{children:[d.jsx(cd,{args:[V,.02,.035],radius:.002,smoothness:4,position:[B,W,M],children:d.jsx("meshBasicMaterial",{color:s.chipBorder})}),A.map((ne,U)=>{const z=_+p/2,Y=Math.abs(M-z),j=(z+M)/2;return d.jsx("group",{children:d.jsx(cd,{args:[.02,.02,Y],radius:.001,smoothness:2,position:[ne[0],W,j],children:d.jsx("meshBasicMaterial",{color:s.chipBorder})})},U)}),d.jsx(cd,{args:[.02,.02,H],radius:.001,smoothness:2,position:[0,W,q],children:d.jsx("meshBasicMaterial",{color:s.chipBorder})}),d.jsx(wo,{position:[.15,.035,q],rotation:[-Math.PI/2,0,-Math.PI/2],fontSize:.06,maxWidth:H-.1,color:s.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,textAlign:"center",children:`PCIe Gen${P} x${k}`})]})})(),(()=>{const P=[];return t.software.cuda&&P.push(`CUDA ${t.software.cuda}`),t.software.pytorch&&P.push(`PyTorch ${t.software.pytorch}`),t.software.python&&P.push(`Python ${t.software.python}`),P.length===0?null:d.jsx(wo,{position:[0,.035,f/2-.1],rotation:[-Math.PI/2,0,0],fontSize:.03,color:s.textBlack,anchorX:"center",anchorY:"middle",children:P.join(" · ")})})()]})}function HZ(){const t=Tu();return d.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.05,0],children:[d.jsx("planeGeometry",{args:[50,50]}),d.jsx("meshBasicMaterial",{color:t.background})]})}function uNe({node:t,position:e,onClick:n}){const r=Tu(),[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,f=(()=>{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 vE(()=>{if(!o.current)return;const _=i?e[1]+.06:e[1];o.current.position.y+=(_-o.current.position.y)*.15}),d.jsxs("group",{ref:o,position:e,children:[d.jsxs(cd,{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:[d.jsx("meshBasicMaterial",{color:r.platform}),d.jsx(w0,{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),P=_.role.role==="trainer"?r.trainer:_.role.role==="inference"?r.inference:r.unassigned;return d.jsxs("mesh",{position:[N,x/2+.025,-.15],children:[d.jsx("boxGeometry",{args:[.18,.04,.22]}),d.jsx("meshBasicMaterial",{color:P})]},S)}),d.jsxs(wo,{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":""]}),d.jsx(wo,{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}),d.jsx(wo,{position:[-p/2+.15,b,.25],rotation:[-Math.PI/2,0,0],fontSize:.08,color:r.textBlack,anchorX:"left",anchorY:"middle",children:f}),d.jsx(wo,{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 dNe({topology:t,onSelectNode:e}){const n=Tu(),r=n.background==="#ffffff"?"#ffffff":"#888888",i=n.background==="#ffffff"?"#ffffff":"#333333",s=2.5,o=1.5,a=w.useMemo(()=>{const c=[],f=Math.ceil(Math.sqrt(t.nodes.length)),p=3.2,m=2.2;return t.nodes.forEach((x,b)=>{const _=Math.floor(b/f),S=b%f,C=-(Math.min(f,t.nodes.length-_*f)-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,f=-1/0,p=1/0,m=-1/0;for(const[b,,_]of a)c=Math.min(c,b-s/2),f=Math.max(f,b+s/2),p=Math.min(p,_-o/2),m=Math.max(m,_+o/2);const x=.6;return{w:f-c+x*2,d:m-p+x*2,cx:(c+f)/2,cz:(p+m)/2}},[a]);return d.jsxs(d.Fragment,{children:[d.jsx("color",{attach:"background",args:[n.background]}),d.jsx("ambientLight",{intensity:.7}),d.jsx("directionalLight",{position:[8,12,5],intensity:.8}),d.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),d.jsx("hemisphereLight",{color:r,groundColor:i,intensity:.5}),d.jsx(HZ,{}),d.jsx("gridHelper",{args:[50,50,n.gridColor,n.gridColor],position:[0,-.04,0]}),d.jsxs(cd,{args:[l.w,.06,l.d],radius:0,smoothness:4,position:[l.cx,0,l.cz],children:[d.jsx("meshBasicMaterial",{color:n.platform}),d.jsx(w0,{color:n.platformBorder,threshold:1,scale:1.002})]}),t.nodes.map((c,f)=>d.jsx(uNe,{node:c,position:a[f],onClick:()=>e(c.node_id)},c.node_id))]})}function fNe({focusTarget:t,overviewPosition:e,overviewLookAt:n}){const{camera:r}=kc(),i=kc(m=>m.controls),s=w.useRef(new We(...e)),o=w.useRef(new We(...n)),a=w.useRef(!1),l=w.useRef(null),c=w.useRef(e.join(",")),f=e.join(",");w.useEffect(()=>{c.current=f,!t&&i&&(r.position.set(...e),i.target.set(...n),i.update(),a.current=!1)},[f]);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]),vE(()=>{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 d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:t}),d.jsx("span",{className:n?"font-mono":"",children:e})]})}function hNe({topology:t,focusedItem:e,onClose:n}){const r=Tu();return d.jsx("div",{className:"absolute top-4 right-4 w-72 max-h-[calc(100%-2rem)] overflow-auto",children:e?d.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 d.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"GPU Details"}),d.jsx("div",{className:"font-mono text-foreground text-xs mb-1",children:i.hardware.name}),d.jsx(Qi,{label:"Node / Index",value:`#${e.nodeId} / GPU ${i.local_index}`}),d.jsx(Qi,{label:"Role",value:d.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&&d.jsx(Qi,{label:"Rank",value:i.role.rank}),i.role.dp_rank!==void 0&&d.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&&d.jsx(Qi,{label:"Server",value:i.role.server_idx}),i.role.url&&d.jsx(Qi,{label:"URL",value:d.jsx("span",{className:"text-[9px]",children:i.role.url})}),d.jsx("div",{className:"border-t border-foreground mt-1.5 pt-1.5"}),d.jsx(Qi,{label:"VRAM",value:`${i.hardware.memory_total_gb} GB`}),d.jsx(Qi,{label:"PCIe",value:`Gen${i.hardware.pcie_gen} x${i.hardware.pcie_width}`}),d.jsx(Qi,{label:"Serial",value:d.jsx("span",{className:"text-[9px]",children:i.hardware.serial})}),d.jsx(Qi,{label:"UUID",value:d.jsx("span",{className:"text-[9px] break-all",children:i.hardware.uuid})})]})})(),e.type==="cpu"&&(()=>{const i=e.data;return d.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"CPU Details"}),d.jsx("div",{className:"font-mono text-foreground text-xs mb-1",children:i.model}),d.jsx(Qi,{label:"Node",value:`#${e.nodeId}`}),d.jsx(Qi,{label:"Architecture",value:i.architecture}),d.jsx(Qi,{label:"Cores",value:i.cores}),d.jsx(Qi,{label:"Logical Cores",value:i.logical_cores}),d.jsx(Qi,{label:"Sockets",value:i.sockets}),d.jsx(Qi,{label:"Frequency",value:`${(i.frequency_mhz/1e3).toFixed(2)} GHz`})]})})(),e.type==="ram"&&(()=>{const i=e.data;return d.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"System Memory"}),d.jsx(Qi,{label:"Node",value:`#${e.nodeId}`}),d.jsx(Qi,{label:"Total",value:`${i.total_gb.toFixed(0)} GB`})]})})(),d.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"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"bg-background border border-foreground rounded-none p-4 mb-3",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"Cluster Overview"}),d.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[d.jsx(Qi,{label:"Model",value:d.jsx("span",{className:"text-foreground",children:t.model||"—"}),mono:!1}),d.jsx(Qi,{label:"Nodes",value:t.nodes.length}),d.jsx(Qi,{label:"Total GPUs",value:t.total_gpus}),t.trainer_config&&d.jsxs(d.Fragment,{children:[d.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"}),d.jsx(Qi,{label:"GPUs",value:t.trainer_total_gpus}),d.jsx(Qi,{label:"Backend",value:t.trainer_config.backend}),d.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&&d.jsxs(d.Fragment,{children:[d.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"}),d.jsx(Qi,{label:"GPUs",value:t.inference_total_gpus}),d.jsx(Qi,{label:"Servers",value:t.inference_config.num_servers}),d.jsx(Qi,{label:"TP Size",value:t.inference_config.tensor_parallel_size}),d.jsx(Qi,{label:"Placement",value:t.inference_config.placement_strategy})]})]})]}),d.jsxs("div",{className:"bg-background border border-foreground rounded-none p-3",children:[d.jsx("div",{className:"text-[10px] font-semibold text-foreground mb-1.5",children:"Legend"}),d.jsxs("div",{className:"space-y-1",children:[d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[d.jsx("div",{className:"w-3 h-2",style:{background:r.trainer}}),"Trainer GPU"]}),d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[d.jsx("div",{className:"w-3 h-2",style:{background:r.inference}}),"Inference GPU"]}),d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[d.jsx("div",{className:"w-3 h-2",style:{background:r.unassigned}}),"Unassigned GPU"]}),d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[d.jsx("div",{className:"w-3 h-1",style:{background:r.nvlink}}),"NVLink"]})]})]})]})})}function pNe({topology:t,hoveredItem:e,setHoveredItem:n,setSelectedItem:r,focusedItem:i}){const s=Tu(),o=s.background==="#ffffff"?"#ffffff":"#888888",a=s.background==="#ffffff"?"#ffffff":"#333333",l=w.useMemo(()=>{const c=[],f=Math.ceil(Math.sqrt(t.nodes.length)),p=6.5,m=3.5;return t.nodes.forEach((x,b)=>{const _=Math.floor(b/f),S=b%f,C=-(Math.min(f,t.nodes.length-_*f)-1)*p/2;c.push([S*p+C,0,_*m])}),c},[t.nodes]);return d.jsxs(d.Fragment,{children:[d.jsx("color",{attach:"background",args:[s.background]}),d.jsx("ambientLight",{intensity:.7}),d.jsx("directionalLight",{position:[8,12,5],intensity:.8}),d.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),d.jsx("hemisphereLight",{color:o,groundColor:a,intensity:.5}),d.jsx(HZ,{}),d.jsx("gridHelper",{args:[50,50,s.gridColor,s.gridColor],position:[0,-.04,0]}),t.nodes.map((c,f)=>d.jsx(cNe,{node:c,position:l[f],hoveredItem:i?null:e,setHoveredItem:i?()=>{}:n,setSelectedItem:i?()=>{}:r},c.node_id))]})}function mNe(){const t=Tu(),{gl:e}=kc();return w.useEffect(()=>{e.setClearColor(t.background)},[e,t.background]),null}function VZ({topology:t}){const e=Tu(),[n,r]=w.useState(null),[i,s]=w.useState(null),[o,a]=w.useState(null),l=t.nodes.length>1,c=l&&o===null,f=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:f,A=C.nodes.length,N=Math.max(...C.nodes.map(k=>k.gpus.length),1);if(c){const k=Math.max(4,A*1.5);return[k*.6,k*.9,k*.6]}const P=Math.max(3.5,A*1.8,N*.8);return[P*.8,P*.7,P*.8]},[t,f,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 d.jsxs("div",{className:"relative w-full h-full bg-background",children:[d.jsxs(PAe,{camera:{position:p,fov:45,near:.1,far:100},gl:{antialias:!0,alpha:!1},onCreated:({gl:C})=>{C.setClearColor(e.background),C.toneMapping=mu},children:[c?d.jsx(dNe,{topology:t,onSelectNode:S}):d.jsx(pNe,{topology:f,hoveredItem:n,setHoveredItem:r,setSelectedItem:x,focusedItem:i}),d.jsx(fNe,{focusTarget:!c&&i?{position:i.worldPosition}:null,overviewPosition:p,overviewLookAt:m}),d.jsx(Z6e,{makeDefault:!0,enablePan:!0,enableZoom:!0,enableRotate:!0,minDistance:1,maxDistance:30,maxPolarAngle:Math.PI/2-.05,onStart:()=>{i&&b()}}),d.jsx(mNe,{})]}),l&&o!==null&&d.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"}),d.jsx(hNe,{topology:c?t:f,focusedItem:i,onClose:b}),d.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 GZ(t){if(t&&typeof t=="object"&&"value"in t)return GZ(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 gNe=[1,5,10,30,60,120,300],DN=Vs,BF=Vs,xNe=["torch_allocated_gb"],vNe="__timeline_noop_metric__";function _E(t){return g9(t==null?void 0:t.setup)}function yNe(t){const e=_E(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 f=vi(c);if(!f)continue;const p=Lr(f.rank);p!==null&&(n[p]={node_id:a,local_rank:Lr(f.local_rank)})}}return n}function bNe(t){const e=_E(t),n=vi(e==null?void 0:e.inference);return Lr(n==null?void 0:n.num_servers)??void 0}function _Ne(t){const e=_E(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 f=vi(c);if(!f)continue;const p=Lr(f.server_idx);p!==null&&(p in n||(n[p]=a))}}return n}function HF(t){const e=_E(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 SNe(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 wNe({value:t,onChange:e}){const[n,r]=w.useState(!1),[i,s]=w.useState(""),o=w.useRef(null),a=c=>{c&&(s(DN(t)),setTimeout(()=>{var f;return(f=o.current)==null?void 0:f.select()},0)),r(c)},l=()=>{const c=SNe(i);c!==null&&(e(c),r(!1))};return d.jsxs(YT,{open:n,onOpenChange:a,children:[d.jsx(KT,{asChild:!0,children:d.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:[DN(t),d.jsx(kr,{className:"size-3 text-muted-foreground"})]})}),d.jsxs(ZT,{align:"start",className:"w-40 p-1.5 gap-1",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.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"}),d.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"})]}),d.jsx("div",{className:"flex flex-col",children:gNe.map(c=>d.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:DN(c)},c))})]})]})}function MNe(){var q,J,K,ne,U;const t=qn(bl),[e,n]=fn(Sce),[r,i]=fn(wce),s=!0,{data:o,isFetching:a,isPlaceholderData:l,error:c}=Nde(t||"",e,r,!!t),{data:f}=kde(t||"",!!t),{data:p}=_h(t||"",!!t,s),m=w.useMemo(()=>{var Y;const z=(Y=p==null?void 0:p.config)==null?void 0:Y.trainer_devices;return GZ(z)},[(q=p==null?void 0:p.config)==null?void 0:q.trainer_devices]),x=(o==null?void 0:o.interval_start)??null,b=(o==null?void 0:o.interval_end)??null,_=a&&(l||!o),[S,M]=w.useState(()=>[...xNe]),C=w.useMemo(()=>{const z=Array.from(new Set(S.filter(Y=>typeof Y=="string"&&Y.trim().length>0))).sort((Y,j)=>Y.localeCompare(j));return z.length>0?z:[vNe]},[S]),A=w.useMemo(()=>yNe(p==null?void 0:p.summary),[p==null?void 0:p.summary]),N=w.useMemo(()=>{const z={},Y=(o==null?void 0:o.trainer_events)??[];for(const j of Y){const le=j.rank;if(!Number.isFinite(le))continue;const ce=z[le]??{node_id:null,local_rank:null},X=ce.node_id!==null?ce.node_id:typeof j.node_id=="number"&&Number.isFinite(j.node_id)?j.node_id:null,ie=ce.local_rank!==null?ce.local_rank:typeof j.local_rank=="number"&&Number.isFinite(j.local_rank)?j.local_rank:null;z[le]={node_id:X,local_rank:ie}}return z},[o==null?void 0:o.trainer_events]),P=w.useMemo(()=>{const z={};return new Set([...Object.keys(A).map(Number),...Object.keys(N).map(Number)]).forEach(j=>{const le=A[j],ce=N[j];z[j]={node_id:(le==null?void 0:le.node_id)??(ce==null?void 0:ce.node_id)??null,local_rank:(le==null?void 0:le.local_rank)??(ce==null?void 0:ce.local_rank)??null}}),z},[A,N]),k=w.useMemo(()=>_Ne(p==null?void 0:p.summary),[p==null?void 0:p.summary]),O=w.useMemo(()=>{const z={},Y=(o==null?void 0:o.inference_events)??[];for(const j of Y){const le=j.server;Number.isFinite(le)&&z[le]===void 0&&typeof j.node_id=="number"&&Number.isFinite(j.node_id)&&(z[le]=j.node_id)}return z},[o==null?void 0:o.inference_events]),R=w.useMemo(()=>{const z={};return new Set([...Object.keys(k).map(Number),...Object.keys(O).map(Number)]).forEach(j=>{z[j]=k[j]??O[j]??null}),z},[k,O]),L=w.useMemo(()=>{const z=((o==null?void 0:o.trainer_events)??[]).map(j=>j.rank).filter(j=>Number.isFinite(j)),Y=Object.keys(P).map(Number);return Array.from(new Set([...z,...Y])).sort((j,le)=>j-le)},[o==null?void 0:o.trainer_events,P]),B=w.useMemo(()=>L.map(z=>{var Y,j;return{rank:z,node_id:((Y=P[z])==null?void 0:Y.node_id)??null,local_rank:((j=P[z])==null?void 0:j.local_rank)??null}}),[L,P]),V=w.useMemo(()=>{const z=[];let Y=!1;return L.forEach(j=>{var ce;const le=(ce=P[j])==null?void 0:ce.local_rank;le!=null&&(z[j]=le,Y=!0)}),Y?z:m},[P,L,m]),W=Pde(t||"",C,B,x,b,!!t&&x!==null&&b!==null&&B.length>0),G=w.useMemo(()=>{const z={};return B.forEach((Y,j)=>{var ce;const le=(ce=W[j])==null?void 0:ce.data;z[Y.rank]=(le==null?void 0:le.metrics)??[]}),z},[B,W]),ee=w.useMemo(()=>{const z=[];W.forEach(le=>{const ce=le.data;ce!=null&&ce.available_metrics&&ce.available_metrics.forEach(X=>{typeof X=="string"&&z.push(X)})});const Y=Array.from(new Set(z));if(Y.length>0)return Y;const j=new Set;return W.forEach(le=>{var X;const ce=le.data;(X=ce==null?void 0:ce.metrics)==null||X.forEach(ie=>{typeof ie.metric_name=="string"&&j.add(ie.metric_name)})}),Array.from(j).sort((le,ce)=>le.localeCompare(ce))},[W]),H=W.some(z=>z.isFetching);return t?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center gap-2 h-7",children:[d.jsx(gD,{currentPage:e,totalPages:(o==null?void 0:o.total_pages)??1,onPageChange:n}),d.jsx(wNe,{value:r,onChange:z=>{const Y=Math.floor(e*r/z);i(z),n(Y)}}),x!==null&&b!==null&&(o==null?void 0:o.global_min_time)!=null&&d.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[BF(x-o.global_min_time)," – ",BF(b-o.global_min_time)]})]})})}),d.jsx("div",{className:"flex-1 overflow-auto p-6",children:d.jsxs("div",{className:"max-w-7xl mx-auto",children:[c&&d.jsx(dd,{className:"border-destructive mb-6",children:d.jsx(ch,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error: ",c instanceof Error?c.message:"Unknown error"]})})}),d.jsx(dSe,{orchestratorData:o==null?void 0:o.orchestrator_events,trainerData:o==null?void 0:o.trainer_events,inferenceData:o==null?void 0:o.inference_events,inflightSnapshot:f,isLoading:_,intervalStart:(o==null?void 0:o.interval_start)??0,intervalEnd:(o==null?void 0:o.interval_end)??r,trainerGpuMetricsByRank:G,trainerGpuMetricsIsLoading:H,trainerAvailableGpuMetrics:ee,selectedTrainerGpuMetrics:S,onSelectedTrainerGpuMetricsChange:M,trainerSystemGpuIndices:V,trainerRankInfoByRank:P,totalSetupNodes:HF(p==null?void 0:p.summary),inferenceServerNodeMap:R,numInferenceServers:bNe(p==null?void 0:p.summary)??((J=p==null?void 0:p.config)==null?void 0:J.num_inference_servers),maxConcurrentPrompts:(K=p==null?void 0:p.config)==null?void 0:K.max_concurrent_prompts,groupSize:(ne=p==null?void 0:p.config)==null?void 0:ne.group_size,freeLaneAfterGeneration:(U=p==null?void 0:p.config)==null?void 0:U.free_lane_after_generation})]})}),d.jsx(TNe,{runPath:t,trainerEvents:o==null?void 0:o.trainer_events,totalSetupNodes:HF(p==null?void 0:p.summary)})]}):d.jsx(I0,{description:"Select a run from the sidebar to view the timeline."})}function TNe({runPath:t,trainerEvents:e,totalSetupNodes:n}){const r=qn(as),[i,s]=fn(nW),[o,a]=fn(tW),[l,c]=w.useState("inference"),[f,p]=w.useState(i),[m,x]=w.useState(o);i!==f&&(p(i),i&&c("inference")),o!==m&&(x(o),o&&c("trainer"));const{data:b}=Rde(t??"",(i==null?void 0:i.groupId)??null,!!i&&!!t),_=w.useMemo(()=>{if(!i||!(b!=null&&b.events))return null;const X={};for(const ie of b.events)ie.sample_id!==void 0&&(X[ie.sample_id]||(X[ie.sample_id]=[]),X[ie.sample_id].push(ie));return X},[i,b]),S=w.useMemo(()=>{if(!b)return null;const X=b.environment_response_times??[],ie=b.compute_reward_times??[],fe={};for(const ue of X)fe[ue.sample_idx]||(fe[ue.sample_idx]=[]),fe[ue.sample_idx].push({turn_order:ue.turn_order,time:ue.time});for(const ue of Object.values(fe))ue.sort((he,se)=>he.turn_order-se.turn_order);const Q={};for(const ue of ie)Q[ue.sample_idx]=ue.time;return{envBySample:fe,rewardBySample:Q}},[b]),M=w.useMemo(()=>{if(!_)return null;let X=1/0,ie=-1/0;for(const[fe,Q]of Object.entries(_)){for(const ue of Q){X=Math.min(X,ue.start_time),ie=Math.max(ie,ue.end_time);let he=ue.end_time;ue.environment_response_time&&ue.environment_response_time>0&&(he+=ue.environment_response_time),ue.compute_reward_time&&ue.compute_reward_time>0&&(he+=ue.compute_reward_time),ie=Math.max(ie,he)}if(S){const ue=Number(fe),he=[...Q].sort((Me,Te)=>Me.start_time-Te.start_time),se=S.envBySample[ue]??[];let Ce=-1/0;for(let Me=0;Me<he.length;Me++)Ce=he[Me].end_time,Me<se.length&&se[Me].time>0&&(Ce+=se[Me].time);const de=S.rewardBySample[ue]??0;de>0&&(Ce+=de),ie=Math.max(ie,Ce)}}return X===1/0?null:{start:X,end:ie,duration:ie-X}},[_,S]),{data:C}=Dde(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 X={};for(const ie of A)X[ie.rank]||(X[ie.rank]=[]),X[ie.rank].push(ie);return X},[A]),P=w.useMemo(()=>o?(N[o.rank]||[]).find(ie=>ie.event_type===o.eventType&&ie.step===o.step&&ie.rank===o.rank&&!ie.event_type.includes("/"))??null:null,[o,N]),k=w.useMemo(()=>o?(N[o.rank]||[]).filter(ie=>ie.event_type.startsWith(o.eventType+"/")&&ie.step===o.step):[],[o,N]),O=qn(FT),R=qn(eW),L=w.useMemo(()=>!i||!_?[]:Object.keys(_).map(Number).map(X=>({group_id:i.groupId,sample_idx:X})),[i,_]),{data:B}=o8(t??"",L,!!t&&L.length>0&&O),V=!O||L.length===0||!!B,W=w.useMemo(()=>!O||!(B!=null&&B.statuses)?!1:B.statuses.some(X=>X.kind==="rollouts_discarded"),[O,B]),G=w.useMemo(()=>_?Object.values(_).some(X=>X.some(ie=>ie.is_canceled)):!1,[_]),ee=w.useMemo(()=>{var X;return G||W||!O||i!=null&&i.isEval?!1:!V||!((X=B==null?void 0:B.statuses)!=null&&X.length)?!0:!B.statuses.some(ie=>ie.kind==="rollouts")},[G,W,O,V,B]),{data:H}=hW(t??"",(i==null?void 0:i.groupId)??null,(i==null?void 0:i.sampleId)??null,!!t&&!!i,i==null?void 0:i.isEval),q=w.useMemo(()=>!H||H.kind!=="rollouts_discarded"?null:H.discard_reason,[H]),J=w.useMemo(()=>{if(!H||H.kind===null)return null;const X=H.samples_data;if(!X||X.length===0)return null;const ie=X.map(fe=>fe.reward).filter(fe=>fe!==null);return ie.length===0?null:ie.every(fe=>fe===0)?"all_zero":ie.every(fe=>fe>0)?"all_positive":null},[H]),K=X=>{switch(X){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return X.split("_").map(ie=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(" ")}},ne=!!i,U=!!o&&k.length>0&&!!P,z=l==="inference"&&!ne&&U?"trainer":l==="trainer"&&!U&&ne?"inference":l;if(!ne&&!U)return null;const Y=()=>{z==="inference"?(s(null),U&&c("trainer")):(a(null),ne&&c("inference"))},j=P?fW(P.event_type,P.step,P.microbatch,P.minibatch):null,le=P?G2(P.event_type):void 0,ce=ne&&U;return d.jsxs("footer",{className:"border-t bg-background shrink-0 h-[28vh] flex flex-col",children:[d.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0",children:[ce&&d.jsxs("div",{className:"flex items-center bg-muted rounded-md p-0.5 gap-0.5",children:[d.jsx("button",{onClick:()=>c("inference"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${z==="inference"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Inference"}),d.jsx("button",{onClick:()=>c("trainer"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${z==="trainer"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Trainer"})]}),z==="inference"&&i&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:G?r?NS:"#adadad":W?r?"#9ca3af":"#6b7280":ee?"rgba(161, 98, 7, 0.9)":i.isEval?"#047857":"#075985"}}),d.jsxs("span",{className:"text-xs font-medium",children:["Sample ",i.sampleId]})]}),d.jsx("span",{className:"text-muted-foreground",children:"/"}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("div",{className:`w-2.5 h-2.5 rounded-sm${V?"":" animate-pulse bg-muted"}`,style:V?{backgroundColor:G?r?NS:eC:W?r?JT:QT:ee?"rgba(202, 138, 4, 0.8)":i.isEval?"#10b981":"#0369a1"}:void 0}),d.jsxs("span",{className:"text-xs font-medium",children:["Group ",i.groupId]})]}),G&&d.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"}),ee&&!G&&d.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-yellow-100 text-yellow-700 border border-yellow-200",children:"Waiting for Group"}),q&&d.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:K(q)}),q==="zero_advantage"&&J==="all_zero"&&d.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"}),q==="zero_advantage"&&J==="all_positive"&&d.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"})]}),z==="trainer"&&j&&P&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:le}}),d.jsxs("span",{className:"text-xs font-medium",children:[j.primary," Breakdown"]}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:["GPU ",P.rank]}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:["(Step ",P.step,")"]})]}),d.jsx("button",{onClick:Y,className:"ml-auto text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:d.jsx(Na,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"overflow-auto flex-1 min-h-0",children:[z==="inference"&&i&&_&&M&&d.jsx(NSe,{eventsBySampleId:_,selectedSampleId:i.sampleId,timeBounds:M,groupId:i.groupId,runPath:t??"",envResponseTimesBySample:S==null?void 0:S.envBySample,computeRewardTimeBySample:R?S==null?void 0:S.rewardBySample:void 0,onSampleClick:X=>{s({sampleId:X,groupId:i.groupId,isEval:i.isEval})},showNodeLabel:typeof n=="number"&&n>1,isEval:i.isEval}),z==="trainer"&&P&&k.length>0&&d.jsx(FSe,{parentEvent:P,childEvents:k})]})]})}function x9(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",f=(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:f});return m.observe(p),()=>{m.disconnect(),a.current&&clearTimeout(a.current)}},[t,l,c,f]),r||s}function WZ(){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?ql.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function $Z({isFullscreen:t,onClick:e}){return d.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?d.jsx(qT,{className:"h-3 w-3"}):d.jsx($T,{className:"h-3 w-3"})})}const ZM={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"}]}},CNe={discarded_stats:{label:"Discarded Rollouts",metrics:[{prefix:"discarded_count",label:"Discarded Count",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_pct",label:"Discarded Zero Advantage %",simple:!0,group:"General"},{prefix:"discarded_max_async_pct",label:"Discarded Max Async %",simple:!0,group:"General"},{prefix:"discarded_stop_reason_length_pct",label:"Discarded % Stop Reason = Length",simple:!0,group:"General"},{prefix:"discarded_group_length_gini_mean",label:"Discarded Group Completion Length Gini",simple:!0,group:"General"},{prefix:"discarded_group_length_max_median_ratio_mean",label:"Discarded Group Completion Length Max/Median",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_zero_pct",label:"Discarded Zero Adv (All Reward = 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_positive_pct",label:"Discarded Zero Adv (All Reward > 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_mean_reward",label:"Discarded 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"}},ENe={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:"Inference % Generation (Normal)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_discarded_pct",label:"Inference % Generation (Discarded)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_canceled_pct",label:"Inference % Generation (Canceled)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_all_pct",label:"Inference % Generation (All)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_normal_pct",label:"Inference % Compute Reward (Normal)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_discarded_pct",label:"Inference % Compute Reward (Discarded)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_canceled_pct",label:"Inference % Compute Reward (Canceled)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_all_pct",label:"Inference % Compute Reward (All)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_idle_pct",label:"Inference % Idle Time",simple:!0,group:"Time Breakdown (% of Step Time)"}]}},YR=["mean","std","min","max"],w1="histogram",M1="distribution_over_time";function VF(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 Pm(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 f of YR){const p=`${r.prefix}_${f}`,m=f.charAt(0).toUpperCase()+f.slice(1);t.push({category:e,categoryLabel:n.label,group:s,metricKey:p,label:`${r.label} - ${m}`,prefix:r.prefix,suffix:f,showZeroLine:o,unit:a})}const l=`${r.prefix}_${w1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:l,label:`${r.label} - Histogram`,prefix:r.prefix,suffix:w1,showZeroLine:o,unit:a,isHistogram:!0,histogramMetricType:VF(r.prefix)});const c=`${r.prefix}_${M1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:c,label:`${r.label} - Distribution Over Time`,prefix:r.prefix,suffix:M1,showZeroLine:o,unit:a,isDistributionOverTime:!0,histogramMetricType:VF(r.prefix)})}}function ANe(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}`;Pm(r,l,{label:v1(i),metrics:a.map(c=>({prefix:c,label:v1(c),simple:!0,group:o?v1(o):void 0}))})}Pm(r,"rewards",ZM.rewards),t.length>0&&Pm(r,"rollout_metrics",{label:"Samples Metrics",metrics:t.flatMap(i=>[{prefix:`reward_${i}`,label:v1(i)},{prefix:`reward_${i}_gini_mean`,label:`${v1(i)} Sparsity (Gini)`,simple:!0}])}),Pm(r,"advantage",ZM.advantage),r.push(...NNe(n)),Pm(r,"tokens",ZM.tokens),Pm(r,"rollouts_general",ZM.rollouts_general);for(const[i,s]of Object.entries(CNe))Pm(r,i,s);for(const[i,s]of Object.entries(ENe))Pm(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 X$)r.push({category:"inference_utilization_area",categoryLabel:"Inference Performance",group:"Breakdown (Area)",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isInferenceUtilizationArea:!0,inferenceAreaCategories:[...i.categories]});for(const i of $$)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:"Trainer % Idle",trainerMetricType:"idle"},{key:"trainer_perf_working",label:"Trainer % Working",trainerMetricType:"working"},{key:"trainer_perf_working_except_weight_sync",label:"Trainer % Working (excl. Weight Sync)",trainerMetricType:"working_except_weight_sync"},{key:"trainer_perf_forward",label:"Trainer % Forward",trainerMetricType:"forward"},{key:"trainer_perf_backward",label:"Trainer % Backward",trainerMetricType:"backward"},{key:"trainer_perf_optimizer",label:"Trainer % Optimizer",trainerMetricType:"optimizer"},{key:"trainer_perf_loss_computation",label:"Trainer % Loss Computation",trainerMetricType:"loss_computation"},{key:"trainer_perf_weight_broadcast",label:"Trainer % Weight Sync",trainerMetricType:"weight_broadcast"},{key:"trainer_perf_data_wait",label:"Trainer % Data Wait",trainerMetricType:"data_wait"},{key:"trainer_perf_grad_clip",label:"Trainer % Grad Clip",trainerMetricType:"grad_clip"},{key:"trainer_perf_grad_norm",label:"Trainer % Grad Norm",trainerMetricType:"grad_norm"},{key:"trainer_perf_checkpoint",label:"Trainer % 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 NNe(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=v1(s),a=`${r} / ${o}`,l=`${i}reward_${s}`,c="evals";for(const f of YR){const p=f.charAt(0).toUpperCase()+f.slice(1);e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${f}`,label:`${r} ${o} - ${p}`,prefix:l,suffix:f,isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${w1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:w1,isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${M1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:M1,isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}for(const s of["length_completion","length_prompt","length_sum"]){const o=s==="length_completion"?"Tokens Completion":s==="length_prompt"?"Tokens Prompt":"Tokens Total",a=`${r} / ${o}`,l=`${i}${s}`,c="evals";for(const f of YR){const p=f.charAt(0).toUpperCase()+f.slice(1);e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${f}`,label:`${r} ${o} - ${p}`,prefix:l,suffix:f,unit:"tokens",isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${w1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:w1,unit:"tokens",isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${M1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:M1,unit:"tokens",isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}}return e}function v1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function kNe(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 RNe(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.isInferenceUtilizationArea?"inference_utilization_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 v9({openAtom:t=J7}={}){const[e,n]=fn(t);return!qn(bl)||e?null:d.jsx(wn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Metrics"})}function Im({id:t,children:e}){const{attributes:n,listeners:r,setNodeRef:i,transform:s,transition:o,isDragging:a}=aC({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=d.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:d.jsx(WT,{className:"h-3 w-3 text-muted-foreground"})});return d.jsx("div",{ref:i,style:l,children:e(c)})}function y9({currentStep:t,maxSelectableStep:e,openAtom:n=J7,selectedMetricsAtom:r=Rce,selectedStepAtom:i=zT,includeDiscardedDefaults:s=!1,evalConfig:o}){const[a,l]=fn(n),[c,f]=fn(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),P=qn(jT),k=qn(UT),O=!0,R=!!o,{data:L}=P0(),B=w.useMemo(()=>{const he=new Set(P);return N&&he.add(N),Array.from(he)},[N,P]),{customMetricSections:V,availableRewardNames:W,evalsList:G}=a8(B),ee=w.useRef(!1);w.useEffect(()=>{if(R||ee.current)return;if(c.length>0){ee.current=!0;return}if(W.length===0&&V&&Object.keys(V).length===0)return;ee.current=!0;const he=["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",...W.flatMap(se=>[`reward_${se}_mean`,`reward_${se}_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"]:[]];f(he)},[W,V,R]);const H=w.useRef(new Set);w.useEffect(()=>{if(R||W.length===0)return;const he=[];for(const se of W){if(!H.current.has(se)){const Ce=`reward_${se}_mean`,de=`reward_${se}_distribution_over_time`;c.includes(Ce)||he.push(Ce),c.includes(de)||he.push(de)}H.current.add(se)}he.length>0&&f(se=>[...se,...he])},[W,R]);const q=w.useRef("");w.useEffect(()=>{if(!R||!o)return;const he=`${o.prefix}|${o.rewardNames.join(",")}`;if(he===q.current)return;q.current=he;const se=o.prefix,Ce=[`${se}length_completion_mean`,`${se}length_completion_std`,`${se}length_completion_min`,`${se}length_completion_max`,`${se}length_completion_distribution_over_time`,...o.rewardNames.flatMap(de=>[`${se}reward_${de}_mean`,`${se}reward_${de}_distribution_over_time`])];f(Ce)},[o,R,f]);const J=w.useMemo(()=>{const he=(L==null?void 0:L.runs)||[],se=new Set(P);return N&&se.add(N),he.filter(Ce=>se.has(Ce.run_id)).map(Ce=>({runPath:Ce.run_id,runName:Ce.name,color:Ce.color,isSelected:Ce.run_id===N}))},[N,P,L==null?void 0:L.runs]),K=w.useMemo(()=>ANe(W,V,G),[W,V,G]);w.useMemo(()=>kNe(K),[K]);const ne=w.useMemo(()=>{const he=new Set(K.map(Ce=>Ce.metricKey)),se={};return c.map((Ce,de)=>{const Me=se[Ce]||0;return se[Ce]=Me+1,{metricKey:Ce,originalIndex:de,sortableId:`${Ce}::${Me}`}}).filter(({metricKey:Ce})=>he.has(Ce))},[c,K]),U=w.useMemo(()=>ne.map(he=>he.metricKey),[ne]),z=w.useMemo(()=>RNe(K),[K]),Y=w.useMemo(()=>U.map(he=>{const se=K.find(Ce=>Ce.metricKey===he);return{id:he,metricKey:he,label:(se==null?void 0:se.label)||he,plotType:se!=null&&se.isInferencePerformance?"inference_performance":se!=null&&se.isInferencePerformanceArea?"inference_performance_area":se!=null&&se.isInferenceUtilizationArea?"inference_utilization_area":se!=null&&se.isTrainerPerformance?"trainer_performance":se!=null&&se.isTrainerPerformanceArea?"trainer_performance_area":se!=null&&se.isHistogram?"histogram":se!=null&&se.isDistributionOverTime?"distribution_over_time":se!=null&&se.isEvalMetric?"eval_metric":"step_metric"}}),[U,K]),j=he=>{he&&f(se=>[...se,he])},le=he=>{f(se=>se.filter((Ce,de)=>de!==he))},ce=fy(od(d0,{activationConstraint:{distance:5}}),od(u0,{coordinateGetter:gy})),X=w.useCallback(he=>{const{active:se,over:Ce}=he;if(!Ce||se.id===Ce.id)return;const de=ne.find(Te=>Te.sortableId===se.id),Me=ne.find(Te=>Te.sortableId===Ce.id);!de||!Me||f(Te=>f0(Te,de.originalIndex,Me.originalIndex))},[f,ne]),ie=he=>K.find(se=>se.metricKey===he),[fe,Q]=w.useState(null),ue=w.useCallback(he=>{if(!he||!a){Q(null);return}const se=he.querySelector('[data-slot="scroll-area-viewport"]');se&&Q(se)},[a]);return!N||!a?null:d.jsxs("div",{className:"w-[320px] border-l border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[d.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center justify-between shrink-0",children:[d.jsx("h2",{className:"font-semibold text-sm",children:R?"Eval Metrics":"Training Metrics"}),d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l(!1),children:d.jsx(Kue,{className:"h-4 w-4"})})]}),d.jsx("div",{className:"px-4 py-2 border-b border-border shrink-0",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Sy,{catalog:z,onSelect:he=>j(he.metricKey),existingPlots:Y,allowDuplicates:!0,children:d.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:[d.jsx("span",{className:"font-medium",children:"Charts"}),U.length>0&&d.jsx("span",{className:"text-[10px] bg-accent text-accent-foreground rounded px-1.5 py-0 font-medium",children:U.length}),d.jsx(kr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 ml-auto"})]})}),d.jsx(IS,{label:"EMA",variant:"selecting",size:"sm",enabled:b,onEnabledChange:_,value:C,onValueChange:A,onValueCommit:he=>{const se=parseInt(he,10);!isNaN(se)&&se>=2&&se<=100?(M(se),A(se.toString())):A(S.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"})]})}),d.jsx(jx,{ref:ue,className:"flex-1 min-h-0",children:d.jsxs("div",{className:"p-4 space-y-4",children:[R&&d.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[d.jsx(wn,{variant:p?"outline":"default",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>m(!1),children:"All"}),d.jsx(wn,{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?d.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"}):d.jsx(py,{sensors:ce,collisionDetection:hy,onDragEnd:X,children:d.jsx(my,{items:ne.map(({sortableId:he})=>he),strategy:m8,children:d.jsx("div",{className:"space-y-4",children:ne.map(({metricKey:he,originalIndex:se,sortableId:Ce})=>{const de=ie(he);if(x&&(de!=null&&de.isHistogram||de!=null&&de.isDistributionOverTime||de!=null&&de.suffix&&de.suffix!=="mean"&&de.suffix!==""))return null;const Me=R&&x?`/s/${o.selectedSampleIdx}/`:"/",Pe=R&&he.startsWith("eval/")?he.replace(/^(eval\/[^/]+)\//,`$1${Me}`):he,oe=(de==null?void 0:de.histogramMetricType)||"",Ve=R&&oe.startsWith("eval/")?oe.replace(/^(eval\/[^/]+)\//,`$1${Me}`):oe,He=x&&(de==null?void 0:de.suffix)==="mean"?(de.label||he).replace(/ - Mean$/,""):(de==null?void 0:de.label)||he;if(de!=null&&de.isInferencePerformance&&de.inferenceMetricType){const ze=d.jsx("button",{onClick:()=>le(se),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:d.jsx(Na,{className:"h-3.5 w-3.5"})});return d.jsx(Im,{id:Ce,children:Ge=>d.jsx(W$,{runs:J,shouldPoll:O,hoveredRunId:k,scrollRoot:fe,inferenceMetricType:de.inferenceMetricType,label:He,headerPrefix:Ge,headerSuffix:ze})},Ce)}if(de!=null&&de.isInferencePerformanceArea&&de.inferenceAreaCategories){const ze=d.jsx("button",{onClick:()=>le(se),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:d.jsx(Na,{className:"h-3.5 w-3.5"})});return d.jsx(Im,{id:Ce,children:Ge=>d.jsx(q$,{runs:J,shouldPoll:O,scrollRoot:fe,label:He,categories:de.inferenceAreaCategories,headerPrefix:Ge,headerSuffix:ze})},Ce)}if(de!=null&&de.isInferenceUtilizationArea&&de.inferenceAreaCategories){const ze=d.jsx("button",{onClick:()=>le(se),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:d.jsx(Na,{className:"h-3.5 w-3.5"})});return d.jsx(Im,{id:Ce,children:Ge=>d.jsx(Y$,{runs:J,shouldPoll:O,scrollRoot:fe,label:He,categories:de.inferenceAreaCategories,headerPrefix:Ge,headerSuffix:ze})},Ce)}if(de!=null&&de.isTrainerPerformance&&de.trainerMetricType){const ze=d.jsx("button",{onClick:()=>le(se),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:d.jsx(Na,{className:"h-3.5 w-3.5"})});return d.jsx(Im,{id:Ce,children:Ge=>d.jsx(Z$,{runs:J,shouldPoll:O,hoveredRunId:k,scrollRoot:fe,trainerMetricType:de.trainerMetricType,label:He,headerPrefix:Ge,headerSuffix:ze})},Ce)}if(de!=null&&de.isTrainerPerformanceArea&&de.trainerAreaCategories){const ze=d.jsx("button",{onClick:()=>le(se),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:d.jsx(Na,{className:"h-3.5 w-3.5"})});return d.jsx(Im,{id:Ce,children:Ge=>d.jsx(J$,{runs:J,shouldPoll:O,scrollRoot:fe,label:He,categories:de.trainerAreaCategories,headerPrefix:Ge,headerSuffix:ze})},Ce)}return de!=null&&de.isHistogram?d.jsx(Im,{id:Ce,children:ze=>d.jsx(ONe,{runPath:N,step:t,metricType:Ve,label:He,showZeroLine:de==null?void 0:de.showZeroLine,unit:de==null?void 0:de.unit,isTokenMetric:(de==null?void 0:de.category)==="tokens",onRemove:()=>le(se),scrollRoot:fe,headerPrefix:ze})},Ce):de!=null&&de.isDistributionOverTime?d.jsx(Im,{id:Ce,children:ze=>d.jsx(jNe,{runPath:N,metricType:Ve,label:He,showZeroLine:de==null?void 0:de.showZeroLine,unit:de==null?void 0:de.unit,isTokenMetric:(de==null?void 0:de.category)==="tokens",currentStep:t,shouldPoll:O,onRemove:()=>le(se),selectedStepAtom:i,maxSelectableStep:e,scrollRoot:fe,headerPrefix:ze})},Ce):d.jsx(Im,{id:Ce,children:ze=>d.jsx(PNe,{runs:J,shouldPoll:O,metricKey:Pe,label:He,showZeroLine:de==null?void 0:de.showZeroLine,unit:de==null?void 0:de.unit,isTokenMetric:(de==null?void 0:de.category)==="tokens",showEma:b,emaSpan:S,currentStep:t,onRemove:()=>le(se),hoveredRunId:k,selectedStepAtom:i,maxSelectableStep:e,scrollRoot:fe,filterKey:`${he}-${se}`,headerPrefix:ze})},Ce)})})})})]})})]})}function DNe(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 Wf(t,e,n,r){const{isEval:i,evalName:s,rawMetricName:o,sampleIdx:a}=DNe(e),l=pW(t,e,n&&!i,r),c=zde(t,s,o,n&&i,r,a);return i?c:l}function PNe({runs:t,shouldPoll:e,metricKey:n,label:r,showZeroLine:i,unit:s,isTokenMetric:o,showEma:a=!1,emaSpan:l=10,currentStep:c,onRemove:f,hoveredRunId:p=null,selectedStepAtom:m=zT,maxSelectableStep:x,scrollRoot:b=null,filterKey:_,headerPrefix:S}){var tt,be,Le,Ze,Ee,Ye,it,mt,ft,Qe;const M=sd(m),C=qn(as),{isFullscreen:A,toggleFullscreen:N,fullscreenPortal:P}=WZ(),k=w.useRef(null),O=w.useRef(null),R=w.useRef(null),L=w.useRef(null),B=w.useRef(null),V=_??n,[W,G]=fn(Q7),ee=D8.has(n),H=W[V],q=(H==null?void 0:H.ignoreOutliers)??!1,J=(H==null?void 0:H.ignoreFirstStep)??ee,K=(H==null?void 0:H.minY)??null,ne=(H==null?void 0:H.maxY)??null,U=w.useCallback(Ae=>{G(Xe=>{const Re={ignoreOutliers:!1,ignoreFirstStep:ee,minY:null,maxY:null,tagFilters:{},envFilters:[]},Be=Xe[V]??Re,ot=Ae(Be);if(ot.ignoreOutliers===Re.ignoreOutliers&&ot.ignoreFirstStep===Re.ignoreFirstStep&&ot.minY===Re.minY&&ot.maxY===Re.maxY&&Object.keys(ot.tagFilters??{}).length===0){if(!Object.prototype.hasOwnProperty.call(Xe,V))return Xe;const Nt={...Xe};return delete Nt[V],Nt}return{...Xe,[V]:ot}})},[V,G,ee]),z=w.useCallback(Ae=>U(Xe=>({...Xe,ignoreOutliers:Ae})),[U]),Y=w.useCallback(Ae=>U(Xe=>({...Xe,ignoreFirstStep:Ae})),[U]),j=w.useCallback(Ae=>U(Xe=>({...Xe,minY:Ae})),[U]),le=w.useCallback(Ae=>U(Xe=>({...Xe,maxY:Ae})),[U]),X=x9(k,{root:b,threshold:0})||A,ie=Wf(((tt=t[0])==null?void 0:tt.runPath)||"",n,X&&!!t[0],e),fe=Wf(((be=t[1])==null?void 0:be.runPath)||"",n,X&&!!t[1],e),Q=Wf(((Le=t[2])==null?void 0:Le.runPath)||"",n,X&&!!t[2],e),ue=Wf(((Ze=t[3])==null?void 0:Ze.runPath)||"",n,X&&!!t[3],e),he=Wf(((Ee=t[4])==null?void 0:Ee.runPath)||"",n,X&&!!t[4],e),se=Wf(((Ye=t[5])==null?void 0:Ye.runPath)||"",n,X&&!!t[5],e),Ce=Wf(((it=t[6])==null?void 0:it.runPath)||"",n,X&&!!t[6],e),de=Wf(((mt=t[7])==null?void 0:mt.runPath)||"",n,X&&!!t[7],e),Me=Wf(((ft=t[8])==null?void 0:ft.runPath)||"",n,X&&!!t[8],e),Te=Wf(((Qe=t[9])==null?void 0:Qe.runPath)||"",n,X&&!!t[9],e),Pe=w.useMemo(()=>{const Ae=t.filter(Re=>!Re.isSelected),Xe=t.filter(Re=>Re.isSelected);return[...Ae,...Xe]},[t]),oe=w.useMemo(()=>Pe.slice(0,10),[Pe]),Ve=w.useMemo(()=>{const Ae=new Map;return oe.forEach((Xe,Re)=>{Ae.set(Xe.runPath,Re)}),Ae},[oe]),{uplotData:He,seriesConfig:ze,isFetching:Ge,isRefetching:ae,isPlaceholderData:Z,hasData:ge,minStep:we,maxStep:_e}=w.useMemo(()=>{const Ae=[ie,fe,Q,ue,he,se,Ce,de,Me,Te],Xe=new Map;t.forEach((Ut,Ft)=>{Ft<10&&Xe.set(Ut.runPath,Ae[Ft])});const Re=new Set,Be=new Map;let ot=!1,dt=!1,Nt=!1;if(Pe.forEach((Ut,Ft)=>{var Rt;if(Ft>=10)return;const Bt=Xe.get(Ut.runPath);if(!Bt)return;Bt.isFetching&&(ot=!0),Bt.isRefetching&&(dt=!0),Bt.isPlaceholderData&&(Nt=!0);const Kt=((Rt=Bt.data)==null?void 0:Rt.metrics)||[],dn=new Map;Kt.forEach(Pt=>{Re.add(Pt.step),dn.set(Pt.step,Pt.value)}),Be.set(Ft,dn)}),Re.size===0)return{uplotData:null,seriesConfig:[],isFetching:ot,isRefetching:dt,isPlaceholderData:Nt,hasData:!1,minStep:0,maxStep:0};const Dt=Array.from(Re).sort((Ut,Ft)=>Ut-Ft),St=new Float64Array(Dt),Ht=[{label:"Step"}],rn=[St];return Pe.forEach((Ut,Ft)=>{if(Ft>=10)return;const Bt=Be.get(Ft)||new Map,Kt=Dt.map(Lt=>Bt.get(Lt)??null),dn=p===Ut.runPath,Rt=p!==null;let Pt;Rt&&!dn?Pt=.1:Pt=a?.3:1,rn.push(Kt),Ht.push({label:wp(Ut),stroke:Ut.color,width:1,alpha:Pt,spanGaps:!0,points:{show:!1}})}),a&&Pe.forEach((Ut,Ft)=>{if(Ft>=10)return;const Bt=Be.get(Ft)||new Map,Kt=2/(l+1);let dn=null;const Rt=[];Dt.forEach(It=>{const Oe=Bt.get(It);Oe!==void 0?(dn===null?dn=Oe:dn=Kt*Oe+(1-Kt)*dn,Rt.push(dn)):Rt.push(null)});const Pt=p===Ut.runPath,Lt=p!==null;let ln;Lt&&!Pt?ln=.1:ln=1,rn.push(Rt),Ht.push({label:`${wp(Ut)} (EMA)`,stroke:Ut.color,width:1.5,alpha:ln,spanGaps:!0,points:{show:!1}})}),{uplotData:rn,seriesConfig:Ht,isFetching:ot,isRefetching:dt,isPlaceholderData:Nt,hasData:!0,minStep:Dt[0],maxStep:Dt[Dt.length-1]}},[t,Pe,ie,fe,Q,ue,he,se,Ce,de,Me,Te,a,l,p]),ve=n.split("_").pop()||"",Ue=w.useCallback(Ae=>Ae==null?"N/A":o&&(ve==="min"||ve==="max")?Math.round(Ae).toLocaleString():vu(Ae),[o,ve]),Se=w.useCallback(Ae=>Math.abs(Ae)>=1e3?`${parseFloat((Ae/1e3).toFixed(1))}k`:o?ve==="min"||ve==="max"?Math.round(Ae).toString():String(parseFloat(Ae.toFixed(1))):Number.isInteger(Ae)?Ae.toLocaleString():Math.abs(Ae)<.01&&Ae!==0?Ae.toExponential(1):String(parseFloat(Ae.toFixed(2))),[o,ve]),ke=w.useCallback(Ae=>Ae>=1e3?`${(Ae/1e3).toFixed(0)}k`:Ae.toString(),[]);w.useEffect(()=>{if(!O.current||!He||!ge)return;const Ae=O.current,Xe=Ae.clientWidth,Re=Ae.clientHeight||160;let Be=null;if(q){const It=[];for(let Oe=1;Oe<He.length;Oe++){const gt=He[Oe],_t=J?1:0;for(let Vt=_t;Vt<gt.length;Vt++){const vn=gt[Vt];vn!=null&&It.push(vn)}}Be=gC(It)}let ot=1/0,dt=-1/0;for(let It=1;It<He.length;It++){const Oe=He[It],gt=J?1:0;for(let _t=gt;_t<Oe.length;_t++){const Vt=Oe[_t];if(Vt!=null){if(q&&Be&&(Vt<Be.lower||Vt>Be.upper))continue;Vt<ot&&(ot=Vt),Vt>dt&&(dt=Vt)}}}const Nt=dt-ot,Dt=Math.max(Math.abs(dt),Math.abs(ot)),St=Math.max(Dt*.05,1e-10),Ht=Math.max(Nt*.1,St);let rn,Ut;i?(rn=Math.min(ot-Ht,0),Ut=Math.max(dt+Ht,0)):(rn=ot-Ht,Ut=dt+Ht),K!==null&&(rn=K),ne!==null&&(Ut=ne);const Ft=C?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Bt=C?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Kt=(It,Oe)=>{if(!Oe||Oe.length===0)return 36;const gt=Math.max(...Oe.map(_t=>_t.length));return Math.max(36,gt*6+12)},dn=c!=null&&Number.isFinite(we)&&Number.isFinite(_e)&&c>=we&&c<=_e,Rt={width:Xe,height:Re,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[rn,Ut]}},axes:[{stroke:Bt,grid:{stroke:Ft,width:1},ticks:{stroke:Ft,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(It,Oe)=>Oe.map(ke)},{stroke:Bt,grid:{stroke:Ft,width:1},ticks:{stroke:Ft,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:Kt,values:(It,Oe)=>Oe.map(Se)}],series:ze,hooks:{draw:[It=>{if(dn&&c!=null){const Oe=It.ctx,gt=It.valToPos(c,"x",!0),_t=It.valToPos(Ut,"y",!0),Vt=It.valToPos(rn,"y",!0);Oe.save(),Oe.strokeStyle=C?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.25)",Oe.lineWidth=2,Oe.beginPath(),Oe.moveTo(gt,_t),Oe.lineTo(gt,Vt),Oe.stroke(),Oe.restore()}if(i&&rn<0&&Ut>0){const Oe=It.ctx,gt=It.valToPos(0,"y",!0),_t=It.valToPos(It.scales.x.min,"x",!0),Vt=It.valToPos(It.scales.x.max,"x",!0);Oe.save(),Oe.strokeStyle=C?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",Oe.lineWidth=1,Oe.setLineDash([5,5]),Oe.beginPath(),Oe.moveTo(_t,gt),Oe.lineTo(Vt,gt),Oe.stroke(),Oe.restore()}}],setCursor:[It=>{if(!L.current)return;const{left:Oe,idx:gt}=It.cursor;if(B.current=gt??null,gt==null||Oe===void 0||Oe<0){L.current.style.display="none";return}const _t=He[0][gt];if(_t===void 0){L.current.style.display="none";return}let Vt=`<div class="font-medium mb-1">Step ${Number(_t).toLocaleString()}</div>`;const vn=oe.length;t.forEach(ut=>{var hn,Sn;const qt=Ve.get(ut.runPath);if(qt===void 0)return;const en=qt+1,Qt=(hn=He[en])==null?void 0:hn[gt];let Gt;if(a){const Nn=vn+qt+1;Gt=(Sn=He[Nn])==null?void 0:Sn[gt]}Qt!=null&&(Vt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${ut.color}"></div>
                    <span>${Ow(ut)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${a?.7:1}">${Ue(Qt)}${s?` ${s}`:""}</span>
                    ${a&&Gt!==void 0&&Gt!==null?`<span class="text-muted-foreground">(EMA: ${Ue(Gt)})</span>`:""}
                  </div>
                </div>
              `)}),L.current.innerHTML=Vt,L.current.style.display="block",L.current.style.left="0px",L.current.style.top="0px";const ye=L.current.getBoundingClientRect(),et=O.current.getBoundingClientRect();let xt=et.left+Oe+15;xt+ye.width+20>window.innerWidth&&(xt=et.left+Oe-ye.width-15+It.bbox.left),xt=Math.max(4,xt);let vt=et.top-ye.height+20;vt<4&&(vt=et.top+8),L.current.style.left=`${xt-ye.left}px`,L.current.style.top=`${vt-ye.top}px`}]}};R.current&&R.current.destroy();const Pt=new ss(Rt,He,Ae);R.current=Pt;const Lt=()=>{const It=B.current;if(It!=null){let Oe=He[0][It];Oe!==void 0&&!isNaN(Oe)&&(x!=null&&Oe>x&&(Oe=x),M(Oe))}};Ae.addEventListener("click",Lt);const ln=new ResizeObserver(It=>{for(const Oe of It){const{width:gt,height:_t}=Oe.contentRect;Pt&&gt>0&&_t>0&&Pt.setSize({width:gt,height:_t})}});return ln.observe(Ae),()=>{Ae.removeEventListener("click",Lt),ln.disconnect(),Pt.destroy(),R.current=null}},[He,ze,ge,i,Se,ke,Ue,Pe,a,s,c,we,_e,M,x,t,oe,Ve,C,q,J,K,ne,A]);const qe=w.useCallback(()=>{L.current&&(L.current.style.display="none")},[]),Je=Ge&&(!ae||Z),nt=q||J||K!==null||ne!==null;return P(d.jsxs("div",{ref:k,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&&Je&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[!A&&S,d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",A?"text-sm":"text-xs"),title:r,children:r})}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:q,onCheckedChange:z,children:"Ignore Outliers"}),d.jsx(ur,{checked:J,onCheckedChange:Y,children:"Ignore First Step"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:Ae=>{const Xe=Ae.target.value;j(Xe===""?null:Number(Xe))},onClick:Ae=>Ae.stopPropagation(),onKeyDown:Ae=>Ae.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:ne??"",onChange:Ae=>{const Xe=Ae.target.value;le(Xe===""?null:Number(Xe))},onClick:Ae=>Ae.stopPropagation(),onKeyDown:Ae=>Ae.stopPropagation()})]})]})]}),d.jsx($Z,{isFullscreen:A,onClick:N}),!A&&d.jsx("button",{onClick:f,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:d.jsx(Na,{className:"h-3.5 w-3.5"})})]})]}),nt&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[q&&d.jsx(rs,{label:"Ignore Outliers",onRemove:()=>z(!1)}),J&&d.jsx(rs,{label:"Ignore First Step",onRemove:()=>Y(!1)}),K!==null&&d.jsx(rs,{label:`Min Y: ${K}`,onRemove:()=>j(null)}),ne!==null&&d.jsx(rs,{label:`Max Y: ${ne}`,onRemove:()=>le(null)})]})]}),ge?d.jsxs("div",{className:bt("cursor-pointer relative bg-background rounded",A?"flex-1 min-h-0":"h-40"),ref:O,onMouseLeave:qe,children:[d.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"}}),ae&&!Z&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:bt("flex items-center justify-center text-muted-foreground text-xs rounded",A?"flex-1 min-h-0":"h-40"),children:Ge?"Loading...":"No data"})]}))}function INe(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 ONe({runPath:t,step:e,metricType:n,label:r,showZeroLine:i,isTokenMetric:s,onRemove:o,scrollRoot:a=null,headerPrefix:l}){const c=qn(as),f=w.useRef(null),p=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=x9(f,{root:a,threshold:0}),{data:_,isFetching:S,isRefetching:M,isPlaceholderData:C}=Ude(t,e??null,n,b&&!!t&&e!==null&&e!==void 0&&!!n),{histogramData:A,hasData:N}=w.useMemo(()=>{const R=(_==null?void 0:_.values)??[];if(R.length===0)return{histogramData:null,hasData:!1};const{binEdges:L,counts:B}=INe(R,25),V=L.slice(0,-1).map((W,G)=>(W+L[G+1])/2);return{histogramData:{binEdges:L,binCenters:V,counts:B,totalCount:R.length,min:Math.min(...R),max:Math.max(...R),mean:R.reduce((W,G)=>W+G,0)/R.length},hasData:!0}},[_==null?void 0:_.values]),P=w.useCallback(R=>R==null?"N/A":s?Math.round(R).toLocaleString():vu(R),[s]);w.useEffect(()=>{if(!p.current||!A||!N)return;const R=p.current,L=R.clientWidth,B=R.clientHeight||160,V=new Float64Array(A.binCenters),W=new Float64Array(A.counts),G=[V,W],H=Math.max(...A.counts)*1.1,q=c?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",J=c?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",K="rgba(59, 130, 246, 0.7)",ne=A.binEdges[1]-A.binEdges[0],z={width:L,height:B,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,H]}},axes:[{stroke:J,grid:{stroke:q,width:1},ticks:{stroke:q,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(le,ce)=>ce.map(X=>Math.abs(X)>=1e3?`${parseFloat((X/1e3).toFixed(1))}k`:Math.abs(X)<.01&&X!==0?X.toExponential(1):String(parseFloat(X.toFixed(2))))},{stroke:J,grid:{stroke:q,width:1},ticks:{stroke:q,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(le,ce)=>{if(!ce||ce.length===0)return 36;const X=Math.max(...ce.map(ie=>ie.length));return Math.max(36,X*6+12)},values:(le,ce)=>ce.map(X=>X>=1e3?`${(X/1e3).toFixed(0)}k`:Math.round(X).toString())}],series:[{label:"Value"},{label:"Count",stroke:K,fill:K,width:0,paths:(le,ce)=>{const X=new Path2D,{data:ie}=le,fe=ie[0],Q=ie[ce];for(let ue=0;ue<fe.length;ue++){const he=fe[ue],se=Q[ue];if(se==null||se===0)continue;const Ce=le.valToPos(he-ne/2,"x",!0),de=le.valToPos(he+ne/2,"x",!0),Me=le.valToPos(0,"y",!0),Te=le.valToPos(se,"y",!0),Pe=Math.max(1,de-Ce-1);X.rect(Ce+.5,Te,Pe,Me-Te)}return{stroke:X,fill:X}}}],hooks:{draw:[le=>{if(i&&A.min<0&&A.max>0){const ce=le.ctx,X=le.valToPos(0,"x",!0),ie=le.valToPos(0,"y",!0),fe=le.valToPos(H,"y",!0);ce.save(),ce.strokeStyle=c?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",ce.lineWidth=1,ce.setLineDash([5,5]),ce.beginPath(),ce.moveTo(X,ie),ce.lineTo(X,fe),ce.stroke(),ce.restore()}}],setCursor:[le=>{if(!x.current)return;const{left:ce,idx:X}=le.cursor;if(X==null||ce===void 0||ce<0){x.current.style.display="none";return}const ie=A.binCenters[X],fe=A.counts[X],Q=A.binEdges[X],ue=A.binEdges[X+1];if(ie===void 0||fe===void 0){x.current.style.display="none";return}const he=(fe/A.totalCount*100).toFixed(1);x.current.innerHTML=`
              <div class="font-medium mb-1">Range: ${P(Q)} - ${P(ue)}</div>
              <div class="text-muted-foreground">Count: ${fe.toLocaleString()} (${he}%)</div>
            `,x.current.style.display="block",x.current.style.left="0px",x.current.style.top="0px";const se=x.current.getBoundingClientRect(),Ce=p.current.getBoundingClientRect();let de=Ce.left+ce+15;de+se.width+20>window.innerWidth&&(de=Ce.left+ce-se.width-15+le.bbox.left),de=Math.max(4,de);let Me=Ce.top-se.height+20;Me<4&&(Me=Ce.top+8),x.current.style.left=`${de-se.left}px`,x.current.style.top=`${Me-se.top}px`}]}};m.current&&m.current.destroy();const Y=new ss(z,G,R);m.current=Y;const j=new ResizeObserver(le=>{for(const ce of le){const{width:X,height:ie}=ce.contentRect;Y&&X>0&&ie>0&&Y.setSize({width:X,height:ie})}});return j.observe(R),()=>{j.disconnect(),Y.destroy(),m.current=null}},[A,N,i,P,c]);const k=w.useCallback(()=>{x.current&&(x.current.style.display="none")},[]),O=S&&(!M||C);return d.jsxs("div",{ref:f,className:bt("group/card rounded-lg border border-border p-3 transition-opacity","bg-background",O&&"opacity-50"),children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l,d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:r})}),d.jsx("div",{className:"flex items-center gap-2",children:d.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:d.jsx(Na,{className:"h-3.5 w-3.5"})})})]}),N?d.jsxs("div",{className:"h-40 relative bg-background rounded",ref:p,onMouseLeave:k,children:[d.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&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.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 lT=100;function LNe(t,e,n){const r=t.length;if(r<=lT)return{steps:t,counts:e};const i=Math.ceil(r/lT),s=[],o=[],a=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),f=Math.floor((l+c-1)/2);s.push(t[f]);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 jNe({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,currentStep:s,shouldPoll:o,onRemove:a,selectedStepAtom:l=zT,maxSelectableStep:c,scrollRoot:f=null,headerPrefix:p}){const m=qn(as),{isFullscreen:x,toggleFullscreen:b,fullscreenPortal:_}=WZ(),S=w.useRef(null),M=w.useRef(null),C=w.useRef(null),A=w.useRef(null),N=w.useRef(null),P=sd(l),[k,O]=w.useState(0),L=x9(S,{root:f,threshold:0})||x,{data:B,isFetching:V,isRefetching:W,isPlaceholderData:G}=mW(t,e,L&&!!t&&!!e,o),ee=B&&B.steps.length>0&&B.bin_edges.length>0,H=ee&&B.steps.length>lT,q=w.useMemo(()=>!ee||!B?null:H?LNe(B.steps,B.counts,B.bin_edges):{steps:B.steps,counts:B.counts},[ee,B,H]),J=w.useCallback(le=>le==null?"N/A":i?Math.round(le).toLocaleString():vu(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]),ne=w.useCallback(()=>{const le={top:8,right:8,bottom:24,left:40};if(!C.current||!B)return le;const ce=C.current.getContext("2d");if(!ce)return le;const X="10px system-ui, sans-serif",ie=5;let fe=0;ce.save(),ce.setTransform(1,0,0,1,0,0),ce.font=X;for(let Q=0;Q<ie;Q++){const ue=(B.global_min??0)+Q/(ie-1)*((B.global_max??0)-(B.global_min??0)),he=K(ue);fe=Math.max(fe,ce.measureText(he).width)}return ce.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(fe)+12)}},[B,K]);w.useEffect(()=>{if(!M.current||!C.current||!ee||!B||!q)return;const le=M.current,ce=C.current,X=ce.getContext("2d");if(!X)return;const ie=le.clientWidth,fe=le.clientHeight||160,Q=m?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",ue=m?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",he="10px system-ui, sans-serif",se=window.devicePixelRatio||1;ce.width=ie*se,ce.height=fe*se,ce.style.width=`${ie}px`,ce.style.height=`${fe}px`,X.scale(se,se),X.font=he,X.clearRect(0,0,ie,fe);const Ce=ne(),de=ie-Ce.left-Ce.right,Me=fe-Ce.top-Ce.bottom,Te=q.steps,Pe=B.bin_edges,oe=q.counts,Ve=Te.length,He=Pe.length-1;if(Ve===0||He===0)return;let ze=0;for(const Ue of oe)for(const Se of Ue)Se>ze&&(ze=Se);const Ge=Math.min(5,Ve),ae=5,Z=de/Math.max(Ve,1),ge=Ue=>Ce.left+(Ue+.5)*Z,we=Ue=>{const Se=(B.global_max??1)-(B.global_min??0),ke=(Ue-(B.global_min??0))/(Se||1);return Ce.top+Me-ke*Me},_e=Ue=>Ue===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(Ue/ze)*.75})`;X.strokeStyle=ue,X.lineWidth=1;for(let Ue=0;Ue<Ge;Ue++){const Se=Math.floor(Ue/Math.max(Ge-1,1)*(Ve-1)),ke=ge(Se);X.beginPath(),X.moveTo(ke,Ce.top),X.lineTo(ke,fe-Ce.bottom),X.stroke()}for(let Ue=0;Ue<ae;Ue++){const Se=(B.global_min??0)+Ue/(ae-1)*((B.global_max??0)-(B.global_min??0)),ke=we(Se);X.beginPath(),X.moveTo(Ce.left,ke),X.lineTo(ie-Ce.right,ke),X.stroke()}const ve=Z;for(let Ue=0;Ue<Ve;Ue++){const Se=Ce.left+Ue*Z,ke=oe[Ue];for(let qe=0;qe<He;qe++){const Je=ke[qe];if(Je===0)continue;const nt=Pe[qe+1],tt=Pe[qe],be=we(nt),Le=we(tt),Ze=Math.max(1,Le-be);X.fillStyle=_e(Je),X.fillRect(Se,be,ve,Ze)}}if(r&&(B.global_min??0)<0&&(B.global_max??0)>0){const Ue=we(0);X.strokeStyle=m?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",X.lineWidth=1,X.setLineDash([5,5]),X.beginPath(),X.moveTo(Ce.left,Ue),X.lineTo(ie-Ce.right,Ue),X.stroke(),X.setLineDash([])}if(s!=null){let Ue=-1,Se=1/0;for(let ke=0;ke<Te.length;ke++){const qe=Math.abs(Te[ke]-s);qe<Se&&(Se=qe,Ue=ke)}if(Ue>=0){const ke=ge(Ue);X.strokeStyle=m?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.25)",X.lineWidth=1,X.beginPath(),X.moveTo(ke,Ce.top),X.lineTo(ke,fe-Ce.bottom),X.stroke()}}X.strokeStyle=Q,X.lineWidth=1,X.beginPath(),X.moveTo(Ce.left,fe-Ce.bottom),X.lineTo(ie-Ce.right,fe-Ce.bottom),X.stroke(),X.beginPath(),X.moveTo(Ce.left,Ce.top),X.lineTo(Ce.left,fe-Ce.bottom),X.stroke(),X.fillStyle=Q,X.font=he,X.textAlign="center";for(let Ue=0;Ue<Ge;Ue++){const Se=Math.floor(Ue/Math.max(Ge-1,1)*(Ve-1)),ke=Te[Se],qe=ge(Se),Je=ke>=1e3?`${(ke/1e3).toFixed(0)}k`:ke.toString();X.fillText(Je,qe,fe-6)}X.textAlign="right",X.textBaseline="middle";for(let Ue=0;Ue<ae;Ue++){const Se=(B.global_min??0)+Ue/(ae-1)*((B.global_max??0)-(B.global_min??0)),ke=we(Se);X.fillText(K(Se),Ce.left-4,ke)}},[B,q,ee,r,s,K,ne,m,k,x]),w.useEffect(()=>{if(!M.current)return;const le=M.current,ce=new ResizeObserver(()=>{O(X=>X+1)});return ce.observe(le),()=>{ce.disconnect()}},[]);const U=w.useCallback(le=>{if(!B||!q||!C.current||!M.current)return;const ce=C.current.getBoundingClientRect(),X=le.clientX-ce.left,ie=M.current.clientWidth,fe=ne(),Q=ie-fe.left-fe.right;if(Q<=0)return;const ue=(X-fe.left)/Q,he=Math.round(ue*(q.steps.length-1));if(he>=0&&he<q.steps.length){let se=q.steps[he];c!=null&&se>c&&(se=c),P(se)}},[B,q,ne,P,c]),z=w.useCallback(le=>{var Je;if(!B||!q||!A.current||!C.current||!M.current)return;const ce=C.current.getBoundingClientRect(),X=le.clientX-ce.left,ie=le.clientY-ce.top,fe=M.current.clientWidth,Q=M.current.clientHeight||160,ue=ne(),he=fe-ue.left-ue.right,se=Q-ue.top-ue.bottom;if(he<=0||se<=0){N.current&&(N.current.style.display="none");return}if(X<ue.left||X>fe-ue.right||ie<ue.top||ie>Q-ue.bottom){A.current.style.display="none",N.current&&(N.current.style.display="none");return}const Ce=(X-ue.left)/he,de=Math.min(q.steps.length-1,Math.max(0,Math.round(Ce*(q.steps.length-1)))),Me=q.steps[de];if(N.current){const nt=he/Math.max(q.steps.length,1),tt=ue.left+(de+.5)*nt;N.current.style.display="block",N.current.style.left=`${tt}px`,N.current.style.top=`${ue.top}px`,N.current.style.bottom=`${ue.bottom}px`}const Te=1-(ie-ue.top)/se,Pe=B.bin_edges.length-1,oe=Math.min(Pe-1,Math.max(0,Math.floor(Te*Pe))),Ve=B.bin_edges[oe],He=B.bin_edges[oe+1],ze=((Je=q.counts[de])==null?void 0:Je[oe])??0,ae=(q.counts[de]??[]).reduce((nt,tt)=>nt+tt,0),Z=ae>0?(ze/ae*100).toFixed(1):"0.0",we=H&&B.steps.length>lT?" (aggregated)":"";A.current.innerHTML=`
        <div class="font-medium mb-1">Step ${Me.toLocaleString()}${we}</div>
        <div class="text-muted-foreground">Range: ${J(Ve)} to ${J(He)}</div>
        <div class="text-muted-foreground">Count: ${ze.toLocaleString()} (${Z}%)</div>
      `,A.current.style.display="block",A.current.style.left="0px",A.current.style.top="0px";const _e=A.current.getBoundingClientRect(),ve=le.clientX;let Ue=ve;Ue+_e.width+20>window.innerWidth&&(Ue=ve-_e.width);const Se=Math.max(4,window.innerWidth-_e.width-4);Ue=Math.min(Math.max(4,Ue),Se);const ke=M.current.getBoundingClientRect();let qe=ke.top-_e.height+20;qe<4&&(qe=ke.top+8),A.current.style.left=`${Ue-_e.left}px`,A.current.style.top=`${qe-_e.top}px`},[B,q,J,ne,H]),Y=w.useCallback(()=>{A.current&&(A.current.style.display="none"),N.current&&(N.current.style.display="none")},[]),j=V&&(!W||G);return _(d.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:[d.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[!x&&p,d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("h4",{className:bt("font-medium leading-snug line-clamp-2 break-words",x?"text-sm":"text-xs"),title:n,children:n})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx($Z,{isFullscreen:x,onClick:b}),!x&&d.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:d.jsx(Na,{className:"h-3.5 w-3.5"})})]})]}),ee?d.jsxs("div",{className:bt("relative bg-background rounded",x?"flex-1 min-h-0":"h-40"),ref:M,children:[d.jsx("canvas",{className:"block w-full h-full max-w-full cursor-pointer",ref:C,onClick:U,onMouseMove:z,onMouseLeave:Y}),d.jsx("div",{ref:N,className:"absolute z-[2] border-l border-dashed border-border pointer-events-none",style:{display:"none"}}),d.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"}}),W&&!G&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:bt("flex items-center justify-center text-muted-foreground text-xs rounded",x?"flex-1 min-h-0":"h-40"),children:V?"Loading...":"No data"})]}))}function iw(t,e=60){if(!t)return"";const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"..."}function zNe(t){return t===null||Number.isNaN(t)?null:`hsl(${Math.max(0,Math.min(1,t))*120} 70% 38%)`}function PN(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 GF(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 b9({openAtom:t=e8}={}){const[e,n]=fn(t);return!qn(bl)||e?null:d.jsx(wn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Samples"})}const WF=["gen_length","gen_length_sum","gen_length_avg","reward","advantage"];function _9({prompts:t,data:e,samplesData:n,rolloutMetrics:r,availableMetricNames:i,isLoading:s,step:o,currentStepIndex:a,totalSteps:l,onStepChange:c,hasSteps:f,stepValues:p,openAtom:m=e8,selectedGroupIdAtom:x=rW,selectedSampleIdxAtom:b=iW,viewModeAtom:_=oW,getGroupBadge:S,renderLeftControls:M,onGroupClick:C,hideRewardAdvantage:A=!1,envDetailsOverride:N}){var Ze,Ee,Ye,it,mt,ft,Qe,Ae,Xe;const[P,k]=fn(m),[O,R]=fn(x),[L,B]=fn(b),[V,W]=fn(_),[G,ee]=fn(Pce),[H,q]=fn(Ice),J=qn(bl),K=qn(as),{data:ne}=_h(J||"",!!J,!0),U=(Ze=ne==null?void 0:ne.config)==null?void 0:Ze.max_tokens,z=w.useMemo(()=>GF(U),[U]),Y=(Ee=ne==null?void 0:ne.config)==null?void 0:Ee.group_size,j=w.useMemo(()=>GF(Y),[Y]),le=w.useMemo(()=>{if(j==null||j<=1)return null;const Re=Math.sqrt(j-1);return{min:-Re,max:Re}},[j]),ce=N??((Ye=ne==null?void 0:ne.config)==null?void 0:Ye.environments),X=w.useMemo(()=>Hw(ce),[ce]),ie=w.useMemo(()=>{var dt;const Re=Tp(ce),Be=Tp((dt=ne==null?void 0:ne.summary)==null?void 0:dt.env_details),ot=Vw(ne==null?void 0:ne.data_metric_ranges);return Cp(Cp(Re,Be),ot)},[ce,(it=ne==null?void 0:ne.summary)==null?void 0:it.env_details,ne==null?void 0:ne.data_metric_ranges]),fe=w.useMemo(()=>{var Be;const Re=[ce,(Be=ne==null?void 0:ne.summary)==null?void 0:Be.env_details];for(const ot of Re){const dt=mD(ot);if(dt.length!==0)return dt.some(Nt=>(Nt==null?void 0:Nt.is_multi_turn)===!0)}return!1},[ce,(mt=ne==null?void 0:ne.summary)==null?void 0:mt.env_details]),[Q,ue]=w.useState(new Map),he=w.useMemo(()=>{if(!r)return null;const Re=new Map;for(const Be of r){let ot=Re.get(Be.sample_idx);ot||(ot=new Map,Re.set(Be.sample_idx,ot)),ot.set(Be.metric_name,{value:Be.value,env:Be.env})}return Re},[r]);he!==null&&he!==Q&&ue(he);const se=he??Q,[Ce,de]=w.useState([]),Me=w.useMemo(()=>{if(i!=null&&i.length)return i;if(!r)return null;const Re=new Set;for(const Be of r)Re.add(Be.metric_name);return[...Re].sort()},[i,r]);Me!==null&&Me!==Ce&&de(Me);const Te=Me??Ce,Pe=(Re,Be)=>{ee(ot=>Be===!0?ot.includes(Re)?ot:[...ot,Re]:ot.filter(dt=>dt!==Re))};w.useEffect(()=>{if(!Te.length&&!e)return;const Re=new Set;A&&(Re.add("reward"),Re.add("advantage")),fe?Re.add("gen_length"):(Re.add("gen_length_sum"),Re.add("gen_length_avg"));const Be=WF.filter(dt=>!Re.has(dt)),ot=new Set([...Be,...Te]);ee(dt=>{let Nt=dt;!fe&&!dt.includes("gen_length")&&(dt.includes("gen_length_avg")||dt.includes("gen_length_sum"))?Nt=[...Nt.filter(St=>St!=="gen_length_avg"&&St!=="gen_length_sum"),"gen_length"]:fe&&!dt.includes("gen_length_avg")&&dt.includes("gen_length")&&(Nt=[...Nt.filter(St=>St!=="gen_length"),"gen_length_avg"]);const Dt=Nt.filter(St=>ot.has(St));return Dt.length===dt.length&&Dt.every((St,Ht)=>St===dt[Ht])?dt:Dt})},[Te,e,ee,A,fe]);const oe=w.useMemo(()=>{const Re=new Set;A&&(Re.add("reward"),Re.add("advantage")),fe?Re.add("gen_length"):(Re.add("gen_length_sum"),Re.add("gen_length_avg"));const Be=[],ot=new Set;for(const dt of WF)Re.has(dt)||G.includes(dt)&&!ot.has(dt)&&(Be.push(dt),ot.add(dt));for(const dt of Te)G.includes(dt)&&!ot.has(dt)&&(Be.push(dt),ot.add(dt));return Be},[G,Te,A,fe]),[Ve,He]=w.useState([]),ze=w.useRef(0),Ge=w.useRef(null),ae=w.useRef(o),Z=w.useRef(0);w.useEffect(()=>{var ot;const Re=(ot=Ge.current)==null?void 0:ot.querySelector('[data-slot="scroll-area-viewport"]');if(!Re)return;const Be=()=>{Z.current=Re.scrollTop};return Re.addEventListener("scroll",Be,{passive:!0}),()=>Re.removeEventListener("scroll",Be)},[P]),w.useEffect(()=>{var Re;if(o!==ae.current){ae.current=o,ze.current=0,Z.current=0;const Be=(Re=Ge.current)==null?void 0:Re.querySelector('[data-slot="scroll-area-viewport"]');Be&&(Be.scrollTop=0)}},[o]);const ge=w.useMemo(()=>{if(!t)return new Map;const Re=new Map;for(const Be of t)Re.set(Be.group_id,Be);return Re},[t]),we=w.useMemo(()=>{if(!n)return new Map;const Re=new Map;for(const Be of n)Re.set(Be.sample_idx,Be);return Re},[n]),_e=w.useMemo(()=>{if(!e)return null;const Re=new Map,Be=new Map;for(const Dt of e){const St=Re.get(Dt.sample_idx)||[];St.push(Dt),Re.set(Dt.sample_idx,St),Be.set(Dt.sample_idx,Dt.group_id)}const ot=new Map;for(const[Dt,St]of Re){const Ht=[...St].sort((Oe,gt)=>Oe.turn_order-gt.turn_order),rn=Be.get(Dt)??-1,Ut=ge.get(rn)??null,Ft=we.get(Dt),Bt=Ht.find(Oe=>Oe.turn_type==="model"),Kt=(Bt==null?void 0:Bt.content)??"";let dn=null,Rt=null,Pt=0,Lt=0;for(const Oe of Ht)Oe.turn_type==="model"&&typeof Oe.tokens=="number"&&(Pt+=Oe.tokens,Lt+=1);Lt>0&&(dn=Pt/Lt,Rt=Pt);const ln={sample_idx:Dt,group_id:rn,prompt:Ut,responsePreview:Kt,turnsCount:Ht.length,turnsData:Ht,reward:(Ft==null?void 0:Ft.reward)??null,advantage:(Ft==null?void 0:Ft.advantage)??null,assistantTokens:dn,assistantTokensTotal:Rt},It=ot.get(rn)||[];It.push(ln),ot.set(rn,It)}const dt=[];for(const[Dt,St]of ot){const Ht=ge.get(Dt)??null;St.sort((rn,Ut)=>rn.sample_idx-Ut.sample_idx),dt.push({group_id:Dt,prompt:Ht,samples:St,sampleCount:St.length})}return dt.sort((Dt,St)=>Dt.group_id-St.group_id)},[e,ge,we]);_e!==null&&_e!==Ve&&He(_e);const ve=_e??Ve;w.useLayoutEffect(()=>{var Be;const Re=(Be=Ge.current)==null?void 0:Be.querySelector('[data-slot="scroll-area-viewport"]');Re&&Z.current>0&&Re.scrollTop!==Z.current&&(Re.scrollTop=Z.current)},[ve]);const Ue=w.useMemo(()=>O===null?null:ve.find(Re=>Re.group_id===O)??null,[ve,O]),Se=Ue!==null,ke=w.useMemo(()=>{let Re=0;for(const Be of ve)for(const ot of Be.samples)ot.assistantTokens!==null&&ot.assistantTokens>Re&&(Re=ot.assistantTokens);return Re>0?Re:null},[ve]),qe=z??ke,Je=w.useMemo(()=>{let Re=0;for(const Be of ve)for(const ot of Be.samples)ot.assistantTokensTotal!==null&&ot.assistantTokensTotal>Re&&(Re=ot.assistantTokensTotal);return Re>0?Re:null},[ve]),nt=z!=null?Math.max(z,Je??0)||null:Je;w.useEffect(()=>{!Se&&V==="samples"&&!s&&W("groups")},[Se,V,W,s]);const tt=Re=>{var ot;const Be=(ot=Ge.current)==null?void 0:ot.querySelector('[data-slot="scroll-area-viewport"]');if(Be&&(ze.current=Be.scrollTop),C){const dt=ve.find(Nt=>Nt.group_id===Re);dt&&C(Re,dt);return}R(Re),W("samples")},be=Re=>{B(Re)},Le=Re=>{var Be;if(Re==="samples"&&!Se){W("groups");return}if(Re==="groups"||Re==="samples"){if(V==="groups"&&Re==="samples"){const ot=(Be=Ge.current)==null?void 0:Be.querySelector('[data-slot="scroll-area-viewport"]');ot&&(ze.current=ot.scrollTop)}W(Re)}};return w.useEffect(()=>{V==="groups"&&ze.current>0&&requestAnimationFrame(()=>{var Be;const Re=(Be=Ge.current)==null?void 0:Be.querySelector('[data-slot="scroll-area-viewport"]');Re&&(Re.scrollTop=ze.current,Z.current=ze.current)})},[V]),w.useEffect(()=>{V!=="samples"||L===null||requestAnimationFrame(()=>{var ot;const Re=(ot=Ge.current)==null?void 0:ot.querySelector('[data-slot="scroll-area-viewport"]');if(!Re)return;const Be=Re.querySelector(`[data-sample-idx="${L}"]`);Be&&(Be.scrollIntoView({block:"nearest",behavior:"smooth"}),setTimeout(()=>{Z.current=Re.scrollTop},350))})},[V,L]),!J||!P?null:d.jsxs("div",{className:"w-[260px] border-r border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[d.jsxs("div",{className:"border-b border-sidebar-border shrink-0",children:[d.jsx("div",{className:"py-2.5 px-1 flex items-center justify-center h-12",children:f?d.jsx(gD,{currentPage:a,totalPages:l,onPageChange:c,pageValues:p}):d.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Loading...":"No steps available"})}),d.jsxs("div",{className:"py-1.5 px-3 flex items-center justify-between border-t border-sidebar-border",children:[M?M({viewMode:V,setViewMode:W,hasSelectedGroupInStep:Se,groups:ve}):d.jsxs(h0,{type:"single",variant:"outline",size:"sm",value:V,onValueChange:Le,children:[d.jsx(Xa,{value:"groups",className:"text-xs px-2 py-1 h-7",children:"Groups"}),d.jsx(Xa,{value:"samples",className:"text-xs px-2 py-1 h-7",disabled:!Se,children:"Samples"})]}),d.jsxs("div",{className:"flex items-center gap-0.5",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:d.jsx(uW,{className:"h-4 w-4"})})}),d.jsxs($s,{align:"end",className:"min-w-[180px]",children:[d.jsx(l0,{children:"Settings"}),d.jsx(Ds,{}),d.jsx(ur,{checked:H,onCheckedChange:Re=>q(Re===!0),onSelect:Re=>Re.preventDefault(),children:"Show Tooltips"})]})]}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:d.jsx(Ek,{className:"h-4 w-4"})})}),d.jsxs($s,{align:"end",className:"min-w-[180px]",children:[d.jsx(l0,{children:"Display Metrics"}),d.jsx(Ds,{}),fe?d.jsxs(d.Fragment,{children:[d.jsx(ur,{checked:G.includes("gen_length_sum"),onCheckedChange:Re=>Pe("gen_length_sum",Re),onSelect:Re=>Re.preventDefault(),children:"Gen. Length Sum"}),d.jsx(ur,{checked:G.includes("gen_length_avg"),onCheckedChange:Re=>Pe("gen_length_avg",Re),onSelect:Re=>Re.preventDefault(),children:"Gen. Length Avg"})]}):d.jsx(ur,{checked:G.includes("gen_length"),onCheckedChange:Re=>Pe("gen_length",Re),onSelect:Re=>Re.preventDefault(),children:"Gen. Length"}),!A&&d.jsx(ur,{checked:G.includes("reward"),onCheckedChange:Re=>Pe("reward",Re),onSelect:Re=>Re.preventDefault(),children:"Reward"}),!A&&d.jsx(ur,{checked:G.includes("advantage"),onCheckedChange:Re=>Pe("advantage",Re),onSelect:Re=>Re.preventDefault(),children:"Advantage"}),Te.length>0&&d.jsx(Ds,{}),Te.map(Re=>d.jsx(ur,{checked:G.includes(Re),onCheckedChange:Be=>Pe(Re,Be),onSelect:Be=>Be.preventDefault(),children:KR(Re)},Re))]})]}),d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>k(!1),children:d.jsx(Xue,{className:"h-4 w-4"})})]})]})]}),d.jsx(jx,{ref:Ge,className:bt("flex-1 min-h-0 transition-opacity",s&&"opacity-50"),children:ve.length===0?d.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:s?"Loading...":"No samples available"}):V==="groups"||!Ue?d.jsx("div",{className:"p-2 space-y-1",children:ve.map(Re=>d.jsx(FNe,{group:Re,onClick:()=>tt(Re.group_id),isSelected:O===Re.group_id,tokenScaleMax:qe,tokenScaleSumMax:nt,envRewardRanges:X,envMetricRanges:ie,advantageRange:le,badge:S?S(Re):null,displayMetrics:oe,metricsBySampleIdx:se,tooltipsEnabled:H,darkMode:K},Re.group_id))}):d.jsxs("div",{className:"flex flex-col min-h-0",children:[d.jsxs(Ix,{delayDuration:300,open:H?void 0:!1,children:[d.jsx(Ox,{asChild:!0,children:d.jsxs("div",{className:"p-3 border-b border-border bg-muted/30 shrink-0 cursor-default",children:[((ft=Ue.prompt)==null?void 0:ft.system_prompt)&&d.jsxs("div",{className:"mb-2",children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),d.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere]",children:iw(Ue.prompt.system_prompt,100)})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),d.jsx("p",{className:"text-xs text-foreground line-clamp-3 break-words overflow-hidden [overflow-wrap:anywhere]",children:iw((Qe=Ue.prompt)==null?void 0:Qe.prompt,150)})]})]})}),d.jsxs(Lx,{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:[((Ae=Ue.prompt)==null?void 0:Ae.system_prompt)&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:Ue.prompt.system_prompt})]}),((Xe=Ue.prompt)==null?void 0:Xe.prompt)&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:Ue.prompt.prompt})]})]})]}),d.jsx("div",{className:"p-2 space-y-1",children:Ue.samples.map(Re=>d.jsx("div",{"data-sample-idx":Re.sample_idx,children:d.jsx(VNe,{sample:Re,isSelected:L===Re.sample_idx,onClick:()=>be(Re.sample_idx),envRewardRanges:X,envMetricRanges:ie,advantageRange:le,displayMetrics:oe,metricsBySampleIdx:se,tokenScaleMax:qe,tokenScaleSumMax:nt,tooltipsEnabled:H,darkMode:K})},Re.sample_idx))})]})})]})}function FNe({group:t,onClick:e,isSelected:n,tokenScaleMax:r,tokenScaleSumMax:i,envRewardRanges:s,envMetricRanges:o,advantageRange:a,badge:l,displayMetrics:c,metricsBySampleIdx:f,tooltipsEnabled:p,darkMode:m}){var x,b,_,S;return d.jsxs(Ix,{delayDuration:300,open:p?void 0:!1,children:[d.jsx(Ox,{asChild:!0,children:d.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:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[((x=t.prompt)==null?void 0:x.system_prompt)&&d.jsx("p",{className:"text-xs text-muted-foreground mb-1 line-clamp-1 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:iw(t.prompt.system_prompt,50)}),d.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:iw((b=t.prompt)==null?void 0:b.prompt,80)}),l&&d.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:l})]}),c.length>0&&d.jsx("div",{className:"flex items-start gap-1 shrink-0 pt-0",children:c.map(M=>d.jsx("div",{className:"flex flex-col items-start gap-[0.5px]",children:t.samples.map(C=>{const A=ZR(C,M,f,r,i,s,a,o,void 0,m);return d.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))})]})})}),d.jsxs(Lx,{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)&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.system_prompt})]}),((S=t.prompt)==null?void 0:S.prompt)&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.prompt})]})]})]})}function UNe(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function KR(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function qZ(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function BNe(t,e){switch(e){case"gen_length":case"gen_length_sum":case"gen_length_avg":return Math.round(t).toString();default:return qZ(t)}}function HNe(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 ZR(t,e,n,r,i,s,o,a,l,c){var f,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=((f=t.prompt)==null?void 0:f.env)??null,x=m?s==null?void 0:s.get(m):void 0;return{value:t.reward,color:t.reward!==null?PN(t.reward,(x==null?void 0:x.min)??null,(x==null?void 0:x.max)??null)??zNe(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?PN(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:`${KR(e)}: n/a`};const b=x.env??((p=t.prompt)==null?void 0:p.env)??null,_=HNe(a,b,e),S=PN(x.value,(_==null?void 0:_.min)??null,(_==null?void 0:_.max)??null,_==null?void 0:_.invert);return{value:x.value,color:S??null,label:`${KR(e)}: ${qZ(x.value)}`}}}}function VNe({sample:t,isSelected:e,onClick:n,envRewardRanges:r,envMetricRanges:i,advantageRange:s,displayMetrics:o,metricsBySampleIdx:a,tokenScaleMax:l,tokenScaleSumMax:c,tooltipsEnabled:f,darkMode:p}){return d.jsxs(Ix,{delayDuration:300,open:f?void 0:!1,children:[d.jsx(Ox,{asChild:!0,children:d.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:d.jsxs("div",{className:"flex items-stretch justify-between gap-2 min-w-0",children:[d.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=>ZR(t,m,a,l,c,r,s,i,70,p).value!==null).length):2,overflowWrap:"anywhere"},children:iw(t.responsePreview,300)||"No response"}),o.length>0&&d.jsx("div",{className:"flex items-start gap-1 shrink-0",children:d.jsx("div",{className:"flex flex-col items-center gap-0.5",children:o.map(m=>{const x=ZR(t,m,a,l,c,r,s,i,70,p);return x.value===null?null:d.jsx("span",{className:"text-[10px] font-semibold tabular-nums leading-none",style:x.color?{color:x.color}:void 0,title:x.label,children:BNe(x.value,m)},m)})})})]})})}),d.jsx(Lx,{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:d.jsxs("div",{className:"space-y-3",children:[t.turnsData.map(m=>d.jsxs("div",{children:[d.jsxs("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5 flex items-center gap-2",children:[d.jsx("span",{children:UNe(m.turn_type)}),m.tokens!=null&&d.jsxs("span",{className:"font-normal normal-case",children:[m.tokens.toLocaleString()," tokens"]})]}),d.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&&d.jsx("p",{className:"text-xs text-muted-foreground",children:"No turns available"})]})})]})}function GNe(){var de,Me,Te,Pe,oe;const t=qn(bl),[e]=c7(),[n,r]=fn(zT),[i,s]=fn(rW),[o,a]=fn(iW),l=qn(sW),[c,f]=fn(e8),[,p]=fn(oW),m=qn(J7),[x,b]=fn(BT),[_,S]=fn(HT),M=x.length+(_?1:0),C=Ve=>{b(He=>He.includes(Ve)?He.filter(ze=>ze!==Ve):[...He,Ve])},[A,N]=w.useState(0),[P,k]=w.useState(0),[O,R]=w.useState(!0),L=!0,B=w.useMemo(()=>{const Ve=e.get("step");if(!Ve)return null;const He=Number(Ve);return Number.isFinite(He)?He:null},[e]),V=w.useMemo(()=>{const Ve=e.get("sample");if(!Ve)return null;const He=Number(Ve);return Number.isFinite(He)?He:null},[e]),W=w.useMemo(()=>{const Ve=e.get("group");if(!Ve)return null;const He=Number(Ve);return Number.isFinite(He)?He:null},[e]),G=w.useRef(null),ee=w.useRef({group:null,sample:null});w.useEffect(()=>{if(!t){G.current=null,ee.current={group:null,sample:null};return}if(B==null){G.current=null;return}B!==G.current&&(r(B),G.current=B)},[B,t,r]),w.useEffect(()=>{t&&(W==null||V==null||ee.current.group===W&&ee.current.sample===V||(s(W),a(V),f(!0),p("samples"),ee.current={group:W,sample:V}))},[W,V,t,s,a,f,p]);const{data:H,isLoading:q,error:J}=wde(t||"",n,!!t),{data:K}=_h(t||"",!!t,L),ne=w.useMemo(()=>{var Ve;return Hw((Ve=K==null?void 0:K.config)==null?void 0:Ve.environments)},[(de=K==null?void 0:K.config)==null?void 0:de.environments]),U=w.useMemo(()=>{var Ge,ae;const Ve=Tp((Ge=K==null?void 0:K.config)==null?void 0:Ge.environments),He=Tp((ae=K==null?void 0:K.summary)==null?void 0:ae.env_details),ze=Vw(K==null?void 0:K.data_metric_ranges);return Cp(Cp(Ve,He),ze)},[(Me=K==null?void 0:K.config)==null?void 0:Me.environments,(Te=K==null?void 0:K.summary)==null?void 0:Te.env_details,K==null?void 0:K.data_metric_ranges]),z=w.useMemo(()=>{var Ge;const Ve=(Ge=K==null?void 0:K.config)==null?void 0:Ge.group_size,He=typeof Ve=="object"&&Ve!==null&&"value"in Ve?Number(Ve.value):Number(Ve);if(!He||isNaN(He)||He<=1)return null;const ze=Math.sqrt(He-1);return{min:-ze,max:ze}},[(Pe=K==null?void 0:K.config)==null?void 0:Pe.group_size]),Y=w.useMemo(()=>{var Ve;return(Ve=H==null?void 0:H.available_steps)!=null&&Ve.length&&n===null?H.available_steps[H.available_steps.length-1]:null},[H,n]);w.useEffect(()=>{Y!==null&&n===null&&B==null&&r(Y)},[Y,B,n,r]);const j=Ve=>{r(Ve)},[le,ce]=w.useState([]),[X,ie]=w.useState(null);t!==X&&(ce([]),ie(t));const fe=H==null?void 0:H.available_steps,Q=w.useMemo(()=>{const Ve=fe??[];return[...new Set([...le,...Ve])].sort((ze,Ge)=>ze-Ge)},[fe,le]);Q.length>le.length&&ce(Q);const ue=Q.length>0,he=ue?Q[Q.length-1]:0,se=w.useMemo(()=>{if(n==null)return Q.length-1;const Ve=Q.indexOf(n);return Ve>=0?Ve:Q.length-1},[Q,n]),Ce=Ve=>{Ve>=0&&Ve<Q.length&&j(Q[Ve])};return t?d.jsxs("div",{className:"flex h-full overflow-hidden",children:[d.jsx(_9,{prompts:H==null?void 0:H.prompts,data:H==null?void 0:H.rollouts,samplesData:H==null?void 0:H.samples_data,rolloutMetrics:H==null?void 0:H.rollout_metrics,availableMetricNames:H==null?void 0:H.available_rollout_metric_names,isLoading:q,step:n??void 0,currentStepIndex:se,totalSteps:Q.length,onStepChange:Ce,hasSteps:ue,stepValues:Q}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center justify-between h-7",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(b9,{}),l&&d.jsxs("div",{className:"text-sm text-muted-foreground",children:[d.jsxs("span",{children:["Step ",((oe=l.sample.turns[0])==null?void 0:oe.step)??n]})," · ",d.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",d.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&d.jsx(DC,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&d.jsxs(d.Fragment,{children:[d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(Ve=>Ve+1),R(!1)},children:"Collapse All"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{k(Ve=>Ve+1),R(!0)},children:"Expand All"}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",M>0&&` (${M})`]})}),d.jsxs($s,{align:"start",className:"w-auto",children:[d.jsx(ur,{checked:_,onCheckedChange:Ve=>S(!!Ve),onSelect:Ve=>Ve.preventDefault(),children:"Format Think"}),d.jsx(ur,{checked:x.includes("markdown"),onCheckedChange:()=>C("markdown"),onSelect:Ve=>Ve.preventDefault(),children:"Markdown"}),d.jsx(ur,{checked:x.includes("latex"),onCheckedChange:()=>C("latex"),onSelect:Ve=>Ve.preventDefault(),children:"LaTeX"}),d.jsx(ur,{checked:x.includes("code"),onCheckedChange:()=>C("code"),onSelect:Ve=>Ve.preventDefault(),children:"Code"})]})]})]})]}),d.jsx(v9,{})]})})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:d.jsxs("div",{className:c||m?"max-w-5xl mx-auto":"",children:[J&&d.jsx(dd,{className:"border-destructive mb-6",children:d.jsx(ch,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",J instanceof Error?J.message:"Unknown error"]})})}),d.jsx(j1,{prompts:H==null?void 0:H.prompts,data:H==null?void 0:H.rollouts,samplesData:H==null?void 0:H.samples_data,rolloutMetrics:H==null?void 0:H.rollout_metrics,goldenAnswers:H==null?void 0:H.golden_answers,infoTurns:H==null?void 0:H.info_turns,isLoading:q,step:n??void 0,scrollToSampleId:V,filterGroupId:i,filterSampleIdx:o,collapseAllSignal:A,expandAllSignal:P,defaultSectionsOpen:O,envRewardRanges:ne,envMetricRanges:U,advantageRange:z,renderOptions:x,formatThinkBlocks:_})]})})]}),d.jsx(y9,{currentStep:n,maxSelectableStep:he})]}):d.jsx(I0,{description:"Select a run from the sidebar to view rollouts."})}function WNe(){var we,_e,ve,Ue,Se;const t=qn(bl),[e]=c7(),[n,r]=fn(yI),[i,s]=fn(bI),[o,a]=fn(_I),l=qn(SI),[c,f]=fn(MA),[,p]=fn(wI),m=qn(wA),[x,b]=fn(BT),[_,S]=fn(HT),M=x.length+(_?1:0),C=ke=>{b(qe=>qe.includes(ke)?qe.filter(Je=>Je!==ke):[...qe,ke])},[A,N]=w.useState(0),[P,k]=w.useState(0),[O,R]=w.useState(!0),L=!0,B=w.useMemo(()=>{const ke=e.get("step")??e.get("trainer_step");if(!ke)return null;const qe=Number(ke);return Number.isFinite(qe)?qe:null},[e]),V=w.useMemo(()=>{const ke=e.get("sample");if(!ke)return null;const qe=Number(ke);return Number.isFinite(qe)?qe:null},[e]),W=w.useMemo(()=>{const ke=e.get("group");if(!ke)return null;const qe=Number(ke);return Number.isFinite(qe)?qe:null},[e]),G=w.useRef(null),ee=w.useRef({group:null,sample:null});w.useEffect(()=>{if(!t){G.current=null,ee.current={group:null,sample:null};return}if(B==null){G.current=null;return}B!==G.current&&(r(B),G.current=B)},[B,t,r]),w.useEffect(()=>{t&&(W==null||V==null||ee.current.group===W&&ee.current.sample===V||(s(W),a(V),f(!0),p("samples"),ee.current={group:W,sample:V}))},[W,V,t,s,a,f,p]);const{data:H,isLoading:q,error:J}=Mde(t||"",n,!!t),{data:K}=_h(t||"",!!t,L),ne=w.useMemo(()=>{var ke;return Hw((ke=K==null?void 0:K.config)==null?void 0:ke.environments)},[(we=K==null?void 0:K.config)==null?void 0:we.environments]),U=w.useMemo(()=>{var nt,tt;const ke=Tp((nt=K==null?void 0:K.config)==null?void 0:nt.environments),qe=Tp((tt=K==null?void 0:K.summary)==null?void 0:tt.env_details),Je=Vw(K==null?void 0:K.data_metric_ranges);return Cp(Cp(ke,qe),Je)},[(_e=K==null?void 0:K.config)==null?void 0:_e.environments,(ve=K==null?void 0:K.summary)==null?void 0:ve.env_details,K==null?void 0:K.data_metric_ranges]),z=w.useMemo(()=>{var nt;const ke=(nt=K==null?void 0:K.config)==null?void 0:nt.group_size,qe=typeof ke=="object"&&ke!==null&&"value"in ke?Number(ke.value):Number(ke);if(!qe||isNaN(qe)||qe<=1)return null;const Je=Math.sqrt(qe-1);return{min:-Je,max:Je}},[(Ue=K==null?void 0:K.config)==null?void 0:Ue.group_size]),Y=w.useMemo(()=>{var ke;return(ke=H==null?void 0:H.available_trainer_steps)!=null&&ke.length&&n===null?H.available_trainer_steps[H.available_trainer_steps.length-1]:null},[H,n]);w.useEffect(()=>{Y!==null&&n===null&&B==null&&r(Y)},[Y,B,n,r]);const j=ke=>{r(ke)},[le,ce]=w.useState([]),[X,ie]=w.useState(null),[fe,Q]=w.useState(new Map);t!==X&&(ce([]),ie(t),Q(new Map));const ue=H==null?void 0:H.available_trainer_steps,he=w.useMemo(()=>{const ke=ue??[];return[...new Set([...le,...ke])].sort((Je,nt)=>Je-nt)},[ue,le]);he.length>le.length&&ce(he);const se=he.length>0,Ce=se?he[he.length-1]:0,de=w.useMemo(()=>{if(n==null)return he.length-1;const ke=he.indexOf(n);return ke>=0?ke:he.length-1},[he,n]),Me=ke=>{ke>=0&&ke<he.length&&j(he[ke])},Te=w.useMemo(()=>{if(H!=null&&H.prompts)return H.prompts.map(ke=>({step:ke.trainer_step,group_id:ke.group_id,env:ke.env,system_prompt:ke.system_prompt,tokens_system_prompt:ke.tokens_system_prompt,prompt:ke.prompt,tokens_prompt:ke.tokens_prompt}))},[H]),Pe=w.useMemo(()=>{if(H!=null&&H.rollouts)return H.rollouts.map(ke=>({step:ke.trainer_step,group_id:ke.group_id,sample_idx:ke.sample_idx,turn_order:ke.turn_order,turn_type:ke.turn_type,content:ke.content,tokens:ke.tokens}))},[H]),oe=w.useMemo(()=>{if(H!=null&&H.samples_data)return H.samples_data.map(ke=>({step:ke.trainer_step,group_id:ke.group_id,sample_idx:ke.sample_idx,reward:ke.reward,advantage:ke.advantage,turns:ke.turns,total_tokens:ke.total_tokens,raw_string:ke.raw_string}))},[H]),Ve=w.useMemo(()=>{if(!(H!=null&&H.rollout_metrics))return;const ke=n??0;return H.rollout_metrics.map(qe=>({step:ke,sample_idx:qe.sample_idx,env:qe.env,metric_name:qe.metric_name,value:qe.value}))},[H,n]),He=w.useMemo(()=>{if(!(H!=null&&H.golden_answers))return;const ke=n??0;return H.golden_answers.map(qe=>({step:ke,sample_idx:qe.sample_idx,env:qe.env,key:qe.key,value:qe.value}))},[H,n]),ze=w.useMemo(()=>{if(!(H!=null&&H.info_turns))return;const ke=n??0;return H.info_turns.map(qe=>({step:ke,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}))},[H,n]),Ge=w.useMemo(()=>{if(!(H!=null&&H.prompts))return null;const ke=new Map;for(const qe of H.prompts)ke.set(qe.group_id,qe.discard_reason);return ke},[H]),ae=Ge??fe;Ge&&Ge!==fe&&Q(Ge);const Z=ke=>{switch(ke){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return ke.split("_").map(qe=>qe.charAt(0).toUpperCase()+qe.slice(1)).join(" ")}},ge=ke=>{switch(ke){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}};return t?d.jsxs("div",{className:"flex h-full overflow-hidden",children:[d.jsx(_9,{prompts:Te,data:Pe,samplesData:oe,rolloutMetrics:Ve,isLoading:q,step:n??void 0,currentStepIndex:de,totalSteps:he.length,onStepChange:Me,hasSteps:se,stepValues:he,openAtom:MA,selectedGroupIdAtom:bI,selectedSampleIdxAtom:_I,viewModeAtom:wI,getGroupBadge:ke=>{const qe=ae.get(ke.group_id);return qe?d.jsx(xy,{variant:ge(qe),className:"text-[10px] h-4 px-1.5",children:Z(qe)}):null}}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center justify-between h-7",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(b9,{openAtom:MA}),l&&d.jsxs("div",{className:"text-sm text-muted-foreground",children:[d.jsxs("span",{children:["Step"," ",((Se=l.sample.turns[0])==null?void 0:Se.step)??n]})," · ",d.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",d.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&d.jsx(DC,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&d.jsxs(d.Fragment,{children:[d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(ke=>ke+1),R(!1)},children:"Collapse All"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{k(ke=>ke+1),R(!0)},children:"Expand All"}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",M>0&&` (${M})`]})}),d.jsxs($s,{align:"start",className:"w-auto",children:[d.jsx(ur,{checked:_,onCheckedChange:ke=>S(!!ke),onSelect:ke=>ke.preventDefault(),children:"Format Think"}),d.jsx(ur,{checked:x.includes("markdown"),onCheckedChange:()=>C("markdown"),onSelect:ke=>ke.preventDefault(),children:"Markdown"}),d.jsx(ur,{checked:x.includes("latex"),onCheckedChange:()=>C("latex"),onSelect:ke=>ke.preventDefault(),children:"LaTeX"}),d.jsx(ur,{checked:x.includes("code"),onCheckedChange:()=>C("code"),onSelect:ke=>ke.preventDefault(),children:"Code"})]})]})]})]}),d.jsx(v9,{openAtom:wA})]})})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:d.jsxs("div",{className:c||m?"max-w-5xl mx-auto":"",children:[J&&d.jsx(dd,{className:"border-destructive mb-6",children:d.jsx(ch,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",J instanceof Error?J.message:"Unknown error"]})})}),d.jsx(j1,{prompts:Te,data:Pe,samplesData:oe,rolloutMetrics:Ve,goldenAnswers:He,infoTurns:ze,isLoading:q,step:n??void 0,scrollToSampleId:V,filterGroupId:i,filterSampleIdx:o,lastValidSampleAtom:SI,collapseAllSignal:A,expandAllSignal:P,defaultSectionsOpen:O,envRewardRanges:ne,envMetricRanges:U,advantageRange:z,renderOptions:x,formatThinkBlocks:_})]})})]}),d.jsx(y9,{currentStep:n,maxSelectableStep:Ce,openAtom:wA,selectedMetricsAtom:Dce,selectedStepAtom:yI,includeDiscardedDefaults:!0})]}):d.jsx(I0,{description:"Select a run from the sidebar to view discarded rollouts."})}function $Ne(){const t=qn(bl),{data:e,error:n}=_h(t||"",!!t,!1),r=w.useMemo(()=>BZ(e==null?void 0:e.summary),[e==null?void 0:e.summary]);return t?n?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),d.jsx("div",{className:"text-xs text-muted-foreground",children:n instanceof Error?n.message:"Unknown error"})]})}):e?!r||r.nodes.length===0?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),d.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):d.jsx("div",{className:"h-full w-full",children:d.jsx(VZ,{topology:r})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})}):d.jsx(I0,{description:"Select a run from the sidebar to view cluster topology."})}const gs=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],QR=["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"],$F=["torch_allocated_gb","torch_reserved_gb","torch_max_allocated_gb"],qF=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],XF=["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 qNe(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 cT(t,e,n){return n?`${t??"?"}:${e}`:`gpu:${e}`}function sw(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 JR(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:cT(i.node_id,i.gpu_index,e),...i,label:e?`Node ${i.node_id??"?"} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?gs[s%gs.length]:gs[i.gpu_index%gs.length]}))}function XNe(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:cT(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?gs[s%gs.length]:gs[i.gpu_index%gs.length]}))}function e7({series:t,activeSeriesKeys:e,onSeriesHover:n,onSeriesToggle:r}){return t.length===0?null:d.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 d.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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?sw(i.color,.25):i.color}}),d.jsx("span",{className:"text-xs text-muted-foreground",children:i.label})]},i.seriesKey)})})}function YNe({trainerLabels:t,inferenceLabels:e,activeSeriesKeys:n,onSeriesHover:r,onSeriesToggle:i}){return t.length===0&&e.length===0?null:d.jsxs("div",{className:"space-y-2 mb-3",children:[t.length>0&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Trainer"}),d.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 d.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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?sw(s.color,.25):s.color}}),d.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`trainer-${s.seriesKey}`)})})]}),e.length>0&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Inference"}),d.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 d.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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?sw(s.color,.25):s.color}}),d.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`inference-${s.seriesKey}`)})})]})]})}function XZ(t){const e=Math.abs(t);if(e>=60)return nC(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 yu(t)}const YZ=28;function KZ(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,f=l<t.length?t[l]:void 0,p=c!=null,m=f!=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 ZZ(t){if(t.length<4)return null;const e=[...t].sort((c,f)=>c-f),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 U1({label:t,onRemove:e}){return d.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,d.jsx(Na,{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?ql.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function JZ({isFullscreen:t,onClick:e}){return d.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?d.jsx(qT,{className:"h-3 w-3"}):d.jsx($T,{className:"h-3 w-3"})})}function KNe({metricName:t,data:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=qn(as),{isFullscreen:a,toggleFullscreen:l,fullscreenPortal:c}=QZ(),f=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=xC[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:N,seriesConfig:P,hasData:k,nodeIds:O,timeRange:R,outlierBounds:L}=w.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:[],timeRange:i??{start:0,end:1},outlierBounds:null};const G=new Set;let ee=1/0,H=-1/0;const q=[];for(const ce of e){const X=typeof ce.node_id=="number"&&Number.isFinite(ce.node_id)?ce.node_id:0;G.add(X),ce.timestamp<ee&&(ee=ce.timestamp),ce.timestamp>H&&(H=ce.timestamp),q.push(ce.value)}const J=Array.from(G).sort((ce,X)=>ce-X),K=i??{start:ee,end:H},ne={},U=new Set;for(const ce of e){const X=typeof ce.node_id=="number"&&Number.isFinite(ce.node_id)?ce.node_id:0;U.add(ce.timestamp),ne[ce.timestamp]||(ne[ce.timestamp]={}),ne[ce.timestamp][X]=ce.value}const z=Array.from(U).sort((ce,X)=>ce-X);if(z.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:J,timeRange:K,outlierBounds:null};const Y=z.map(ce=>ce-K.start),j=[{label:"Time"}],le=[Y];for(let ce=0;ce<J.length;ce++){const X=J[ce],ie=z.map(fe=>{var Q;return((Q=ne[fe])==null?void 0:Q[X])??null});le.push(ie),j.push({label:`Node ${X}`,stroke:gs[ce%gs.length],width:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:le,seriesConfig:j,hasData:!0,nodeIds:J,timeRange:K,outlierBounds:ZZ(q)}},[e,i]),B=O.length>1,V=w.useCallback(G=>Math.abs(G)>=1e3?`${parseFloat((G/1e3).toFixed(1))}k`:Number.isInteger(G)?G.toLocaleString():Math.abs(G)<.01&&G!==0?G.toExponential(1):String(parseFloat(G.toFixed(2))),[]);w.useEffect(()=>{if(!f.current||!N||!k)return;const G=f.current,ee=G.clientWidth,H=200;let q=Number.POSITIVE_INFINITY,J=Number.NEGATIVE_INFINITY;for(let Q=1;Q<N.length;Q+=1){const ue=N[Q];for(let he=0;he<ue.length;he+=1){const se=ue[he];se!=null&&(x&&L?se>=L.lower&&se<=L.upper&&(se<q&&(q=se),se>J&&(J=se)):(se<q&&(q=se),se>J&&(J=se)))}}q===Number.POSITIVE_INFINITY&&L&&(q=L.lower,J=L.upper);const K=J-q,ne=Math.max(Math.abs(J),Math.abs(q)),U=Math.max(ne*.05,1e-10),z=Math.max(K*.1,U),Y=[_!==null?_:Math.max(0,q-z),M!==null?M:J+z],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)",X={width:ee,height:H,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:B},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(Q,ue,he)=>{const se=R.end-R.start;return se>0?[0,se]:[ue,he]}},y:{range:Y}},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:(Q,ue,he,se)=>[he,se],values:(Q,ue)=>ue.map(he=>c0(R.start+Number(he),R.end-R.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:(Q,ue)=>{if(!ue||ue.length===0)return 40;const he=Math.max(...ue.map(se=>se.length));return Math.max(40,he*7+14)},values:(Q,ue)=>ue.map(V)}],series:P,hooks:{setCursor:[Q=>{if(!m.current||!f.current)return;const{left:ue,idx:he}=Q.cursor;if(he==null||ue===void 0||ue<0){m.current.style.display="none";return}const se=N[0][he];if(se===void 0){m.current.style.display="none";return}const Ce=N[0],de=(()=>{const Z=Q.scales.x,ge=Number(Z.min),we=Number(Z.max);if(!Number.isFinite(ge)||!Number.isFinite(we))return null;const _e=Math.abs(we-ge);if(_e<=0)return null;const ve=Math.max(1,Q.bbox.width);return _e*YZ/ve})(),Me=XZ(Number(se)+s),Te=R.start+Number(se);let oe=`<div class="font-medium mb-1">${c0(Te,R.end-R.start)}</div>`;oe+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${Me}</div>`,oe+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Te.toFixed(3)}</div>`;let Ve=!1;for(let Z=0;Z<O.length;Z+=1){const ge=N[Z+1],we=KZ(ge,Ce,he,de);if(we===null)continue;const _e=ge==null?void 0:ge[we];if(_e==null)continue;Ve=!0;const ve=vu(_e);oe+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${gs[Z%gs.length]}"></div>
                  <span class="text-muted-foreground">Node ${O[Z]}:</span>
                  <span class="font-medium">${ve} ${A.unit}</span>
                </div>
              `}if(!Ve){m.current.style.display="none";return}m.current.innerHTML=oe,m.current.style.display="block";const He=f.current.getBoundingClientRect(),ze=m.current.getBoundingClientRect();let Ge=He.left+ue+15;Ge+ze.width+20>window.innerWidth&&(Ge=He.left+ue-ze.width-15+Q.bbox.left),Ge=Math.max(4,Ge);let ae=He.top-ze.height+20;ae<4&&(ae=He.top+8),m.current.style.left=`${Ge}px`,m.current.style.top=`${ae}px`}]}};p.current&&p.current.destroy();const ie=new ss(X,N,G);p.current=ie;const fe=new ResizeObserver(Q=>{for(const ue of Q){const{width:he,height:se}=ue.contentRect;ie&&he>0&&se>0&&ie.setSize({width:he,height:se})}});return fe.observe(G),()=>{fe.disconnect(),ie.destroy(),p.current=null}},[N,k,P,t,R,s,B,A.unit,O,V,x,L,_,M,o,a]);const W=w.useCallback(()=>{m.current&&(m.current.style.display="none")},[]);return c(d.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:[d.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h4",{className:bt("font-medium truncate",a?"text-sm":"text-xs"),title:t,children:A.label}),x&&d.jsx(U1,{label:"Ignore Outliers",onRemove:()=>b(!1)}),_!==null&&d.jsx(U1,{label:`Min Y: ${_}`,onRemove:()=>S(null)}),M!==null&&d.jsx(U1,{label:`Max Y: ${M}`,onRemove:()=>C(null)})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:x,onCheckedChange:b,children:"Ignore Outliers"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:G=>{const ee=G.target.value;S(ee===""?null:Number(ee))},onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:G=>{const ee=G.target.value;C(ee===""?null:Number(ee))},onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation()})]})]})]}),d.jsx(JZ,{isFullscreen:a,onClick:l})]})]}),k?d.jsxs("div",{className:bt("relative bg-background rounded",a?"flex-1 min-h-0":"h-[200px]"),ref:f,onMouseLeave:W,children:[r&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),d.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"}})]}):d.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 t7({data:t,metricNames:e,intervalStart:n,intervalEnd:r,gpuIndices:i,seriesMode:s,isLoading:o,isRefetching:a,seriesRoles:l,activeSeriesKeys:c,xOffset:f=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?QR:p,[o,e,p]);return m.length===0&&!o?d.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"}):d.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 d.jsx(rq,{metricName:x,data:b,gpuIndices:i,intervalStart:n,intervalEnd:r,seriesMode:s,showLegend:!1,isLoading:o,isRefetching:a,seriesRoles:l,activeSeriesKeys:c,xOffset:f,xAxisMode:"clock",xAxisTicks:"bounds"},x)})})}function ZNe({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=w.useMemo(()=>{const l=new Set;for(const f of t)f.metric_name.startsWith("cpu_core_")||l.add(f.metric_name);for(const f of e??[])f.startsWith("cpu_core_")||l.add(f);const c=qF.filter(f=>l.has(f));for(const f of l)c.includes(f)||c.push(f);return c},[t,e]),a=w.useMemo(()=>o.length>0?o:n?qF:o,[o,n]);return a.length===0&&!n?d.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"}):d.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(f=>f.metric_name===l);return d.jsx(KNe,{metricName:l,data:c,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s},l)})})}function QNe({metricName:t,data:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=qn(as),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:f}=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=xC[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:P,seriesConfig:k,hasData:O,serverIds:R,timeRange:L,outlierBounds:B}=w.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:[],timeRange:s??{start:0,end:1},outlierBounds:null};const G=new Set;let ee=1/0,H=-1/0;const q=[];for(const ce of e)G.add(ce.server),ce.timestamp<ee&&(ee=ce.timestamp),ce.timestamp>H&&(H=ce.timestamp),q.push(ce.value);const J=Array.from(G).sort((ce,X)=>ce-X),K=s??{start:ee,end:H},ne={},U=new Set;for(const ce of e)U.add(ce.timestamp),ne[ce.timestamp]||(ne[ce.timestamp]={}),ne[ce.timestamp][ce.server]=ce.value;const z=Array.from(U).sort((ce,X)=>ce-X);if(z.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:J,timeRange:K,outlierBounds:null};const Y=z.map(ce=>ce-K.start),j=[{label:"Time"}],le=[Y];for(let ce=0;ce<J.length;ce++){const X=J[ce],ie=z.map(Q=>{var ue;return((ue=ne[Q])==null?void 0:ue[X])??null}),fe=!!i&&i.size>0&&!i.has(X);le.push(ie),j.push({label:`Server ${X}`,stroke:fe?sw(gs[ce%gs.length],.25):gs[ce%gs.length],width:fe?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:le,seriesConfig:j,hasData:!0,serverIds:J,timeRange:K,outlierBounds:ZZ(q)}},[e,s,i]),V=w.useCallback(G=>Math.abs(G)>=1e3?`${parseFloat((G/1e3).toFixed(1))}k`:Number.isInteger(G)?G.toLocaleString():Math.abs(G)<.01&&G!==0?G.toExponential(1):String(parseFloat(G.toFixed(2))),[]);w.useEffect(()=>{if(!p.current||!P||!O)return;const G=p.current,ee=G.clientWidth,H=200;let q=Number.POSITIVE_INFINITY,J=Number.NEGATIVE_INFINITY;for(let Q=1;Q<P.length;Q+=1){const ue=P[Q];for(let he=0;he<ue.length;he+=1){const se=ue[he];se!=null&&(b&&B?se>=B.lower&&se<=B.upper&&(se<q&&(q=se),se>J&&(J=se)):(se<q&&(q=se),se>J&&(J=se)))}}q===Number.POSITIVE_INFINITY&&B&&(q=B.lower,J=B.upper);const K=J-q,ne=Math.max(Math.abs(J),Math.abs(q)),U=Math.max(ne*.05,1e-10),z=Math.max(K*.1,U),Y=[S!==null?S:Math.max(0,q-z),C!==null?C:J+z],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)",X={width:ee,height:H,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:(Q,ue,he)=>{const se=L.end-L.start;return se>0?[0,se]:[ue,he]}},y:{range:Y}},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:(Q,ue,he,se)=>[he,se],values:(Q,ue)=>ue.map(he=>c0(L.start+Number(he),L.end-L.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:(Q,ue)=>{if(!ue||ue.length===0)return 40;const he=Math.max(...ue.map(se=>se.length));return Math.max(40,he*7+14)},values:(Q,ue)=>ue.map(V)}],series:k,hooks:{setCursor:[Q=>{if(!x.current||!p.current)return;const{left:ue,idx:he}=Q.cursor;if(he==null||ue===void 0||ue<0){x.current.style.display="none";return}const se=P[0][he];if(se===void 0){x.current.style.display="none";return}const Ce=P[0],de=(()=>{const Z=Q.scales.x,ge=Number(Z.min),we=Number(Z.max);if(!Number.isFinite(ge)||!Number.isFinite(we))return null;const _e=Math.abs(we-ge);if(_e<=0)return null;const ve=Math.max(1,Q.bbox.width);return _e*YZ/ve})(),Me=XZ(Number(se)+o),Te=L.start+Number(se);let oe=`<div class="font-medium mb-1">${c0(Te,L.end-L.start)}</div>`;oe+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${Me}</div>`,oe+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Te.toFixed(3)}</div>`;let Ve=!1;for(let Z=0;Z<R.length;Z+=1){const ge=P[Z+1],we=KZ(ge,Ce,he,de);if(we===null)continue;const _e=ge==null?void 0:ge[we];if(_e==null)continue;Ve=!0;const ve=vu(_e);oe+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${gs[Z%gs.length]}"></div>
                  <span class="text-muted-foreground">Server ${R[Z]}:</span>
                  <span class="font-medium">${ve} ${N.unit}</span>
                </div>
              `}if(!Ve){x.current.style.display="none";return}x.current.innerHTML=oe,x.current.style.display="block";const He=p.current.getBoundingClientRect(),ze=x.current.getBoundingClientRect();let Ge=He.left+ue+15;Ge+ze.width+20>window.innerWidth&&(Ge=He.left+ue-ze.width-15+Q.bbox.left),Ge=Math.max(4,Ge);let ae=He.top-ze.height+20;ae<4&&(ae=He.top+8),x.current.style.left=`${Ge}px`,x.current.style.top=`${ae}px`}]}};m.current&&m.current.destroy();const ie=new ss(X,P,G);m.current=ie;const fe=new ResizeObserver(Q=>{for(const ue of Q){const{width:he,height:se}=ue.contentRect;ie&&he>0&&se>0&&ie.setSize({width:he,height:se})}});return fe.observe(G),()=>{fe.disconnect(),ie.destroy(),m.current=null}},[P,O,k,t,L,o,N.unit,R,V,b,B,S,C,a,l]);const W=w.useCallback(()=>{x.current&&(x.current.style.display="none")},[]);return f(d.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:[d.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h4",{className:bt("font-medium truncate",l?"text-sm":"text-xs"),title:t,children:N.label}),b&&d.jsx(U1,{label:"Ignore Outliers",onRemove:()=>_(!1)}),S!==null&&d.jsx(U1,{label:`Min Y: ${S}`,onRemove:()=>M(null)}),C!==null&&d.jsx(U1,{label:`Max Y: ${C}`,onRemove:()=>A(null)})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(cf,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(ur,{checked:b,onCheckedChange:_,children:"Ignore Outliers"}),d.jsx(Ds,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:G=>{const ee=G.target.value;M(ee===""?null:Number(ee))},onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:G=>{const ee=G.target.value;A(ee===""?null:Number(ee))},onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation()})]})]})]}),d.jsx(JZ,{isFullscreen:l,onClick:c})]})]}),O?d.jsxs("div",{className:bt("relative bg-background rounded",l?"flex-1 min-h-0":"h-[200px]"),ref:p,onMouseLeave:W,children:[r&&d.jsx(Sl,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),d.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"}})]}):d.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 JNe({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:gs[l%gs.length]}))},[t]);return i.length<=1?null:d.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 d.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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?sw(s.color,.25):s.color}}),d.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},s.label)})})}function eke({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 f=XF.filter(p=>c.has(p));for(const p of c)f.includes(p)||f.push(p);return f},[t,e]),l=w.useMemo(()=>a.length>0?a:n?XF:a,[a,n]);return l.length===0&&!n?d.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"}):d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:l.map(c=>{const f=t.filter(p=>p.metric_name===c);return d.jsx(QNe,{metricName:c,data:f,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o},c)})})}function tke({nodeId:t,gpuCount:e,children:n}){const[r,i]=w.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return d.jsxs(Di,{open:r,onOpenChange:i,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),d.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),d.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"mt-3",children:n})})]})}function YF({title:t,gpuData:e,gpuMetricNames:n,timeRange:r,nodeGpuMap:i,isLoading:s,isRefetching:o,open:a,onOpenChange:l,nodeMode:c,onNodeModeChange:f,xOffset:p=0}){const[m,x]=w.useState(!0),[b,_]=w.useState("combined"),S=a??m,M=l??x,C=c??b,A=f??_,[N,P]=w.useState(null),[k,O]=w.useState([]),R=i.size>1,L=w.useMemo(()=>{const K=[],ne=Array.from(i.keys()).sort((U,z)=>U-z);for(const U of ne){const z=[...i.get(U)??[]].sort((Y,j)=>Y-j);for(const Y of z)K.push({nodeId:U,gpuIndex:Y})}return K.map((U,z)=>({seriesKey:cT(U.nodeId,U.gpuIndex,R),node_id:U.nodeId,gpu_index:U.gpuIndex,label:R?`Node ${U.nodeId} GPU ${U.gpuIndex}`:`GPU ${U.gpuIndex}`,color:R?gs[z%gs.length]:gs[U.gpuIndex%gs.length]}))},[i,R]),B=w.useMemo(()=>{const K=JR(e,R);return K.length>0?K:L},[e,R,L]),V=w.useMemo(()=>{const K=new Set;for(const ne of e)K.add(ne.gpu_index);return Array.from(K).sort((ne,U)=>ne-U)},[e]),W=w.useMemo(()=>{const K=[],ne=Array.from(i.keys()).sort((U,z)=>U-z);for(const U of ne){const z=i.get(U),Y=e.filter(ce=>(typeof ce.node_id=="number"?ce.node_id:null)===U&&z.includes(ce.gpu_index)),j=JR(Y,!1),le=j.length>0?j:z.map(ce=>({seriesKey:cT(U,ce,!1),node_id:U,gpu_index:ce,label:`GPU ${ce}`,color:gs[ce%gs.length]}));K.push({nodeId:U,gpuIndices:z,data:Y,labels:le})}return K},[e,i]),G=w.useMemo(()=>{const K=new Set;return C==="combined"||!R?(B.forEach(ne=>K.add(ne.seriesKey)),K):(W.forEach(ne=>{ne.labels.forEach(U=>K.add(U.seriesKey))}),K)},[C,R,B,W]),ee=w.useCallback(K=>{O(ne=>{const U=ne.filter(ce=>!G.has(ce)),z=ne.filter(ce=>G.has(ce)),j=z.includes(K)?z.filter(ce=>ce!==K):[...z,K],le=G.size>0&&j.length===G.size?[]:j;return[...U,...le]})},[G]),H=w.useMemo(()=>G.size===0?k:k.filter(K=>G.has(K)),[k,G]),q=w.useMemo(()=>N&&(G.size===0||G.has(N))?N:null,[N,G]),J=w.useMemo(()=>H.length>0?new Set(H):q?new Set([q]):null,[H,q]);return d.jsxs(Di,{open:S,onOpenChange:M,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Pi,{asChild:!0,children:d.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:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!S&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:t})]})}),S&&R&&d.jsxs(h0,{type:"single",variant:"selecting",size:"sm",value:C,onValueChange:K=>{K&&A(K)},children:[d.jsx(Xa,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"}),d.jsx(Xa,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Nodes"})]})]}),d.jsx(Ii,{children:d.jsx("div",{className:"space-y-6",children:C==="combined"||!R?d.jsxs(d.Fragment,{children:[d.jsx(e7,{series:B,activeSeriesKeys:J,onSeriesHover:P,onSeriesToggle:ee}),d.jsx(t7,{data:e,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:V,seriesMode:R?"node_gpu":"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:J,xOffset:p})]}):W.map(K=>d.jsxs(tke,{nodeId:K.nodeId,gpuCount:K.gpuIndices.length,children:[d.jsx(e7,{series:K.labels,activeSeriesKeys:J,onSeriesHover:P,onSeriesToggle:ee}),d.jsx(t7,{data:K.data,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:K.gpuIndices,seriesMode:"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:J,xOffset:p})]},K.nodeId))})})]})}function nke({gpuMetrics:t,cpuMetrics:e,vllmMetrics:n,availableGpuMetrics:r,availableCpuMetrics:i,availableVllmMetrics:s,trainerGpus:o,inferenceGpus:a,isLoading:l,isRefetching:c,systemMetricsOpen:f,onSystemMetricsOpenChange:p,cpuMetricsOpen:m,onCpuMetricsOpenChange:x,vllmMetricsOpen:b,onVllmMetricsOpenChange:_,roleMode:S,onRoleModeChange:M,trainerSectionOpen:C,onTrainerSectionOpenChange:A,inferenceSectionOpen:N,onInferenceSectionOpenChange:P,trainerNodeMode:k,onTrainerNodeModeChange:O,inferenceNodeMode:R,onInferenceNodeModeChange:L,overrideTimeRange:B,xOffset:V=0}){const[W,G]=w.useState(!0),[ee,H]=w.useState(!0),[q,J]=w.useState(!0),[K,ne]=w.useState("separated"),U=f??W,z=p??G,Y=m??ee,j=x??H,le=b??q,ce=_??J,X=S??K,ie=M??ne,[fe,Q]=w.useState(null),[ue,he]=w.useState([]),[se,Ce]=w.useState(null),[de,Me]=w.useState([]),Te=w.useMemo(()=>B||qNe(t),[t,B]),Pe=w.useMemo(()=>{const Ae=new Set(r),Xe=QR.filter(dt=>Ae.has(dt)),Re=$F.filter(dt=>Ae.has(dt)),Be=new Set([...QR,...$F]),ot=r.filter(dt=>!Be.has(dt)).sort();return[...Xe,...Re,...ot]},[r]),oe=w.useMemo(()=>new Set(o.map(Ae=>`${Ae.node_id}:${Ae.gpu_index}`)),[o]),Ve=w.useMemo(()=>new Set(a.map(Ae=>`${Ae.node_id}:${Ae.gpu_index}`)),[a]),He=w.useMemo(()=>oe.size===0?[]:t.filter(Ae=>{const Xe=typeof Ae.node_id=="number"&&Number.isFinite(Ae.node_id)?Ae.node_id:null;return Xe===null?!1:oe.has(`${Xe}:${Ae.gpu_index}`)}),[t,oe]),ze=w.useMemo(()=>Ve.size===0?[]:t.filter(Ae=>{const Xe=typeof Ae.node_id=="number"&&Number.isFinite(Ae.node_id)?Ae.node_id:null;return Xe===null?!1:Ve.has(`${Xe}:${Ae.gpu_index}`)}),[t,Ve]),Ge=w.useMemo(()=>{const Ae=new Map;for(const Xe of o){const Re=Ae.get(Xe.node_id)??[];Re.includes(Xe.gpu_index)||Re.push(Xe.gpu_index),Ae.set(Xe.node_id,Re)}for(const[Xe,Re]of Ae)Ae.set(Xe,Re.sort((Be,ot)=>Be-ot));return Ae},[o]),ae=w.useMemo(()=>{const Ae=new Map;for(const Xe of a){const Re=Ae.get(Xe.node_id)??[];Re.includes(Xe.gpu_index)||Re.push(Xe.gpu_index),Ae.set(Xe.node_id,Re)}for(const[Xe,Re]of Ae)Ae.set(Xe,Re.sort((Be,ot)=>Be-ot));return Ae},[a]),Z=w.useMemo(()=>{const Ae=new Set;for(const Xe of t)Ae.add(Xe.gpu_index);return Array.from(Ae).sort((Xe,Re)=>Xe-Re)},[t]),ge=w.useMemo(()=>{const Ae=new Set;for(const Xe of t){const Re=typeof Xe.node_id=="number"&&Number.isFinite(Xe.node_id)?Xe.node_id:null;Ae.add(Re)}return Ae.size>1},[t]),we=w.useMemo(()=>JR(t,ge),[t,ge]),_e=w.useMemo(()=>{if(o.length===0&&a.length===0)return[];const Ae=[...o,...a],Xe=new Set(Ae.map(Re=>Re.node_id)).size>1;return XNe(Ae,Xe)},[o,a]),ve=w.useMemo(()=>{const Ae=we.length>0?we:_e,Xe=new Set(o.map(Re=>`${Re.node_id}:${Re.gpu_index}`));return Ae.filter(Re=>{const Be=`${Re.node_id??"?"}:${Re.gpu_index}`;return Xe.has(Be)||Xe.has(`${Re.node_id}:${Re.gpu_index}`)})},[we,_e,o]),Ue=w.useMemo(()=>{const Ae=we.length>0?we:_e,Xe=new Set(a.map(Re=>`${Re.node_id}:${Re.gpu_index}`));return Ae.filter(Re=>{const Be=`${Re.node_id??"?"}:${Re.gpu_index}`;return Xe.has(Be)||Xe.has(`${Re.node_id}:${Re.gpu_index}`)})},[we,_e,a]),Se=w.useMemo(()=>{const Ae={},Xe=new Set(o.map(Be=>`${Be.node_id}:${Be.gpu_index}`)),Re=new Set(a.map(Be=>`${Be.node_id}:${Be.gpu_index}`));if(ge)for(const Be of t){const ot=typeof Be.node_id=="number"&&Number.isFinite(Be.node_id)?Be.node_id:null,dt=`${ot??"?"}:${Be.gpu_index}`,Nt=`${ot}:${Be.gpu_index}`;Xe.has(Nt)||Xe.has(dt)?Ae[dt]="Trainer":(Re.has(Nt)||Re.has(dt))&&(Ae[dt]="Inference")}else{for(const Be of o)Ae[`gpu:${Be.gpu_index}`]="Trainer";for(const Be of a)Ae[`gpu:${Be.gpu_index}`]="Inference"}return Ae},[t,o,a,ge]),ke=o.length>0||a.length>0,qe=He.length>0||!!l&&o.length>0,Je=ze.length>0||!!l&&a.length>0,nt=w.useMemo(()=>{if(!ke)return we;const Ae=new Map;for(const Xe of ve)Ae.set(Xe.seriesKey,Xe);for(const Xe of Ue)Ae.set(Xe.seriesKey,Xe);return Array.from(Ae.values())},[ke,we,ve,Ue]),tt=w.useMemo(()=>new Set(nt.map(Ae=>Ae.seriesKey)),[nt]),be=w.useMemo(()=>tt.size===0?ue:ue.filter(Ae=>tt.has(Ae)),[ue,tt]),Le=w.useCallback(Ae=>{he(Xe=>{const Re=Xe.filter(Dt=>!tt.has(Dt)),Be=Xe.filter(Dt=>tt.has(Dt)),dt=Be.includes(Ae)?Be.filter(Dt=>Dt!==Ae):[...Be,Ae],Nt=tt.size>0&&dt.length===tt.size?[]:dt;return[...Re,...Nt]})},[tt]),Ze=w.useMemo(()=>fe&&(tt.size===0||tt.has(fe))?fe:null,[fe,tt]),Ee=w.useMemo(()=>be.length>0?tt.size>0&&be.length===tt.size?null:new Set(be):Ze?new Set([Ze]):null,[be,Ze,tt]),Ye=w.useMemo(()=>{const Ae=new Set;for(const Xe of n??[])Ae.add(Xe.server);return Ae},[n]),it=w.useMemo(()=>Ye.size===0?de:de.filter(Ae=>Ye.has(Ae)),[de,Ye]),mt=w.useCallback(Ae=>{Me(Xe=>{const Re=Xe.filter(Dt=>!Ye.has(Dt)),Be=Xe.filter(Dt=>Ye.has(Dt)),dt=Be.includes(Ae)?Be.filter(Dt=>Dt!==Ae):[...Be,Ae],Nt=Ye.size>0&&dt.length===Ye.size?[]:dt;return[...Re,...Nt]})},[Ye]),ft=w.useMemo(()=>se===null?null:Ye.size===0||Ye.has(se)?se:null,[se,Ye]),Qe=w.useMemo(()=>it.length>0?Ye.size>0&&it.length===Ye.size?null:new Set(it):ft!==null?new Set([ft]):null,[it,ft,Ye]);return d.jsxs("div",{className:"space-y-4",children:[d.jsxs(Di,{open:U,onOpenChange:z,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!U&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"GPU Metrics"})]})})}),U&&ke&&d.jsxs(h0,{type:"single",variant:"selecting",size:"sm",value:X,onValueChange:Ae=>{Ae&&ie(Ae)},children:[d.jsx(Xa,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Trainer/Inference"}),d.jsx(Xa,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"})]})]}),d.jsx(Ii,{children:d.jsx("div",{className:"space-y-6 mt-3 mb-4",children:X==="combined"||!ke?d.jsxs(d.Fragment,{children:[ke?d.jsx(YNe,{trainerLabels:ve,inferenceLabels:Ue,activeSeriesKeys:Ee,onSeriesHover:Q,onSeriesToggle:Le}):d.jsx(e7,{series:we,activeSeriesKeys:Ee,onSeriesHover:Q,onSeriesToggle:Le}),d.jsx(t7,{data:t,metricNames:Pe,intervalStart:Te.start,intervalEnd:Te.end,gpuIndices:Z,seriesMode:ge?"node_gpu":"gpu",isLoading:l,isRefetching:c,seriesRoles:ke?Se:void 0,activeSeriesKeys:Ee,xOffset:V})]}):d.jsxs(d.Fragment,{children:[qe&&d.jsx(YF,{title:"Trainer",gpuData:He,gpuMetricNames:Pe,timeRange:Te,nodeGpuMap:Ge,isLoading:l,isRefetching:c,open:C,onOpenChange:A,nodeMode:k,onNodeModeChange:O,xOffset:V}),Je&&d.jsxs(d.Fragment,{children:[qe&&d.jsx("div",{className:"border-t border-border my-3"}),d.jsx(YF,{title:"Inference",gpuData:ze,gpuMetricNames:Pe,timeRange:Te,nodeGpuMap:ae,isLoading:l,isRefetching:c,open:N,onOpenChange:P,nodeMode:R,onNodeModeChange:L,xOffset:V})]}),!l&&He.length===0&&ze.length===0&&d.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"})]})})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:Y,onOpenChange:j,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!Y&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"CPU Metrics"})]})})}),d.jsx(Ii,{children:d.jsx("div",{className:"mt-3 mb-4",children:d.jsx(ZNe,{data:e,availableMetricNames:i,isLoading:l,isRefetching:c,overrideTimeRange:B,xOffset:V})})})]}),n&&n.length>0||s&&s.length>0||l?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Di,{open:le,onOpenChange:ce,children:[d.jsx(Pi,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(kr,{className:bt("h-4 w-4 text-muted-foreground transition-transform",!le&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"vLLM Metrics"})]})})}),d.jsx(Ii,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[d.jsx(JNe,{data:n??[],activeServerIds:Qe,onServerHover:Ce,onServerToggle:mt}),d.jsx(eke,{data:n??[],availableMetricNames:s,isLoading:l,isRefetching:c,activeServerIds:Qe,overrideTimeRange:B,xOffset:V})]})})]})]}):null]})}function rke(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 f=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:f,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:f,type:p,args:"",children:[],depth:i.length,repeatCount:1,estimatedParams:0};x.children.push(b),i.push(b)}}return eQ(r),nQ(r),r}function KF(t){return/^\d+(-\d+)?$/.test(t)}function eQ(t){for(const r of t.children)eQ(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&&KF(r.name)&&KF(t.children[n+i].name)&&tQ(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 tQ(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(!tQ(t.children[n],e.children[n]))return!1;return!0}function nQ(t){if(t.children.length===0)return t.estimatedParams*(t.repeatCount||1);let e=0;for(const n of t.children)e+=nQ(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 ike(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 rQ(t,e,1),e}function rQ(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=ske(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 f=Math.max(l[0],l[1]);e.hiddenSize&&f>e.hiddenSize&&(!e.intermediateSize||f>e.intermediateSize)&&(e.intermediateSize=f)}}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)rQ(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 ske(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 Iy(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 iQ(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 ZF={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"}},QF={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 SE(t){return t?QF[t]?QF[t]:t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function oke(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 uT(){return d.jsx("div",{className:"w-px h-4 bg-border mx-auto"})}function ake({node:t}){const e=SE(t.name)||t.type,n=iQ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?Iy(t.estimatedParams):null;return d.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[d.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),r&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 break-all",children:r}),i&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:i})]})}function lke({node:t}){const e=SE(t.name)||t.type,n=iQ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?Iy(t.estimatedParams):null;return d.jsxs("div",{className:"rounded-md border bg-background px-2.5 py-2 flex-1 min-w-0 text-center",children:[d.jsx("div",{className:"text-xs font-medium text-foreground",children:e}),r&&d.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5 break-all",children:r}),i&&d.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:i})]})}function cke({node:t}){const e=SE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?Iy(t.estimatedParams):null;return d.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[d.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r}),d.jsx("div",{className:"flex gap-1.5 flex-wrap mt-2",children:t.children.map((i,s)=>d.jsx(lke,{node:i},s))})]})}function S9({node:t}){return t.children.length===0?d.jsx(ake,{node:t}):t.repeatCount>1?d.jsx(uke,{node:t}):t.children.every(n=>n.children.length===0)?d.jsx(cke,{node:t}):d.jsx(dke,{node:t})}function uke({node:t}){return d.jsxs("div",{className:"relative w-full",children:[d.jsx("div",{className:"rounded-lg border-2 border-dashed border-muted-foreground/25 p-3 w-full",children:d.jsx("div",{className:"flex flex-col items-center w-full",children:t.children.map((e,n)=>d.jsxs("div",{className:"flex flex-col items-center w-full",children:[n>0&&d.jsx(uT,{}),d.jsx(S9,{node:e})]},n))})}),d.jsx("div",{className:"absolute left-full top-1/2 -translate-y-1/2 pl-5 pointer-events-none select-none",children:d.jsxs("span",{className:"text-4xl font-extralight text-muted-foreground/50 whitespace-nowrap leading-tight",children:["×",t.repeatCount,d.jsx("br",{}),d.jsx("span",{className:"text-2xl",children:"layers"})]})})]})}function dke({node:t}){const e=SE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?Iy(t.estimatedParams):null;return d.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full",children:[d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r})]}),d.jsx("div",{className:"flex flex-col items-center w-full mt-2",children:t.children.map((i,s)=>d.jsxs("div",{className:"flex flex-col items-center w-full",children:[s>0&&d.jsx(uT,{}),d.jsx(S9,{node:i})]},s))})]})}function fke({root:t}){const e=w.useMemo(()=>oke(t),[t]);return d.jsxs("div",{className:"flex flex-col items-center py-8 px-6 max-w-2xl mx-auto",children:[d.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Input"}),e.map((n,r)=>d.jsxs("div",{className:"flex flex-col items-center w-full",children:[d.jsx(uT,{}),d.jsx(S9,{node:n})]},r)),d.jsx(uT,{}),d.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Output"})]})}function hke({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 d.jsxs("div",{className:"w-72 shrink-0 border-l overflow-y-auto p-4 space-y-5",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-base font-semibold",children:t.modelName}),i>0&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:["~",Iy(i)," parameters"]})]}),(t.numLayers>0||t.hiddenSize||t.vocabSize)&&d.jsxs("div",{children:[d.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Architecture"}),d.jsxs("div",{className:"space-y-1 text-sm",children:[t.numLayers>0&&d.jsx(QM,{label:"Layers",value:String(t.numLayers)}),t.hiddenSize&&d.jsx(QM,{label:"Hidden size",value:t.hiddenSize.toLocaleString()}),t.vocabSize&&d.jsx(QM,{label:"Vocab size",value:t.vocabSize.toLocaleString()}),t.intermediateSize&&d.jsx(QM,{label:"Intermediate",value:t.intermediateSize.toLocaleString()})]})]}),i>0&&s.length>0&&d.jsxs("div",{children:[d.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Parameters"}),d.jsx("div",{className:"flex h-2 rounded-full overflow-hidden mb-2.5",children:s.map(([a,l])=>d.jsx("div",{className:`${ZF[a].bar}`,style:{width:`${l/i*100}%`,minWidth:l>0?"2px":0}},a))}),d.jsx("div",{className:"space-y-0.5",children:s.map(([a,l])=>d.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[d.jsx("div",{className:`w-2 h-2 rounded-sm shrink-0 ${ZF[a].bar}`}),d.jsx("span",{className:"capitalize text-muted-foreground",children:a}),d.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:[Iy(l)," (",(l/i*100).toFixed(0),"%)"]})]},a))})]}),o.length>0&&d.jsxs("div",{children:[d.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Layer Types"}),d.jsx("div",{className:"space-y-0.5",children:o.map(([a,l])=>d.jsxs("div",{className:"flex items-center text-xs",children:[d.jsx("span",{className:"text-foreground",children:a}),d.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:["×",l]})]},a))})]}),d.jsxs(Di,{open:n,onOpenChange:r,children:[d.jsxs(Pi,{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider hover:text-foreground transition-colors",children:[n?d.jsx(kr,{className:"size-3"}):d.jsx(r0,{className:"size-3"}),"Raw repr"]}),d.jsx(Ii,{children:d.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 QM({label:t,value:e}){return d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:t}),d.jsx("span",{className:"font-medium tabular-nums",children:e})]})}function pke({modelRepr:t}){const e=w.useMemo(()=>rke(t),[t]),n=w.useMemo(()=>e?ike(e):null,[e]);return!e||!n?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx(zue,{className:"size-8 text-muted-foreground mx-auto mb-2"}),d.jsx("div",{className:"text-sm text-muted-foreground",children:"Could not parse model architecture"})]})}):d.jsxs("div",{className:"flex h-full",children:[d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsx(fke,{root:e})}),d.jsx(hke,{stats:n,rawRepr:t})]})}function sQ(t){return g9(t==null?void 0:t.setup)}function mke(t){const e=sQ(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 f=vi(c);if(!f)continue;const p=Lr(f.gpu_index);p!==null&&n.push({node_id:a,gpu_index:p})}}return n}function gke(t){const e=sQ(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 f=vi(c);if(!f)continue;const p=Lr(f.gpu_index);p!==null&&n.push({node_id:a,gpu_index:p})}}return n}const xke=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],vke=[1,5,10,30,60,120,300],LN=Vs;function yke(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 JM(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 bke(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 _ke(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 Ske(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 wke(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 Mke({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 f;return(f=o.current)==null?void 0:f.select()},0)),r(c)},l=()=>{const c=yke(i);c!==null&&(e(c),r(!1))};return d.jsxs(YT,{open:n,onOpenChange:a,children:[d.jsx(KT,{asChild:!0,children:d.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),d.jsx(kr,{className:"size-3 text-muted-foreground"})]})}),d.jsxs(ZT,{align:"start",className:"w-40 p-1.5 gap-1",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.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"}),d.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"})]}),d.jsx("div",{className:"flex flex-col",children:vke.map(c=>d.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 Tke(){var Dt;const[t,e]=w.useState(null),n=w.useRef(0),r=qn(bl),i=!0,[s,o]=fn(zce),[a,l]=fn(Fce),[c,f]=fn(Uce),[p,m]=fn(Bce),[x,b]=fn(Hce),[_,S]=fn(Vce),[M,C]=fn(Gce),[A,N]=fn(Wce),[P,k]=fn($ce),[O,R]=fn(qce),[L,B]=fn(Qce),[V,W]=fn(Xce),[G,ee]=fn(Yce),[H,q]=fn(Kce),[J,K]=fn(Zce),[ne,U]=w.useState(JM(_));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:z,error:Y}=_h(r||"",!!r,i),j=w.useMemo(()=>BZ(z==null?void 0:z.summary),[z==null?void 0:z.summary]),{data:le,isFetching:ce,isPlaceholderData:X}=Ide(r||"",a,c,p,!!r),ie=!!r&&le!==void 0,{data:fe,isFetching:Q,isPlaceholderData:ue}=Ode(r||"",a,c,(le==null?void 0:le.global_min_time)??null,p,xke,ie),he=!!r&&le!==void 0,{data:se,isFetching:Ce,isPlaceholderData:de}=Lde(r||"",a,c,(le==null?void 0:le.global_min_time)??null,p,null,he),Me=(le==null?void 0:le.total_pages)??(fe==null?void 0:fe.total_pages)??null,Te=le,Pe=fe,oe=se,[Ve,He]=w.useState([]),[ze,Ge]=w.useState([]),[ae,Z]=w.useState([]);w.useEffect(()=>{Te!=null&&Te.available_metrics&&Te.available_metrics.length>0&&He(Te.available_metrics)},[Te==null?void 0:Te.available_metrics]),w.useEffect(()=>{Pe!=null&&Pe.available_metrics&&Pe.available_metrics.length>0&&Ge(Pe.available_metrics)},[Pe==null?void 0:Pe.available_metrics]),w.useEffect(()=>{oe!=null&&oe.available_metrics&&oe.available_metrics.length>0&&Z(oe.available_metrics)},[oe==null?void 0:oe.available_metrics]);const[ge,we]=w.useState(1),[_e,ve]=w.useState(null),[Ue,Se]=w.useState(null),[ke,qe]=w.useState(null);w.useEffect(()=>{Me!==null&&Me>0&&we(Me)},[Me]),w.useEffect(()=>{const St=(Te==null?void 0:Te.global_min_time)??(Pe==null?void 0:Pe.global_min_time)??null;St!==null&&ve(St)},[Te==null?void 0:Te.global_min_time,Pe==null?void 0:Pe.global_min_time]),w.useEffect(()=>{const St=(Te==null?void 0:Te.interval_start)??(Pe==null?void 0:Pe.interval_start)??null,Ht=(Te==null?void 0:Te.interval_end)??(Pe==null?void 0:Pe.interval_end)??null;St!==null&&Ht!==null&&Se({start:St,end:Ht})},[Te==null?void 0:Te.interval_start,Te==null?void 0:Te.interval_end,Pe==null?void 0:Pe.interval_start,Pe==null?void 0:Pe.interval_end]),w.useEffect(()=>{we(1),ve(null),Se(null),qe(null)},[r]);const Je=Me??ge,nt=(Te==null?void 0:Te.interval_start)??(Pe==null?void 0:Pe.interval_start)??null,tt=(Te==null?void 0:Te.interval_end)??(Pe==null?void 0:Pe.interval_end)??null,be=(Te==null?void 0:Te.global_min_time)??(Pe==null?void 0:Pe.global_min_time)??_e;w.useEffect(()=>{if(p&&Me!==null&&Me>0){const St=Me-1;a!==St&&l(St)}},[p,Me,a,l]);const Le=St=>{m(!1),l(St)},Ze=St=>{if(!p){const Ht=Math.floor(a*c/St);l(Ht)}f(St)},Ee=()=>{p?m(!1):(m(!0),Me!==null&&Me>0&&l(Me-1))};w.useEffect(()=>{U(JM(_))},[_]);const Ye=w.useMemo(()=>{const St=(Te==null?void 0:Te.metrics)??[];return!x||_<=0?St:_ke(St,_)},[Te==null?void 0:Te.metrics,x,_]),it=w.useMemo(()=>{const St=(Pe==null?void 0:Pe.metrics)??[];return!x||_<=0?St:Ske(St,_)},[Pe==null?void 0:Pe.metrics,x,_]),mt=w.useMemo(()=>{const St=(oe==null?void 0:oe.metrics)??[];return!x||_<=0?St:wke(St,_)},[oe==null?void 0:oe.metrics,x,_]),ft=w.useMemo(()=>{if(p){const Ft=[],Bt=[];if((Te==null?void 0:Te.interval_start)!=null&&Bt.push(Te.interval_start),(Te==null?void 0:Te.interval_end)!=null&&Ft.push(Te.interval_end),(Pe==null?void 0:Pe.interval_start)!=null&&Bt.push(Pe.interval_start),(Pe==null?void 0:Pe.interval_end)!=null&&Ft.push(Pe.interval_end),(oe==null?void 0:oe.interval_start)!=null&&Bt.push(oe.interval_start),(oe==null?void 0:oe.interval_end)!=null&&Ft.push(oe.interval_end),Ft.length===0)return null;const Kt=Math.min(...Ft),dn=Math.max(be??Kt,Kt-c),Rt=Bt.length>0?Math.max(...Bt):dn;return{start:Math.min(Kt,Math.max(dn,Rt)),end:Kt}}const St=(Ue==null?void 0:Ue.start)??null,Ht=(Ue==null?void 0:Ue.end)??null,rn=nt??St,Ut=tt??Ht;return rn===null||Ut===null?null:{start:rn,end:Ut}},[p,Te==null?void 0:Te.interval_end,Te==null?void 0:Te.interval_start,Pe==null?void 0:Pe.interval_end,Pe==null?void 0:Pe.interval_start,oe==null?void 0:oe.interval_end,oe==null?void 0:oe.interval_start,be,c,nt,tt,Ue==null?void 0:Ue.start,Ue==null?void 0:Ue.end]);w.useEffect(()=>{ft&&qe(ft)},[ft]);const Qe=ft??ke,Ae=w.useMemo(()=>!Qe||be===null?0:Qe.start-be,[Qe,be]),Xe=ce&&X||Q&&ue||Ce&&de,Re=ce&&!Te||ie&&Q&&!Pe||he&&Ce&&!oe,Be=!Xe&&!Re&&(ce&&!!Te||Q&&!!Pe||Ce&&!!oe),ot=Xe||Re,dt=w.useMemo(()=>mke(z==null?void 0:z.summary),[z==null?void 0:z.summary]),Nt=w.useMemo(()=>gke(z==null?void 0:z.summary),[z==null?void 0:z.summary]);return r?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center gap-2 h-7",children:[d.jsxs(h0,{type:"single",variant:"selecting",size:"sm",value:s,onValueChange:St=>{St&&o(St)},children:[d.jsx(Xa,{value:"metrics",className:"text-xs px-2 py-1 h-7",children:"Metrics"}),d.jsx(Xa,{value:"topology",className:"text-xs px-2 py-1 h-7",children:"Topology"}),d.jsx(Xa,{value:"model",className:"text-xs px-2 py-1 h-7",children:"Model"})]}),s==="metrics"&&d.jsxs(d.Fragment,{children:[d.jsx(gD,{currentPage:a,totalPages:Je,onPageChange:Le}),d.jsx(Mke,{value:c,onChange:Ze}),Qe&&d.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[c0(Qe.start,Qe.end-Qe.start)," ","–"," ",c0(Qe.end,Qe.end-Qe.start)]}),d.jsx("button",{onClick:Ee,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"}),d.jsx(IS,{label:"Aggregate",variant:"selecting",size:"sm",inputType:"text",enabled:x,onEnabledChange:b,value:ne,onValueChange:U,onValueCommit:St=>{const Ht=bke(St);Ht!==null?(S(Ht),U(JM(Ht))):U(JM(_))},inputWidth:"w-10"})]})]})})}),s==="metrics"&&d.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:d.jsxs("div",{className:"max-w-7xl mx-auto",children:[Y&&d.jsx(dd,{className:"border-destructive mb-6",children:d.jsx(ch,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",Y instanceof Error?Y.message:"Unknown error"]})})}),d.jsx(nke,{gpuMetrics:Ye,cpuMetrics:it,vllmMetrics:mt,availableGpuMetrics:(Te==null?void 0:Te.available_metrics)??Ve,availableCpuMetrics:(Pe==null?void 0:Pe.available_metrics)??ze,availableVllmMetrics:(oe==null?void 0:oe.available_metrics)??ae,trainerGpus:dt,inferenceGpus:Nt,isLoading:ot,isRefetching:Be,roleMode:A,onRoleModeChange:N,systemMetricsOpen:P,onSystemMetricsOpenChange:k,cpuMetricsOpen:O,onCpuMetricsOpenChange:R,vllmMetricsOpen:L,onVllmMetricsOpenChange:B,trainerSectionOpen:V,onTrainerSectionOpenChange:W,inferenceSectionOpen:G,onInferenceSectionOpenChange:ee,trainerNodeMode:H,onTrainerNodeModeChange:q,inferenceNodeMode:J,onInferenceNodeModeChange:K,overrideTimeRange:Qe,xOffset:Ae})]})}),s==="topology"&&d.jsx("div",{className:"flex-1 overflow-hidden",children:Y?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),d.jsx("div",{className:"text-xs text-muted-foreground",children:Y instanceof Error?Y.message:"Unknown error"})]})}):z?!j||j.nodes.length===0?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),d.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):d.jsx("div",{className:"h-full w-full",children:d.jsx(VZ,{topology:j})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})})}),s==="model"&&d.jsx("div",{className:"flex-1 overflow-hidden",children:Y?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load model data"}),d.jsx("div",{className:"text-xs text-muted-foreground",children:Y instanceof Error?Y.message:"Unknown error"})]})}):z?(Dt=z.summary)!=null&&Dt.model_architecture?d.jsx("div",{className:"h-full w-full",children:d.jsx(pke,{modelRepr:z.summary.model_architecture})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No model architecture available"}),d.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have model_architecture in its W&B summary."})]})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading model architecture…"})})})]}):d.jsx(I0,{description:"Select a run from the sidebar to view infrastructure metrics."})}const oQ=1e4;function I_(t,e){return t*oQ+e}function Cke(){var ve,Ue;const t=qn(bl),[e]=c7(),[n,r]=fn(MI),[i,s]=fn(Lce),[o,a]=fn(TI),[l,c]=fn(CI),f=qn(EI),[p]=fn(TA),[,m]=fn(AI),x=qn(CA),[b,_]=fn(BT),[S,M]=fn(HT),C=b.length+(S?1:0),A=Se=>{_(ke=>ke.includes(Se)?ke.filter(qe=>qe!==Se):[...ke,Se])},[N,P]=w.useState(0),[k,O]=w.useState(0),[R,L]=w.useState(!0),B=!0,V=w.useMemo(()=>{const Se=e.get("step");if(!Se)return null;const ke=Number(Se);return Number.isFinite(ke)?ke:null},[e]),W=w.useRef(null);w.useEffect(()=>{if(!t){W.current=null;return}if(V==null){W.current=null;return}V!==W.current&&(r(V),W.current=V)},[V,t,r]);const{data:G,isLoading:ee,error:H}=Tde(t||"",n,i,!!t),{data:q}=_h(t||"",!!t,B),J=((ve=q==null?void 0:q.summary)==null?void 0:ve.eval_env_details)??((Ue=q==null?void 0:q.config)==null?void 0:Ue.eval_env_details),K=w.useMemo(()=>Hw(J),[J]),ne=w.useMemo(()=>{const Se=Tp(J),ke=Vw(q==null?void 0:q.data_metric_ranges);return Cp(Se,ke)},[J,q==null?void 0:q.data_metric_ranges]),[U,z]=w.useState([]),Y=G==null?void 0:G.available_rollout_metric_names,j=Y&&Y.length>0?Y:U;Y&&Y.length>0&&Y!==U&&z(Y);const le=w.useMemo(()=>{if(i)return{prefix:`eval/${i}/`,rewardNames:j,selectedSampleIdx:o}},[i,j,o]);w.useEffect(()=>{if(!G)return;const Se=G.available_eval_names;Se.length&&(i&&Se.includes(i)||s(Se[0]))},[G==null?void 0:G.available_eval_names,i,s,G]);const ce=w.useMemo(()=>{var Se;return(Se=G==null?void 0:G.available_steps)!=null&&Se.length&&n===null?G.available_steps[G.available_steps.length-1]:null},[G==null?void 0:G.available_steps,n]);w.useEffect(()=>{ce!==null&&n===null&&V==null&&r(ce)},[ce,V,n,r]);const X=Se=>{r(Se)},[ie,fe]=w.useState([]),[Q,ue]=w.useState(null);t!==Q&&(fe([]),ue(t));const he=G==null?void 0:G.available_steps,se=w.useMemo(()=>{const Se=he??[];return[...new Set([...ie,...Se])].sort((qe,Je)=>qe-Je)},[he,ie]);se.length>ie.length&&fe(se);const Ce=se.length>0,de=Ce?se[se.length-1]:0,Me=w.useMemo(()=>{if(n==null)return se.length-1;const Se=se.indexOf(n);return Se>=0?Se:se.length-1},[se,n]),Te=Se=>{Se>=0&&Se<se.length&&X(se[Se])},Pe=w.useMemo(()=>{if(G!=null&&G.prompts)return G.prompts.map(Se=>({step:Se.step,group_id:Se.sample_idx,env:Se.env,system_prompt:Se.system_prompt,tokens_system_prompt:Se.tokens_system_prompt,prompt:Se.prompt,tokens_prompt:Se.tokens_prompt}))},[G]),oe=w.useMemo(()=>{if(G!=null&&G.rollouts)return G.rollouts.map(Se=>({step:Se.step,group_id:Se.sample_idx,sample_idx:I_(Se.sample_idx,Se.completion_idx),turn_order:Se.turn_order,turn_type:Se.turn_type,content:Se.content,tokens:Se.tokens}))},[G]),Ve=w.useMemo(()=>{if(G!=null&&G.samples_data)return G.samples_data.map(Se=>({step:Se.step,group_id:Se.sample_idx,sample_idx:I_(Se.sample_idx,Se.completion_idx),reward:null,advantage:null,turns:Se.turns,total_tokens:null,raw_string:null}))},[G]),He=w.useMemo(()=>{if(G!=null&&G.rollout_metrics)return G.rollout_metrics.map(Se=>({step:Se.step,sample_idx:I_(Se.sample_idx,Se.completion_idx),env:Se.env,metric_name:Se.metric_name,value:Se.value}))},[G]),ze=w.useMemo(()=>{if(G!=null&&G.golden_answers)return G.golden_answers.map(Se=>({step:Se.step,sample_idx:I_(Se.sample_idx,Se.completion_idx),env:Se.env,key:Se.key,value:Se.value}))},[G]),Ge=w.useMemo(()=>{if(G!=null&&G.info_turns)return G.info_turns.map(Se=>({step:Se.step,sample_idx:I_(Se.sample_idx,Se.completion_idx),turn_order:Se.turn_order,env:Se.env,info_key:Se.info_key,info_value:Se.info_value,info_type:Se.info_type}))},[G]),ae=w.useMemo(()=>{if(!(G!=null&&G.samples_data))return new Map;const Se=new Map;for(const ke of G.samples_data)Se.set(ke.sample_idx,(Se.get(ke.sample_idx)??0)+1);return Se},[G]),Z=w.useCallback((Se,ke)=>{const qe=ae.get(Se)??ke.samples.length;if(a(Se),qe<=1){const Je=ke.samples[0];Je&&c(Je.sample_idx)}else m("samples")},[ae,a,c,m]),ge=w.useCallback(()=>{m("groups")},[m]),we=w.useCallback(({viewMode:Se})=>d.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[Se==="samples"&&d.jsx(wn,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:ge,children:d.jsx(VT,{className:"h-4 w-4"})}),d.jsxs(ay,{value:i??"",onValueChange:ke=>{s(ke),a(null),c(null),m("groups")},children:[d.jsx(cy,{className:"h-7 text-xs min-w-0 flex-1",children:d.jsx(ly,{placeholder:"Select eval..."})}),d.jsx(uy,{children:((G==null?void 0:G.available_eval_names)??[]).map(ke=>d.jsx(Mx,{value:ke,className:"text-xs",children:ke},ke))})]})]}),[i,G==null?void 0:G.available_eval_names,s,a,c,m,ge]),_e=w.useMemo(()=>{var tt;if(!f)return null;const Se=((tt=f.sample.turns[0])==null?void 0:tt.step)??n,ke=f.sample.group_id,Je=f.sample.sample_idx%oQ,nt=ae.get(ke)??1;return{step:Se,evalSampleIdx:ke,completionIdx:Je,numCompletions:nt}},[f,n,ae]);return t?d.jsxs("div",{className:"flex h-full overflow-hidden",children:[d.jsx(_9,{prompts:Pe,data:oe,samplesData:Ve,rolloutMetrics:He,availableMetricNames:j,isLoading:ee,step:n??void 0,currentStepIndex:Me,totalSteps:se.length,onStepChange:Te,hasSteps:Ce,stepValues:se,openAtom:TA,selectedGroupIdAtom:TI,selectedSampleIdxAtom:CI,viewModeAtom:AI,renderLeftControls:we,onGroupClick:Z,hideRewardAdvantage:!0,envDetailsOverride:J}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center justify-between h-7",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(b9,{openAtom:TA}),_e&&d.jsxs("div",{className:"text-sm text-muted-foreground",children:[d.jsxs("span",{children:["Step ",_e.step]}),i&&d.jsxs(d.Fragment,{children:[" · ",d.jsx("span",{children:i})]})," · ",d.jsxs("span",{children:["Sample ",_e.evalSampleIdx]}),_e.numCompletions>1&&d.jsxs(d.Fragment,{children:[" · ",d.jsxs("span",{children:["Completion ",_e.completionIdx]})]})]}),(f==null?void 0:f.sample.raw_string)&&d.jsx(DC,{rawString:f.sample.raw_string,totalTokens:f.sample.total_tokens,turns:f.sample.turns.length}),f&&d.jsxs(d.Fragment,{children:[d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(Se=>Se+1),L(!1)},children:"Collapse All"}),d.jsx(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{O(Se=>Se+1),L(!0)},children:"Expand All"}),d.jsxs(Gs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(wn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",C>0&&` (${C})`]})}),d.jsxs($s,{align:"start",className:"w-auto",children:[d.jsx(ur,{checked:S,onCheckedChange:Se=>M(!!Se),onSelect:Se=>Se.preventDefault(),children:"Format Think"}),d.jsx(ur,{checked:b.includes("markdown"),onCheckedChange:()=>A("markdown"),onSelect:Se=>Se.preventDefault(),children:"Markdown"}),d.jsx(ur,{checked:b.includes("latex"),onCheckedChange:()=>A("latex"),onSelect:Se=>Se.preventDefault(),children:"LaTeX"}),d.jsx(ur,{checked:b.includes("code"),onCheckedChange:()=>A("code"),onSelect:Se=>Se.preventDefault(),children:"Code"})]})]})]})]}),le&&d.jsx(v9,{openAtom:CA})]})})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:d.jsxs("div",{className:p||x?"max-w-5xl mx-auto":"",children:[H&&d.jsx(dd,{className:"border-destructive mb-6",children:d.jsx(ch,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",H instanceof Error?H.message:"Unknown error"]})})}),d.jsx(j1,{prompts:Pe,data:oe,samplesData:Ve,rolloutMetrics:He,goldenAnswers:ze,infoTurns:Ge,isLoading:ee,step:n??void 0,filterGroupId:o,filterSampleIdx:l,lastValidSampleAtom:EI,collapseAllSignal:N,expandAllSignal:k,defaultSectionsOpen:R,envRewardRanges:K,envMetricRanges:ne,renderOptions:b,formatThinkBlocks:S})]})})]}),le&&d.jsx(y9,{currentStep:n,maxSelectableStep:de,openAtom:CA,selectedMetricsAtom:jce,selectedStepAtom:MI,evalConfig:le})]}):d.jsx(I0,{description:"Select a run from the sidebar to view evals."})}function Eke(){const t=qn(as);return d.jsx("div",{className:"h-full flex items-center justify-center overflow-auto pb-40",children:d.jsxs("div",{className:"max-w-2xl px-6 py-12 text-center",children:[d.jsx("div",{className:"flex items-center justify-center mb-8",children:d.jsx("img",{src:t?"/logo-full-dark.svg":"/logo-full.svg",alt:"Telescope",className:"h-12"})}),d.jsxs("div",{className:"space-y-4 text-base text-foreground/60 leading-relaxed text-justify",children:[d.jsx("p",{children:"Telescope is a framework to post-train LLMs with reinforcement learning for reasoning and agents."}),d.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."}),d.jsx("p",{children:"This visualization tool provides critical insight into your runs: metrics, rollouts, infrastructure, inference traces, trainer GPU events, and more."}),d.jsx("p",{children:"Telescope is built with a modern stack and focused on infrastructure, observability, scalability, and reliability."}),d.jsxs("p",{children:["You can find the documentation at"," ",d.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"}),"."]})]}),d.jsxs("div",{className:"mt-10 flex items-center justify-center gap-6 text-xs text-muted-foreground",children:[d.jsx("a",{href:"https://github.com/eduardoslonski/telescope",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Trainer"}),d.jsx("span",{className:"text-border",children:"|"}),d.jsx("a",{href:"https://github.com/eduardoslonski/telescope-ui",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"UI Visualization"}),d.jsx("span",{className:"text-border",children:"|"}),d.jsx("a",{href:"https://eduardoslonski.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Created by Eduardo Slonski"})]})]})})}function Ake(){return d.jsxs(tue,{children:[d.jsx(ufe,{}),d.jsx("main",{className:"ml-56 h-screen overflow-hidden bg-background",children:d.jsxs(WJ,{children:[d.jsx($f,{path:"/",element:d.jsx(F0e,{})}),d.jsx($f,{path:"/metrics",element:d.jsx(B0e,{})}),d.jsx($f,{path:"/timeline",element:d.jsx(MNe,{})}),d.jsx($f,{path:"/rollouts",element:d.jsx(GNe,{})}),d.jsx($f,{path:"/rollouts-discarded",element:d.jsx(WNe,{})}),d.jsx($f,{path:"/topology",element:d.jsx($Ne,{})}),d.jsx($f,{path:"/infra",element:d.jsx(Tke,{})}),d.jsx($f,{path:"/evals",element:d.jsx(Cke,{})}),d.jsx($f,{path:"/about",element:d.jsx(Eke,{})})]})})]})}hU.createRoot(document.getElementById("root")).render(d.jsx(w.StrictMode,{children:d.jsx(gee,{children:d.jsx(Ake,{})})}));
