var AP=t=>{throw TypeError(t)};var dC=(t,e,n)=>e.has(t)||AP("Cannot "+n);var it=(t,e,n)=>(dC(t,e,"read from private field"),n?n.call(t):e.get(t)),Ln=(t,e,n)=>e.has(t)?AP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),un=(t,e,n,r)=>(dC(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),fr=(t,e,n)=>(dC(t,e,"access private method"),n);var B3=(t,e,n,r)=>({set _(i){un(t,e,i,n)},get _(){return it(t,e,r)}});function VZ(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 a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 cy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fC={exports:{}},zb={};/**
 * @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 NP;function GZ(){if(NP)return zb;NP=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var a=null;if(s!==void 0&&(a=""+s),i.key!==void 0&&(a=""+i.key),"key"in i){s={};for(var o in i)o!=="key"&&(s[o]=i[o])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:a,ref:i!==void 0?i:null,props:s}}return zb.Fragment=e,zb.jsx=n,zb.jsxs=n,zb}var RP;function WZ(){return RP||(RP=1,fC.exports=GZ()),fC.exports}var p=WZ(),hC={exports:{}},xr={};/**
 * @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 kP;function $Z(){if(kP)return xr;kP=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"),a=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function v(j){return j===null||typeof j!="object"?null:(j=g&&j[g]||j["@@iterator"],typeof j=="function"?j:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function S(j,X,H){this.props=j,this.context=X,this.refs=w,this.updater=H||b}S.prototype.isReactComponent={},S.prototype.setState=function(j,X){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,X,"setState")},S.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function E(){}E.prototype=S.prototype;function A(j,X,H){this.props=j,this.context=X,this.refs=w,this.updater=H||b}var N=A.prototype=new E;N.constructor=A,_(N,S.prototype),N.isPureReactComponent=!0;var I=Array.isArray;function P(){}var L={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function O(j,X,H){var se=H.ref;return{$$typeof:t,type:j,key:X,ref:se!==void 0?se:null,props:H}}function W(j,X){return O(j.type,X,j.props)}function U(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function V(j){var X={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(H){return X[H]})}var G=/\/+/g;function Z(j,X){return typeof j=="object"&&j!==null&&j.key!=null?V(""+j.key):X.toString(36)}function B(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(P,P):(j.status="pending",j.then(function(X){j.status==="pending"&&(j.status="fulfilled",j.value=X)},function(X){j.status==="pending"&&(j.status="rejected",j.reason=X)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function q(j,X,H,se,re){var ie=typeof j;(ie==="undefined"||ie==="boolean")&&(j=null);var ue=!1;if(j===null)ue=!0;else switch(ie){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(j.$$typeof){case t:case e:ue=!0;break;case d:return ue=j._init,q(ue(j._payload),X,H,se,re)}}if(ue)return re=re(j),ue=se===""?"."+Z(j,0):se,I(re)?(H="",ue!=null&&(H=ue.replace(G,"$&/")+"/"),q(re,X,H,"",function(xe){return xe})):re!=null&&(U(re)&&(re=W(re,H+(re.key==null||j&&j.key===re.key?"":(""+re.key).replace(G,"$&/")+"/")+ue)),X.push(re)),1;ue=0;var le=se===""?".":se+":";if(I(j))for(var fe=0;fe<j.length;fe++)se=j[fe],ie=le+Z(se,fe),ue+=q(se,X,H,ie,re);else if(fe=v(j),typeof fe=="function")for(j=fe.call(j),fe=0;!(se=j.next()).done;)se=se.value,ie=le+Z(se,fe++),ue+=q(se,X,H,ie,re);else if(ie==="object"){if(typeof j.then=="function")return q(B(j),X,H,se,re);throw X=String(j),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ue}function Y(j,X,H){if(j==null)return j;var se=[],re=0;return q(j,se,"","",function(ie){return X.call(H,ie,re++)}),se}function K(j){if(j._status===-1){var X=j._result;X=X(),X.then(function(H){(j._status===0||j._status===-1)&&(j._status=1,j._result=H)},function(H){(j._status===0||j._status===-1)&&(j._status=2,j._result=H)}),j._status===-1&&(j._status=0,j._result=X)}if(j._status===1)return j._result.default;throw j._result}var J=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},F={map:Y,forEach:function(j,X,H){Y(j,function(){X.apply(this,arguments)},H)},count:function(j){var X=0;return Y(j,function(){X++}),X},toArray:function(j){return Y(j,function(X){return X})||[]},only:function(j){if(!U(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return xr.Activity=h,xr.Children=F,xr.Component=S,xr.Fragment=n,xr.Profiler=i,xr.PureComponent=A,xr.StrictMode=r,xr.Suspense=l,xr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,xr.__COMPILER_RUNTIME={__proto__:null,c:function(j){return L.H.useMemoCache(j)}},xr.cache=function(j){return function(){return j.apply(null,arguments)}},xr.cacheSignal=function(){return null},xr.cloneElement=function(j,X,H){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var se=_({},j.props),re=j.key;if(X!=null)for(ie in X.key!==void 0&&(re=""+X.key),X)!R.call(X,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&X.ref===void 0||(se[ie]=X[ie]);var ie=arguments.length-2;if(ie===1)se.children=H;else if(1<ie){for(var ue=Array(ie),le=0;le<ie;le++)ue[le]=arguments[le+2];se.children=ue}return O(j.type,re,se)},xr.createContext=function(j){return j={$$typeof:a,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:s,_context:j},j},xr.createElement=function(j,X,H){var se,re={},ie=null;if(X!=null)for(se in X.key!==void 0&&(ie=""+X.key),X)R.call(X,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(re[se]=X[se]);var ue=arguments.length-2;if(ue===1)re.children=H;else if(1<ue){for(var le=Array(ue),fe=0;fe<ue;fe++)le[fe]=arguments[fe+2];re.children=le}if(j&&j.defaultProps)for(se in ue=j.defaultProps,ue)re[se]===void 0&&(re[se]=ue[se]);return O(j,ie,re)},xr.createRef=function(){return{current:null}},xr.forwardRef=function(j){return{$$typeof:o,render:j}},xr.isValidElement=U,xr.lazy=function(j){return{$$typeof:d,_payload:{_status:-1,_result:j},_init:K}},xr.memo=function(j,X){return{$$typeof:c,type:j,compare:X===void 0?null:X}},xr.startTransition=function(j){var X=L.T,H={};L.T=H;try{var se=j(),re=L.S;re!==null&&re(H,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(P,J)}catch(ie){J(ie)}finally{X!==null&&H.types!==null&&(X.types=H.types),L.T=X}},xr.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},xr.use=function(j){return L.H.use(j)},xr.useActionState=function(j,X,H){return L.H.useActionState(j,X,H)},xr.useCallback=function(j,X){return L.H.useCallback(j,X)},xr.useContext=function(j){return L.H.useContext(j)},xr.useDebugValue=function(){},xr.useDeferredValue=function(j,X){return L.H.useDeferredValue(j,X)},xr.useEffect=function(j,X){return L.H.useEffect(j,X)},xr.useEffectEvent=function(j){return L.H.useEffectEvent(j)},xr.useId=function(){return L.H.useId()},xr.useImperativeHandle=function(j,X,H){return L.H.useImperativeHandle(j,X,H)},xr.useInsertionEffect=function(j,X){return L.H.useInsertionEffect(j,X)},xr.useLayoutEffect=function(j,X){return L.H.useLayoutEffect(j,X)},xr.useMemo=function(j,X){return L.H.useMemo(j,X)},xr.useOptimistic=function(j,X){return L.H.useOptimistic(j,X)},xr.useReducer=function(j,X,H){return L.H.useReducer(j,X,H)},xr.useRef=function(j){return L.H.useRef(j)},xr.useState=function(j){return L.H.useState(j)},xr.useSyncExternalStore=function(j,X,H){return L.H.useSyncExternalStore(j,X,H)},xr.useTransition=function(){return L.H.useTransition()},xr.version="19.2.1",xr}var PP;function GS(){return PP||(PP=1,hC.exports=$Z()),hC.exports}var T=GS();const Zr=cy(T),kF=VZ({__proto__:null,default:Zr},[T]);var pC={exports:{}},jb={},mC={exports:{}},gC={};/**
 * @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 qZ(){return DP||(DP=1,(function(t){function e(q,Y){var K=q.length;q.push(Y);e:for(;0<K;){var J=K-1>>>1,F=q[J];if(0<i(F,Y))q[J]=Y,q[K]=F,K=J;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var Y=q[0],K=q.pop();if(K!==Y){q[0]=K;e:for(var J=0,F=q.length,j=F>>>1;J<j;){var X=2*(J+1)-1,H=q[X],se=X+1,re=q[se];if(0>i(H,K))se<F&&0>i(re,H)?(q[J]=re,q[se]=K,J=se):(q[J]=H,q[X]=K,J=X);else if(se<F&&0>i(re,K))q[J]=re,q[se]=K,J=se;else break e}}return Y}function i(q,Y){var K=q.sortIndex-Y.sortIndex;return K!==0?K:q.id-Y.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 a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,h=null,g=3,v=!1,b=!1,_=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function N(q){for(var Y=n(c);Y!==null;){if(Y.callback===null)r(c);else if(Y.startTime<=q)r(c),Y.sortIndex=Y.expirationTime,e(l,Y);else break;Y=n(c)}}function I(q){if(_=!1,N(q),!b)if(n(l)!==null)b=!0,P||(P=!0,V());else{var Y=n(c);Y!==null&&B(I,Y.startTime-q)}}var P=!1,L=-1,R=5,O=-1;function W(){return w?!0:!(t.unstable_now()-O<R)}function U(){if(w=!1,P){var q=t.unstable_now();O=q;var Y=!0;try{e:{b=!1,_&&(_=!1,E(L),L=-1),v=!0;var K=g;try{t:{for(N(q),h=n(l);h!==null&&!(h.expirationTime>q&&W());){var J=h.callback;if(typeof J=="function"){h.callback=null,g=h.priorityLevel;var F=J(h.expirationTime<=q);if(q=t.unstable_now(),typeof F=="function"){h.callback=F,N(q),Y=!0;break t}h===n(l)&&r(l),N(q)}else r(l);h=n(l)}if(h!==null)Y=!0;else{var j=n(c);j!==null&&B(I,j.startTime-q),Y=!1}}break e}finally{h=null,g=K,v=!1}Y=void 0}}finally{Y?V():P=!1}}}var V;if(typeof A=="function")V=function(){A(U)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,Z=G.port2;G.port1.onmessage=U,V=function(){Z.postMessage(null)}}else V=function(){S(U,0)};function B(q,Y){L=S(function(){q(t.unstable_now())},Y)}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 g},t.unstable_next=function(q){switch(g){case 1:case 2:case 3:var Y=3;break;default:Y=g}var K=g;g=Y;try{return q()}finally{g=K}},t.unstable_requestPaint=function(){w=!0},t.unstable_runWithPriority=function(q,Y){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=g;g=q;try{return Y()}finally{g=K}},t.unstable_scheduleCallback=function(q,Y,K){var J=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?J+K:J):K=J,q){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=K+F,q={id:d++,callback:Y,priorityLevel:q,startTime:K,expirationTime:F,sortIndex:-1},K>J?(q.sortIndex=K,e(c,q),n(l)===null&&q===n(c)&&(_?(E(L),L=-1):_=!0,B(I,K-J))):(q.sortIndex=F,e(l,q),b||v||(b=!0,P||(P=!0,V()))),q},t.unstable_shouldYield=W,t.unstable_wrapCallback=function(q){var Y=g;return function(){var K=g;g=Y;try{return q.apply(this,arguments)}finally{g=K}}}})(gC)),gC}var IP;function PF(){return IP||(IP=1,mC.exports=qZ()),mC.exports}var vC={exports:{}},rl={};/**
 * @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 OP;function XZ(){if(OP)return rl;OP=1;var t=GS();function e(l){var c="https://react.dev/errors/"+l;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+l+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(l,c,d){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:h==null?null:""+h,children:l,containerInfo:c,implementation:d}}var a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(l,c){if(l==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return rl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,rl.createPortal=function(l,c){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)throw Error(e(299));return s(l,c,null,d)},rl.flushSync=function(l){var c=a.T,d=r.p;try{if(a.T=null,r.p=2,l)return l()}finally{a.T=c,r.p=d,r.d.f()}},rl.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))},rl.prefetchDNS=function(l){typeof l=="string"&&r.d.D(l)},rl.preinit=function(l,c){if(typeof l=="string"&&c&&typeof c.as=="string"){var d=c.as,h=o(d,c.crossOrigin),g=typeof c.integrity=="string"?c.integrity:void 0,v=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;d==="style"?r.d.S(l,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:h,integrity:g,fetchPriority:v}):d==="script"&&r.d.X(l,{crossOrigin:h,integrity:g,fetchPriority:v,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},rl.preinitModule=function(l,c){if(typeof l=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var d=o(c.as,c.crossOrigin);r.d.M(l,{crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0})}}else c==null&&r.d.M(l)},rl.preload=function(l,c){if(typeof l=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var d=c.as,h=o(d,c.crossOrigin);r.d.L(l,d,{crossOrigin:h,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})}},rl.preloadModule=function(l,c){if(typeof l=="string")if(c){var d=o(c.as,c.crossOrigin);r.d.m(l,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else r.d.m(l)},rl.requestFormReset=function(l){r.d.r(l)},rl.unstable_batchedUpdates=function(l,c){return l(c)},rl.useFormState=function(l,c,d){return a.H.useFormState(l,c,d)},rl.useFormStatus=function(){return a.H.useHostTransitionStatus()},rl.version="19.2.1",rl}var LP;function DF(){if(LP)return vC.exports;LP=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(),vC.exports=XZ(),vC.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 zP;function YZ(){if(zP)return jb;zP=1;var t=PF(),e=GS(),n=DF();function r(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)f+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+f+" 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 f=u,y=u;if(u.alternate)for(;f.return;)f=f.return;else{u=f;do f=u,(f.flags&4098)!==0&&(y=f.return),u=f.return;while(u)}return f.tag===3?y:null}function a(u){if(u.tag===13){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function o(u){if(u.tag===31){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function l(u){if(s(u)!==u)throw Error(r(188))}function c(u){var f=u.alternate;if(!f){if(f=s(u),f===null)throw Error(r(188));return f!==u?null:u}for(var y=u,M=f;;){var D=y.return;if(D===null)break;var z=D.alternate;if(z===null){if(M=D.return,M!==null){y=M;continue}break}if(D.child===z.child){for(z=D.child;z;){if(z===y)return l(D),u;if(z===M)return l(D),f;z=z.sibling}throw Error(r(188))}if(y.return!==M.return)y=D,M=z;else{for(var ce=!1,Ne=D.child;Ne;){if(Ne===y){ce=!0,y=D,M=z;break}if(Ne===M){ce=!0,M=D,y=z;break}Ne=Ne.sibling}if(!ce){for(Ne=z.child;Ne;){if(Ne===y){ce=!0,y=z,M=D;break}if(Ne===M){ce=!0,M=z,y=D;break}Ne=Ne.sibling}if(!ce)throw Error(r(189))}}if(y.alternate!==M)throw Error(r(190))}if(y.tag!==3)throw Error(r(188));return y.stateNode.current===y?u:f}function d(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u;for(u=u.child;u!==null;){if(f=d(u),f!==null)return f;u=u.sibling}return null}var h=Object.assign,g=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),A=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function V(u){return u===null||typeof u!="object"?null:(u=U&&u[U]||u["@@iterator"],typeof u=="function"?u:null)}var G=Symbol.for("react.client.reference");function Z(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 S:return"Profiler";case w:return"StrictMode";case I:return"Suspense";case P:return"SuspenseList";case O:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case b:return"Portal";case A:return u.displayName||"Context";case E:return(u._context.displayName||"Context")+".Consumer";case N:var f=u.render;return u=u.displayName,u||(u=f.displayName||f.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case L:return f=u.displayName||null,f!==null?f:Z(u.type)||"Memo";case R:f=u._payload,u=u._init;try{return Z(u(f))}catch{}}return null}var B=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},J=[],F=-1;function j(u){return{current:u}}function X(u){0>F||(u.current=J[F],J[F]=null,F--)}function H(u,f){F++,J[F]=u.current,u.current=f}var se=j(null),re=j(null),ie=j(null),ue=j(null);function le(u,f){switch(H(ie,f),H(re,u),H(se,null),f.nodeType){case 9:case 11:u=(u=f.documentElement)&&(u=u.namespaceURI)?Z9(u):0;break;default:if(u=f.tagName,f=f.namespaceURI)f=Z9(f),u=Q9(f,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}X(se),H(se,u)}function fe(){X(se),X(re),X(ie)}function xe(u){u.memoizedState!==null&&H(ue,u);var f=se.current,y=Q9(f,u.type);f!==y&&(H(re,u),H(se,y))}function he(u){re.current===u&&(X(se),X(re)),ue.current===u&&(X(ue),Db._currentValue=K)}var Te,We;function Se(u){if(Te===void 0)try{throw Error()}catch(y){var f=y.stack.trim().match(/\n( *(at )?)/);Te=f&&f[1]||"",We=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Te+u+We}var Le=!1;function pe(u,f){if(!u||Le)return"";Le=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var M={DetermineComponentFrameRoot:function(){try{if(f){var Ut=function(){throw Error()};if(Object.defineProperty(Ut.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ut,[])}catch(It){var At=It}Reflect.construct(u,[],Ut)}else{try{Ut.call()}catch(It){At=It}u.call(Ut.prototype)}}else{try{throw Error()}catch(It){At=It}(Ut=u())&&typeof Ut.catch=="function"&&Ut.catch(function(){})}}catch(It){if(It&&At&&typeof It.stack=="string")return[It.stack,At.stack]}return[null,null]}};M.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var D=Object.getOwnPropertyDescriptor(M.DetermineComponentFrameRoot,"name");D&&D.configurable&&Object.defineProperty(M.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var z=M.DetermineComponentFrameRoot(),ce=z[0],Ne=z[1];if(ce&&Ne){var rt=ce.split(`
`),Tt=Ne.split(`
`);for(D=M=0;M<rt.length&&!rt[M].includes("DetermineComponentFrameRoot");)M++;for(;D<Tt.length&&!Tt[D].includes("DetermineComponentFrameRoot");)D++;if(M===rt.length||D===Tt.length)for(M=rt.length-1,D=Tt.length-1;1<=M&&0<=D&&rt[M]!==Tt[D];)D--;for(;1<=M&&0<=D;M--,D--)if(rt[M]!==Tt[D]){if(M!==1||D!==1)do if(M--,D--,0>D||rt[M]!==Tt[D]){var Ot=`
`+rt[M].replace(" at new "," at ");return u.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",u.displayName)),Ot}while(1<=M&&0<=D);break}}}finally{Le=!1,Error.prepareStackTrace=y}return(y=u?u.displayName||u.name:"")?Se(y):""}function Re(u,f){switch(u.tag){case 26:case 27:case 5:return Se(u.type);case 16:return Se("Lazy");case 13:return u.child!==f&&f!==null?Se("Suspense Fallback"):Se("Suspense");case 19:return Se("SuspenseList");case 0:case 15:return pe(u.type,!1);case 11:return pe(u.type.render,!1);case 1:return pe(u.type,!0);case 31:return Se("Activity");default:return""}}function ne(u){try{var f="",y=null;do f+=Re(u,y),y=u,u=u.return;while(u);return f}catch(M){return`
Error generating stack: `+M.message+`
`+M.stack}}var Xe=Object.prototype.hasOwnProperty,Ae=t.unstable_scheduleCallback,Pe=t.unstable_cancelCallback,Ke=t.unstable_shouldYield,oe=t.unstable_requestPaint,te=t.unstable_now,_e=t.unstable_getCurrentPriorityLevel,ve=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,Be=t.unstable_LowPriority,ge=t.unstable_IdlePriority,Ye=t.log,Qe=t.unstable_setDisableYieldValue,Ie=null,Fe=null;function Ge(u){if(typeof Ye=="function"&&Qe(u),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ie,u)}catch{}}var Me=Math.clz32?Math.clz32:Oe,$e=Math.log,dt=Math.LN2;function Oe(u){return u>>>=0,u===0?32:31-($e(u)/dt|0)|0}var st=256,ft=262144,pt=4194304;function et(u){var f=u&42;if(f!==0)return f;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 Ze(u,f,y){var M=u.pendingLanes;if(M===0)return 0;var D=0,z=u.suspendedLanes,ce=u.pingedLanes;u=u.warmLanes;var Ne=M&134217727;return Ne!==0?(M=Ne&~z,M!==0?D=et(M):(ce&=Ne,ce!==0?D=et(ce):y||(y=Ne&~u,y!==0&&(D=et(y))))):(Ne=M&~z,Ne!==0?D=et(Ne):ce!==0?D=et(ce):y||(y=M&~u,y!==0&&(D=et(y)))),D===0?0:f!==0&&f!==D&&(f&z)===0&&(z=D&-D,y=f&-f,z>=y||z===32&&(y&4194048)!==0)?f:D}function me(u,f){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&f)===0}function je(u,f){switch(u){case 1:case 2:case 4:case 8:case 64:return f+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 f+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 He(){var u=pt;return pt<<=1,(pt&62914560)===0&&(pt=4194304),u}function nt(u){for(var f=[],y=0;31>y;y++)f.push(u);return f}function yt(u,f){u.pendingLanes|=f,f!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function lt(u,f,y,M,D,z){var ce=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 Ne=u.entanglements,rt=u.expirationTimes,Tt=u.hiddenUpdates;for(y=ce&~y;0<y;){var Ot=31-Me(y),Ut=1<<Ot;Ne[Ot]=0,rt[Ot]=-1;var At=Tt[Ot];if(At!==null)for(Tt[Ot]=null,Ot=0;Ot<At.length;Ot++){var It=At[Ot];It!==null&&(It.lane&=-536870913)}y&=~Ut}M!==0&&bt(u,M,0),z!==0&&D===0&&u.tag!==0&&(u.suspendedLanes|=z&~(ce&~f))}function bt(u,f,y){u.pendingLanes|=f,u.suspendedLanes&=~f;var M=31-Me(f);u.entangledLanes|=f,u.entanglements[M]=u.entanglements[M]|1073741824|y&261930}function Nt(u,f){var y=u.entangledLanes|=f;for(u=u.entanglements;y;){var M=31-Me(y),D=1<<M;D&f|u[M]&f&&(u[M]|=f),y&=~D}}function Pt(u,f){var y=f&-f;return y=(y&42)!==0?1:Ve(y),(y&(u.suspendedLanes|f))!==0?0:y}function Ve(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 wt(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Et(){var u=Y.p;return u!==0?u:(u=window.event,u===void 0?32:_P(u.type))}function zt(u,f){var y=Y.p;try{return Y.p=u,f()}finally{Y.p=y}}var Ht=Math.random().toString(36).slice(2),an="__reactFiber$"+Ht,Dn="__reactProps$"+Ht,Vt="__reactContainer$"+Ht,pn="__reactEvents$"+Ht,Bt="__reactListeners$"+Ht,Cn="__reactHandles$"+Ht,Bn="__reactResources$"+Ht,wn="__reactMarker$"+Ht;function On(u){delete u[an],delete u[Dn],delete u[pn],delete u[Bt],delete u[Cn]}function jn(u){var f=u[an];if(f)return f;for(var y=u.parentNode;y;){if(f=y[Vt]||y[an]){if(y=f.alternate,f.child!==null||y!==null&&y.child!==null)for(u=sP(u);u!==null;){if(y=u[an])return y;u=sP(u)}return f}u=y,y=u.parentNode}return null}function Bi(u){if(u=u[an]||u[Vt]){var f=u.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return u}return null}function ui(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u.stateNode;throw Error(r(33))}function be(u){var f=u[Bn];return f||(f=u[Bn]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function ot(u){u[wn]=!0}var _t=new Set,xt={};function gt(u,f){Yt(u,f),Yt(u+"Capture",f)}function Yt(u,f){for(xt[u]=f,u=0;u<f.length;u++)_t.add(f[u])}var rn=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]*$"),sn={},Zt={};function Mn(u){return Xe.call(Zt,u)?!0:Xe.call(sn,u)?!1:rn.test(u)?Zt[u]=!0:(sn[u]=!0,!1)}function Fn(u,f,y){if(Mn(f))if(y===null)u.removeAttribute(f);else{switch(typeof y){case"undefined":case"function":case"symbol":u.removeAttribute(f);return;case"boolean":var M=f.toLowerCase().slice(0,5);if(M!=="data-"&&M!=="aria-"){u.removeAttribute(f);return}}u.setAttribute(f,""+y)}}function $n(u,f,y){if(y===null)u.removeAttribute(f);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(f);return}u.setAttribute(f,""+y)}}function on(u,f,y,M){if(M===null)u.removeAttribute(y);else{switch(typeof M){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(y);return}u.setAttributeNS(f,y,""+M)}}function ir(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function qr(u){var f=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function Jr(u,f,y){var M=Object.getOwnPropertyDescriptor(u.constructor.prototype,f);if(!u.hasOwnProperty(f)&&typeof M<"u"&&typeof M.get=="function"&&typeof M.set=="function"){var D=M.get,z=M.set;return Object.defineProperty(u,f,{configurable:!0,get:function(){return D.call(this)},set:function(ce){y=""+ce,z.call(this,ce)}}),Object.defineProperty(u,f,{enumerable:M.enumerable}),{getValue:function(){return y},setValue:function(ce){y=""+ce},stopTracking:function(){u._valueTracker=null,delete u[f]}}}}function cr(u){if(!u._valueTracker){var f=qr(u)?"checked":"value";u._valueTracker=Jr(u,f,""+u[f])}}function Nr(u){if(!u)return!1;var f=u._valueTracker;if(!f)return!0;var y=f.getValue(),M="";return u&&(M=qr(u)?u.checked?"true":"false":u.value),u=M,u!==y?(f.setValue(u),!0):!1}function en(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var ss=/[\n"\\]/g;function Rn(u){return u.replace(ss,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function gs(u,f,y,M,D,z,ce,Ne){u.name="",ce!=null&&typeof ce!="function"&&typeof ce!="symbol"&&typeof ce!="boolean"?u.type=ce:u.removeAttribute("type"),f!=null?ce==="number"?(f===0&&u.value===""||u.value!=f)&&(u.value=""+ir(f)):u.value!==""+ir(f)&&(u.value=""+ir(f)):ce!=="submit"&&ce!=="reset"||u.removeAttribute("value"),f!=null?Pi(u,ce,ir(f)):y!=null?Pi(u,ce,ir(y)):M!=null&&u.removeAttribute("value"),D==null&&z!=null&&(u.defaultChecked=!!z),D!=null&&(u.checked=D&&typeof D!="function"&&typeof D!="symbol"),Ne!=null&&typeof Ne!="function"&&typeof Ne!="symbol"&&typeof Ne!="boolean"?u.name=""+ir(Ne):u.removeAttribute("name")}function Rs(u,f,y,M,D,z,ce,Ne){if(z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"&&(u.type=z),f!=null||y!=null){if(!(z!=="submit"&&z!=="reset"||f!=null)){cr(u);return}y=y!=null?""+ir(y):"",f=f!=null?""+ir(f):y,Ne||f===u.value||(u.value=f),u.defaultValue=f}M=M??D,M=typeof M!="function"&&typeof M!="symbol"&&!!M,u.checked=Ne?u.checked:!!M,u.defaultChecked=!!M,ce!=null&&typeof ce!="function"&&typeof ce!="symbol"&&typeof ce!="boolean"&&(u.name=ce),cr(u)}function Pi(u,f,y){f==="number"&&en(u.ownerDocument)===u||u.defaultValue===""+y||(u.defaultValue=""+y)}function vs(u,f,y,M){if(u=u.options,f){f={};for(var D=0;D<y.length;D++)f["$"+y[D]]=!0;for(y=0;y<u.length;y++)D=f.hasOwnProperty("$"+u[y].value),u[y].selected!==D&&(u[y].selected=D),D&&M&&(u[y].defaultSelected=!0)}else{for(y=""+ir(y),f=null,D=0;D<u.length;D++){if(u[D].value===y){u[D].selected=!0,M&&(u[D].defaultSelected=!0);return}f!==null||u[D].disabled||(f=u[D])}f!==null&&(f.selected=!0)}}function pr(u,f,y){if(f!=null&&(f=""+ir(f),f!==u.value&&(u.value=f),y==null)){u.defaultValue!==f&&(u.defaultValue=f);return}u.defaultValue=y!=null?""+ir(y):""}function di(u,f,y,M){if(f==null){if(M!=null){if(y!=null)throw Error(r(92));if(B(M)){if(1<M.length)throw Error(r(93));M=M[0]}y=M}y==null&&(y=""),f=y}y=ir(f),u.defaultValue=y,M=u.textContent,M===y&&M!==""&&M!==null&&(u.value=M),cr(u)}function ks(u,f){if(f){var y=u.firstChild;if(y&&y===u.lastChild&&y.nodeType===3){y.nodeValue=f;return}}u.textContent=f}var Di=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 $a(u,f,y){var M=f.indexOf("--")===0;y==null||typeof y=="boolean"||y===""?M?u.setProperty(f,""):f==="float"?u.cssFloat="":u[f]="":M?u.setProperty(f,y):typeof y!="number"||y===0||Di.has(f)?f==="float"?u.cssFloat=y:u[f]=(""+y).trim():u[f]=y+"px"}function co(u,f,y){if(f!=null&&typeof f!="object")throw Error(r(62));if(u=u.style,y!=null){for(var M in y)!y.hasOwnProperty(M)||f!=null&&f.hasOwnProperty(M)||(M.indexOf("--")===0?u.setProperty(M,""):M==="float"?u.cssFloat="":u[M]="");for(var D in f)M=f[D],f.hasOwnProperty(D)&&y[D]!==M&&$a(u,D,M)}else for(var z in f)f.hasOwnProperty(z)&&$a(u,z,f[z])}function So(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 ql=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"]]),xl=/^[\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 uo(u){return xl.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function Ps(){}var Xl=null;function Go(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var wo=null,Mo=null;function kc(u){var f=Bi(u);if(f&&(u=f.stateNode)){var y=u[Dn]||null;e:switch(u=f.stateNode,f.type){case"input":if(gs(u,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name),f=y.name,y.type==="radio"&&f!=null){for(y=u;y.parentNode;)y=y.parentNode;for(y=y.querySelectorAll('input[name="'+Rn(""+f)+'"][type="radio"]'),f=0;f<y.length;f++){var M=y[f];if(M!==u&&M.form===u.form){var D=M[Dn]||null;if(!D)throw Error(r(90));gs(M,D.value,D.defaultValue,D.defaultValue,D.checked,D.defaultChecked,D.type,D.name)}}for(f=0;f<y.length;f++)M=y[f],M.form===u.form&&Nr(M)}break e;case"textarea":pr(u,y.value,y.defaultValue);break e;case"select":f=y.value,f!=null&&vs(u,!!y.multiple,f,!1)}}}var Pc=!1;function Yl(u,f,y){if(Pc)return u(f,y);Pc=!0;try{var M=u(f);return M}finally{if(Pc=!1,(wo!==null||Mo!==null)&&(Uc(),wo&&(f=wo,u=Mo,Mo=wo=null,kc(f),u)))for(f=0;f<u.length;f++)kc(u[f])}}function qa(u,f){var y=u.stateNode;if(y===null)return null;var M=y[Dn]||null;if(M===null)return null;y=M[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(M=!M.disabled)||(u=u.type,M=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!M;break e;default:u=!1}if(u)return null;if(y&&typeof y!="function")throw Error(r(231,f,typeof y));return y}var ia=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Na=!1;if(ia)try{var yl={};Object.defineProperty(yl,"passive",{get:function(){Na=!0}}),window.addEventListener("test",yl,yl),window.removeEventListener("test",yl,yl)}catch{Na=!1}var xs=null,Wo=null,$o=null;function Dc(){if($o)return $o;var u,f=Wo,y=f.length,M,D="value"in xs?xs.value:xs.textContent,z=D.length;for(u=0;u<y&&f[u]===D[u];u++);var ce=y-u;for(M=1;M<=ce&&f[y-M]===D[z-M];M++);return $o=D.slice(u,1<M?1-M:void 0)}function ei(u){var f=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&f===13&&(u=13)):u=f,u===10&&(u=13),32<=u||u===13?u:0}function zr(){return!0}function Xa(){return!1}function mr(u){function f(y,M,D,z,ce){this._reactName=y,this._targetInst=D,this.type=M,this.nativeEvent=z,this.target=ce,this.currentTarget=null;for(var Ne in u)u.hasOwnProperty(Ne)&&(y=u[Ne],this[Ne]=y?y(z):z[Ne]);return this.isDefaultPrevented=(z.defaultPrevented!=null?z.defaultPrevented:z.returnValue===!1)?zr:Xa,this.isPropagationStopped=Xa,this}return h(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var y=this.nativeEvent;y&&(y.preventDefault?y.preventDefault():typeof y.returnValue!="unknown"&&(y.returnValue=!1),this.isDefaultPrevented=zr)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=zr)},persist:function(){},isPersistent:zr}),f}var bi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ii=mr(bi),Gr=h({},bi,{view:0,detail:0}),To=mr(Gr),bl,Kl,ga,hi=h({},Gr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mp,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!==ga&&(ga&&u.type==="mousemove"?(bl=u.screenX-ga.screenX,Kl=u.screenY-ga.screenY):Kl=bl=0,ga=u),bl)},movementY:function(u){return"movementY"in u?u.movementY:Kl}}),vh=mr(hi),nd=h({},hi,{dataTransfer:0}),rd=mr(nd),Qd=h({},Gr,{relatedTarget:0}),fo=mr(Qd),Gi=h({},bi,{animationName:0,elapsedTime:0,pseudoElement:0}),Hs=mr(Gi),ys=h({},bi,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),_l=mr(ys),va=h({},bi,{data:0}),wp=mr(va),xh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ym={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"},Jd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function id(u){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(u):(u=Jd[u])?!!f[u]:!1}function Mp(){return id}var Tp=h({},Gr,{key:function(u){if(u.key){var f=xh[u.key]||u.key;if(f!=="Unidentified")return f}return u.type==="keypress"?(u=ei(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?ym[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mp,charCode:function(u){return u.type==="keypress"?ei(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?ei(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),sd=mr(Tp),Zl=h({},hi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ql=mr(Zl),ad=h({},Gr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mp}),bm=mr(ad),Ep=h({},bi,{propertyName:0,elapsedTime:0,pseudoElement:0}),_m=mr(Ep),Vs=h({},hi,{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}),Sm=mr(Vs),wm=h({},bi,{newState:0,oldState:0}),Mm=mr(wm),Tm=[9,13,27,32],uu=ia&&"CompositionEvent"in window,od=null;ia&&"documentMode"in document&&(od=document.documentMode);var Cp=ia&&"TextEvent"in window&&!od,Ap=ia&&(!uu||od&&8<od&&11>=od),Em=" ",Jl=!1;function ld(u,f){switch(u){case"keyup":return Tm.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ds(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var du=!1;function bs(u,f){switch(u){case"compositionend":return Ds(f);case"keypress":return f.which!==32?null:(Jl=!0,Em);case"textInput":return u=f.data,u===Em&&Jl?null:u;default:return null}}function Np(u,f){if(du)return u==="compositionend"||!uu&&ld(u,f)?(u=Dc(),$o=Wo=xs=null,du=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return Ap&&f.locale!=="ko"?null:f.data;default:return null}}var yh={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 f=u&&u.nodeName&&u.nodeName.toLowerCase();return f==="input"?!!yh[u.type]:f==="textarea"}function Rp(u,f,y,M){wo?Mo?Mo.push(M):Mo=[M]:wo=M,f=E3(f,"onChange"),0<f.length&&(y=new Ii("onChange","change",null,y,M),u.push({event:y,listeners:f}))}var fu=null,Ic=null;function de(u){W9(u,0)}function Ee(u){var f=ui(u);if(Nr(f))return u}function Ue(u,f){if(u==="change")return f}var qe=!1;if(ia){var ct;if(ia){var St="oninput"in document;if(!St){var jt=document.createElement("div");jt.setAttribute("oninput","return;"),St=typeof jt.oninput=="function"}ct=St}else ct=!1;qe=ct&&(!document.documentMode||9<document.documentMode)}function Gt(){fu&&(fu.detachEvent("onpropertychange",Kt),Ic=fu=null)}function Kt(u){if(u.propertyName==="value"&&Ee(Ic)){var f=[];Rp(f,Ic,u,Go(u)),Yl(de,f)}}function mn(u,f,y){u==="focusin"?(Gt(),fu=f,Ic=y,fu.attachEvent("onpropertychange",Kt)):u==="focusout"&&Gt()}function vn(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Ee(Ic)}function _n(u,f){if(u==="click")return Ee(f)}function er(u,f){if(u==="input"||u==="change")return Ee(f)}function Xr(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var tr=typeof Object.is=="function"?Object.is:Xr;function ur(u,f){if(tr(u,f))return!0;if(typeof u!="object"||u===null||typeof f!="object"||f===null)return!1;var y=Object.keys(u),M=Object.keys(f);if(y.length!==M.length)return!1;for(M=0;M<y.length;M++){var D=y[M];if(!Xe.call(f,D)||!tr(u[D],f[D]))return!1}return!0}function Vn(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function Nn(u,f){var y=Vn(u);u=0;for(var M;y;){if(y.nodeType===3){if(M=u+y.textContent.length,u<=f&&M>=f)return{node:y,offset:f-u};u=M}e:{for(;y;){if(y.nextSibling){y=y.nextSibling;break e}y=y.parentNode}y=void 0}y=Vn(y)}}function qn(u,f){return u&&f?u===f?!0:u&&u.nodeType===3?!1:f&&f.nodeType===3?qn(u,f.parentNode):"contains"in u?u.contains(f):u.compareDocumentPosition?!!(u.compareDocumentPosition(f)&16):!1:!1}function Ji(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var f=en(u.document);f instanceof u.HTMLIFrameElement;){try{var y=typeof f.contentWindow.location.href=="string"}catch{y=!1}if(y)u=f.contentWindow;else break;f=en(u.document)}return f}function Is(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f&&(f==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||f==="textarea"||u.contentEditable==="true")}var pi=ia&&"documentMode"in document&&11>=document.documentMode,si=null,as=null,Os=null,Ya=!1;function Ra(u,f,y){var M=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;Ya||si==null||si!==en(M)||(M=si,"selectionStart"in M&&Is(M)?M={start:M.selectionStart,end:M.selectionEnd}:(M=(M.ownerDocument&&M.ownerDocument.defaultView||window).getSelection(),M={anchorNode:M.anchorNode,anchorOffset:M.anchorOffset,focusNode:M.focusNode,focusOffset:M.focusOffset}),Os&&ur(Os,M)||(Os=M,M=E3(as,"onSelect"),0<M.length&&(f=new Ii("onSelect","select",null,f,y),u.push({event:f,listeners:M}),f.target=si)))}function Hi(u,f){var y={};return y[u.toLowerCase()]=f.toLowerCase(),y["Webkit"+u]="webkit"+f,y["Moz"+u]="moz"+f,y}var Gs={animationend:Hi("Animation","AnimationEnd"),animationiteration:Hi("Animation","AnimationIteration"),animationstart:Hi("Animation","AnimationStart"),transitionrun:Hi("Transition","TransitionRun"),transitionstart:Hi("Transition","TransitionStart"),transitioncancel:Hi("Transition","TransitionCancel"),transitionend:Hi("Transition","TransitionEnd")},ka={},Eo={};ia&&(Eo=document.createElement("div").style,"AnimationEvent"in window||(delete Gs.animationend.animation,delete Gs.animationiteration.animation,delete Gs.animationstart.animation),"TransitionEvent"in window||delete Gs.transitionend.transition);function sa(u){if(ka[u])return ka[u];if(!Gs[u])return u;var f=Gs[u],y;for(y in f)if(f.hasOwnProperty(y)&&y in Eo)return ka[u]=f[y];return u}var aa=sa("animationend"),xa=sa("animationiteration"),Oc=sa("animationstart"),Pa=sa("transitionrun"),Av=sa("transitionstart"),Nw=sa("transitioncancel"),Oy=sa("transitionend"),ec=new Map,Cm="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(" ");Cm.push("scrollEnd");function tc(u,f){ec.set(u,f),gt(f,[u])}var Am=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=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(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},nc=[],ud=0,Da=0;function Nm(){for(var u=ud,f=Da=ud=0;f<u;){var y=nc[f];nc[f++]=null;var M=nc[f];nc[f++]=null;var D=nc[f];nc[f++]=null;var z=nc[f];if(nc[f++]=null,M!==null&&D!==null){var ce=M.pending;ce===null?D.next=D:(D.next=ce.next,ce.next=D),M.pending=D}z!==0&&ef(y,D,z)}}function Ia(u,f,y,M){nc[ud++]=u,nc[ud++]=f,nc[ud++]=y,nc[ud++]=M,Da|=M,u.lanes|=M,u=u.alternate,u!==null&&(u.lanes|=M)}function Nv(u,f,y,M){return Ia(u,f,y,M),rc(u)}function Co(u,f){return Ia(u,null,null,f),rc(u)}function ef(u,f,y){u.lanes|=y;var M=u.alternate;M!==null&&(M.lanes|=y);for(var D=!1,z=u.return;z!==null;)z.childLanes|=y,M=z.alternate,M!==null&&(M.childLanes|=y),z.tag===22&&(u=z.stateNode,u===null||u._visibility&1||(D=!0)),u=z,z=z.return;return u.tag===3?(z=u.stateNode,D&&f!==null&&(D=31-Me(y),u=z.hiddenUpdates,M=u[D],M===null?u[D]=[f]:M.push(f),f.lane=y|536870912),z):null}function rc(u){if(50<bf)throw bf=0,jh=null,Error(r(185));for(var f=u.return;f!==null;)u=f,f=u.return;return u.tag===3?u.stateNode:null}var tf={};function Ly(u,f,y,M){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=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=M,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _s(u,f,y,M){return new Ly(u,f,y,M)}function Rv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function qo(u,f){var y=u.alternate;return y===null?(y=_s(u.tag,f,u.key,u.mode),y.elementType=u.elementType,y.type=u.type,y.stateNode=u.stateNode,y.alternate=u,u.alternate=y):(y.pendingProps=f,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,f=u.dependencies,y.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},y.sibling=u.sibling,y.index=u.index,y.ref=u.ref,y.refCleanup=u.refCleanup,y}function kp(u,f){u.flags&=65011714;var y=u.alternate;return y===null?(u.childLanes=0,u.lanes=f,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,f=y.dependencies,u.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),u}function hu(u,f,y,M,D,z){var ce=0;if(M=u,typeof u=="function")Rv(u)&&(ce=1);else if(typeof u=="string")ce=kZ(u,y,se.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case O:return u=_s(31,y,f,D),u.elementType=O,u.lanes=z,u;case _:return nf(y.children,D,z,f);case w:ce=8,D|=24;break;case S:return u=_s(12,y,f,D|2),u.elementType=S,u.lanes=z,u;case I:return u=_s(13,y,f,D),u.elementType=I,u.lanes=z,u;case P:return u=_s(19,y,f,D),u.elementType=P,u.lanes=z,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case A:ce=10;break e;case E:ce=9;break e;case N:ce=11;break e;case L:ce=14;break e;case R:ce=16,M=null;break e}ce=29,y=Error(r(130,u===null?"null":typeof u,"")),M=null}return f=_s(ce,y,f,D),f.elementType=u,f.type=M,f.lanes=z,f}function nf(u,f,y,M){return u=_s(7,u,M,f),u.lanes=y,u}function kv(u,f,y){return u=_s(6,u,null,f),u.lanes=y,u}function Pp(u){var f=_s(18,null,null,0);return f.stateNode=u,f}function Pv(u,f,y){return f=_s(4,u.children!==null?u.children:[],u.key,f),f.lanes=y,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}var Rm=new WeakMap;function Sl(u,f){if(typeof u=="object"&&u!==null){var y=Rm.get(u);return y!==void 0?y:(f={value:u,source:f,stack:ne(f)},Rm.set(u,f),f)}return{value:u,source:f,stack:ne(f)}}var rf=[],sf=0,Dp=null,Ip=0,Xo=[],os=0,dd=null,Ss=1,Lc="";function pu(u,f){rf[sf++]=Ip,rf[sf++]=Dp,Dp=u,Ip=f}function Rw(u,f,y){Xo[os++]=Ss,Xo[os++]=Lc,Xo[os++]=dd,dd=u;var M=Ss;u=Lc;var D=32-Me(M)-1;M&=~(1<<D),y+=1;var z=32-Me(f)+D;if(30<z){var ce=D-D%5;z=(M&(1<<ce)-1).toString(32),M>>=ce,D-=ce,Ss=1<<32-Me(f)+D|y<<D|M,Lc=z+u}else Ss=1<<z|y<<D|M,Lc=u}function mu(u){u.return!==null&&(pu(u,1),Rw(u,1,0))}function Dv(u){for(;u===Dp;)Dp=rf[--sf],rf[sf]=null,Ip=rf[--sf],rf[sf]=null;for(;u===dd;)dd=Xo[--os],Xo[os]=null,Lc=Xo[--os],Xo[os]=null,Ss=Xo[--os],Xo[os]=null}function Iv(u,f){Xo[os++]=Ss,Xo[os++]=Lc,Xo[os++]=dd,Ss=f.id,Lc=f.overflow,dd=u}var Ls=null,Wi=null,Wr=!1,fd=null,wl=!1,Op=Error(r(519));function gu(u){var f=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vu(Sl(f,u)),Op}function kw(u){var f=u.stateNode,y=u.type,M=u.memoizedProps;switch(f[an]=u,f[Dn]=M,y){case"dialog":Kr("cancel",f),Kr("close",f);break;case"iframe":case"object":case"embed":Kr("load",f);break;case"video":case"audio":for(y=0;y<gc.length;y++)Kr(gc[y],f);break;case"source":Kr("error",f);break;case"img":case"image":case"link":Kr("error",f),Kr("load",f);break;case"details":Kr("toggle",f);break;case"input":Kr("invalid",f),Rs(f,M.value,M.defaultValue,M.checked,M.defaultChecked,M.type,M.name,!0);break;case"select":Kr("invalid",f);break;case"textarea":Kr("invalid",f),di(f,M.value,M.defaultValue,M.children)}y=M.children,typeof y!="string"&&typeof y!="number"&&typeof y!="bigint"||f.textContent===""+y||M.suppressHydrationWarning===!0||Y9(f.textContent,y)?(M.popover!=null&&(Kr("beforetoggle",f),Kr("toggle",f)),M.onScroll!=null&&Kr("scroll",f),M.onScrollEnd!=null&&Kr("scrollend",f),M.onClick!=null&&(f.onclick=Ps),f=!0):f=!1,f||gu(u,!0)}function Pw(u){for(Ls=u.return;Ls;)switch(Ls.tag){case 5:case 31:case 13:wl=!1;return;case 27:case 3:wl=!0;return;default:Ls=Ls.return}}function Lp(u){if(u!==Ls)return!1;if(!Wr)return Pw(u),Wr=!0,!1;var f=u.tag,y;if((y=f!==3&&f!==27)&&((y=f===5)&&(y=u.type,y=!(y!=="form"&&y!=="button")||KE(u.type,u.memoizedProps)),y=!y),y&&Wi&&gu(u),Pw(u),f===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Wi=iP(u)}else if(f===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Wi=iP(u)}else f===27?(f=Wi,n0(u.type)?(u=tC,tC=null,Wi=u):Wi=f):Wi=Ls?ku(u.stateNode.nextSibling):null;return!0}function af(){Wi=Ls=null,Wr=!1}function Ov(){var u=fd;return u!==null&&(js===null?js=u:js.push.apply(js,u),fd=null),u}function vu(u){fd===null?fd=[u]:fd.push(u)}var zp=j(null),of=null,xu=null;function hd(u,f,y){H(zp,f._currentValue),f._currentValue=y}function yu(u){u._currentValue=zp.current,X(zp)}function Lv(u,f,y){for(;u!==null;){var M=u.alternate;if((u.childLanes&f)!==f?(u.childLanes|=f,M!==null&&(M.childLanes|=f)):M!==null&&(M.childLanes&f)!==f&&(M.childLanes|=f),u===y)break;u=u.return}}function zv(u,f,y,M){var D=u.child;for(D!==null&&(D.return=u);D!==null;){var z=D.dependencies;if(z!==null){var ce=D.child;z=z.firstContext;e:for(;z!==null;){var Ne=z;z=D;for(var rt=0;rt<f.length;rt++)if(Ne.context===f[rt]){z.lanes|=y,Ne=z.alternate,Ne!==null&&(Ne.lanes|=y),Lv(z.return,y,u),M||(ce=null);break e}z=Ne.next}}else if(D.tag===18){if(ce=D.return,ce===null)throw Error(r(341));ce.lanes|=y,z=ce.alternate,z!==null&&(z.lanes|=y),Lv(ce,y,u),ce=null}else ce=D.child;if(ce!==null)ce.return=D;else for(ce=D;ce!==null;){if(ce===u){ce=null;break}if(D=ce.sibling,D!==null){D.return=ce.return,ce=D;break}ce=ce.return}D=ce}}function bu(u,f,y,M){u=null;for(var D=f,z=!1;D!==null;){if(!z){if((D.flags&524288)!==0)z=!0;else if((D.flags&262144)!==0)break}if(D.tag===10){var ce=D.alternate;if(ce===null)throw Error(r(387));if(ce=ce.memoizedProps,ce!==null){var Ne=D.type;tr(D.pendingProps.value,ce.value)||(u!==null?u.push(Ne):u=[Ne])}}else if(D===ue.current){if(ce=D.alternate,ce===null)throw Error(r(387));ce.memoizedState.memoizedState!==D.memoizedState.memoizedState&&(u!==null?u.push(Db):u=[Db])}D=D.return}u!==null&&zv(f,u,y,M),f.flags|=262144}function km(u){for(u=u.firstContext;u!==null;){if(!tr(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function lf(u){of=u,xu=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function nr(u){return Dw(of,u)}function jp(u,f){return of===null&&lf(u),Dw(u,f)}function Dw(u,f){var y=f._currentValue;if(f={context:f,memoizedValue:y,next:null},xu===null){if(u===null)throw Error(r(308));xu=f,u.dependencies={lanes:0,firstContext:f},u.flags|=524288}else xu=xu.next=f;return y}var Iw=typeof AbortController<"u"?AbortController:function(){var u=[],f=this.signal={aborted:!1,addEventListener:function(y,M){u.push(M)}};this.abort=function(){f.aborted=!0,u.forEach(function(y){return y()})}},OE=t.unstable_scheduleCallback,LE=t.unstable_NormalPriority,oa={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zy(){return{controller:new Iw,data:new Map,refCount:0}}function bh(u){u.refCount--,u.refCount===0&&OE(LE,function(){u.controller.abort()})}var Ml=null,jv=0,pd=0,ic=null;function jy(u,f){if(Ml===null){var y=Ml=[];jv=0,pd=kt(),ic={status:"pending",value:void 0,then:function(M){y.push(M)}}}return jv++,f.then(Fy,Fy),f}function Fy(){if(--jv===0&&Ml!==null){ic!==null&&(ic.status="fulfilled");var u=Ml;Ml=null,pd=0,ic=null;for(var f=0;f<u.length;f++)(0,u[f])()}}function Uy(u,f){var y=[],M={status:"pending",value:null,reason:null,then:function(D){y.push(D)}};return u.then(function(){M.status="fulfilled",M.value=f;for(var D=0;D<y.length;D++)(0,y[D])(f)},function(D){for(M.status="rejected",M.reason=D,D=0;D<y.length;D++)(0,y[D])(void 0)}),M}var Ow=q.S;q.S=function(u,f){Cb=te(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&jy(u,f),Ow!==null&&Ow(u,f)};var cf=j(null);function Fv(){var u=cf.current;return u!==null?u:or.pooledCache}function Pm(u,f){f===null?H(cf,cf.current):H(cf,f.pool)}function By(){var u=Fv();return u===null?null:{parent:oa._currentValue,pool:u}}var _h=Error(r(460)),Dm=Error(r(474)),Sr=Error(r(542)),Uv={then:function(){}};function Yo(u){return u=u.status,u==="fulfilled"||u==="rejected"}function Bv(u,f,y){switch(y=u[y],y===void 0?u.push(f):y!==f&&(f.then(Ps,Ps),f=y),f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,Mh(u),u;default:if(typeof f.status=="string")f.then(Ps,Ps);else{if(u=or,u!==null&&100<u.shellSuspendCounter)throw Error(r(482));u=f,u.status="pending",u.then(function(M){if(f.status==="pending"){var D=f;D.status="fulfilled",D.value=M}},function(M){if(f.status==="pending"){var D=f;D.status="rejected",D.reason=M}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,Mh(u),u}throw _u=f,_h}}function Sh(u){try{var f=u._init;return f(u._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(_u=y,_h):y}}var _u=null;function wh(){if(_u===null)throw Error(r(459));var u=_u;return _u=null,u}function Mh(u){if(u===_h||u===Sr)throw Error(r(483))}var Th=null,Eh=0;function Im(u){var f=Eh;return Eh+=1,Th===null&&(Th=[]),Bv(Th,u,f)}function sc(u,f){f=f.props.ref,u.ref=f!==void 0?f:null}function Fp(u,f){throw f.$$typeof===g?Error(r(525)):(u=Object.prototype.toString.call(f),Error(r(31,u==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":u)))}function Hv(u){function f(mt,ut){if(u){var Mt=mt.deletions;Mt===null?(mt.deletions=[ut],mt.flags|=16):Mt.push(ut)}}function y(mt,ut){if(!u)return null;for(;ut!==null;)f(mt,ut),ut=ut.sibling;return null}function M(mt){for(var ut=new Map;mt!==null;)mt.key!==null?ut.set(mt.key,mt):ut.set(mt.index,mt),mt=mt.sibling;return ut}function D(mt,ut){return mt=qo(mt,ut),mt.index=0,mt.sibling=null,mt}function z(mt,ut,Mt){return mt.index=Mt,u?(Mt=mt.alternate,Mt!==null?(Mt=Mt.index,Mt<ut?(mt.flags|=67108866,ut):Mt):(mt.flags|=67108866,ut)):(mt.flags|=1048576,ut)}function ce(mt){return u&&mt.alternate===null&&(mt.flags|=67108866),mt}function Ne(mt,ut,Mt,Ft){return ut===null||ut.tag!==6?(ut=kv(Mt,mt.mode,Ft),ut.return=mt,ut):(ut=D(ut,Mt),ut.return=mt,ut)}function rt(mt,ut,Mt,Ft){var Wn=Mt.type;return Wn===_?Ot(mt,ut,Mt.props.children,Ft,Mt.key):ut!==null&&(ut.elementType===Wn||typeof Wn=="object"&&Wn!==null&&Wn.$$typeof===R&&Sh(Wn)===ut.type)?(ut=D(ut,Mt.props),sc(ut,Mt),ut.return=mt,ut):(ut=hu(Mt.type,Mt.key,Mt.props,null,mt.mode,Ft),sc(ut,Mt),ut.return=mt,ut)}function Tt(mt,ut,Mt,Ft){return ut===null||ut.tag!==4||ut.stateNode.containerInfo!==Mt.containerInfo||ut.stateNode.implementation!==Mt.implementation?(ut=Pv(Mt,mt.mode,Ft),ut.return=mt,ut):(ut=D(ut,Mt.children||[]),ut.return=mt,ut)}function Ot(mt,ut,Mt,Ft,Wn){return ut===null||ut.tag!==7?(ut=nf(Mt,mt.mode,Ft,Wn),ut.return=mt,ut):(ut=D(ut,Mt),ut.return=mt,ut)}function Ut(mt,ut,Mt){if(typeof ut=="string"&&ut!==""||typeof ut=="number"||typeof ut=="bigint")return ut=kv(""+ut,mt.mode,Mt),ut.return=mt,ut;if(typeof ut=="object"&&ut!==null){switch(ut.$$typeof){case v:return Mt=hu(ut.type,ut.key,ut.props,null,mt.mode,Mt),sc(Mt,ut),Mt.return=mt,Mt;case b:return ut=Pv(ut,mt.mode,Mt),ut.return=mt,ut;case R:return ut=Sh(ut),Ut(mt,ut,Mt)}if(B(ut)||V(ut))return ut=nf(ut,mt.mode,Mt,null),ut.return=mt,ut;if(typeof ut.then=="function")return Ut(mt,Im(ut),Mt);if(ut.$$typeof===A)return Ut(mt,jp(mt,ut),Mt);Fp(mt,ut)}return null}function At(mt,ut,Mt,Ft){var Wn=ut!==null?ut.key:null;if(typeof Mt=="string"&&Mt!==""||typeof Mt=="number"||typeof Mt=="bigint")return Wn!==null?null:Ne(mt,ut,""+Mt,Ft);if(typeof Mt=="object"&&Mt!==null){switch(Mt.$$typeof){case v:return Mt.key===Wn?rt(mt,ut,Mt,Ft):null;case b:return Mt.key===Wn?Tt(mt,ut,Mt,Ft):null;case R:return Mt=Sh(Mt),At(mt,ut,Mt,Ft)}if(B(Mt)||V(Mt))return Wn!==null?null:Ot(mt,ut,Mt,Ft,null);if(typeof Mt.then=="function")return At(mt,ut,Im(Mt),Ft);if(Mt.$$typeof===A)return At(mt,ut,jp(mt,Mt),Ft);Fp(mt,Mt)}return null}function It(mt,ut,Mt,Ft,Wn){if(typeof Ft=="string"&&Ft!==""||typeof Ft=="number"||typeof Ft=="bigint")return mt=mt.get(Mt)||null,Ne(ut,mt,""+Ft,Wn);if(typeof Ft=="object"&&Ft!==null){switch(Ft.$$typeof){case v:return mt=mt.get(Ft.key===null?Mt:Ft.key)||null,rt(ut,mt,Ft,Wn);case b:return mt=mt.get(Ft.key===null?Mt:Ft.key)||null,Tt(ut,mt,Ft,Wn);case R:return Ft=Sh(Ft),It(mt,ut,Mt,Ft,Wn)}if(B(Ft)||V(Ft))return mt=mt.get(Mt)||null,Ot(ut,mt,Ft,Wn,null);if(typeof Ft.then=="function")return It(mt,ut,Mt,Im(Ft),Wn);if(Ft.$$typeof===A)return It(mt,ut,Mt,jp(ut,Ft),Wn);Fp(ut,Ft)}return null}function kn(mt,ut,Mt,Ft){for(var Wn=null,_i=null,zn=ut,Rr=ut=0,ni=null;zn!==null&&Rr<Mt.length;Rr++){zn.index>Rr?(ni=zn,zn=null):ni=zn.sibling;var Si=At(mt,zn,Mt[Rr],Ft);if(Si===null){zn===null&&(zn=ni);break}u&&zn&&Si.alternate===null&&f(mt,zn),ut=z(Si,ut,Rr),_i===null?Wn=Si:_i.sibling=Si,_i=Si,zn=ni}if(Rr===Mt.length)return y(mt,zn),Wr&&pu(mt,Rr),Wn;if(zn===null){for(;Rr<Mt.length;Rr++)zn=Ut(mt,Mt[Rr],Ft),zn!==null&&(ut=z(zn,ut,Rr),_i===null?Wn=zn:_i.sibling=zn,_i=zn);return Wr&&pu(mt,Rr),Wn}for(zn=M(zn);Rr<Mt.length;Rr++)ni=It(zn,mt,Rr,Mt[Rr],Ft),ni!==null&&(u&&ni.alternate!==null&&zn.delete(ni.key===null?Rr:ni.key),ut=z(ni,ut,Rr),_i===null?Wn=ni:_i.sibling=ni,_i=ni);return u&&zn.forEach(function(o0){return f(mt,o0)}),Wr&&pu(mt,Rr),Wn}function Jn(mt,ut,Mt,Ft){if(Mt==null)throw Error(r(151));for(var Wn=null,_i=null,zn=ut,Rr=ut=0,ni=null,Si=Mt.next();zn!==null&&!Si.done;Rr++,Si=Mt.next()){zn.index>Rr?(ni=zn,zn=null):ni=zn.sibling;var o0=At(mt,zn,Si.value,Ft);if(o0===null){zn===null&&(zn=ni);break}u&&zn&&o0.alternate===null&&f(mt,zn),ut=z(o0,ut,Rr),_i===null?Wn=o0:_i.sibling=o0,_i=o0,zn=ni}if(Si.done)return y(mt,zn),Wr&&pu(mt,Rr),Wn;if(zn===null){for(;!Si.done;Rr++,Si=Mt.next())Si=Ut(mt,Si.value,Ft),Si!==null&&(ut=z(Si,ut,Rr),_i===null?Wn=Si:_i.sibling=Si,_i=Si);return Wr&&pu(mt,Rr),Wn}for(zn=M(zn);!Si.done;Rr++,Si=Mt.next())Si=It(zn,mt,Rr,Si.value,Ft),Si!==null&&(u&&Si.alternate!==null&&zn.delete(Si.key===null?Rr:Si.key),ut=z(Si,ut,Rr),_i===null?Wn=Si:_i.sibling=Si,_i=Si);return u&&zn.forEach(function(HZ){return f(mt,HZ)}),Wr&&pu(mt,Rr),Wn}function Xi(mt,ut,Mt,Ft){if(typeof Mt=="object"&&Mt!==null&&Mt.type===_&&Mt.key===null&&(Mt=Mt.props.children),typeof Mt=="object"&&Mt!==null){switch(Mt.$$typeof){case v:e:{for(var Wn=Mt.key;ut!==null;){if(ut.key===Wn){if(Wn=Mt.type,Wn===_){if(ut.tag===7){y(mt,ut.sibling),Ft=D(ut,Mt.props.children),Ft.return=mt,mt=Ft;break e}}else if(ut.elementType===Wn||typeof Wn=="object"&&Wn!==null&&Wn.$$typeof===R&&Sh(Wn)===ut.type){y(mt,ut.sibling),Ft=D(ut,Mt.props),sc(Ft,Mt),Ft.return=mt,mt=Ft;break e}y(mt,ut);break}else f(mt,ut);ut=ut.sibling}Mt.type===_?(Ft=nf(Mt.props.children,mt.mode,Ft,Mt.key),Ft.return=mt,mt=Ft):(Ft=hu(Mt.type,Mt.key,Mt.props,null,mt.mode,Ft),sc(Ft,Mt),Ft.return=mt,mt=Ft)}return ce(mt);case b:e:{for(Wn=Mt.key;ut!==null;){if(ut.key===Wn)if(ut.tag===4&&ut.stateNode.containerInfo===Mt.containerInfo&&ut.stateNode.implementation===Mt.implementation){y(mt,ut.sibling),Ft=D(ut,Mt.children||[]),Ft.return=mt,mt=Ft;break e}else{y(mt,ut);break}else f(mt,ut);ut=ut.sibling}Ft=Pv(Mt,mt.mode,Ft),Ft.return=mt,mt=Ft}return ce(mt);case R:return Mt=Sh(Mt),Xi(mt,ut,Mt,Ft)}if(B(Mt))return kn(mt,ut,Mt,Ft);if(V(Mt)){if(Wn=V(Mt),typeof Wn!="function")throw Error(r(150));return Mt=Wn.call(Mt),Jn(mt,ut,Mt,Ft)}if(typeof Mt.then=="function")return Xi(mt,ut,Im(Mt),Ft);if(Mt.$$typeof===A)return Xi(mt,ut,jp(mt,Mt),Ft);Fp(mt,Mt)}return typeof Mt=="string"&&Mt!==""||typeof Mt=="number"||typeof Mt=="bigint"?(Mt=""+Mt,ut!==null&&ut.tag===6?(y(mt,ut.sibling),Ft=D(ut,Mt),Ft.return=mt,mt=Ft):(y(mt,ut),Ft=kv(Mt,mt.mode,Ft),Ft.return=mt,mt=Ft),ce(mt)):y(mt,ut)}return function(mt,ut,Mt,Ft){try{Eh=0;var Wn=Xi(mt,ut,Mt,Ft);return Th=null,Wn}catch(zn){if(zn===_h||zn===Sr)throw zn;var _i=_s(29,zn,null,mt.mode);return _i.lanes=Ft,_i.return=mt,_i}finally{}}}var md=Hv(!0),Vv=Hv(!1),Ao=!1;function Om(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hy(u,f){u=u.updateQueue,f.updateQueue===u&&(f.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function gd(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function uf(u,f,y){var M=u.updateQueue;if(M===null)return null;if(M=M.shared,(Un&2)!==0){var D=M.pending;return D===null?f.next=f:(f.next=D.next,D.next=f),M.pending=f,f=rc(u),ef(u,null,y),f}return Ia(u,M,f,y),rc(u)}function df(u,f,y){if(f=f.updateQueue,f!==null&&(f=f.shared,(y&4194048)!==0)){var M=f.lanes;M&=u.pendingLanes,y|=M,f.lanes=y,Nt(u,y)}}function Gn(u,f){var y=u.updateQueue,M=u.alternate;if(M!==null&&(M=M.updateQueue,y===M)){var D=null,z=null;if(y=y.firstBaseUpdate,y!==null){do{var ce={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};z===null?D=z=ce:z=z.next=ce,y=y.next}while(y!==null);z===null?D=z=f:z=z.next=f}else D=z=f;y={baseState:M.baseState,firstBaseUpdate:D,lastBaseUpdate:z,shared:M.shared,callbacks:M.callbacks},u.updateQueue=y;return}u=y.lastBaseUpdate,u===null?y.firstBaseUpdate=f:u.next=f,y.lastBaseUpdate=f}var Vy=!1;function Lm(){if(Vy){var u=ic;if(u!==null)throw u}}function Up(u,f,y,M){Vy=!1;var D=u.updateQueue;Ao=!1;var z=D.firstBaseUpdate,ce=D.lastBaseUpdate,Ne=D.shared.pending;if(Ne!==null){D.shared.pending=null;var rt=Ne,Tt=rt.next;rt.next=null,ce===null?z=Tt:ce.next=Tt,ce=rt;var Ot=u.alternate;Ot!==null&&(Ot=Ot.updateQueue,Ne=Ot.lastBaseUpdate,Ne!==ce&&(Ne===null?Ot.firstBaseUpdate=Tt:Ne.next=Tt,Ot.lastBaseUpdate=rt))}if(z!==null){var Ut=D.baseState;ce=0,Ot=Tt=rt=null,Ne=z;do{var At=Ne.lane&-536870913,It=At!==Ne.lane;if(It?(_r&At)===At:(M&At)===At){At!==0&&At===pd&&(Vy=!0),Ot!==null&&(Ot=Ot.next={lane:0,tag:Ne.tag,payload:Ne.payload,callback:null,next:null});e:{var kn=u,Jn=Ne;At=f;var Xi=y;switch(Jn.tag){case 1:if(kn=Jn.payload,typeof kn=="function"){Ut=kn.call(Xi,Ut,At);break e}Ut=kn;break e;case 3:kn.flags=kn.flags&-65537|128;case 0:if(kn=Jn.payload,At=typeof kn=="function"?kn.call(Xi,Ut,At):kn,At==null)break e;Ut=h({},Ut,At);break e;case 2:Ao=!0}}At=Ne.callback,At!==null&&(u.flags|=64,It&&(u.flags|=8192),It=D.callbacks,It===null?D.callbacks=[At]:It.push(At))}else It={lane:At,tag:Ne.tag,payload:Ne.payload,callback:Ne.callback,next:null},Ot===null?(Tt=Ot=It,rt=Ut):Ot=Ot.next=It,ce|=At;if(Ne=Ne.next,Ne===null){if(Ne=D.shared.pending,Ne===null)break;It=Ne,Ne=It.next,It.next=null,D.lastBaseUpdate=It,D.shared.pending=null}}while(!0);Ot===null&&(rt=Ut),D.baseState=rt,D.firstBaseUpdate=Tt,D.lastBaseUpdate=Ot,z===null&&(D.shared.lanes=0),Au|=ce,u.lanes=ce,u.memoizedState=Ut}}function Bp(u,f){if(typeof u!="function")throw Error(r(191,u));u.call(f)}function Lw(u,f){var y=u.callbacks;if(y!==null)for(u.callbacks=null,u=0;u<y.length;u++)Bp(y[u],f)}var Hp=j(null),Gv=j(0);function zw(u,f){u=Al,H(Gv,u),H(Hp,f),Al=u|f.baseLanes}function Gy(){H(Gv,Al),H(Hp,Hp.current)}function zm(){Al=Gv.current,X(Hp),X(Gv)}var Ko=j(null),No=null;function vd(u){var f=u.alternate;H($r,$r.current&1),H(Ko,u),No===null&&(f===null||Hp.current!==null||f.memoizedState!==null)&&(No=u)}function Wy(u){H($r,$r.current),H(Ko,u),No===null&&(No=u)}function jw(u){u.tag===22?(H($r,$r.current),H(Ko,u),No===null&&(No=u)):Zo()}function Zo(){H($r,$r.current),H(Ko,Ko.current)}function Ws(u){X(Ko),No===u&&(No=null),X($r)}var $r=j(0);function Tl(u){for(var f=u;f!==null;){if(f.tag===13){var y=f.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||JE(y)||eC(y)))return f}else if(f.tag===19&&(f.memoizedProps.revealOrder==="forwards"||f.memoizedProps.revealOrder==="backwards"||f.memoizedProps.revealOrder==="unstable_legacy-backwards"||f.memoizedProps.revealOrder==="together")){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var ls=0,gr=null,Oi=null,jr=null,ac=!1,Vp=!1,Ch=!1,Wv=0,jm=0,Gp=null,$y=0;function ws(){throw Error(r(321))}function qy(u,f){if(f===null)return!1;for(var y=0;y<f.length&&y<u.length;y++)if(!tr(u[y],f[y]))return!1;return!0}function $v(u,f,y,M,D,z){return ls=z,gr=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,q.H=u===null||u.memoizedState===null?g3:hb,Ch=!1,z=y(M,D),Ch=!1,Vp&&(z=Ah(f,y,M,D)),Fw(u),z}function Fw(u){q.H=Wp;var f=Oi!==null&&Oi.next!==null;if(ls=0,jr=Oi=gr=null,ac=!1,jm=0,Gp=null,f)throw Error(r(300));u===null||la||(u=u.dependencies,u!==null&&km(u)&&(la=!0))}function Ah(u,f,y,M){gr=u;var D=0;do{if(Vp&&(Gp=null),jm=0,Vp=!1,25<=D)throw Error(r(301));if(D+=1,jr=Oi=null,u.updateQueue!=null){var z=u.updateQueue;z.lastEffect=null,z.events=null,z.stores=null,z.memoCache!=null&&(z.memoCache.index=0)}q.H=oc,z=f(y,M)}while(Vp);return z}function Nh(){var u=q.H,f=u.useState()[0];return f=typeof f.then=="function"?Fm(f):f,u=u.useState()[0],(Oi!==null?Oi.memoizedState:null)!==u&&(gr.flags|=1024),f}function Xy(){var u=Wv!==0;return Wv=0,u}function Yy(u,f,y){f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~y}function Ky(u){if(ac){for(u=u.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}ac=!1}ls=0,jr=Oi=gr=null,Vp=!1,jm=Wv=0,Gp=null}function ya(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jr===null?gr.memoizedState=jr=u:jr=jr.next=u,jr}function $s(){if(Oi===null){var u=gr.alternate;u=u!==null?u.memoizedState:null}else u=Oi.next;var f=jr===null?gr.memoizedState:jr.next;if(f!==null)jr=f,Oi=u;else{if(u===null)throw gr.alternate===null?Error(r(467)):Error(r(310));Oi=u,u={memoizedState:Oi.memoizedState,baseState:Oi.baseState,baseQueue:Oi.baseQueue,queue:Oi.queue,next:null},jr===null?gr.memoizedState=jr=u:jr=jr.next=u}return jr}function qv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fm(u){var f=jm;return jm+=1,Gp===null&&(Gp=[]),u=Bv(Gp,u,f),f=gr,(jr===null?f.memoizedState:jr.next)===null&&(f=f.alternate,q.H=f===null||f.memoizedState===null?g3:hb),u}function ff(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return Fm(u);if(u.$$typeof===A)return nr(u)}throw Error(r(438,String(u)))}function Zy(u){var f=null,y=gr.updateQueue;if(y!==null&&(f=y.memoCache),f==null){var M=gr.alternate;M!==null&&(M=M.updateQueue,M!==null&&(M=M.memoCache,M!=null&&(f={data:M.data.map(function(D){return D.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),y===null&&(y=qv(),gr.updateQueue=y),y.memoCache=f,y=f.data[f.index],y===void 0)for(y=f.data[f.index]=Array(u),M=0;M<u;M++)y[M]=W;return f.index++,y}function xd(u,f){return typeof f=="function"?f(u):f}function Xv(u){var f=$s();return Qy(f,Oi,u)}function Qy(u,f,y){var M=u.queue;if(M===null)throw Error(r(311));M.lastRenderedReducer=y;var D=u.baseQueue,z=M.pending;if(z!==null){if(D!==null){var ce=D.next;D.next=z.next,z.next=ce}f.baseQueue=D=z,M.pending=null}if(z=u.baseState,D===null)u.memoizedState=z;else{f=D.next;var Ne=ce=null,rt=null,Tt=f,Ot=!1;do{var Ut=Tt.lane&-536870913;if(Ut!==Tt.lane?(_r&Ut)===Ut:(ls&Ut)===Ut){var At=Tt.revertLane;if(At===0)rt!==null&&(rt=rt.next={lane:0,revertLane:0,gesture:null,action:Tt.action,hasEagerState:Tt.hasEagerState,eagerState:Tt.eagerState,next:null}),Ut===pd&&(Ot=!0);else if((ls&At)===At){Tt=Tt.next,At===pd&&(Ot=!0);continue}else Ut={lane:0,revertLane:Tt.revertLane,gesture:null,action:Tt.action,hasEagerState:Tt.hasEagerState,eagerState:Tt.eagerState,next:null},rt===null?(Ne=rt=Ut,ce=z):rt=rt.next=Ut,gr.lanes|=At,Au|=At;Ut=Tt.action,Ch&&y(z,Ut),z=Tt.hasEagerState?Tt.eagerState:y(z,Ut)}else At={lane:Ut,revertLane:Tt.revertLane,gesture:Tt.gesture,action:Tt.action,hasEagerState:Tt.hasEagerState,eagerState:Tt.eagerState,next:null},rt===null?(Ne=rt=At,ce=z):rt=rt.next=At,gr.lanes|=Ut,Au|=Ut;Tt=Tt.next}while(Tt!==null&&Tt!==f);if(rt===null?ce=z:rt.next=Ne,!tr(z,u.memoizedState)&&(la=!0,Ot&&(y=ic,y!==null)))throw y;u.memoizedState=z,u.baseState=ce,u.baseQueue=rt,M.lastRenderedState=z}return D===null&&(M.lanes=0),[u.memoizedState,M.dispatch]}function Jy(u){var f=$s(),y=f.queue;if(y===null)throw Error(r(311));y.lastRenderedReducer=u;var M=y.dispatch,D=y.pending,z=f.memoizedState;if(D!==null){y.pending=null;var ce=D=D.next;do z=u(z,ce.action),ce=ce.next;while(ce!==D);tr(z,f.memoizedState)||(la=!0),f.memoizedState=z,f.baseQueue===null&&(f.baseState=z),y.lastRenderedState=z}return[z,M]}function Uw(u,f,y){var M=gr,D=$s(),z=Wr;if(z){if(y===void 0)throw Error(r(407));y=y()}else y=f();var ce=!tr((Oi||D).memoizedState,y);if(ce&&(D.memoizedState=y,la=!0),D=D.queue,ob(Vw.bind(null,M,D,u),[u]),D.getSnapshot!==f||ce||jr!==null&&jr.memoizedState.tag&1){if(M.flags|=2048,hf(9,{destroy:void 0},Hw.bind(null,M,D,y,f),null),or===null)throw Error(r(349));z||(ls&127)!==0||Bw(M,f,y)}return y}function Bw(u,f,y){u.flags|=16384,u={getSnapshot:f,value:y},f=gr.updateQueue,f===null?(f=qv(),gr.updateQueue=f,f.stores=[u]):(y=f.stores,y===null?f.stores=[u]:y.push(u))}function Hw(u,f,y,M){f.value=y,f.getSnapshot=M,Gw(f)&&Ww(u)}function Vw(u,f,y){return y(function(){Gw(f)&&Ww(u)})}function Gw(u){var f=u.getSnapshot;u=u.value;try{var y=f();return!tr(u,y)}catch{return!0}}function Ww(u){var f=Co(u,2);f!==null&&Mr(f,u,2)}function eb(u){var f=ya();if(typeof u=="function"){var y=u;if(u=y(),Ch){Ge(!0);try{y()}finally{Ge(!1)}}}return f.memoizedState=f.baseState=u,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xd,lastRenderedState:u},f}function tb(u,f,y,M){return u.baseState=y,Qy(u,Oi,typeof M=="function"?M:xd)}function zE(u,f,y,M,D){if(Qv(u))throw Error(r(485));if(u=f.action,u!==null){var z={payload:D,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(ce){z.listeners.push(ce)}};q.T!==null?y(!0):z.isTransition=!1,M(z),y=f.pending,y===null?(z.next=f.pending=z,$w(f,z)):(z.next=y.next,f.pending=y.next=z)}}function $w(u,f){var y=f.action,M=f.payload,D=u.state;if(f.isTransition){var z=q.T,ce={};q.T=ce;try{var Ne=y(D,M),rt=q.S;rt!==null&&rt(ce,Ne),qw(u,f,Ne)}catch(Tt){nb(u,f,Tt)}finally{z!==null&&ce.types!==null&&(z.types=ce.types),q.T=z}}else try{z=y(D,M),qw(u,f,z)}catch(Tt){nb(u,f,Tt)}}function qw(u,f,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(M){Xw(u,f,M)},function(M){return nb(u,f,M)}):Xw(u,f,y)}function Xw(u,f,y){f.status="fulfilled",f.value=y,Yw(f),u.state=y,f=u.pending,f!==null&&(y=f.next,y===f?u.pending=null:(y=y.next,f.next=y,$w(u,y)))}function nb(u,f,y){var M=u.pending;if(u.pending=null,M!==null){M=M.next;do f.status="rejected",f.reason=y,Yw(f),f=f.next;while(f!==M)}u.action=null}function Yw(u){u=u.listeners;for(var f=0;f<u.length;f++)(0,u[f])()}function rb(u,f){return f}function ib(u,f){if(Wr){var y=or.formState;if(y!==null){e:{var M=gr;if(Wr){if(Wi){t:{for(var D=Wi,z=wl;D.nodeType!==8;){if(!z){D=null;break t}if(D=ku(D.nextSibling),D===null){D=null;break t}}z=D.data,D=z==="F!"||z==="F"?D:null}if(D){Wi=ku(D.nextSibling),M=D.data==="F!";break e}}gu(M)}M=!1}M&&(f=y[0])}}return y=ya(),y.memoizedState=y.baseState=f,M={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rb,lastRenderedState:f},y.queue=M,y=h3.bind(null,gr,M),M.dispatch=y,M=eb(!1),z=fb.bind(null,gr,!1,M.queue),M=ya(),D={state:f,dispatch:null,action:u,pending:null},M.queue=D,y=zE.bind(null,gr,D,z,y),D.dispatch=y,M.memoizedState=u,[f,y,!1]}function Kw(u){var f=$s();return sb(f,Oi,u)}function sb(u,f,y){if(f=Qy(u,f,rb)[0],u=Xv(xd)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var M=Fm(f)}catch(ce){throw ce===_h?Sr:ce}else M=f;f=$s();var D=f.queue,z=D.dispatch;return y!==f.memoizedState&&(gr.flags|=2048,hf(9,{destroy:void 0},Zw.bind(null,D,y),null)),[M,z,u]}function Zw(u,f){u.action=f}function ab(u){var f=$s(),y=Oi;if(y!==null)return sb(f,y,u);$s(),f=f.memoizedState,y=$s();var M=y.queue.dispatch;return y.memoizedState=u,[f,M,!1]}function hf(u,f,y,M){return u={tag:u,create:y,deps:M,inst:f,next:null},f=gr.updateQueue,f===null&&(f=qv(),gr.updateQueue=f),y=f.lastEffect,y===null?f.lastEffect=u.next=u:(M=y.next,y.next=u,u.next=M,f.lastEffect=u),u}function Yv(){return $s().memoizedState}function Kv(u,f,y,M){var D=ya();gr.flags|=u,D.memoizedState=hf(1|f,{destroy:void 0},y,M===void 0?null:M)}function Zv(u,f,y,M){var D=$s();M=M===void 0?null:M;var z=D.memoizedState.inst;Oi!==null&&M!==null&&qy(M,Oi.memoizedState.deps)?D.memoizedState=hf(f,z,y,M):(gr.flags|=u,D.memoizedState=hf(1|f,z,y,M))}function Qw(u,f){Kv(8390656,8,u,f)}function ob(u,f){Zv(2048,8,u,f)}function Jw(u){gr.flags|=4;var f=gr.updateQueue;if(f===null)f=qv(),gr.updateQueue=f,f.events=[u];else{var y=f.events;y===null?f.events=[u]:y.push(u)}}function e3(u){var f=$s().memoizedState;return Jw({ref:f,nextImpl:u}),function(){if((Un&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}function t3(u,f){return Zv(4,2,u,f)}function n3(u,f){return Zv(4,4,u,f)}function r3(u,f){if(typeof f=="function"){u=u();var y=f(u);return function(){typeof y=="function"?y():f(null)}}if(f!=null)return u=u(),f.current=u,function(){f.current=null}}function i3(u,f,y){y=y!=null?y.concat([u]):null,Zv(4,4,r3.bind(null,f,u),y)}function lb(){}function s3(u,f){var y=$s();f=f===void 0?null:f;var M=y.memoizedState;return f!==null&&qy(f,M[1])?M[0]:(y.memoizedState=[u,f],u)}function a3(u,f){var y=$s();f=f===void 0?null:f;var M=y.memoizedState;if(f!==null&&qy(f,M[1]))return M[0];if(M=u(),Ch){Ge(!0);try{u()}finally{Ge(!1)}}return y.memoizedState=[M,f],M}function cb(u,f,y){return y===void 0||(ls&1073741824)!==0&&(_r&261930)===0?u.memoizedState=f:(u.memoizedState=y,u=Dr(),gr.lanes|=u,Au|=u,y)}function o3(u,f,y,M){return tr(y,f)?y:Hp.current!==null?(u=cb(u,y,M),tr(u,f)||(la=!0),u):(ls&42)===0||(ls&1073741824)!==0&&(_r&261930)===0?(la=!0,u.memoizedState=y):(u=Dr(),gr.lanes|=u,Au|=u,f)}function l3(u,f,y,M,D){var z=Y.p;Y.p=z!==0&&8>z?z:8;var ce=q.T,Ne={};q.T=Ne,fb(u,!1,f,y);try{var rt=D(),Tt=q.S;if(Tt!==null&&Tt(Ne,rt),rt!==null&&typeof rt=="object"&&typeof rt.then=="function"){var Ot=Uy(rt,M);Um(u,f,Ot,Rl(u))}else Um(u,f,M,Rl(u))}catch(Ut){Um(u,f,{then:function(){},status:"rejected",reason:Ut},Rl())}finally{Y.p=z,ce!==null&&Ne.types!==null&&(ce.types=Ne.types),q.T=ce}}function jE(){}function ub(u,f,y,M){if(u.tag!==5)throw Error(r(476));var D=c3(u).queue;l3(u,D,f,K,y===null?jE:function(){return u3(u),y(M)})}function c3(u){var f=u.memoizedState;if(f!==null)return f;f={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xd,lastRenderedState:K},next:null};var y={};return f.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xd,lastRenderedState:y},next:null},u.memoizedState=f,u=u.alternate,u!==null&&(u.memoizedState=f),f}function u3(u){var f=c3(u);f.next===null&&(f=u.alternate.memoizedState),Um(u,f.next.queue,{},Rl())}function db(){return nr(Db)}function d3(){return $s().memoizedState}function f3(){return $s().memoizedState}function FE(u){for(var f=u.return;f!==null;){switch(f.tag){case 24:case 3:var y=Rl();u=gd(y);var M=uf(f,u,y);M!==null&&(Mr(M,f,y),df(M,f,y)),f={cache:zy()},u.payload=f;return}f=f.return}}function UE(u,f,y){var M=Rl();y={lane:M,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},Qv(u)?p3(f,y):(y=Nv(u,f,y,M),y!==null&&(Mr(y,u,M),m3(y,f,M)))}function h3(u,f,y){var M=Rl();Um(u,f,y,M)}function Um(u,f,y,M){var D={lane:M,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(Qv(u))p3(f,D);else{var z=u.alternate;if(u.lanes===0&&(z===null||z.lanes===0)&&(z=f.lastRenderedReducer,z!==null))try{var ce=f.lastRenderedState,Ne=z(ce,y);if(D.hasEagerState=!0,D.eagerState=Ne,tr(Ne,ce))return Ia(u,f,D,0),or===null&&Nm(),!1}catch{}finally{}if(y=Nv(u,f,D,M),y!==null)return Mr(y,u,M),m3(y,f,M),!0}return!1}function fb(u,f,y,M){if(M={lane:2,revertLane:kt(),gesture:null,action:M,hasEagerState:!1,eagerState:null,next:null},Qv(u)){if(f)throw Error(r(479))}else f=Nv(u,y,M,2),f!==null&&Mr(f,u,2)}function Qv(u){var f=u.alternate;return u===gr||f!==null&&f===gr}function p3(u,f){Vp=ac=!0;var y=u.pending;y===null?f.next=f:(f.next=y.next,y.next=f),u.pending=f}function m3(u,f,y){if((y&4194048)!==0){var M=f.lanes;M&=u.pendingLanes,y|=M,f.lanes=y,Nt(u,y)}}var Wp={readContext:nr,use:ff,useCallback:ws,useContext:ws,useEffect:ws,useImperativeHandle:ws,useLayoutEffect:ws,useInsertionEffect:ws,useMemo:ws,useReducer:ws,useRef:ws,useState:ws,useDebugValue:ws,useDeferredValue:ws,useTransition:ws,useSyncExternalStore:ws,useId:ws,useHostTransitionStatus:ws,useFormState:ws,useActionState:ws,useOptimistic:ws,useMemoCache:ws,useCacheRefresh:ws};Wp.useEffectEvent=ws;var g3={readContext:nr,use:ff,useCallback:function(u,f){return ya().memoizedState=[u,f===void 0?null:f],u},useContext:nr,useEffect:Qw,useImperativeHandle:function(u,f,y){y=y!=null?y.concat([u]):null,Kv(4194308,4,r3.bind(null,f,u),y)},useLayoutEffect:function(u,f){return Kv(4194308,4,u,f)},useInsertionEffect:function(u,f){Kv(4,2,u,f)},useMemo:function(u,f){var y=ya();f=f===void 0?null:f;var M=u();if(Ch){Ge(!0);try{u()}finally{Ge(!1)}}return y.memoizedState=[M,f],M},useReducer:function(u,f,y){var M=ya();if(y!==void 0){var D=y(f);if(Ch){Ge(!0);try{y(f)}finally{Ge(!1)}}}else D=f;return M.memoizedState=M.baseState=D,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:D},M.queue=u,u=u.dispatch=UE.bind(null,gr,u),[M.memoizedState,u]},useRef:function(u){var f=ya();return u={current:u},f.memoizedState=u},useState:function(u){u=eb(u);var f=u.queue,y=h3.bind(null,gr,f);return f.dispatch=y,[u.memoizedState,y]},useDebugValue:lb,useDeferredValue:function(u,f){var y=ya();return cb(y,u,f)},useTransition:function(){var u=eb(!1);return u=l3.bind(null,gr,u.queue,!0,!1),ya().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,f,y){var M=gr,D=ya();if(Wr){if(y===void 0)throw Error(r(407));y=y()}else{if(y=f(),or===null)throw Error(r(349));(_r&127)!==0||Bw(M,f,y)}D.memoizedState=y;var z={value:y,getSnapshot:f};return D.queue=z,Qw(Vw.bind(null,M,z,u),[u]),M.flags|=2048,hf(9,{destroy:void 0},Hw.bind(null,M,z,y,f),null),y},useId:function(){var u=ya(),f=or.identifierPrefix;if(Wr){var y=Lc,M=Ss;y=(M&~(1<<32-Me(M)-1)).toString(32)+y,f="_"+f+"R_"+y,y=Wv++,0<y&&(f+="H"+y.toString(32)),f+="_"}else y=$y++,f="_"+f+"r_"+y.toString(32)+"_";return u.memoizedState=f},useHostTransitionStatus:db,useFormState:ib,useActionState:ib,useOptimistic:function(u){var f=ya();f.memoizedState=f.baseState=u;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=y,f=fb.bind(null,gr,!0,y),y.dispatch=f,[u,f]},useMemoCache:Zy,useCacheRefresh:function(){return ya().memoizedState=FE.bind(null,gr)},useEffectEvent:function(u){var f=ya(),y={impl:u};return f.memoizedState=y,function(){if((Un&2)!==0)throw Error(r(440));return y.impl.apply(void 0,arguments)}}},hb={readContext:nr,use:ff,useCallback:s3,useContext:nr,useEffect:ob,useImperativeHandle:i3,useInsertionEffect:t3,useLayoutEffect:n3,useMemo:a3,useReducer:Xv,useRef:Yv,useState:function(){return Xv(xd)},useDebugValue:lb,useDeferredValue:function(u,f){var y=$s();return o3(y,Oi.memoizedState,u,f)},useTransition:function(){var u=Xv(xd)[0],f=$s().memoizedState;return[typeof u=="boolean"?u:Fm(u),f]},useSyncExternalStore:Uw,useId:d3,useHostTransitionStatus:db,useFormState:Kw,useActionState:Kw,useOptimistic:function(u,f){var y=$s();return tb(y,Oi,u,f)},useMemoCache:Zy,useCacheRefresh:f3};hb.useEffectEvent=e3;var oc={readContext:nr,use:ff,useCallback:s3,useContext:nr,useEffect:ob,useImperativeHandle:i3,useInsertionEffect:t3,useLayoutEffect:n3,useMemo:a3,useReducer:Jy,useRef:Yv,useState:function(){return Jy(xd)},useDebugValue:lb,useDeferredValue:function(u,f){var y=$s();return Oi===null?cb(y,u,f):o3(y,Oi.memoizedState,u,f)},useTransition:function(){var u=Jy(xd)[0],f=$s().memoizedState;return[typeof u=="boolean"?u:Fm(u),f]},useSyncExternalStore:Uw,useId:d3,useHostTransitionStatus:db,useFormState:ab,useActionState:ab,useOptimistic:function(u,f){var y=$s();return Oi!==null?tb(y,Oi,u,f):(y.baseState=u,[u,y.queue.dispatch])},useMemoCache:Zy,useCacheRefresh:f3};oc.useEffectEvent=e3;function Jv(u,f,y,M){f=u.memoizedState,y=y(M,f),y=y==null?f:h({},f,y),u.memoizedState=y,u.lanes===0&&(u.updateQueue.baseState=y)}var Bm={enqueueSetState:function(u,f,y){u=u._reactInternals;var M=Rl(),D=gd(M);D.payload=f,y!=null&&(D.callback=y),f=uf(u,D,M),f!==null&&(Mr(f,u,M),df(f,u,M))},enqueueReplaceState:function(u,f,y){u=u._reactInternals;var M=Rl(),D=gd(M);D.tag=1,D.payload=f,y!=null&&(D.callback=y),f=uf(u,D,M),f!==null&&(Mr(f,u,M),df(f,u,M))},enqueueForceUpdate:function(u,f){u=u._reactInternals;var y=Rl(),M=gd(y);M.tag=2,f!=null&&(M.callback=f),f=uf(u,M,y),f!==null&&(Mr(f,u,y),df(f,u,y))}};function pb(u,f,y,M,D,z,ce){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(M,z,ce):f.prototype&&f.prototype.isPureReactComponent?!ur(y,M)||!ur(D,z):!0}function mb(u,f,y,M){u=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(y,M),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(y,M),f.state!==u&&Bm.enqueueReplaceState(f,f.state,null)}function pf(u,f){var y=f;if("ref"in f){y={};for(var M in f)M!=="ref"&&(y[M]=f[M])}if(u=u.defaultProps){y===f&&(y=h({},y));for(var D in u)y[D]===void 0&&(y[D]=u[D])}return y}function v3(u){Am(u)}function gb(u){console.error(u)}function vb(u){Am(u)}function ex(u,f){try{var y=u.onUncaughtError;y(f.value,{componentStack:f.stack})}catch(M){setTimeout(function(){throw M})}}function x3(u,f,y){try{var M=u.onCaughtError;M(y.value,{componentStack:y.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(D){setTimeout(function(){throw D})}}function xb(u,f,y){return y=gd(y),y.tag=3,y.payload={element:null},y.callback=function(){ex(u,f)},y}function yb(u){return u=gd(u),u.tag=3,u}function y3(u,f,y,M){var D=y.type.getDerivedStateFromError;if(typeof D=="function"){var z=M.value;u.payload=function(){return D(z)},u.callback=function(){x3(f,y,M)}}var ce=y.stateNode;ce!==null&&typeof ce.componentDidCatch=="function"&&(u.callback=function(){x3(f,y,M),typeof D!="function"&&(Ys===null?Ys=new Set([this]):Ys.add(this));var Ne=M.stack;this.componentDidCatch(M.value,{componentStack:Ne!==null?Ne:""})})}function ba(u,f,y,M,D){if(y.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){if(f=y.alternate,f!==null&&bu(f,y,D,!0),y=Ko.current,y!==null){switch(y.tag){case 31:case 13:return No===null?Qp():y.alternate===null&&Ms===0&&(Ms=3),y.flags&=-257,y.flags|=65536,y.lanes=D,M===Uv?y.flags|=16384:(f=y.updateQueue,f===null?y.updateQueue=new Set([M]):f.add(M),Jm(u,M,D)),!1;case 22:return y.flags|=65536,M===Uv?y.flags|=16384:(f=y.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([M])},y.updateQueue=f):(y=f.retryQueue,y===null?f.retryQueue=new Set([M]):y.add(M)),Jm(u,M,D)),!1}throw Error(r(435,y.tag))}return Jm(u,M,D),Qp(),!1}if(Wr)return f=Ko.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=D,M!==Op&&(u=Error(r(422),{cause:M}),vu(Sl(u,y)))):(M!==Op&&(f=Error(r(423),{cause:M}),vu(Sl(f,y))),u=u.current.alternate,u.flags|=65536,D&=-D,u.lanes|=D,M=Sl(M,y),D=xb(u.stateNode,M,D),Gn(u,D),Ms!==4&&(Ms=2)),!1;var z=Error(r(520),{cause:M});if(z=Sl(z,y),zh===null?zh=[z]:zh.push(z),Ms!==4&&(Ms=2),f===null)return!0;M=Sl(M,y),y=f;do{switch(y.tag){case 3:return y.flags|=65536,u=D&-D,y.lanes|=u,u=xb(y.stateNode,M,u),Gn(y,u),!1;case 1:if(f=y.type,z=y.stateNode,(y.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||z!==null&&typeof z.componentDidCatch=="function"&&(Ys===null||!Ys.has(z))))return y.flags|=65536,D&=-D,y.lanes|=D,D=yb(D),y3(D,u,y,M),Gn(y,D),!1}y=y.return}while(y!==null);return!1}var tx=Error(r(461)),la=!1;function Oa(u,f,y,M){f.child=u===null?Vv(f,null,y,M):md(f,u.child,y,M)}function bb(u,f,y,M,D){y=y.render;var z=f.ref;if("ref"in M){var ce={};for(var Ne in M)Ne!=="ref"&&(ce[Ne]=M[Ne])}else ce=M;return lf(f),M=$v(u,f,y,ce,z,D),Ne=Xy(),u!==null&&!la?(Yy(u,f,D),qs(u,f,D)):(Wr&&Ne&&mu(f),f.flags|=1,Oa(u,f,M,D),f.child)}function Rh(u,f,y,M,D){if(u===null){var z=y.type;return typeof z=="function"&&!Rv(z)&&z.defaultProps===void 0&&y.compare===null?(f.tag=15,f.type=z,nx(u,f,z,M,D)):(u=hu(y.type,null,M,f,f.mode,D),u.ref=f.ref,u.return=f,f.child=u)}if(z=u.child,!lx(u,D)){var ce=z.memoizedProps;if(y=y.compare,y=y!==null?y:ur,y(ce,M)&&u.ref===f.ref)return qs(u,f,D)}return f.flags|=1,u=qo(z,M),u.ref=f.ref,u.return=f,f.child=u}function nx(u,f,y,M,D){if(u!==null){var z=u.memoizedProps;if(ur(z,M)&&u.ref===f.ref)if(la=!1,f.pendingProps=M=z,lx(u,D))(u.flags&131072)!==0&&(la=!0);else return f.lanes=u.lanes,qs(u,f,D)}return $p(u,f,y,M,D)}function kh(u,f,y,M){var D=M.children,z=u!==null?u.memoizedState:null;if(u===null&&f.stateNode===null&&(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),M.mode==="hidden"){if((f.flags&128)!==0){if(z=z!==null?z.baseLanes|y:y,u!==null){for(M=f.child=u.child,D=0;M!==null;)D=D|M.lanes|M.childLanes,M=M.sibling;M=D&~z}else M=0,f.child=null;return Qo(u,f,z,y,M)}if((y&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},u!==null&&Pm(f,z!==null?z.cachePool:null),z!==null?zw(f,z):Gy(),jw(f);else return M=f.lanes=536870912,Qo(u,f,z!==null?z.baseLanes|y:y,y,M)}else z!==null?(Pm(f,z.cachePool),zw(f,z),Zo(),f.memoizedState=null):(u!==null&&Pm(f,null),Gy(),Zo());return Oa(u,f,D,y),f.child}function Su(u,f){return u!==null&&u.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function Qo(u,f,y,M,D){var z=Fv();return z=z===null?null:{parent:oa._currentValue,pool:z},f.memoizedState={baseLanes:y,cachePool:z},u!==null&&Pm(f,null),Gy(),jw(f),u!==null&&bu(u,f,M,!0),f.childLanes=D,null}function rx(u,f){return f=ox({mode:f.mode,children:f.children},u.mode),f.ref=u.ref,u.child=f,f.return=u,f}function b3(u,f,y){return md(f,u.child,null,y),u=rx(f,f.pendingProps),u.flags|=2,Ws(f),f.memoizedState=null,u}function ix(u,f,y){var M=f.pendingProps,D=(f.flags&128)!==0;if(f.flags&=-129,u===null){if(Wr){if(M.mode==="hidden")return u=rx(f,M),f.lanes=536870912,Su(null,u);if(Wy(f),(u=Wi)?(u=rP(u,wl),u=u!==null&&u.data==="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:dd!==null?{id:Ss,overflow:Lc}:null,retryLane:536870912,hydrationErrors:null},y=Pp(u),y.return=f,f.child=y,Ls=f,Wi=null)):u=null,u===null)throw gu(f);return f.lanes=536870912,null}return rx(f,M)}var z=u.memoizedState;if(z!==null){var ce=z.dehydrated;if(Wy(f),D)if(f.flags&256)f.flags&=-257,f=b3(u,f,y);else if(f.memoizedState!==null)f.child=u.child,f.flags|=128,f=null;else throw Error(r(558));else if(la||bu(u,f,y,!1),D=(y&u.childLanes)!==0,la||D){if(M=or,M!==null&&(ce=Pt(M,y),ce!==0&&ce!==z.retryLane))throw z.retryLane=ce,Co(u,ce),Mr(M,u,ce),tx;Qp(),f=b3(u,f,y)}else u=z.treeContext,Wi=ku(ce.nextSibling),Ls=f,Wr=!0,fd=null,wl=!1,u!==null&&Iv(f,u),f=rx(f,M),f.flags|=4096;return f}return u=qo(u.child,{mode:M.mode,children:M.children}),u.ref=f.ref,f.child=u,u.return=f,u}function Ph(u,f){var y=f.ref;if(y===null)u!==null&&u.ref!==null&&(f.flags|=4194816);else{if(typeof y!="function"&&typeof y!="object")throw Error(r(284));(u===null||u.ref!==y)&&(f.flags|=4194816)}}function $p(u,f,y,M,D){return lf(f),y=$v(u,f,y,M,void 0,D),M=Xy(),u!==null&&!la?(Yy(u,f,D),qs(u,f,D)):(Wr&&M&&mu(f),f.flags|=1,Oa(u,f,y,D),f.child)}function Hm(u,f,y,M,D,z){return lf(f),f.updateQueue=null,y=Ah(f,M,y,D),Fw(u),M=Xy(),u!==null&&!la?(Yy(u,f,z),qs(u,f,z)):(Wr&&M&&mu(f),f.flags|=1,Oa(u,f,y,z),f.child)}function sx(u,f,y,M,D){if(lf(f),f.stateNode===null){var z=tf,ce=y.contextType;typeof ce=="object"&&ce!==null&&(z=nr(ce)),z=new y(M,z),f.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,z.updater=Bm,f.stateNode=z,z._reactInternals=f,z=f.stateNode,z.props=M,z.state=f.memoizedState,z.refs={},Om(f),ce=y.contextType,z.context=typeof ce=="object"&&ce!==null?nr(ce):tf,z.state=f.memoizedState,ce=y.getDerivedStateFromProps,typeof ce=="function"&&(Jv(f,y,ce,M),z.state=f.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof z.getSnapshotBeforeUpdate=="function"||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(ce=z.state,typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount(),ce!==z.state&&Bm.enqueueReplaceState(z,z.state,null),Up(f,M,z,D),Lm(),z.state=f.memoizedState),typeof z.componentDidMount=="function"&&(f.flags|=4194308),M=!0}else if(u===null){z=f.stateNode;var Ne=f.memoizedProps,rt=pf(y,Ne);z.props=rt;var Tt=z.context,Ot=y.contextType;ce=tf,typeof Ot=="object"&&Ot!==null&&(ce=nr(Ot));var Ut=y.getDerivedStateFromProps;Ot=typeof Ut=="function"||typeof z.getSnapshotBeforeUpdate=="function",Ne=f.pendingProps!==Ne,Ot||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Ne||Tt!==ce)&&mb(f,z,M,ce),Ao=!1;var At=f.memoizedState;z.state=At,Up(f,M,z,D),Lm(),Tt=f.memoizedState,Ne||At!==Tt||Ao?(typeof Ut=="function"&&(Jv(f,y,Ut,M),Tt=f.memoizedState),(rt=Ao||pb(f,y,rt,M,At,Tt,ce))?(Ot||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(f.flags|=4194308)):(typeof z.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=M,f.memoizedState=Tt),z.props=M,z.state=Tt,z.context=ce,M=rt):(typeof z.componentDidMount=="function"&&(f.flags|=4194308),M=!1)}else{z=f.stateNode,Hy(u,f),ce=f.memoizedProps,Ot=pf(y,ce),z.props=Ot,Ut=f.pendingProps,At=z.context,Tt=y.contextType,rt=tf,typeof Tt=="object"&&Tt!==null&&(rt=nr(Tt)),Ne=y.getDerivedStateFromProps,(Tt=typeof Ne=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(ce!==Ut||At!==rt)&&mb(f,z,M,rt),Ao=!1,At=f.memoizedState,z.state=At,Up(f,M,z,D),Lm();var It=f.memoizedState;ce!==Ut||At!==It||Ao||u!==null&&u.dependencies!==null&&km(u.dependencies)?(typeof Ne=="function"&&(Jv(f,y,Ne,M),It=f.memoizedState),(Ot=Ao||pb(f,y,Ot,M,At,It,rt)||u!==null&&u.dependencies!==null&&km(u.dependencies))?(Tt||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(M,It,rt),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(M,It,rt)),typeof z.componentDidUpdate=="function"&&(f.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof z.componentDidUpdate!="function"||ce===u.memoizedProps&&At===u.memoizedState||(f.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||ce===u.memoizedProps&&At===u.memoizedState||(f.flags|=1024),f.memoizedProps=M,f.memoizedState=It),z.props=M,z.state=It,z.context=rt,M=Ot):(typeof z.componentDidUpdate!="function"||ce===u.memoizedProps&&At===u.memoizedState||(f.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||ce===u.memoizedProps&&At===u.memoizedState||(f.flags|=1024),M=!1)}return z=M,Ph(u,f),M=(f.flags&128)!==0,z||M?(z=f.stateNode,y=M&&typeof y.getDerivedStateFromError!="function"?null:z.render(),f.flags|=1,u!==null&&M?(f.child=md(f,u.child,null,D),f.child=md(f,null,y,D)):Oa(u,f,y,D),f.memoizedState=z.state,u=f.child):u=qs(u,f,D),u}function _3(u,f,y,M){return af(),f.flags|=256,Oa(u,f,y,M),f.child}var _b={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ho(u){return{baseLanes:u,cachePool:By()}}function ax(u,f,y){return u=u!==null?u.childLanes&~y:0,f&&(u|=Po),u}function S3(u,f,y){var M=f.pendingProps,D=!1,z=(f.flags&128)!==0,ce;if((ce=z)||(ce=u!==null&&u.memoizedState===null?!1:($r.current&2)!==0),ce&&(D=!0,f.flags&=-129),ce=(f.flags&32)!==0,f.flags&=-33,u===null){if(Wr){if(D?vd(f):Zo(),(u=Wi)?(u=rP(u,wl),u=u!==null&&u.data!=="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:dd!==null?{id:Ss,overflow:Lc}:null,retryLane:536870912,hydrationErrors:null},y=Pp(u),y.return=f,f.child=y,Ls=f,Wi=null)):u=null,u===null)throw gu(f);return eC(u)?f.lanes=32:f.lanes=536870912,null}var Ne=M.children;return M=M.fallback,D?(Zo(),D=f.mode,Ne=ox({mode:"hidden",children:Ne},D),M=nf(M,D,y,null),Ne.return=f,M.return=f,Ne.sibling=M,f.child=Ne,M=f.child,M.memoizedState=ho(y),M.childLanes=ax(u,ce,y),f.memoizedState=_b,Su(null,M)):(vd(f),Vm(f,Ne))}var rt=u.memoizedState;if(rt!==null&&(Ne=rt.dehydrated,Ne!==null)){if(z)f.flags&256?(vd(f),f.flags&=-257,f=Sb(u,f,y)):f.memoizedState!==null?(Zo(),f.child=u.child,f.flags|=128,f=null):(Zo(),Ne=M.fallback,D=f.mode,M=ox({mode:"visible",children:M.children},D),Ne=nf(Ne,D,y,null),Ne.flags|=2,M.return=f,Ne.return=f,M.sibling=Ne,f.child=M,md(f,u.child,null,y),M=f.child,M.memoizedState=ho(y),M.childLanes=ax(u,ce,y),f.memoizedState=_b,f=Su(null,M));else if(vd(f),eC(Ne)){if(ce=Ne.nextSibling&&Ne.nextSibling.dataset,ce)var Tt=ce.dgst;ce=Tt,M=Error(r(419)),M.stack="",M.digest=ce,vu({value:M,source:null,stack:null}),f=Sb(u,f,y)}else if(la||bu(u,f,y,!1),ce=(y&u.childLanes)!==0,la||ce){if(ce=or,ce!==null&&(M=Pt(ce,y),M!==0&&M!==rt.retryLane))throw rt.retryLane=M,Co(u,M),Mr(ce,u,M),tx;JE(Ne)||Qp(),f=Sb(u,f,y)}else JE(Ne)?(f.flags|=192,f.child=u.child,f=null):(u=rt.treeContext,Wi=ku(Ne.nextSibling),Ls=f,Wr=!0,fd=null,wl=!1,u!==null&&Iv(f,u),f=Vm(f,M.children),f.flags|=4096);return f}return D?(Zo(),Ne=M.fallback,D=f.mode,rt=u.child,Tt=rt.sibling,M=qo(rt,{mode:"hidden",children:M.children}),M.subtreeFlags=rt.subtreeFlags&65011712,Tt!==null?Ne=qo(Tt,Ne):(Ne=nf(Ne,D,y,null),Ne.flags|=2),Ne.return=f,M.return=f,M.sibling=Ne,f.child=M,Su(null,M),M=f.child,Ne=u.child.memoizedState,Ne===null?Ne=ho(y):(D=Ne.cachePool,D!==null?(rt=oa._currentValue,D=D.parent!==rt?{parent:rt,pool:rt}:D):D=By(),Ne={baseLanes:Ne.baseLanes|y,cachePool:D}),M.memoizedState=Ne,M.childLanes=ax(u,ce,y),f.memoizedState=_b,Su(u.child,M)):(vd(f),y=u.child,u=y.sibling,y=qo(y,{mode:"visible",children:M.children}),y.return=f,y.sibling=null,u!==null&&(ce=f.deletions,ce===null?(f.deletions=[u],f.flags|=16):ce.push(u)),f.child=y,f.memoizedState=null,y)}function Vm(u,f){return f=ox({mode:"visible",children:f},u.mode),f.return=u,u.child=f}function ox(u,f){return u=_s(22,u,null,f),u.lanes=0,u}function Sb(u,f,y){return md(f,u.child,null,y),u=Vm(f,f.pendingProps.children),u.flags|=2,f.memoizedState=null,u}function w3(u,f,y){u.lanes|=f;var M=u.alternate;M!==null&&(M.lanes|=f),Lv(u.return,f,y)}function Dh(u,f,y,M,D,z){var ce=u.memoizedState;ce===null?u.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:M,tail:y,tailMode:D,treeForkCount:z}:(ce.isBackwards=f,ce.rendering=null,ce.renderingStartTime=0,ce.last=M,ce.tail=y,ce.tailMode=D,ce.treeForkCount=z)}function Jo(u,f,y){var M=f.pendingProps,D=M.revealOrder,z=M.tail;M=M.children;var ce=$r.current,Ne=(ce&2)!==0;if(Ne?(ce=ce&1|2,f.flags|=128):ce&=1,H($r,ce),Oa(u,f,M,y),M=Wr?Ip:0,!Ne&&u!==null&&(u.flags&128)!==0)e:for(u=f.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&w3(u,y,f);else if(u.tag===19)w3(u,y,f);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===f)break e;for(;u.sibling===null;){if(u.return===null||u.return===f)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(D){case"forwards":for(y=f.child,D=null;y!==null;)u=y.alternate,u!==null&&Tl(u)===null&&(D=y),y=y.sibling;y=D,y===null?(D=f.child,f.child=null):(D=y.sibling,y.sibling=null),Dh(f,!1,D,y,z,M);break;case"backwards":case"unstable_legacy-backwards":for(y=null,D=f.child,f.child=null;D!==null;){if(u=D.alternate,u!==null&&Tl(u)===null){f.child=D;break}u=D.sibling,D.sibling=y,y=D,D=u}Dh(f,!0,y,null,z,M);break;case"together":Dh(f,!1,null,null,void 0,M);break;default:f.memoizedState=null}return f.child}function qs(u,f,y){if(u!==null&&(f.dependencies=u.dependencies),Au|=f.lanes,(y&f.childLanes)===0)if(u!==null){if(bu(u,f,y,!1),(y&f.childLanes)===0)return null}else return null;if(u!==null&&f.child!==u.child)throw Error(r(153));if(f.child!==null){for(u=f.child,y=qo(u,u.pendingProps),f.child=y,y.return=f;u.sibling!==null;)u=u.sibling,y=y.sibling=qo(u,u.pendingProps),y.return=f;y.sibling=null}return f.child}function lx(u,f){return(u.lanes&f)!==0?!0:(u=u.dependencies,!!(u!==null&&km(u)))}function BE(u,f,y){switch(f.tag){case 3:le(f,f.stateNode.containerInfo),hd(f,oa,u.memoizedState.cache),af();break;case 27:case 5:xe(f);break;case 4:le(f,f.stateNode.containerInfo);break;case 10:hd(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,Wy(f),null;break;case 13:var M=f.memoizedState;if(M!==null)return M.dehydrated!==null?(vd(f),f.flags|=128,null):(y&f.child.childLanes)!==0?S3(u,f,y):(vd(f),u=qs(u,f,y),u!==null?u.sibling:null);vd(f);break;case 19:var D=(u.flags&128)!==0;if(M=(y&f.childLanes)!==0,M||(bu(u,f,y,!1),M=(y&f.childLanes)!==0),D){if(M)return Jo(u,f,y);f.flags|=128}if(D=f.memoizedState,D!==null&&(D.rendering=null,D.tail=null,D.lastEffect=null),H($r,$r.current),M)break;return null;case 22:return f.lanes=0,kh(u,f,y,f.pendingProps);case 24:hd(f,oa,u.memoizedState.cache)}return qs(u,f,y)}function cx(u,f,y){if(u!==null)if(u.memoizedProps!==f.pendingProps)la=!0;else{if(!lx(u,y)&&(f.flags&128)===0)return la=!1,BE(u,f,y);la=(u.flags&131072)!==0}else la=!1,Wr&&(f.flags&1048576)!==0&&Rw(f,Ip,f.index);switch(f.lanes=0,f.tag){case 16:e:{var M=f.pendingProps;if(u=Sh(f.elementType),f.type=u,typeof u=="function")Rv(u)?(M=pf(u,M),f.tag=1,f=sx(null,f,u,M,y)):(f.tag=0,f=$p(null,f,u,M,y));else{if(u!=null){var D=u.$$typeof;if(D===N){f.tag=11,f=bb(null,f,u,M,y);break e}else if(D===L){f.tag=14,f=Rh(null,f,u,M,y);break e}}throw f=Z(u)||u,Error(r(306,f,""))}}return f;case 0:return $p(u,f,f.type,f.pendingProps,y);case 1:return M=f.type,D=pf(M,f.pendingProps),sx(u,f,M,D,y);case 3:e:{if(le(f,f.stateNode.containerInfo),u===null)throw Error(r(387));M=f.pendingProps;var z=f.memoizedState;D=z.element,Hy(u,f),Up(f,M,null,y);var ce=f.memoizedState;if(M=ce.cache,hd(f,oa,M),M!==z.cache&&zv(f,[oa],y,!0),Lm(),M=ce.element,z.isDehydrated)if(z={element:M,isDehydrated:!1,cache:ce.cache},f.updateQueue.baseState=z,f.memoizedState=z,f.flags&256){f=_3(u,f,M,y);break e}else if(M!==D){D=Sl(Error(r(424)),f),vu(D),f=_3(u,f,M,y);break e}else{switch(u=f.stateNode.containerInfo,u.nodeType){case 9:u=u.body;break;default:u=u.nodeName==="HTML"?u.ownerDocument.body:u}for(Wi=ku(u.firstChild),Ls=f,Wr=!0,fd=null,wl=!0,y=Vv(f,null,M,y),f.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(af(),M===D){f=qs(u,f,y);break e}Oa(u,f,M,y)}f=f.child}return f;case 26:return Ph(u,f),u===null?(y=cP(f.type,null,f.pendingProps,null))?f.memoizedState=y:Wr||(y=f.type,u=f.pendingProps,M=C3(ie.current).createElement(y),M[an]=f,M[Dn]=u,Io(M,y,u),ot(M),f.stateNode=M):f.memoizedState=cP(f.type,u.memoizedProps,f.pendingProps,u.memoizedState),null;case 27:return xe(f),u===null&&Wr&&(M=f.stateNode=aP(f.type,f.pendingProps,ie.current),Ls=f,wl=!0,D=Wi,n0(f.type)?(tC=D,Wi=ku(M.firstChild)):Wi=D),Oa(u,f,f.pendingProps.children,y),Ph(u,f),u===null&&(f.flags|=4194304),f.child;case 5:return u===null&&Wr&&((D=M=Wi)&&(M=xZ(M,f.type,f.pendingProps,wl),M!==null?(f.stateNode=M,Ls=f,Wi=ku(M.firstChild),wl=!1,D=!0):D=!1),D||gu(f)),xe(f),D=f.type,z=f.pendingProps,ce=u!==null?u.memoizedProps:null,M=z.children,KE(D,z)?M=null:ce!==null&&KE(D,ce)&&(f.flags|=32),f.memoizedState!==null&&(D=$v(u,f,Nh,null,null,y),Db._currentValue=D),Ph(u,f),Oa(u,f,M,y),f.child;case 6:return u===null&&Wr&&((u=y=Wi)&&(y=yZ(y,f.pendingProps,wl),y!==null?(f.stateNode=y,Ls=f,Wi=null,u=!0):u=!1),u||gu(f)),null;case 13:return S3(u,f,y);case 4:return le(f,f.stateNode.containerInfo),M=f.pendingProps,u===null?f.child=md(f,null,M,y):Oa(u,f,M,y),f.child;case 11:return bb(u,f,f.type,f.pendingProps,y);case 7:return Oa(u,f,f.pendingProps,y),f.child;case 8:return Oa(u,f,f.pendingProps.children,y),f.child;case 12:return Oa(u,f,f.pendingProps.children,y),f.child;case 10:return M=f.pendingProps,hd(f,f.type,M.value),Oa(u,f,M.children,y),f.child;case 9:return D=f.type._context,M=f.pendingProps.children,lf(f),D=nr(D),M=M(D),f.flags|=1,Oa(u,f,M,y),f.child;case 14:return Rh(u,f,f.type,f.pendingProps,y);case 15:return nx(u,f,f.type,f.pendingProps,y);case 19:return Jo(u,f,y);case 31:return ix(u,f,y);case 22:return kh(u,f,y,f.pendingProps);case 24:return lf(f),M=nr(oa),u===null?(D=Fv(),D===null&&(D=or,z=zy(),D.pooledCache=z,z.refCount++,z!==null&&(D.pooledCacheLanes|=y),D=z),f.memoizedState={parent:M,cache:D},Om(f),hd(f,oa,D)):((u.lanes&y)!==0&&(Hy(u,f),Up(f,null,null,y),Lm()),D=u.memoizedState,z=f.memoizedState,D.parent!==M?(D={parent:M,cache:M},f.memoizedState=D,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=D),hd(f,oa,M)):(M=z.cache,hd(f,oa,M),M!==D.cache&&zv(f,[oa],y,!0))),Oa(u,f,f.pendingProps.children,y),f.child;case 29:throw f.pendingProps}throw Error(r(156,f.tag))}function wu(u){u.flags|=4}function Gm(u,f,y,M,D){if((f=(u.mode&32)!==0)&&(f=!1),f){if(u.flags|=16777216,(D&335544128)===D)if(u.stateNode.complete)u.flags|=8192;else if(Es())u.flags|=8192;else throw _u=Uv,Dm}else u.flags&=-16777217}function wb(u,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!pP(f))if(Es())u.flags|=8192;else throw _u=Uv,Dm}function yd(u,f){f!==null&&(u.flags|=4),u.flags&16384&&(f=u.tag!==22?He():536870912,u.lanes|=f,es|=f)}function Mu(u,f){if(!Wr)switch(u.tailMode){case"hidden":f=u.tail;for(var y=null;f!==null;)f.alternate!==null&&(y=f),f=f.sibling;y===null?u.tail=null:y.sibling=null;break;case"collapsed":y=u.tail;for(var M=null;y!==null;)y.alternate!==null&&(M=y),y=y.sibling;M===null?f||u.tail===null?u.tail=null:u.tail.sibling=null:M.sibling=null}}function Li(u){var f=u.alternate!==null&&u.alternate.child===u.child,y=0,M=0;if(f)for(var D=u.child;D!==null;)y|=D.lanes|D.childLanes,M|=D.subtreeFlags&65011712,M|=D.flags&65011712,D.return=u,D=D.sibling;else for(D=u.child;D!==null;)y|=D.lanes|D.childLanes,M|=D.subtreeFlags,M|=D.flags,D.return=u,D=D.sibling;return u.subtreeFlags|=M,u.childLanes=y,f}function Wm(u,f,y){var M=f.pendingProps;switch(Dv(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Li(f),null;case 1:return Li(f),null;case 3:return y=f.stateNode,M=null,u!==null&&(M=u.memoizedState.cache),f.memoizedState.cache!==M&&(f.flags|=2048),yu(oa),fe(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(u===null||u.child===null)&&(Lp(f)?wu(f):u===null||u.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,Ov())),Li(f),null;case 26:var D=f.type,z=f.memoizedState;return u===null?(wu(f),z!==null?(Li(f),wb(f,z)):(Li(f),Gm(f,D,null,M,y))):z?z!==u.memoizedState?(wu(f),Li(f),wb(f,z)):(Li(f),f.flags&=-16777217):(u=u.memoizedProps,u!==M&&wu(f),Li(f),Gm(f,D,u,M,y)),null;case 27:if(he(f),y=ie.current,D=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==M&&wu(f);else{if(!M){if(f.stateNode===null)throw Error(r(166));return Li(f),null}u=se.current,Lp(f)?kw(f):(u=aP(D,M,y),f.stateNode=u,wu(f))}return Li(f),null;case 5:if(he(f),D=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==M&&wu(f);else{if(!M){if(f.stateNode===null)throw Error(r(166));return Li(f),null}if(z=se.current,Lp(f))kw(f);else{var ce=C3(ie.current);switch(z){case 1:z=ce.createElementNS("http://www.w3.org/2000/svg",D);break;case 2:z=ce.createElementNS("http://www.w3.org/1998/Math/MathML",D);break;default:switch(D){case"svg":z=ce.createElementNS("http://www.w3.org/2000/svg",D);break;case"math":z=ce.createElementNS("http://www.w3.org/1998/Math/MathML",D);break;case"script":z=ce.createElement("div"),z.innerHTML="<script><\/script>",z=z.removeChild(z.firstChild);break;case"select":z=typeof M.is=="string"?ce.createElement("select",{is:M.is}):ce.createElement("select"),M.multiple?z.multiple=!0:M.size&&(z.size=M.size);break;default:z=typeof M.is=="string"?ce.createElement(D,{is:M.is}):ce.createElement(D)}}z[an]=f,z[Dn]=M;e:for(ce=f.child;ce!==null;){if(ce.tag===5||ce.tag===6)z.appendChild(ce.stateNode);else if(ce.tag!==4&&ce.tag!==27&&ce.child!==null){ce.child.return=ce,ce=ce.child;continue}if(ce===f)break e;for(;ce.sibling===null;){if(ce.return===null||ce.return===f)break e;ce=ce.return}ce.sibling.return=ce.return,ce=ce.sibling}f.stateNode=z;e:switch(Io(z,D,M),D){case"button":case"input":case"select":case"textarea":M=!!M.autoFocus;break e;case"img":M=!0;break e;default:M=!1}M&&wu(f)}}return Li(f),Gm(f,f.type,u===null?null:u.memoizedProps,f.pendingProps,y),null;case 6:if(u&&f.stateNode!=null)u.memoizedProps!==M&&wu(f);else{if(typeof M!="string"&&f.stateNode===null)throw Error(r(166));if(u=ie.current,Lp(f)){if(u=f.stateNode,y=f.memoizedProps,M=null,D=Ls,D!==null)switch(D.tag){case 27:case 5:M=D.memoizedProps}u[an]=f,u=!!(u.nodeValue===y||M!==null&&M.suppressHydrationWarning===!0||Y9(u.nodeValue,y)),u||gu(f,!0)}else u=C3(u).createTextNode(M),u[an]=f,f.stateNode=u}return Li(f),null;case 31:if(y=f.memoizedState,u===null||u.memoizedState!==null){if(M=Lp(f),y!==null){if(u===null){if(!M)throw Error(r(318));if(u=f.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[an]=f}else af(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Li(f),u=!1}else y=Ov(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=y),u=!0;if(!u)return f.flags&256?(Ws(f),f):(Ws(f),null);if((f.flags&128)!==0)throw Error(r(558))}return Li(f),null;case 13:if(M=f.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(D=Lp(f),M!==null&&M.dehydrated!==null){if(u===null){if(!D)throw Error(r(318));if(D=f.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(r(317));D[an]=f}else af(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Li(f),D=!1}else D=Ov(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=D),D=!0;if(!D)return f.flags&256?(Ws(f),f):(Ws(f),null)}return Ws(f),(f.flags&128)!==0?(f.lanes=y,f):(y=M!==null,u=u!==null&&u.memoizedState!==null,y&&(M=f.child,D=null,M.alternate!==null&&M.alternate.memoizedState!==null&&M.alternate.memoizedState.cachePool!==null&&(D=M.alternate.memoizedState.cachePool.pool),z=null,M.memoizedState!==null&&M.memoizedState.cachePool!==null&&(z=M.memoizedState.cachePool.pool),z!==D&&(M.flags|=2048)),y!==u&&y&&(f.child.flags|=8192),yd(f,f.updateQueue),Li(f),null);case 4:return fe(),u===null&&WE(f.stateNode.containerInfo),Li(f),null;case 10:return yu(f.type),Li(f),null;case 19:if(X($r),M=f.memoizedState,M===null)return Li(f),null;if(D=(f.flags&128)!==0,z=M.rendering,z===null)if(D)Mu(M,!1);else{if(Ms!==0||u!==null&&(u.flags&128)!==0)for(u=f.child;u!==null;){if(z=Tl(u),z!==null){for(f.flags|=128,Mu(M,!1),u=z.updateQueue,f.updateQueue=u,yd(f,u),f.subtreeFlags=0,u=y,y=f.child;y!==null;)kp(y,u),y=y.sibling;return H($r,$r.current&1|2),Wr&&pu(f,M.treeForkCount),f.child}u=u.sibling}M.tail!==null&&te()>Xs&&(f.flags|=128,D=!0,Mu(M,!1),f.lanes=4194304)}else{if(!D)if(u=Tl(z),u!==null){if(f.flags|=128,D=!0,u=u.updateQueue,f.updateQueue=u,yd(f,u),Mu(M,!0),M.tail===null&&M.tailMode==="hidden"&&!z.alternate&&!Wr)return Li(f),null}else 2*te()-M.renderingStartTime>Xs&&y!==536870912&&(f.flags|=128,D=!0,Mu(M,!1),f.lanes=4194304);M.isBackwards?(z.sibling=f.child,f.child=z):(u=M.last,u!==null?u.sibling=z:f.child=z,M.last=z)}return M.tail!==null?(u=M.tail,M.rendering=u,M.tail=u.sibling,M.renderingStartTime=te(),u.sibling=null,y=$r.current,H($r,D?y&1|2:y&1),Wr&&pu(f,M.treeForkCount),u):(Li(f),null);case 22:case 23:return Ws(f),zm(),M=f.memoizedState!==null,u!==null?u.memoizedState!==null!==M&&(f.flags|=8192):M&&(f.flags|=8192),M?(y&536870912)!==0&&(f.flags&128)===0&&(Li(f),f.subtreeFlags&6&&(f.flags|=8192)):Li(f),y=f.updateQueue,y!==null&&yd(f,y.retryQueue),y=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),M=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(M=f.memoizedState.cachePool.pool),M!==y&&(f.flags|=2048),u!==null&&X(cf),null;case 24:return y=null,u!==null&&(y=u.memoizedState.cache),f.memoizedState.cache!==y&&(f.flags|=2048),yu(oa),Li(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function lc(u,f){switch(Dv(f),f.tag){case 1:return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return yu(oa),fe(),u=f.flags,(u&65536)!==0&&(u&128)===0?(f.flags=u&-65537|128,f):null;case 26:case 27:case 5:return he(f),null;case 31:if(f.memoizedState!==null){if(Ws(f),f.alternate===null)throw Error(r(340));af()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 13:if(Ws(f),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(r(340));af()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return X($r),null;case 4:return fe(),null;case 10:return yu(f.type),null;case 22:case 23:return Ws(f),zm(),u!==null&&X(cf),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 24:return yu(oa),null;case 25:return null;default:return null}}function El(u,f){switch(Dv(f),f.tag){case 3:yu(oa),fe();break;case 26:case 27:case 5:he(f);break;case 4:fe();break;case 31:f.memoizedState!==null&&Ws(f);break;case 13:Ws(f);break;case 19:X($r);break;case 10:yu(f.type);break;case 22:case 23:Ws(f),zm(),u!==null&&X(cf);break;case 24:yu(oa)}}function cc(u,f){try{var y=f.updateQueue,M=y!==null?y.lastEffect:null;if(M!==null){var D=M.next;y=D;do{if((y.tag&u)===u){M=void 0;var z=y.create,ce=y.inst;M=z(),ce.destroy=M}y=y.next}while(y!==D)}}catch(Ne){ai(f,f.return,Ne)}}function Ka(u,f,y){try{var M=f.updateQueue,D=M!==null?M.lastEffect:null;if(D!==null){var z=D.next;M=z;do{if((M.tag&u)===u){var ce=M.inst,Ne=ce.destroy;if(Ne!==void 0){ce.destroy=void 0,D=f;var rt=y,Tt=Ne;try{Tt()}catch(Ot){ai(D,rt,Ot)}}}M=M.next}while(M!==z)}}catch(Ot){ai(f,f.return,Ot)}}function zc(u){var f=u.updateQueue;if(f!==null){var y=u.stateNode;try{Lw(f,y)}catch(M){ai(u,u.return,M)}}}function La(u,f,y){y.props=pf(u.type,u.memoizedProps),y.state=u.memoizedState;try{y.componentWillUnmount()}catch(M){ai(u,f,M)}}function bd(u,f){try{var y=u.ref;if(y!==null){switch(u.tag){case 26:case 27:case 5:var M=u.stateNode;break;case 30:M=u.stateNode;break;default:M=u.stateNode}typeof y=="function"?u.refCleanup=y(M):y.current=M}}catch(D){ai(u,f,D)}}function Za(u,f){var y=u.ref,M=u.refCleanup;if(y!==null)if(typeof M=="function")try{M()}catch(D){ai(u,f,D)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof y=="function")try{y(null)}catch(D){ai(u,f,D)}else y.current=null}function $m(u){var f=u.type,y=u.memoizedProps,M=u.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":y.autoFocus&&M.focus();break e;case"img":y.src?M.src=y.src:y.srcSet&&(M.srcset=y.srcSet)}}catch(D){ai(u,u.return,D)}}function _a(u,f,y){try{var M=u.stateNode;fZ(M,u.type,y,f),M[Dn]=f}catch(D){ai(u,u.return,D)}}function cs(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&n0(u.type)||u.tag===4}function Fr(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||cs(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&n0(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 Tu(u,f,y){var M=u.tag;if(M===5||M===6)u=u.stateNode,f?(y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y).insertBefore(u,f):(f=y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y,f.appendChild(u),y=y._reactRootContainer,y!=null||f.onclick!==null||(f.onclick=Ps));else if(M!==4&&(M===27&&n0(u.type)&&(y=u.stateNode,f=null),u=u.child,u!==null))for(Tu(u,f,y),u=u.sibling;u!==null;)Tu(u,f,y),u=u.sibling}function Ro(u,f,y){var M=u.tag;if(M===5||M===6)u=u.stateNode,f?y.insertBefore(u,f):y.appendChild(u);else if(M!==4&&(M===27&&n0(u.type)&&(y=u.stateNode),u=u.child,u!==null))for(Ro(u,f,y),u=u.sibling;u!==null;)Ro(u,f,y),u=u.sibling}function ux(u){var f=u.stateNode,y=u.memoizedProps;try{for(var M=u.type,D=f.attributes;D.length;)f.removeAttributeNode(D[0]);Io(f,M,y),f[an]=u,f[Dn]=y}catch(z){ai(u,u.return,z)}}var uc=!1,$i=!1,jc=!1,M3=typeof WeakSet=="function"?WeakSet:Set,za=null;function HE(u,f){if(u=u.containerInfo,XE=I3,u=Ji(u),Is(u)){if("selectionStart"in u)var y={start:u.selectionStart,end:u.selectionEnd};else e:{y=(y=u.ownerDocument)&&y.defaultView||window;var M=y.getSelection&&y.getSelection();if(M&&M.rangeCount!==0){y=M.anchorNode;var D=M.anchorOffset,z=M.focusNode;M=M.focusOffset;try{y.nodeType,z.nodeType}catch{y=null;break e}var ce=0,Ne=-1,rt=-1,Tt=0,Ot=0,Ut=u,At=null;t:for(;;){for(var It;Ut!==y||D!==0&&Ut.nodeType!==3||(Ne=ce+D),Ut!==z||M!==0&&Ut.nodeType!==3||(rt=ce+M),Ut.nodeType===3&&(ce+=Ut.nodeValue.length),(It=Ut.firstChild)!==null;)At=Ut,Ut=It;for(;;){if(Ut===u)break t;if(At===y&&++Tt===D&&(Ne=ce),At===z&&++Ot===M&&(rt=ce),(It=Ut.nextSibling)!==null)break;Ut=At,At=Ut.parentNode}Ut=It}y=Ne===-1||rt===-1?null:{start:Ne,end:rt}}else y=null}y=y||{start:0,end:0}}else y=null;for(YE={focusedElem:u,selectionRange:y},I3=!1,za=f;za!==null;)if(f=za,u=f.child,(f.subtreeFlags&1028)!==0&&u!==null)u.return=f,za=u;else for(;za!==null;){switch(f=za,z=f.alternate,u=f.flags,f.tag){case 0:if((u&4)!==0&&(u=f.updateQueue,u=u!==null?u.events:null,u!==null))for(y=0;y<u.length;y++)D=u[y],D.ref.impl=D.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&z!==null){u=void 0,y=f,D=z.memoizedProps,z=z.memoizedState,M=y.stateNode;try{var kn=pf(y.type,D);u=M.getSnapshotBeforeUpdate(kn,z),M.__reactInternalSnapshotBeforeUpdate=u}catch(Jn){ai(y,y.return,Jn)}}break;case 3:if((u&1024)!==0){if(u=f.stateNode.containerInfo,y=u.nodeType,y===9)QE(u);else if(y===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":QE(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=f.sibling,u!==null){u.return=f.return,za=u;break}za=f.return}}function us(u,f,y){var M=y.flags;switch(y.tag){case 0:case 11:case 15:hc(u,y),M&4&&cc(5,y);break;case 1:if(hc(u,y),M&4)if(u=y.stateNode,f===null)try{u.componentDidMount()}catch(ce){ai(y,y.return,ce)}else{var D=pf(y.type,f.memoizedProps);f=f.memoizedState;try{u.componentDidUpdate(D,f,u.__reactInternalSnapshotBeforeUpdate)}catch(ce){ai(y,y.return,ce)}}M&64&&zc(y),M&512&&bd(y,y.return);break;case 3:if(hc(u,y),M&64&&(u=y.updateQueue,u!==null)){if(f=null,y.child!==null)switch(y.child.tag){case 27:case 5:f=y.child.stateNode;break;case 1:f=y.child.stateNode}try{Lw(u,f)}catch(ce){ai(y,y.return,ce)}}break;case 27:f===null&&M&4&&ux(y);case 26:case 5:hc(u,y),f===null&&M&4&&$m(y),M&512&&bd(y,y.return);break;case 12:hc(u,y);break;case 31:hc(u,y),M&4&&mf(u,y);break;case 13:hc(u,y),M&4&&qp(u,y),M&64&&(u=y.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(y=C.bind(null,y),bZ(u,y))));break;case 22:if(M=y.memoizedState!==null||uc,!M){f=f!==null&&f.memoizedState!==null||$i,D=uc;var z=$i;uc=M,($i=f)&&!z?ko(u,y,(y.subtreeFlags&8772)!==0):hc(u,y),uc=D,$i=z}break;case 30:break;default:hc(u,y)}}function qm(u){var f=u.alternate;f!==null&&(u.alternate=null,qm(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&On(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var Ei=null,po=!1;function dc(u,f,y){for(y=y.child;y!==null;)dx(u,f,y),y=y.sibling}function dx(u,f,y){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ie,y)}catch{}switch(y.tag){case 26:$i||Za(y,f),dc(u,f,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:$i||Za(y,f);var M=Ei,D=po;n0(y.type)&&(Ei=y.stateNode,po=!1),dc(u,f,y),Rb(y.stateNode),Ei=M,po=D;break;case 5:$i||Za(y,f);case 6:if(M=Ei,D=po,Ei=null,dc(u,f,y),Ei=M,po=D,Ei!==null)if(po)try{(Ei.nodeType===9?Ei.body:Ei.nodeName==="HTML"?Ei.ownerDocument.body:Ei).removeChild(y.stateNode)}catch(z){ai(y,f,z)}else try{Ei.removeChild(y.stateNode)}catch(z){ai(y,f,z)}break;case 18:Ei!==null&&(po?(u=Ei,tP(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,y.stateNode),yx(u)):tP(Ei,y.stateNode));break;case 4:M=Ei,D=po,Ei=y.stateNode.containerInfo,po=!0,dc(u,f,y),Ei=M,po=D;break;case 0:case 11:case 14:case 15:Ka(2,y,f),$i||Ka(4,y,f),dc(u,f,y);break;case 1:$i||(Za(y,f),M=y.stateNode,typeof M.componentWillUnmount=="function"&&La(y,f,M)),dc(u,f,y);break;case 21:dc(u,f,y);break;case 22:$i=(M=$i)||y.memoizedState!==null,dc(u,f,y),$i=M;break;default:dc(u,f,y)}}function mf(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{yx(u)}catch(y){ai(f,f.return,y)}}}function qp(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{yx(u)}catch(y){ai(f,f.return,y)}}function Mb(u){switch(u.tag){case 31:case 13:case 19:var f=u.stateNode;return f===null&&(f=u.stateNode=new M3),f;case 22:return u=u.stateNode,f=u._retryCache,f===null&&(f=u._retryCache=new M3),f;default:throw Error(r(435,u.tag))}}function _d(u,f){var y=Mb(u);f.forEach(function(M){if(!y.has(M)){y.add(M);var D=k.bind(null,u,M);M.then(D,D)}})}function Sa(u,f){var y=f.deletions;if(y!==null)for(var M=0;M<y.length;M++){var D=y[M],z=u,ce=f,Ne=ce;e:for(;Ne!==null;){switch(Ne.tag){case 27:if(n0(Ne.type)){Ei=Ne.stateNode,po=!1;break e}break;case 5:Ei=Ne.stateNode,po=!1;break e;case 3:case 4:Ei=Ne.stateNode.containerInfo,po=!0;break e}Ne=Ne.return}if(Ei===null)throw Error(r(160));dx(z,ce,D),Ei=null,po=!1,z=D.alternate,z!==null&&(z.return=null),D.return=null}if(f.subtreeFlags&13886)for(f=f.child;f!==null;)gf(f,u),f=f.sibling}var fc=null;function gf(u,f){var y=u.alternate,M=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Sa(f,u),wa(u),M&4&&(Ka(3,u,u.return),cc(3,u),Ka(5,u,u.return));break;case 1:Sa(f,u),wa(u),M&512&&($i||y===null||Za(y,y.return)),M&64&&uc&&(u=u.updateQueue,u!==null&&(M=u.callbacks,M!==null&&(y=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=y===null?M:y.concat(M))));break;case 26:var D=fc;if(Sa(f,u),wa(u),M&512&&($i||y===null||Za(y,y.return)),M&4){var z=y!==null?y.memoizedState:null;if(M=u.memoizedState,y===null)if(M===null)if(u.stateNode===null){e:{M=u.type,y=u.memoizedProps,D=D.ownerDocument||D;t:switch(M){case"title":z=D.getElementsByTagName("title")[0],(!z||z[wn]||z[an]||z.namespaceURI==="http://www.w3.org/2000/svg"||z.hasAttribute("itemprop"))&&(z=D.createElement(M),D.head.insertBefore(z,D.querySelector("head > title"))),Io(z,M,y),z[an]=u,ot(z),M=z;break e;case"link":var ce=fP("link","href",D).get(M+(y.href||""));if(ce){for(var Ne=0;Ne<ce.length;Ne++)if(z=ce[Ne],z.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&z.getAttribute("rel")===(y.rel==null?null:y.rel)&&z.getAttribute("title")===(y.title==null?null:y.title)&&z.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){ce.splice(Ne,1);break t}}z=D.createElement(M),Io(z,M,y),D.head.appendChild(z);break;case"meta":if(ce=fP("meta","content",D).get(M+(y.content||""))){for(Ne=0;Ne<ce.length;Ne++)if(z=ce[Ne],z.getAttribute("content")===(y.content==null?null:""+y.content)&&z.getAttribute("name")===(y.name==null?null:y.name)&&z.getAttribute("property")===(y.property==null?null:y.property)&&z.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&z.getAttribute("charset")===(y.charSet==null?null:y.charSet)){ce.splice(Ne,1);break t}}z=D.createElement(M),Io(z,M,y),D.head.appendChild(z);break;default:throw Error(r(468,M))}z[an]=u,ot(z),M=z}u.stateNode=M}else hP(D,u.type,u.stateNode);else u.stateNode=dP(D,M,u.memoizedProps);else z!==M?(z===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):z.count--,M===null?hP(D,u.type,u.stateNode):dP(D,M,u.memoizedProps)):M===null&&u.stateNode!==null&&_a(u,u.memoizedProps,y.memoizedProps)}break;case 27:Sa(f,u),wa(u),M&512&&($i||y===null||Za(y,y.return)),y!==null&&M&4&&_a(u,u.memoizedProps,y.memoizedProps);break;case 5:if(Sa(f,u),wa(u),M&512&&($i||y===null||Za(y,y.return)),u.flags&32){D=u.stateNode;try{ks(D,"")}catch(kn){ai(u,u.return,kn)}}M&4&&u.stateNode!=null&&(D=u.memoizedProps,_a(u,D,y!==null?y.memoizedProps:D)),M&1024&&(jc=!0);break;case 6:if(Sa(f,u),wa(u),M&4){if(u.stateNode===null)throw Error(r(162));M=u.memoizedProps,y=u.stateNode;try{y.nodeValue=M}catch(kn){ai(u,u.return,kn)}}break;case 3:if(R3=null,D=fc,fc=A3(f.containerInfo),Sa(f,u),fc=D,wa(u),M&4&&y!==null&&y.memoizedState.isDehydrated)try{yx(f.containerInfo)}catch(kn){ai(u,u.return,kn)}jc&&(jc=!1,fx(u));break;case 4:M=fc,fc=A3(u.stateNode.containerInfo),Sa(f,u),wa(u),fc=M;break;case 12:Sa(f,u),wa(u);break;case 31:Sa(f,u),wa(u),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,_d(u,M)));break;case 13:Sa(f,u),wa(u),u.child.flags&8192&&u.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(Xp=te()),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,_d(u,M)));break;case 22:D=u.memoizedState!==null;var rt=y!==null&&y.memoizedState!==null,Tt=uc,Ot=$i;if(uc=Tt||D,$i=Ot||rt,Sa(f,u),$i=Ot,uc=Tt,wa(u),M&8192)e:for(f=u.stateNode,f._visibility=D?f._visibility&-2:f._visibility|1,D&&(y===null||rt||uc||$i||Eu(u)),y=null,f=u;;){if(f.tag===5||f.tag===26){if(y===null){rt=y=f;try{if(z=rt.stateNode,D)ce=z.style,typeof ce.setProperty=="function"?ce.setProperty("display","none","important"):ce.display="none";else{Ne=rt.stateNode;var Ut=rt.memoizedProps.style,At=Ut!=null&&Ut.hasOwnProperty("display")?Ut.display:null;Ne.style.display=At==null||typeof At=="boolean"?"":(""+At).trim()}}catch(kn){ai(rt,rt.return,kn)}}}else if(f.tag===6){if(y===null){rt=f;try{rt.stateNode.nodeValue=D?"":rt.memoizedProps}catch(kn){ai(rt,rt.return,kn)}}}else if(f.tag===18){if(y===null){rt=f;try{var It=rt.stateNode;D?nP(It,!0):nP(rt.stateNode,!1)}catch(kn){ai(rt,rt.return,kn)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===u)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break e;for(;f.sibling===null;){if(f.return===null||f.return===u)break e;y===f&&(y=null),f=f.return}y===f&&(y=null),f.sibling.return=f.return,f=f.sibling}M&4&&(M=u.updateQueue,M!==null&&(y=M.retryQueue,y!==null&&(M.retryQueue=null,_d(u,y))));break;case 19:Sa(f,u),wa(u),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,_d(u,M)));break;case 30:break;case 21:break;default:Sa(f,u),wa(u)}}function wa(u){var f=u.flags;if(f&2){try{for(var y,M=u.return;M!==null;){if(cs(M)){y=M;break}M=M.return}if(y==null)throw Error(r(160));switch(y.tag){case 27:var D=y.stateNode,z=Fr(u);Ro(u,z,D);break;case 5:var ce=y.stateNode;y.flags&32&&(ks(ce,""),y.flags&=-33);var Ne=Fr(u);Ro(u,Ne,ce);break;case 3:case 4:var rt=y.stateNode.containerInfo,Tt=Fr(u);Tu(u,Tt,rt);break;default:throw Error(r(161))}}catch(Ot){ai(u,u.return,Ot)}u.flags&=-3}f&4096&&(u.flags&=-4097)}function fx(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var f=u;fx(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),u=u.sibling}}function hc(u,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)us(u,f.alternate,f),f=f.sibling}function Eu(u){for(u=u.child;u!==null;){var f=u;switch(f.tag){case 0:case 11:case 14:case 15:Ka(4,f,f.return),Eu(f);break;case 1:Za(f,f.return);var y=f.stateNode;typeof y.componentWillUnmount=="function"&&La(f,f.return,y),Eu(f);break;case 27:Rb(f.stateNode);case 26:case 5:Za(f,f.return),Eu(f);break;case 22:f.memoizedState===null&&Eu(f);break;case 30:Eu(f);break;default:Eu(f)}u=u.sibling}}function ko(u,f,y){for(y=y&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var M=f.alternate,D=u,z=f,ce=z.flags;switch(z.tag){case 0:case 11:case 15:ko(D,z,y),cc(4,z);break;case 1:if(ko(D,z,y),M=z,D=M.stateNode,typeof D.componentDidMount=="function")try{D.componentDidMount()}catch(Tt){ai(M,M.return,Tt)}if(M=z,D=M.updateQueue,D!==null){var Ne=M.stateNode;try{var rt=D.shared.hiddenCallbacks;if(rt!==null)for(D.shared.hiddenCallbacks=null,D=0;D<rt.length;D++)Bp(rt[D],Ne)}catch(Tt){ai(M,M.return,Tt)}}y&&ce&64&&zc(z),bd(z,z.return);break;case 27:ux(z);case 26:case 5:ko(D,z,y),y&&M===null&&ce&4&&$m(z),bd(z,z.return);break;case 12:ko(D,z,y);break;case 31:ko(D,z,y),y&&ce&4&&mf(D,z);break;case 13:ko(D,z,y),y&&ce&4&&qp(D,z);break;case 22:z.memoizedState===null&&ko(D,z,y),bd(z,z.return);break;case 30:break;default:ko(D,z,y)}f=f.sibling}}function vf(u,f){var y=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),u=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(u=f.memoizedState.cachePool.pool),u!==y&&(u!=null&&u.refCount++,y!=null&&bh(y))}function Ih(u,f){u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&bh(u))}function Qa(u,f,y,M){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)Tb(u,f,y,M),f=f.sibling}function Tb(u,f,y,M){var D=f.flags;switch(f.tag){case 0:case 11:case 15:Qa(u,f,y,M),D&2048&&cc(9,f);break;case 1:Qa(u,f,y,M);break;case 3:Qa(u,f,y,M),D&2048&&(u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&bh(u)));break;case 12:if(D&2048){Qa(u,f,y,M),u=f.stateNode;try{var z=f.memoizedProps,ce=z.id,Ne=z.onPostCommit;typeof Ne=="function"&&Ne(ce,f.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(rt){ai(f,f.return,rt)}}else Qa(u,f,y,M);break;case 31:Qa(u,f,y,M);break;case 13:Qa(u,f,y,M);break;case 23:break;case 22:z=f.stateNode,ce=f.alternate,f.memoizedState!==null?z._visibility&2?Qa(u,f,y,M):Cu(u,f):z._visibility&2?Qa(u,f,y,M):(z._visibility|=2,Ja(u,f,y,M,(f.subtreeFlags&10256)!==0||!1)),D&2048&&vf(ce,f);break;case 24:Qa(u,f,y,M),D&2048&&Ih(f.alternate,f);break;default:Qa(u,f,y,M)}}function Ja(u,f,y,M,D){for(D=D&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var z=u,ce=f,Ne=y,rt=M,Tt=ce.flags;switch(ce.tag){case 0:case 11:case 15:Ja(z,ce,Ne,rt,D),cc(8,ce);break;case 23:break;case 22:var Ot=ce.stateNode;ce.memoizedState!==null?Ot._visibility&2?Ja(z,ce,Ne,rt,D):Cu(z,ce):(Ot._visibility|=2,Ja(z,ce,Ne,rt,D)),D&&Tt&2048&&vf(ce.alternate,ce);break;case 24:Ja(z,ce,Ne,rt,D),D&&Tt&2048&&Ih(ce.alternate,ce);break;default:Ja(z,ce,Ne,rt,D)}f=f.sibling}}function Cu(u,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var y=u,M=f,D=M.flags;switch(M.tag){case 22:Cu(y,M),D&2048&&vf(M.alternate,M);break;case 24:Cu(y,M),D&2048&&Ih(M.alternate,M);break;default:Cu(y,M)}f=f.sibling}}var Oh=8192;function Cl(u,f,y){if(u.subtreeFlags&Oh)for(u=u.child;u!==null;)hx(u,f,y),u=u.sibling}function hx(u,f,y){switch(u.tag){case 26:Cl(u,f,y),u.flags&Oh&&u.memoizedState!==null&&PZ(y,fc,u.memoizedState,u.memoizedProps);break;case 5:Cl(u,f,y);break;case 3:case 4:var M=fc;fc=A3(u.stateNode.containerInfo),Cl(u,f,y),fc=M;break;case 22:u.memoizedState===null&&(M=u.alternate,M!==null&&M.memoizedState!==null?(M=Oh,Oh=16777216,Cl(u,f,y),Oh=M):Cl(u,f,y));break;default:Cl(u,f,y)}}function Lh(u){var f=u.alternate;if(f!==null&&(u=f.child,u!==null)){f.child=null;do f=u.sibling,u.sibling=null,u=f;while(u!==null)}}function xf(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var y=0;y<f.length;y++){var M=f[y];za=M,zs(M,u)}Lh(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)el(u),u=u.sibling}function el(u){switch(u.tag){case 0:case 11:case 15:xf(u),u.flags&2048&&Ka(9,u,u.return);break;case 3:xf(u);break;case 12:xf(u);break;case 22:var f=u.stateNode;u.memoizedState!==null&&f._visibility&2&&(u.return===null||u.return.tag!==13)?(f._visibility&=-3,tl(u)):xf(u);break;default:xf(u)}}function tl(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var y=0;y<f.length;y++){var M=f[y];za=M,zs(M,u)}Lh(u)}for(u=u.child;u!==null;){switch(f=u,f.tag){case 0:case 11:case 15:Ka(8,f,f.return),tl(f);break;case 22:y=f.stateNode,y._visibility&2&&(y._visibility&=-3,tl(f));break;default:tl(f)}u=u.sibling}}function zs(u,f){for(;za!==null;){var y=za;switch(y.tag){case 0:case 11:case 15:Ka(8,y,f);break;case 23:case 22:if(y.memoizedState!==null&&y.memoizedState.cachePool!==null){var M=y.memoizedState.cachePool.pool;M!=null&&M.refCount++}break;case 24:bh(y.memoizedState.cache)}if(M=y.child,M!==null)M.return=y,za=M;else e:for(y=u;za!==null;){M=za;var D=M.sibling,z=M.return;if(qm(M),M===y){za=null;break e}if(D!==null){D.return=z,za=D;break e}za=z}}}var Sd={getCacheForType:function(u){var f=nr(oa),y=f.data.get(u);return y===void 0&&(y=u(),f.data.set(u,y)),y},cacheSignal:function(){return nr(oa).controller.signal}},vr=typeof WeakMap=="function"?WeakMap:Map,Un=0,or=null,wr=null,_r=0,Yr=0,mo=null,pc=!1,Fc=!1,Eb=!1,Al=0,Ms=0,Au=0,yf=0,Xm=0,Po=0,es=0,zh=null,js=null,Fs=!1,Xp=0,Cb=0,Xs=1/0,Ts=null,Ys=null,Ci=0,Nl=null,Yp=null,mc=0,Kp=0,Zp=null,Ym=null,bf=0,jh=null;function Rl(){return(Un&2)!==0&&_r!==0?_r&-_r:q.T!==null?kt():Et()}function Dr(){if(Po===0)if((_r&536870912)===0||Wr){var u=ft;ft<<=1,(ft&3932160)===0&&(ft=262144),Po=u}else Po=536870912;return u=Ko.current,u!==null&&(u.flags|=32),Po}function Mr(u,f,y){(u===or&&(Yr===2||Yr===9)||u.cancelPendingCommit!==null)&&(Sf(u,0),ca(u,_r,Po,!1)),yt(u,y),((Un&2)===0||u!==or)&&(u===or&&((Un&2)===0&&(yf|=y),Ms===4&&ca(u,_r,Po,!1)),qt(u))}function Ir(u,f,y){if((Un&6)!==0)throw Error(r(327));var M=!y&&(f&127)===0&&(f&u.expiredLanes)===0||me(u,f),D=M?Km(u,f):Do(u,f,!0),z=M;do{if(D===0){Fc&&!M&&ca(u,f,0,!1);break}else{if(y=u.current.alternate,z&&!Ai(y)){D=Do(u,f,!1),z=!1;continue}if(D===2){if(z=f,u.errorRecoveryDisabledLanes&z)var ce=0;else ce=u.pendingLanes&-536870913,ce=ce!==0?ce:ce&536870912?536870912:0;if(ce!==0){f=ce;e:{var Ne=u;D=zh;var rt=Ne.current.memoizedState.isDehydrated;if(rt&&(Sf(Ne,ce).flags|=256),ce=Do(Ne,ce,!1),ce!==2){if(Eb&&!rt){Ne.errorRecoveryDisabledLanes|=z,yf|=z,D=4;break e}z=js,js=D,z!==null&&(js===null?js=z:js.push.apply(js,z))}D=ce}if(z=!1,D!==2)continue}}if(D===1){Sf(u,0),ca(u,f,0,!0);break}e:{switch(M=u,z=D,z){case 0:case 1:throw Error(r(345));case 4:if((f&4194048)!==f)break;case 6:ca(M,f,Po,!pc);break e;case 2:js=null;break;case 3:case 5:break;default:throw Error(r(329))}if((f&62914560)===f&&(D=Xp+300-te(),10<D)){if(ca(M,f,Po,!pc),Ze(M,0,!0)!==0)break e;mc=f,M.timeoutHandle=J9(Ur.bind(null,M,y,js,Ts,Fs,f,Po,yf,es,pc,z,"Throttled",-0,0),D);break e}Ur(M,y,js,Ts,Fs,f,Po,yf,es,pc,z,null,-0,0)}}break}while(!0);qt(u)}function Ur(u,f,y,M,D,z,ce,Ne,rt,Tt,Ot,Ut,At,It){if(u.timeoutHandle=-1,Ut=f.subtreeFlags,Ut&8192||(Ut&16785408)===16785408){Ut={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ps},hx(f,z,Ut);var kn=(z&62914560)===z?Xp-te():(z&4194048)===z?Cb-te():0;if(kn=DZ(Ut,kn),kn!==null){mc=z,u.cancelPendingCommit=kn(Md.bind(null,u,f,z,y,M,D,ce,Ne,rt,Ot,Ut,null,At,It)),ca(u,z,ce,!Tt);return}}Md(u,f,z,y,M,D,ce,Ne,rt)}function Ai(u){for(var f=u;;){var y=f.tag;if((y===0||y===11||y===15)&&f.flags&16384&&(y=f.updateQueue,y!==null&&(y=y.stores,y!==null)))for(var M=0;M<y.length;M++){var D=y[M],z=D.getSnapshot;D=D.value;try{if(!tr(z(),D))return!1}catch{return!1}}if(y=f.child,f.subtreeFlags&16384&&y!==null)y.return=f,f=y;else{if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function ca(u,f,y,M){f&=~Xm,f&=~yf,u.suspendedLanes|=f,u.pingedLanes&=~f,M&&(u.warmLanes|=f),M=u.expirationTimes;for(var D=f;0<D;){var z=31-Me(D),ce=1<<z;M[z]=-1,D&=~ce}y!==0&&bt(u,y,f)}function Uc(){return(Un&6)===0?(yn(0),!1):!0}function _f(){if(wr!==null){if(Yr===0)var u=wr.return;else u=wr,xu=of=null,Ky(u),Th=null,Eh=0,u=wr;for(;u!==null;)El(u.alternate,u),u=u.return;wr=null}}function Sf(u,f){var y=u.timeoutHandle;y!==-1&&(u.timeoutHandle=-1,mZ(y)),y=u.cancelPendingCommit,y!==null&&(u.cancelPendingCommit=null,y()),mc=0,_f(),or=u,wr=y=qo(u.current,null),_r=f,Yr=0,mo=null,pc=!1,Fc=me(u,f),Eb=!1,es=Po=Xm=yf=Au=Ms=0,js=zh=null,Fs=!1,(f&8)!==0&&(f|=f&32);var M=u.entangledLanes;if(M!==0)for(u=u.entanglements,M&=f;0<M;){var D=31-Me(M),z=1<<D;f|=u[D],M&=~z}return Al=f,Nm(),y}function Nu(u,f){gr=null,q.H=Wp,f===_h||f===Sr?(f=wh(),Yr=3):f===Dm?(f=wh(),Yr=4):Yr=f===tx?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,mo=f,wr===null&&(Ms=1,ex(u,Sl(f,u.current)))}function Es(){var u=Ko.current;return u===null?!0:(_r&4194048)===_r?No===null:(_r&62914560)===_r||(_r&536870912)!==0?u===No:!1}function wd(){var u=q.H;return q.H=Wp,u===null?Wp:u}function wf(){var u=q.A;return q.A=Sd,u}function Qp(){Ms=4,pc||(_r&4194048)!==_r&&Ko.current!==null||(Fc=!0),(Au&134217727)===0&&(yf&134217727)===0||or===null||ca(or,_r,Po,!1)}function Do(u,f,y){var M=Un;Un|=2;var D=wd(),z=wf();(or!==u||_r!==f)&&(Ts=null,Sf(u,f)),f=!1;var ce=Ms;e:do try{if(Yr!==0&&wr!==null){var Ne=wr,rt=mo;switch(Yr){case 8:_f(),ce=6;break e;case 3:case 2:case 9:case 6:Ko.current===null&&(f=!0);var Tt=Yr;if(Yr=0,mo=null,Fh(u,Ne,rt,Tt),y&&Fc){ce=0;break e}break;default:Tt=Yr,Yr=0,mo=null,Fh(u,Ne,rt,Tt)}}Jp(),ce=Ms;break}catch(Ot){Nu(u,Ot)}while(!0);return f&&u.shellSuspendCounter++,xu=of=null,Un=M,q.H=D,q.A=z,wr===null&&(or=null,_r=0,Nm()),ce}function Jp(){for(;wr!==null;)px(wr)}function Km(u,f){var y=Un;Un|=2;var M=wd(),D=wf();or!==u||_r!==f?(Ts=null,Xs=te()+500,Sf(u,f)):Fc=me(u,f);e:do try{if(Yr!==0&&wr!==null){f=wr;var z=mo;t:switch(Yr){case 1:Yr=0,mo=null,Fh(u,f,z,1);break;case 2:case 9:if(Yo(z)){Yr=0,mo=null,Zm(f);break}f=function(){Yr!==2&&Yr!==9||or!==u||(Yr=7),qt(u)},z.then(f,f);break e;case 3:Yr=7;break e;case 4:Yr=5;break e;case 7:Yo(z)?(Yr=0,mo=null,Zm(f)):(Yr=0,mo=null,Fh(u,f,z,7));break;case 5:var ce=null;switch(wr.tag){case 26:ce=wr.memoizedState;case 5:case 27:var Ne=wr;if(ce?pP(ce):Ne.stateNode.complete){Yr=0,mo=null;var rt=Ne.sibling;if(rt!==null)wr=rt;else{var Tt=Ne.return;Tt!==null?(wr=Tt,Mf(Tt)):wr=null}break t}}Yr=0,mo=null,Fh(u,f,z,5);break;case 6:Yr=0,mo=null,Fh(u,f,z,6);break;case 8:_f(),Ms=6;break e;default:throw Error(r(462))}}nl();break}catch(Ot){Nu(u,Ot)}while(!0);return xu=of=null,q.H=M,q.A=D,Un=y,wr!==null?0:(or=null,_r=0,Nm(),Ms)}function nl(){for(;wr!==null&&!Ke();)px(wr)}function px(u){var f=cx(u.alternate,u,Al);u.memoizedProps=u.pendingProps,f===null?Mf(u):wr=f}function Zm(u){var f=u,y=f.alternate;switch(f.tag){case 15:case 0:f=Hm(y,f,f.pendingProps,f.type,void 0,_r);break;case 11:f=Hm(y,f,f.pendingProps,f.type.render,f.ref,_r);break;case 5:Ky(f);default:El(y,f),f=wr=kp(f,Al),f=cx(y,f,Al)}u.memoizedProps=u.pendingProps,f===null?Mf(u):wr=f}function Fh(u,f,y,M){xu=of=null,Ky(f),Th=null,Eh=0;var D=f.return;try{if(ba(u,D,f,y,_r)){Ms=1,ex(u,Sl(y,u.current)),wr=null;return}}catch(z){if(D!==null)throw wr=D,z;Ms=1,ex(u,Sl(y,u.current)),wr=null;return}f.flags&32768?(Wr||M===1?u=!0:Fc||(_r&536870912)!==0?u=!1:(pc=u=!0,(M===2||M===9||M===3||M===6)&&(M=Ko.current,M!==null&&M.tag===13&&(M.flags|=16384))),Qm(f,u)):Mf(f)}function Mf(u){var f=u;do{if((f.flags&32768)!==0){Qm(f,pc);return}u=f.return;var y=Wm(f.alternate,f,Al);if(y!==null){wr=y;return}if(f=f.sibling,f!==null){wr=f;return}wr=f=u}while(f!==null);Ms===0&&(Ms=5)}function Qm(u,f){do{var y=lc(u.alternate,u);if(y!==null){y.flags&=32767,wr=y;return}if(y=u.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!f&&(u=u.sibling,u!==null)){wr=u;return}wr=u=y}while(u!==null);Ms=6,wr=null}function Md(u,f,y,M,D,z,ce,Ne,rt){u.cancelPendingCommit=null;do e0();while(Ci!==0);if((Un&6)!==0)throw Error(r(327));if(f!==null){if(f===u.current)throw Error(r(177));if(z=f.lanes|f.childLanes,z|=Da,lt(u,y,z,ce,Ne,rt),u===or&&(wr=or=null,_r=0),Yp=f,Nl=u,mc=y,Kp=z,Zp=D,Ym=M,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,$(ke,function(){return mx(),null})):(u.callbackNode=null,u.callbackPriority=0),M=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||M){M=q.T,q.T=null,D=Y.p,Y.p=2,ce=Un,Un|=4;try{HE(u,f,y)}finally{Un=ce,Y.p=D,q.T=M}}Ci=1,ua(),Td(),Uh()}}function ua(){if(Ci===1){Ci=0;var u=Nl,f=Yp,y=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||y){y=q.T,q.T=null;var M=Y.p;Y.p=2;var D=Un;Un|=4;try{gf(f,u);var z=YE,ce=Ji(u.containerInfo),Ne=z.focusedElem,rt=z.selectionRange;if(ce!==Ne&&Ne&&Ne.ownerDocument&&qn(Ne.ownerDocument.documentElement,Ne)){if(rt!==null&&Is(Ne)){var Tt=rt.start,Ot=rt.end;if(Ot===void 0&&(Ot=Tt),"selectionStart"in Ne)Ne.selectionStart=Tt,Ne.selectionEnd=Math.min(Ot,Ne.value.length);else{var Ut=Ne.ownerDocument||document,At=Ut&&Ut.defaultView||window;if(At.getSelection){var It=At.getSelection(),kn=Ne.textContent.length,Jn=Math.min(rt.start,kn),Xi=rt.end===void 0?Jn:Math.min(rt.end,kn);!It.extend&&Jn>Xi&&(ce=Xi,Xi=Jn,Jn=ce);var mt=Nn(Ne,Jn),ut=Nn(Ne,Xi);if(mt&&ut&&(It.rangeCount!==1||It.anchorNode!==mt.node||It.anchorOffset!==mt.offset||It.focusNode!==ut.node||It.focusOffset!==ut.offset)){var Mt=Ut.createRange();Mt.setStart(mt.node,mt.offset),It.removeAllRanges(),Jn>Xi?(It.addRange(Mt),It.extend(ut.node,ut.offset)):(Mt.setEnd(ut.node,ut.offset),It.addRange(Mt))}}}}for(Ut=[],It=Ne;It=It.parentNode;)It.nodeType===1&&Ut.push({element:It,left:It.scrollLeft,top:It.scrollTop});for(typeof Ne.focus=="function"&&Ne.focus(),Ne=0;Ne<Ut.length;Ne++){var Ft=Ut[Ne];Ft.element.scrollLeft=Ft.left,Ft.element.scrollTop=Ft.top}}I3=!!XE,YE=XE=null}finally{Un=D,Y.p=M,q.T=y}}u.current=f,Ci=2}}function Td(){if(Ci===2){Ci=0;var u=Nl,f=Yp,y=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||y){y=q.T,q.T=null;var M=Y.p;Y.p=2;var D=Un;Un|=4;try{us(u,f.alternate,f)}finally{Un=D,Y.p=M,q.T=y}}Ci=3}}function Uh(){if(Ci===4||Ci===3){Ci=0,oe();var u=Nl,f=Yp,y=mc,M=Ym;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?Ci=5:(Ci=0,Yp=Nl=null,Ru(u,u.pendingLanes));var D=u.pendingLanes;if(D===0&&(Ys=null),wt(y),f=f.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(Ie,f,void 0,(f.current.flags&128)===128)}catch{}if(M!==null){f=q.T,D=Y.p,Y.p=2,q.T=null;try{for(var z=u.onRecoverableError,ce=0;ce<M.length;ce++){var Ne=M[ce];z(Ne.value,{componentStack:Ne.stack})}}finally{q.T=f,Y.p=D}}(mc&3)!==0&&e0(),qt(u),D=u.pendingLanes,(y&261930)!==0&&(D&42)!==0?u===jh?bf++:(bf=0,jh=u):bf=0,yn(0)}}function Ru(u,f){(u.pooledCacheLanes&=f)===0&&(f=u.pooledCache,f!=null&&(u.pooledCache=null,bh(f)))}function e0(){return ua(),Td(),Uh(),mx()}function mx(){if(Ci!==5)return!1;var u=Nl,f=Kp;Kp=0;var y=wt(mc),M=q.T,D=Y.p;try{Y.p=32>y?32:y,q.T=null,y=Zp,Zp=null;var z=Nl,ce=mc;if(Ci=0,Yp=Nl=null,mc=0,(Un&6)!==0)throw Error(r(331));var Ne=Un;if(Un|=4,el(z.current),Tb(z,z.current,ce,y),Un=Ne,yn(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ie,z)}catch{}return!0}finally{Y.p=D,q.T=M,Ru(u,f)}}function Ab(u,f,y){f=Sl(y,f),f=xb(u.stateNode,f,2),u=uf(u,f,2),u!==null&&(yt(u,2),qt(u))}function ai(u,f,y){if(u.tag===3)Ab(u,u,y);else for(;f!==null;){if(f.tag===3){Ab(f,u,y);break}else if(f.tag===1){var M=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof M.componentDidCatch=="function"&&(Ys===null||!Ys.has(M))){u=Sl(y,u),y=yb(2),M=uf(f,y,2),M!==null&&(y3(y,M,f,u),yt(M,2),qt(M));break}}f=f.return}}function Jm(u,f,y){var M=u.pingCache;if(M===null){M=u.pingCache=new vr;var D=new Set;M.set(f,D)}else D=M.get(f),D===void 0&&(D=new Set,M.set(f,D));D.has(y)||(Eb=!0,D.add(y),u=m.bind(null,u,f,y),f.then(u,u))}function m(u,f,y){var M=u.pingCache;M!==null&&M.delete(f),u.pingedLanes|=u.suspendedLanes&y,u.warmLanes&=~y,or===u&&(_r&y)===y&&(Ms===4||Ms===3&&(_r&62914560)===_r&&300>te()-Xp?(Un&2)===0&&Sf(u,0):Xm|=y,es===_r&&(es=0)),qt(u)}function x(u,f){f===0&&(f=He()),u=Co(u,f),u!==null&&(yt(u,f),qt(u))}function C(u){var f=u.memoizedState,y=0;f!==null&&(y=f.retryLane),x(u,y)}function k(u,f){var y=0;switch(u.tag){case 31:case 13:var M=u.stateNode,D=u.memoizedState;D!==null&&(y=D.retryLane);break;case 19:M=u.stateNode;break;case 22:M=u.stateNode._retryCache;break;default:throw Error(r(314))}M!==null&&M.delete(f),x(u,y)}function $(u,f){return Ae(u,f)}var ee=null,Ce=null,at=!1,Dt=!1,Wt=!1,ln=0;function qt(u){u!==Ce&&u.next===null&&(Ce===null?ee=Ce=u:Ce=Ce.next=u),Dt=!0,at||(at=!0,vt())}function yn(u,f){if(!Wt&&Dt){Wt=!0;do for(var y=!1,M=ee;M!==null;){if(u!==0){var D=M.pendingLanes;if(D===0)var z=0;else{var ce=M.suspendedLanes,Ne=M.pingedLanes;z=(1<<31-Me(42|u)+1)-1,z&=D&~(ce&~Ne),z=z&201326741?z&201326741|1:z?z|2:0}z!==0&&(y=!0,Ct(M,z))}else z=_r,z=Ze(M,M===or?z:0,M.cancelPendingCommit!==null||M.timeoutHandle!==-1),(z&3)===0||me(M,z)||(y=!0,Ct(M,z));M=M.next}while(y);Wt=!1}}function dr(){Ks()}function Ks(){Dt=at=!1;var u=0;ln!==0&&pZ()&&(u=ln);for(var f=te(),y=null,M=ee;M!==null;){var D=M.next,z=t0(M,f);z===0?(M.next=null,y===null?ee=D:y.next=D,D===null&&(Ce=y)):(y=M,(u!==0||(z&3)!==0)&&(Dt=!0)),M=D}Ci!==0&&Ci!==5||yn(u),ln!==0&&(ln=0)}function t0(u,f){for(var y=u.suspendedLanes,M=u.pingedLanes,D=u.expirationTimes,z=u.pendingLanes&-62914561;0<z;){var ce=31-Me(z),Ne=1<<ce,rt=D[ce];rt===-1?((Ne&y)===0||(Ne&M)!==0)&&(D[ce]=je(Ne,f)):rt<=f&&(u.expiredLanes|=Ne),z&=~Ne}if(f=or,y=_r,y=Ze(u,u===f?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),M=u.callbackNode,y===0||u===f&&(Yr===2||Yr===9)||u.cancelPendingCommit!==null)return M!==null&&M!==null&&Pe(M),u.callbackNode=null,u.callbackPriority=0;if((y&3)===0||me(u,y)){if(f=y&-y,f===u.callbackPriority)return f;switch(M!==null&&Pe(M),wt(y)){case 2:case 8:y=ye;break;case 32:y=ke;break;case 268435456:y=ge;break;default:y=ke}return M=Tf.bind(null,u),y=Ae(y,M),u.callbackPriority=f,u.callbackNode=y,f}return M!==null&&M!==null&&Pe(M),u.callbackPriority=2,u.callbackNode=null,2}function Tf(u,f){if(Ci!==0&&Ci!==5)return u.callbackNode=null,u.callbackPriority=0,null;var y=u.callbackNode;if(e0()&&u.callbackNode!==y)return null;var M=_r;return M=Ze(u,u===or?M:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),M===0?null:(Ir(u,M,f),t0(u,te()),u.callbackNode!=null&&u.callbackNode===y?Tf.bind(null,u):null)}function Ct(u,f){if(e0())return null;Ir(u,f,!0)}function vt(){gZ(function(){(Un&6)!==0?Ae(ve,dr):Ks()})}function kt(){if(ln===0){var u=pd;u===0&&(u=st,st<<=1,(st&261888)===0&&(st=256)),ln=u}return ln}function tn(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:uo(""+u)}function Xn(u,f){var y=f.ownerDocument.createElement("input");return y.name=f.name,y.value=f.value,u.id&&y.setAttribute("form",u.id),f.parentNode.insertBefore(y,f),u=new FormData(u),y.parentNode.removeChild(y),u}function Cs(u,f,y,M,D){if(f==="submit"&&y&&y.stateNode===D){var z=tn((D[Dn]||null).action),ce=M.submitter;ce&&(f=(f=ce[Dn]||null)?tn(f.formAction):ce.getAttribute("formAction"),f!==null&&(z=f,ce=null));var Ne=new Ii("action","action",null,M,D);u.push({event:Ne,listeners:[{instance:null,listener:function(){if(M.defaultPrevented){if(ln!==0){var rt=ce?Xn(D,ce):new FormData(D);ub(y,{pending:!0,data:rt,method:D.method,action:z},null,rt)}}else typeof z=="function"&&(Ne.preventDefault(),rt=ce?Xn(D,ce):new FormData(D),ub(y,{pending:!0,data:rt,method:D.method,action:z},z,rt))},currentTarget:D}]})}}for(var Kn=0;Kn<Cm.length;Kn++){var ti=Cm[Kn],ja=ti.toLowerCase(),fi=ti[0].toUpperCase()+ti.slice(1);tc(ja,"on"+fi)}tc(aa,"onAnimationEnd"),tc(xa,"onAnimationIteration"),tc(Oc,"onAnimationStart"),tc("dblclick","onDoubleClick"),tc("focusin","onFocus"),tc("focusout","onBlur"),tc(Pa,"onTransitionRun"),tc(Av,"onTransitionStart"),tc(Nw,"onTransitionCancel"),tc(Oy,"onTransitionEnd"),Yt("onMouseEnter",["mouseout","mouseover"]),Yt("onMouseLeave",["mouseout","mouseover"]),Yt("onPointerEnter",["pointerout","pointerover"]),Yt("onPointerLeave",["pointerout","pointerover"]),gt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gt("onBeforeInput",["compositionend","keypress","textInput","paste"]),gt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),VE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gc));function W9(u,f){f=(f&4)!==0;for(var y=0;y<u.length;y++){var M=u[y],D=M.event;M=M.listeners;e:{var z=void 0;if(f)for(var ce=M.length-1;0<=ce;ce--){var Ne=M[ce],rt=Ne.instance,Tt=Ne.currentTarget;if(Ne=Ne.listener,rt!==z&&D.isPropagationStopped())break e;z=Ne,D.currentTarget=Tt;try{z(D)}catch(Ot){Am(Ot)}D.currentTarget=null,z=rt}else for(ce=0;ce<M.length;ce++){if(Ne=M[ce],rt=Ne.instance,Tt=Ne.currentTarget,Ne=Ne.listener,rt!==z&&D.isPropagationStopped())break e;z=Ne,D.currentTarget=Tt;try{z(D)}catch(Ot){Am(Ot)}D.currentTarget=null,z=rt}}}}function Kr(u,f){var y=f[pn];y===void 0&&(y=f[pn]=new Set);var M=u+"__bubble";y.has(M)||($9(f,u,2,!1),y.add(M))}function GE(u,f,y){var M=0;f&&(M|=4),$9(y,u,M,f)}var T3="_reactListening"+Math.random().toString(36).slice(2);function WE(u){if(!u[T3]){u[T3]=!0,_t.forEach(function(y){y!=="selectionchange"&&(VE.has(y)||GE(y,!1,u),GE(y,!0,u))});var f=u.nodeType===9?u:u.ownerDocument;f===null||f[T3]||(f[T3]=!0,GE("selectionchange",!1,f))}}function $9(u,f,y,M){switch(_P(f)){case 2:var D=LZ;break;case 8:D=zZ;break;default:D=aC}y=D.bind(null,f,y,u),D=void 0,!Na||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(D=!0),M?D!==void 0?u.addEventListener(f,y,{capture:!0,passive:D}):u.addEventListener(f,y,!0):D!==void 0?u.addEventListener(f,y,{passive:D}):u.addEventListener(f,y,!1)}function $E(u,f,y,M,D){var z=M;if((f&1)===0&&(f&2)===0&&M!==null)e:for(;;){if(M===null)return;var ce=M.tag;if(ce===3||ce===4){var Ne=M.stateNode.containerInfo;if(Ne===D)break;if(ce===4)for(ce=M.return;ce!==null;){var rt=ce.tag;if((rt===3||rt===4)&&ce.stateNode.containerInfo===D)return;ce=ce.return}for(;Ne!==null;){if(ce=jn(Ne),ce===null)return;if(rt=ce.tag,rt===5||rt===6||rt===26||rt===27){M=z=ce;continue e}Ne=Ne.parentNode}}M=M.return}Yl(function(){var Tt=z,Ot=Go(y),Ut=[];e:{var At=ec.get(u);if(At!==void 0){var It=Ii,kn=u;switch(u){case"keypress":if(ei(y)===0)break e;case"keydown":case"keyup":It=sd;break;case"focusin":kn="focus",It=fo;break;case"focusout":kn="blur",It=fo;break;case"beforeblur":case"afterblur":It=fo;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":It=vh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":It=rd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":It=bm;break;case aa:case xa:case Oc:It=Hs;break;case Oy:It=_m;break;case"scroll":case"scrollend":It=To;break;case"wheel":It=Sm;break;case"copy":case"cut":case"paste":It=_l;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":It=Ql;break;case"toggle":case"beforetoggle":It=Mm}var Jn=(f&4)!==0,Xi=!Jn&&(u==="scroll"||u==="scrollend"),mt=Jn?At!==null?At+"Capture":null:At;Jn=[];for(var ut=Tt,Mt;ut!==null;){var Ft=ut;if(Mt=Ft.stateNode,Ft=Ft.tag,Ft!==5&&Ft!==26&&Ft!==27||Mt===null||mt===null||(Ft=qa(ut,mt),Ft!=null&&Jn.push(Nb(ut,Ft,Mt))),Xi)break;ut=ut.return}0<Jn.length&&(At=new It(At,kn,null,y,Ot),Ut.push({event:At,listeners:Jn}))}}if((f&7)===0){e:{if(At=u==="mouseover"||u==="pointerover",It=u==="mouseout"||u==="pointerout",At&&y!==Xl&&(kn=y.relatedTarget||y.fromElement)&&(jn(kn)||kn[Vt]))break e;if((It||At)&&(At=Ot.window===Ot?Ot:(At=Ot.ownerDocument)?At.defaultView||At.parentWindow:window,It?(kn=y.relatedTarget||y.toElement,It=Tt,kn=kn?jn(kn):null,kn!==null&&(Xi=s(kn),Jn=kn.tag,kn!==Xi||Jn!==5&&Jn!==27&&Jn!==6)&&(kn=null)):(It=null,kn=Tt),It!==kn)){if(Jn=vh,Ft="onMouseLeave",mt="onMouseEnter",ut="mouse",(u==="pointerout"||u==="pointerover")&&(Jn=Ql,Ft="onPointerLeave",mt="onPointerEnter",ut="pointer"),Xi=It==null?At:ui(It),Mt=kn==null?At:ui(kn),At=new Jn(Ft,ut+"leave",It,y,Ot),At.target=Xi,At.relatedTarget=Mt,Ft=null,jn(Ot)===Tt&&(Jn=new Jn(mt,ut+"enter",kn,y,Ot),Jn.target=Mt,Jn.relatedTarget=Xi,Ft=Jn),Xi=Ft,It&&kn)t:{for(Jn=cZ,mt=It,ut=kn,Mt=0,Ft=mt;Ft;Ft=Jn(Ft))Mt++;Ft=0;for(var Wn=ut;Wn;Wn=Jn(Wn))Ft++;for(;0<Mt-Ft;)mt=Jn(mt),Mt--;for(;0<Ft-Mt;)ut=Jn(ut),Ft--;for(;Mt--;){if(mt===ut||ut!==null&&mt===ut.alternate){Jn=mt;break t}mt=Jn(mt),ut=Jn(ut)}Jn=null}else Jn=null;It!==null&&q9(Ut,At,It,Jn,!1),kn!==null&&Xi!==null&&q9(Ut,Xi,kn,Jn,!0)}}e:{if(At=Tt?ui(Tt):window,It=At.nodeName&&At.nodeName.toLowerCase(),It==="select"||It==="input"&&At.type==="file")var _i=Ue;else if(cd(At))if(qe)_i=er;else{_i=vn;var zn=mn}else It=At.nodeName,!It||It.toLowerCase()!=="input"||At.type!=="checkbox"&&At.type!=="radio"?Tt&&So(Tt.elementType)&&(_i=Ue):_i=_n;if(_i&&(_i=_i(u,Tt))){Rp(Ut,_i,y,Ot);break e}zn&&zn(u,At,Tt),u==="focusout"&&Tt&&At.type==="number"&&Tt.memoizedProps.value!=null&&Pi(At,"number",At.value)}switch(zn=Tt?ui(Tt):window,u){case"focusin":(cd(zn)||zn.contentEditable==="true")&&(si=zn,as=Tt,Os=null);break;case"focusout":Os=as=si=null;break;case"mousedown":Ya=!0;break;case"contextmenu":case"mouseup":case"dragend":Ya=!1,Ra(Ut,y,Ot);break;case"selectionchange":if(pi)break;case"keydown":case"keyup":Ra(Ut,y,Ot)}var Rr;if(uu)e:{switch(u){case"compositionstart":var ni="onCompositionStart";break e;case"compositionend":ni="onCompositionEnd";break e;case"compositionupdate":ni="onCompositionUpdate";break e}ni=void 0}else du?ld(u,y)&&(ni="onCompositionEnd"):u==="keydown"&&y.keyCode===229&&(ni="onCompositionStart");ni&&(Ap&&y.locale!=="ko"&&(du||ni!=="onCompositionStart"?ni==="onCompositionEnd"&&du&&(Rr=Dc()):(xs=Ot,Wo="value"in xs?xs.value:xs.textContent,du=!0)),zn=E3(Tt,ni),0<zn.length&&(ni=new wp(ni,u,null,y,Ot),Ut.push({event:ni,listeners:zn}),Rr?ni.data=Rr:(Rr=Ds(y),Rr!==null&&(ni.data=Rr)))),(Rr=Cp?bs(u,y):Np(u,y))&&(ni=E3(Tt,"onBeforeInput"),0<ni.length&&(zn=new wp("onBeforeInput","beforeinput",null,y,Ot),Ut.push({event:zn,listeners:ni}),zn.data=Rr)),Cs(Ut,u,Tt,y,Ot)}W9(Ut,f)})}function Nb(u,f,y){return{instance:u,listener:f,currentTarget:y}}function E3(u,f){for(var y=f+"Capture",M=[];u!==null;){var D=u,z=D.stateNode;if(D=D.tag,D!==5&&D!==26&&D!==27||z===null||(D=qa(u,y),D!=null&&M.unshift(Nb(u,D,z)),D=qa(u,f),D!=null&&M.push(Nb(u,D,z))),u.tag===3)return M;u=u.return}return[]}function cZ(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function q9(u,f,y,M,D){for(var z=f._reactName,ce=[];y!==null&&y!==M;){var Ne=y,rt=Ne.alternate,Tt=Ne.stateNode;if(Ne=Ne.tag,rt!==null&&rt===M)break;Ne!==5&&Ne!==26&&Ne!==27||Tt===null||(rt=Tt,D?(Tt=qa(y,z),Tt!=null&&ce.unshift(Nb(y,Tt,rt))):D||(Tt=qa(y,z),Tt!=null&&ce.push(Nb(y,Tt,rt)))),y=y.return}ce.length!==0&&u.push({event:f,listeners:ce})}var uZ=/\r\n?/g,dZ=/\u0000|\uFFFD/g;function X9(u){return(typeof u=="string"?u:""+u).replace(uZ,`
`).replace(dZ,"")}function Y9(u,f){return f=X9(f),X9(u)===f}function qi(u,f,y,M,D,z){switch(y){case"children":typeof M=="string"?f==="body"||f==="textarea"&&M===""||ks(u,M):(typeof M=="number"||typeof M=="bigint")&&f!=="body"&&ks(u,""+M);break;case"className":$n(u,"class",M);break;case"tabIndex":$n(u,"tabindex",M);break;case"dir":case"role":case"viewBox":case"width":case"height":$n(u,y,M);break;case"style":co(u,M,z);break;case"data":if(f!=="object"){$n(u,"data",M);break}case"src":case"href":if(M===""&&(f!=="a"||y!=="href")){u.removeAttribute(y);break}if(M==null||typeof M=="function"||typeof M=="symbol"||typeof M=="boolean"){u.removeAttribute(y);break}M=uo(""+M),u.setAttribute(y,M);break;case"action":case"formAction":if(typeof M=="function"){u.setAttribute(y,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof z=="function"&&(y==="formAction"?(f!=="input"&&qi(u,f,"name",D.name,D,null),qi(u,f,"formEncType",D.formEncType,D,null),qi(u,f,"formMethod",D.formMethod,D,null),qi(u,f,"formTarget",D.formTarget,D,null)):(qi(u,f,"encType",D.encType,D,null),qi(u,f,"method",D.method,D,null),qi(u,f,"target",D.target,D,null)));if(M==null||typeof M=="symbol"||typeof M=="boolean"){u.removeAttribute(y);break}M=uo(""+M),u.setAttribute(y,M);break;case"onClick":M!=null&&(u.onclick=Ps);break;case"onScroll":M!=null&&Kr("scroll",u);break;case"onScrollEnd":M!=null&&Kr("scrollend",u);break;case"dangerouslySetInnerHTML":if(M!=null){if(typeof M!="object"||!("__html"in M))throw Error(r(61));if(y=M.__html,y!=null){if(D.children!=null)throw Error(r(60));u.innerHTML=y}}break;case"multiple":u.multiple=M&&typeof M!="function"&&typeof M!="symbol";break;case"muted":u.muted=M&&typeof M!="function"&&typeof M!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(M==null||typeof M=="function"||typeof M=="boolean"||typeof M=="symbol"){u.removeAttribute("xlink:href");break}y=uo(""+M),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":M!=null&&typeof M!="function"&&typeof M!="symbol"?u.setAttribute(y,""+M):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":M&&typeof M!="function"&&typeof M!="symbol"?u.setAttribute(y,""):u.removeAttribute(y);break;case"capture":case"download":M===!0?u.setAttribute(y,""):M!==!1&&M!=null&&typeof M!="function"&&typeof M!="symbol"?u.setAttribute(y,M):u.removeAttribute(y);break;case"cols":case"rows":case"size":case"span":M!=null&&typeof M!="function"&&typeof M!="symbol"&&!isNaN(M)&&1<=M?u.setAttribute(y,M):u.removeAttribute(y);break;case"rowSpan":case"start":M==null||typeof M=="function"||typeof M=="symbol"||isNaN(M)?u.removeAttribute(y):u.setAttribute(y,M);break;case"popover":Kr("beforetoggle",u),Kr("toggle",u),Fn(u,"popover",M);break;case"xlinkActuate":on(u,"http://www.w3.org/1999/xlink","xlink:actuate",M);break;case"xlinkArcrole":on(u,"http://www.w3.org/1999/xlink","xlink:arcrole",M);break;case"xlinkRole":on(u,"http://www.w3.org/1999/xlink","xlink:role",M);break;case"xlinkShow":on(u,"http://www.w3.org/1999/xlink","xlink:show",M);break;case"xlinkTitle":on(u,"http://www.w3.org/1999/xlink","xlink:title",M);break;case"xlinkType":on(u,"http://www.w3.org/1999/xlink","xlink:type",M);break;case"xmlBase":on(u,"http://www.w3.org/XML/1998/namespace","xml:base",M);break;case"xmlLang":on(u,"http://www.w3.org/XML/1998/namespace","xml:lang",M);break;case"xmlSpace":on(u,"http://www.w3.org/XML/1998/namespace","xml:space",M);break;case"is":Fn(u,"is",M);break;case"innerText":case"textContent":break;default:(!(2<y.length)||y[0]!=="o"&&y[0]!=="O"||y[1]!=="n"&&y[1]!=="N")&&(y=ql.get(y)||y,Fn(u,y,M))}}function qE(u,f,y,M,D,z){switch(y){case"style":co(u,M,z);break;case"dangerouslySetInnerHTML":if(M!=null){if(typeof M!="object"||!("__html"in M))throw Error(r(61));if(y=M.__html,y!=null){if(D.children!=null)throw Error(r(60));u.innerHTML=y}}break;case"children":typeof M=="string"?ks(u,M):(typeof M=="number"||typeof M=="bigint")&&ks(u,""+M);break;case"onScroll":M!=null&&Kr("scroll",u);break;case"onScrollEnd":M!=null&&Kr("scrollend",u);break;case"onClick":M!=null&&(u.onclick=Ps);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xt.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(D=y.endsWith("Capture"),f=y.slice(2,D?y.length-7:void 0),z=u[Dn]||null,z=z!=null?z[y]:null,typeof z=="function"&&u.removeEventListener(f,z,D),typeof M=="function")){typeof z!="function"&&z!==null&&(y in u?u[y]=null:u.hasAttribute(y)&&u.removeAttribute(y)),u.addEventListener(f,M,D);break e}y in u?u[y]=M:M===!0?u.setAttribute(y,""):Fn(u,y,M)}}}function Io(u,f,y){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Kr("error",u),Kr("load",u);var M=!1,D=!1,z;for(z in y)if(y.hasOwnProperty(z)){var ce=y[z];if(ce!=null)switch(z){case"src":M=!0;break;case"srcSet":D=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:qi(u,f,z,ce,y,null)}}D&&qi(u,f,"srcSet",y.srcSet,y,null),M&&qi(u,f,"src",y.src,y,null);return;case"input":Kr("invalid",u);var Ne=z=ce=D=null,rt=null,Tt=null;for(M in y)if(y.hasOwnProperty(M)){var Ot=y[M];if(Ot!=null)switch(M){case"name":D=Ot;break;case"type":ce=Ot;break;case"checked":rt=Ot;break;case"defaultChecked":Tt=Ot;break;case"value":z=Ot;break;case"defaultValue":Ne=Ot;break;case"children":case"dangerouslySetInnerHTML":if(Ot!=null)throw Error(r(137,f));break;default:qi(u,f,M,Ot,y,null)}}Rs(u,z,Ne,rt,Tt,ce,D,!1);return;case"select":Kr("invalid",u),M=ce=z=null;for(D in y)if(y.hasOwnProperty(D)&&(Ne=y[D],Ne!=null))switch(D){case"value":z=Ne;break;case"defaultValue":ce=Ne;break;case"multiple":M=Ne;default:qi(u,f,D,Ne,y,null)}f=z,y=ce,u.multiple=!!M,f!=null?vs(u,!!M,f,!1):y!=null&&vs(u,!!M,y,!0);return;case"textarea":Kr("invalid",u),z=D=M=null;for(ce in y)if(y.hasOwnProperty(ce)&&(Ne=y[ce],Ne!=null))switch(ce){case"value":M=Ne;break;case"defaultValue":D=Ne;break;case"children":z=Ne;break;case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(r(91));break;default:qi(u,f,ce,Ne,y,null)}di(u,M,D,z);return;case"option":for(rt in y)if(y.hasOwnProperty(rt)&&(M=y[rt],M!=null))switch(rt){case"selected":u.selected=M&&typeof M!="function"&&typeof M!="symbol";break;default:qi(u,f,rt,M,y,null)}return;case"dialog":Kr("beforetoggle",u),Kr("toggle",u),Kr("cancel",u),Kr("close",u);break;case"iframe":case"object":Kr("load",u);break;case"video":case"audio":for(M=0;M<gc.length;M++)Kr(gc[M],u);break;case"image":Kr("error",u),Kr("load",u);break;case"details":Kr("toggle",u);break;case"embed":case"source":case"link":Kr("error",u),Kr("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(Tt in y)if(y.hasOwnProperty(Tt)&&(M=y[Tt],M!=null))switch(Tt){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:qi(u,f,Tt,M,y,null)}return;default:if(So(f)){for(Ot in y)y.hasOwnProperty(Ot)&&(M=y[Ot],M!==void 0&&qE(u,f,Ot,M,y,void 0));return}}for(Ne in y)y.hasOwnProperty(Ne)&&(M=y[Ne],M!=null&&qi(u,f,Ne,M,y,null))}function fZ(u,f,y,M){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var D=null,z=null,ce=null,Ne=null,rt=null,Tt=null,Ot=null;for(It in y){var Ut=y[It];if(y.hasOwnProperty(It)&&Ut!=null)switch(It){case"checked":break;case"value":break;case"defaultValue":rt=Ut;default:M.hasOwnProperty(It)||qi(u,f,It,null,M,Ut)}}for(var At in M){var It=M[At];if(Ut=y[At],M.hasOwnProperty(At)&&(It!=null||Ut!=null))switch(At){case"type":z=It;break;case"name":D=It;break;case"checked":Tt=It;break;case"defaultChecked":Ot=It;break;case"value":ce=It;break;case"defaultValue":Ne=It;break;case"children":case"dangerouslySetInnerHTML":if(It!=null)throw Error(r(137,f));break;default:It!==Ut&&qi(u,f,At,It,M,Ut)}}gs(u,ce,Ne,rt,Tt,Ot,z,D);return;case"select":It=ce=Ne=At=null;for(z in y)if(rt=y[z],y.hasOwnProperty(z)&&rt!=null)switch(z){case"value":break;case"multiple":It=rt;default:M.hasOwnProperty(z)||qi(u,f,z,null,M,rt)}for(D in M)if(z=M[D],rt=y[D],M.hasOwnProperty(D)&&(z!=null||rt!=null))switch(D){case"value":At=z;break;case"defaultValue":Ne=z;break;case"multiple":ce=z;default:z!==rt&&qi(u,f,D,z,M,rt)}f=Ne,y=ce,M=It,At!=null?vs(u,!!y,At,!1):!!M!=!!y&&(f!=null?vs(u,!!y,f,!0):vs(u,!!y,y?[]:"",!1));return;case"textarea":It=At=null;for(Ne in y)if(D=y[Ne],y.hasOwnProperty(Ne)&&D!=null&&!M.hasOwnProperty(Ne))switch(Ne){case"value":break;case"children":break;default:qi(u,f,Ne,null,M,D)}for(ce in M)if(D=M[ce],z=y[ce],M.hasOwnProperty(ce)&&(D!=null||z!=null))switch(ce){case"value":At=D;break;case"defaultValue":It=D;break;case"children":break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(r(91));break;default:D!==z&&qi(u,f,ce,D,M,z)}pr(u,At,It);return;case"option":for(var kn in y)if(At=y[kn],y.hasOwnProperty(kn)&&At!=null&&!M.hasOwnProperty(kn))switch(kn){case"selected":u.selected=!1;break;default:qi(u,f,kn,null,M,At)}for(rt in M)if(At=M[rt],It=y[rt],M.hasOwnProperty(rt)&&At!==It&&(At!=null||It!=null))switch(rt){case"selected":u.selected=At&&typeof At!="function"&&typeof At!="symbol";break;default:qi(u,f,rt,At,M,It)}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 Jn in y)At=y[Jn],y.hasOwnProperty(Jn)&&At!=null&&!M.hasOwnProperty(Jn)&&qi(u,f,Jn,null,M,At);for(Tt in M)if(At=M[Tt],It=y[Tt],M.hasOwnProperty(Tt)&&At!==It&&(At!=null||It!=null))switch(Tt){case"children":case"dangerouslySetInnerHTML":if(At!=null)throw Error(r(137,f));break;default:qi(u,f,Tt,At,M,It)}return;default:if(So(f)){for(var Xi in y)At=y[Xi],y.hasOwnProperty(Xi)&&At!==void 0&&!M.hasOwnProperty(Xi)&&qE(u,f,Xi,void 0,M,At);for(Ot in M)At=M[Ot],It=y[Ot],!M.hasOwnProperty(Ot)||At===It||At===void 0&&It===void 0||qE(u,f,Ot,At,M,It);return}}for(var mt in y)At=y[mt],y.hasOwnProperty(mt)&&At!=null&&!M.hasOwnProperty(mt)&&qi(u,f,mt,null,M,At);for(Ut in M)At=M[Ut],It=y[Ut],!M.hasOwnProperty(Ut)||At===It||At==null&&It==null||qi(u,f,Ut,At,M,It)}function K9(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function hZ(){if(typeof performance.getEntriesByType=="function"){for(var u=0,f=0,y=performance.getEntriesByType("resource"),M=0;M<y.length;M++){var D=y[M],z=D.transferSize,ce=D.initiatorType,Ne=D.duration;if(z&&Ne&&K9(ce)){for(ce=0,Ne=D.responseEnd,M+=1;M<y.length;M++){var rt=y[M],Tt=rt.startTime;if(Tt>Ne)break;var Ot=rt.transferSize,Ut=rt.initiatorType;Ot&&K9(Ut)&&(rt=rt.responseEnd,ce+=Ot*(rt<Ne?1:(Ne-Tt)/(rt-Tt)))}if(--M,f+=8*(z+ce)/(D.duration/1e3),u++,10<u)break}}if(0<u)return f/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var XE=null,YE=null;function C3(u){return u.nodeType===9?u:u.ownerDocument}function Z9(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 Q9(u,f){if(u===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&f==="foreignObject"?0:u}function KE(u,f){return u==="textarea"||u==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var ZE=null;function pZ(){var u=window.event;return u&&u.type==="popstate"?u===ZE?!1:(ZE=u,!0):(ZE=null,!1)}var J9=typeof setTimeout=="function"?setTimeout:void 0,mZ=typeof clearTimeout=="function"?clearTimeout:void 0,eP=typeof Promise=="function"?Promise:void 0,gZ=typeof queueMicrotask=="function"?queueMicrotask:typeof eP<"u"?function(u){return eP.resolve(null).then(u).catch(vZ)}:J9;function vZ(u){setTimeout(function(){throw u})}function n0(u){return u==="head"}function tP(u,f){var y=f,M=0;do{var D=y.nextSibling;if(u.removeChild(y),D&&D.nodeType===8)if(y=D.data,y==="/$"||y==="/&"){if(M===0){u.removeChild(D),yx(f);return}M--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")M++;else if(y==="html")Rb(u.ownerDocument.documentElement);else if(y==="head"){y=u.ownerDocument.head,Rb(y);for(var z=y.firstChild;z;){var ce=z.nextSibling,Ne=z.nodeName;z[wn]||Ne==="SCRIPT"||Ne==="STYLE"||Ne==="LINK"&&z.rel.toLowerCase()==="stylesheet"||y.removeChild(z),z=ce}}else y==="body"&&Rb(u.ownerDocument.body);y=D}while(y);yx(f)}function nP(u,f){var y=u;u=0;do{var M=y.nextSibling;if(y.nodeType===1?f?(y._stashedDisplay=y.style.display,y.style.display="none"):(y.style.display=y._stashedDisplay||"",y.getAttribute("style")===""&&y.removeAttribute("style")):y.nodeType===3&&(f?(y._stashedText=y.nodeValue,y.nodeValue=""):y.nodeValue=y._stashedText||""),M&&M.nodeType===8)if(y=M.data,y==="/$"){if(u===0)break;u--}else y!=="$"&&y!=="$?"&&y!=="$~"&&y!=="$!"||u++;y=M}while(y)}function QE(u){var f=u.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var y=f;switch(f=f.nextSibling,y.nodeName){case"HTML":case"HEAD":case"BODY":QE(y),On(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}u.removeChild(y)}}function xZ(u,f,y,M){for(;u.nodeType===1;){var D=y;if(u.nodeName.toLowerCase()!==f.toLowerCase()){if(!M&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(M){if(!u[wn])switch(f){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(z=u.getAttribute("rel"),z==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(z!==D.rel||u.getAttribute("href")!==(D.href==null||D.href===""?null:D.href)||u.getAttribute("crossorigin")!==(D.crossOrigin==null?null:D.crossOrigin)||u.getAttribute("title")!==(D.title==null?null:D.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(z=u.getAttribute("src"),(z!==(D.src==null?null:D.src)||u.getAttribute("type")!==(D.type==null?null:D.type)||u.getAttribute("crossorigin")!==(D.crossOrigin==null?null:D.crossOrigin))&&z&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(f==="input"&&u.type==="hidden"){var z=D.name==null?null:""+D.name;if(D.type==="hidden"&&u.getAttribute("name")===z)return u}else return u;if(u=ku(u.nextSibling),u===null)break}return null}function yZ(u,f,y){if(f==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!y||(u=ku(u.nextSibling),u===null))return null;return u}function rP(u,f){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!f||(u=ku(u.nextSibling),u===null))return null;return u}function JE(u){return u.data==="$?"||u.data==="$~"}function eC(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function bZ(u,f){var y=u.ownerDocument;if(u.data==="$~")u._reactRetry=f;else if(u.data!=="$?"||y.readyState!=="loading")f();else{var M=function(){f(),y.removeEventListener("DOMContentLoaded",M)};y.addEventListener("DOMContentLoaded",M),u._reactRetry=M}}function ku(u){for(;u!=null;u=u.nextSibling){var f=u.nodeType;if(f===1||f===3)break;if(f===8){if(f=u.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;if(f==="/$"||f==="/&")return null}}return u}var tC=null;function iP(u){u=u.nextSibling;for(var f=0;u;){if(u.nodeType===8){var y=u.data;if(y==="/$"||y==="/&"){if(f===0)return ku(u.nextSibling);f--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||f++}u=u.nextSibling}return null}function sP(u){u=u.previousSibling;for(var f=0;u;){if(u.nodeType===8){var y=u.data;if(y==="$"||y==="$!"||y==="$?"||y==="$~"||y==="&"){if(f===0)return u;f--}else y!=="/$"&&y!=="/&"||f++}u=u.previousSibling}return null}function aP(u,f,y){switch(f=C3(y),u){case"html":if(u=f.documentElement,!u)throw Error(r(452));return u;case"head":if(u=f.head,!u)throw Error(r(453));return u;case"body":if(u=f.body,!u)throw Error(r(454));return u;default:throw Error(r(451))}}function Rb(u){for(var f=u.attributes;f.length;)u.removeAttributeNode(f[0]);On(u)}var Pu=new Map,oP=new Set;function A3(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Bh=Y.d;Y.d={f:_Z,r:SZ,D:wZ,C:MZ,L:TZ,m:EZ,X:AZ,S:CZ,M:NZ};function _Z(){var u=Bh.f(),f=Uc();return u||f}function SZ(u){var f=Bi(u);f!==null&&f.tag===5&&f.type==="form"?u3(f):Bh.r(u)}var gx=typeof document>"u"?null:document;function lP(u,f,y){var M=gx;if(M&&typeof f=="string"&&f){var D=Rn(f);D='link[rel="'+u+'"][href="'+D+'"]',typeof y=="string"&&(D+='[crossorigin="'+y+'"]'),oP.has(D)||(oP.add(D),u={rel:u,crossOrigin:y,href:f},M.querySelector(D)===null&&(f=M.createElement("link"),Io(f,"link",u),ot(f),M.head.appendChild(f)))}}function wZ(u){Bh.D(u),lP("dns-prefetch",u,null)}function MZ(u,f){Bh.C(u,f),lP("preconnect",u,f)}function TZ(u,f,y){Bh.L(u,f,y);var M=gx;if(M&&u&&f){var D='link[rel="preload"][as="'+Rn(f)+'"]';f==="image"&&y&&y.imageSrcSet?(D+='[imagesrcset="'+Rn(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(D+='[imagesizes="'+Rn(y.imageSizes)+'"]')):D+='[href="'+Rn(u)+'"]';var z=D;switch(f){case"style":z=vx(u);break;case"script":z=xx(u)}Pu.has(z)||(u=h({rel:"preload",href:f==="image"&&y&&y.imageSrcSet?void 0:u,as:f},y),Pu.set(z,u),M.querySelector(D)!==null||f==="style"&&M.querySelector(kb(z))||f==="script"&&M.querySelector(Pb(z))||(f=M.createElement("link"),Io(f,"link",u),ot(f),M.head.appendChild(f)))}}function EZ(u,f){Bh.m(u,f);var y=gx;if(y&&u){var M=f&&typeof f.as=="string"?f.as:"script",D='link[rel="modulepreload"][as="'+Rn(M)+'"][href="'+Rn(u)+'"]',z=D;switch(M){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":z=xx(u)}if(!Pu.has(z)&&(u=h({rel:"modulepreload",href:u},f),Pu.set(z,u),y.querySelector(D)===null)){switch(M){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(Pb(z)))return}M=y.createElement("link"),Io(M,"link",u),ot(M),y.head.appendChild(M)}}}function CZ(u,f,y){Bh.S(u,f,y);var M=gx;if(M&&u){var D=be(M).hoistableStyles,z=vx(u);f=f||"default";var ce=D.get(z);if(!ce){var Ne={loading:0,preload:null};if(ce=M.querySelector(kb(z)))Ne.loading=5;else{u=h({rel:"stylesheet",href:u,"data-precedence":f},y),(y=Pu.get(z))&&nC(u,y);var rt=ce=M.createElement("link");ot(rt),Io(rt,"link",u),rt._p=new Promise(function(Tt,Ot){rt.onload=Tt,rt.onerror=Ot}),rt.addEventListener("load",function(){Ne.loading|=1}),rt.addEventListener("error",function(){Ne.loading|=2}),Ne.loading|=4,N3(ce,f,M)}ce={type:"stylesheet",instance:ce,count:1,state:Ne},D.set(z,ce)}}}function AZ(u,f){Bh.X(u,f);var y=gx;if(y&&u){var M=be(y).hoistableScripts,D=xx(u),z=M.get(D);z||(z=y.querySelector(Pb(D)),z||(u=h({src:u,async:!0},f),(f=Pu.get(D))&&rC(u,f),z=y.createElement("script"),ot(z),Io(z,"link",u),y.head.appendChild(z)),z={type:"script",instance:z,count:1,state:null},M.set(D,z))}}function NZ(u,f){Bh.M(u,f);var y=gx;if(y&&u){var M=be(y).hoistableScripts,D=xx(u),z=M.get(D);z||(z=y.querySelector(Pb(D)),z||(u=h({src:u,async:!0,type:"module"},f),(f=Pu.get(D))&&rC(u,f),z=y.createElement("script"),ot(z),Io(z,"link",u),y.head.appendChild(z)),z={type:"script",instance:z,count:1,state:null},M.set(D,z))}}function cP(u,f,y,M){var D=(D=ie.current)?A3(D):null;if(!D)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof y.precedence=="string"&&typeof y.href=="string"?(f=vx(y.href),y=be(D).hoistableStyles,M=y.get(f),M||(M={type:"style",instance:null,count:0,state:null},y.set(f,M)),M):{type:"void",instance:null,count:0,state:null};case"link":if(y.rel==="stylesheet"&&typeof y.href=="string"&&typeof y.precedence=="string"){u=vx(y.href);var z=be(D).hoistableStyles,ce=z.get(u);if(ce||(D=D.ownerDocument||D,ce={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},z.set(u,ce),(z=D.querySelector(kb(u)))&&!z._p&&(ce.instance=z,ce.state.loading=5),Pu.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},Pu.set(u,y),z||RZ(D,u,y,ce.state))),f&&M===null)throw Error(r(528,""));return ce}if(f&&M!==null)throw Error(r(529,""));return null;case"script":return f=y.async,y=y.src,typeof y=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=xx(y),y=be(D).hoistableScripts,M=y.get(f),M||(M={type:"script",instance:null,count:0,state:null},y.set(f,M)),M):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function vx(u){return'href="'+Rn(u)+'"'}function kb(u){return'link[rel="stylesheet"]['+u+"]"}function uP(u){return h({},u,{"data-precedence":u.precedence,precedence:null})}function RZ(u,f,y,M){u.querySelector('link[rel="preload"][as="style"]['+f+"]")?M.loading=1:(f=u.createElement("link"),M.preload=f,f.addEventListener("load",function(){return M.loading|=1}),f.addEventListener("error",function(){return M.loading|=2}),Io(f,"link",y),ot(f),u.head.appendChild(f))}function xx(u){return'[src="'+Rn(u)+'"]'}function Pb(u){return"script[async]"+u}function dP(u,f,y){if(f.count++,f.instance===null)switch(f.type){case"style":var M=u.querySelector('style[data-href~="'+Rn(y.href)+'"]');if(M)return f.instance=M,ot(M),M;var D=h({},y,{"data-href":y.href,"data-precedence":y.precedence,href:null,precedence:null});return M=(u.ownerDocument||u).createElement("style"),ot(M),Io(M,"style",D),N3(M,y.precedence,u),f.instance=M;case"stylesheet":D=vx(y.href);var z=u.querySelector(kb(D));if(z)return f.state.loading|=4,f.instance=z,ot(z),z;M=uP(y),(D=Pu.get(D))&&nC(M,D),z=(u.ownerDocument||u).createElement("link"),ot(z);var ce=z;return ce._p=new Promise(function(Ne,rt){ce.onload=Ne,ce.onerror=rt}),Io(z,"link",M),f.state.loading|=4,N3(z,y.precedence,u),f.instance=z;case"script":return z=xx(y.src),(D=u.querySelector(Pb(z)))?(f.instance=D,ot(D),D):(M=y,(D=Pu.get(z))&&(M=h({},y),rC(M,D)),u=u.ownerDocument||u,D=u.createElement("script"),ot(D),Io(D,"link",M),u.head.appendChild(D),f.instance=D);case"void":return null;default:throw Error(r(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(M=f.instance,f.state.loading|=4,N3(M,y.precedence,u));return f.instance}function N3(u,f,y){for(var M=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),D=M.length?M[M.length-1]:null,z=D,ce=0;ce<M.length;ce++){var Ne=M[ce];if(Ne.dataset.precedence===f)z=Ne;else if(z!==D)break}z?z.parentNode.insertBefore(u,z.nextSibling):(f=y.nodeType===9?y.head:y,f.insertBefore(u,f.firstChild))}function nC(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.title==null&&(u.title=f.title)}function rC(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.integrity==null&&(u.integrity=f.integrity)}var R3=null;function fP(u,f,y){if(R3===null){var M=new Map,D=R3=new Map;D.set(y,M)}else D=R3,M=D.get(y),M||(M=new Map,D.set(y,M));if(M.has(u))return M;for(M.set(u,null),y=y.getElementsByTagName(u),D=0;D<y.length;D++){var z=y[D];if(!(z[wn]||z[an]||u==="link"&&z.getAttribute("rel")==="stylesheet")&&z.namespaceURI!=="http://www.w3.org/2000/svg"){var ce=z.getAttribute(f)||"";ce=u+ce;var Ne=M.get(ce);Ne?Ne.push(z):M.set(ce,[z])}}return M}function hP(u,f,y){u=u.ownerDocument||u,u.head.insertBefore(y,f==="title"?u.querySelector("head > title"):null)}function kZ(u,f,y){if(y===1||f.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return u=f.disabled,typeof f.precedence=="string"&&u==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function pP(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function PZ(u,f,y,M){if(y.type==="stylesheet"&&(typeof M.media!="string"||matchMedia(M.media).matches!==!1)&&(y.state.loading&4)===0){if(y.instance===null){var D=vx(M.href),z=f.querySelector(kb(D));if(z){f=z._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(u.count++,u=k3.bind(u),f.then(u,u)),y.state.loading|=4,y.instance=z,ot(z);return}z=f.ownerDocument||f,M=uP(M),(D=Pu.get(D))&&nC(M,D),z=z.createElement("link"),ot(z);var ce=z;ce._p=new Promise(function(Ne,rt){ce.onload=Ne,ce.onerror=rt}),Io(z,"link",M),y.instance=z}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(y,f),(f=y.state.preload)&&(y.state.loading&3)===0&&(u.count++,y=k3.bind(u),f.addEventListener("load",y),f.addEventListener("error",y))}}var iC=0;function DZ(u,f){return u.stylesheets&&u.count===0&&D3(u,u.stylesheets),0<u.count||0<u.imgCount?function(y){var M=setTimeout(function(){if(u.stylesheets&&D3(u,u.stylesheets),u.unsuspend){var z=u.unsuspend;u.unsuspend=null,z()}},6e4+f);0<u.imgBytes&&iC===0&&(iC=62500*hZ());var D=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&D3(u,u.stylesheets),u.unsuspend)){var z=u.unsuspend;u.unsuspend=null,z()}},(u.imgBytes>iC?50:800)+f);return u.unsuspend=y,function(){u.unsuspend=null,clearTimeout(M),clearTimeout(D)}}:null}function k3(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)D3(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var P3=null;function D3(u,f){u.stylesheets=null,u.unsuspend!==null&&(u.count++,P3=new Map,f.forEach(IZ,u),P3=null,k3.call(u))}function IZ(u,f){if(!(f.state.loading&4)){var y=P3.get(u);if(y)var M=y.get(null);else{y=new Map,P3.set(u,y);for(var D=u.querySelectorAll("link[data-precedence],style[data-precedence]"),z=0;z<D.length;z++){var ce=D[z];(ce.nodeName==="LINK"||ce.getAttribute("media")!=="not all")&&(y.set(ce.dataset.precedence,ce),M=ce)}M&&y.set(null,M)}D=f.instance,ce=D.getAttribute("data-precedence"),z=y.get(ce)||M,z===M&&y.set(null,D),y.set(ce,D),this.count++,M=k3.bind(this),D.addEventListener("load",M),D.addEventListener("error",M),z?z.parentNode.insertBefore(D,z.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(D,u.firstChild)),f.state.loading|=4}}var Db={$$typeof:A,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function OZ(u,f,y,M,D,z,ce,Ne,rt){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=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=M,this.onUncaughtError=D,this.onCaughtError=z,this.onRecoverableError=ce,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=rt,this.incompleteTransitions=new Map}function mP(u,f,y,M,D,z,ce,Ne,rt,Tt,Ot,Ut){return u=new OZ(u,f,y,ce,rt,Tt,Ot,Ut,Ne),f=1,z===!0&&(f|=24),z=_s(3,null,null,f),u.current=z,z.stateNode=u,f=zy(),f.refCount++,u.pooledCache=f,f.refCount++,z.memoizedState={element:M,isDehydrated:y,cache:f},Om(z),u}function gP(u){return u?(u=tf,u):tf}function vP(u,f,y,M,D,z){D=gP(D),M.context===null?M.context=D:M.pendingContext=D,M=gd(f),M.payload={element:y},z=z===void 0?null:z,z!==null&&(M.callback=z),y=uf(u,M,f),y!==null&&(Mr(y,u,f),df(y,u,f))}function xP(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var y=u.retryLane;u.retryLane=y!==0&&y<f?y:f}}function sC(u,f){xP(u,f),(u=u.alternate)&&xP(u,f)}function yP(u){if(u.tag===13||u.tag===31){var f=Co(u,67108864);f!==null&&Mr(f,u,67108864),sC(u,67108864)}}function bP(u){if(u.tag===13||u.tag===31){var f=Rl();f=Ve(f);var y=Co(u,f);y!==null&&Mr(y,u,f),sC(u,f)}}var I3=!0;function LZ(u,f,y,M){var D=q.T;q.T=null;var z=Y.p;try{Y.p=2,aC(u,f,y,M)}finally{Y.p=z,q.T=D}}function zZ(u,f,y,M){var D=q.T;q.T=null;var z=Y.p;try{Y.p=8,aC(u,f,y,M)}finally{Y.p=z,q.T=D}}function aC(u,f,y,M){if(I3){var D=oC(M);if(D===null)$E(u,f,M,O3,y),SP(u,M);else if(FZ(D,u,f,y,M))M.stopPropagation();else if(SP(u,M),f&4&&-1<jZ.indexOf(u)){for(;D!==null;){var z=Bi(D);if(z!==null)switch(z.tag){case 3:if(z=z.stateNode,z.current.memoizedState.isDehydrated){var ce=et(z.pendingLanes);if(ce!==0){var Ne=z;for(Ne.pendingLanes|=2,Ne.entangledLanes|=2;ce;){var rt=1<<31-Me(ce);Ne.entanglements[1]|=rt,ce&=~rt}qt(z),(Un&6)===0&&(Xs=te()+500,yn(0))}}break;case 31:case 13:Ne=Co(z,2),Ne!==null&&Mr(Ne,z,2),Uc(),sC(z,2)}if(z=oC(M),z===null&&$E(u,f,M,O3,y),z===D)break;D=z}D!==null&&M.stopPropagation()}else $E(u,f,M,null,y)}}function oC(u){return u=Go(u),lC(u)}var O3=null;function lC(u){if(O3=null,u=jn(u),u!==null){var f=s(u);if(f===null)u=null;else{var y=f.tag;if(y===13){if(u=a(f),u!==null)return u;u=null}else if(y===31){if(u=o(f),u!==null)return u;u=null}else if(y===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;u=null}else f!==u&&(u=null)}}return O3=u,null}function _P(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(_e()){case ve:return 2;case ye:return 8;case ke:case Be:return 32;case ge:return 268435456;default:return 32}default:return 32}}var cC=!1,r0=null,i0=null,s0=null,Ib=new Map,Ob=new Map,a0=[],jZ="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 SP(u,f){switch(u){case"focusin":case"focusout":r0=null;break;case"dragenter":case"dragleave":i0=null;break;case"mouseover":case"mouseout":s0=null;break;case"pointerover":case"pointerout":Ib.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ob.delete(f.pointerId)}}function Lb(u,f,y,M,D,z){return u===null||u.nativeEvent!==z?(u={blockedOn:f,domEventName:y,eventSystemFlags:M,nativeEvent:z,targetContainers:[D]},f!==null&&(f=Bi(f),f!==null&&yP(f)),u):(u.eventSystemFlags|=M,f=u.targetContainers,D!==null&&f.indexOf(D)===-1&&f.push(D),u)}function FZ(u,f,y,M,D){switch(f){case"focusin":return r0=Lb(r0,u,f,y,M,D),!0;case"dragenter":return i0=Lb(i0,u,f,y,M,D),!0;case"mouseover":return s0=Lb(s0,u,f,y,M,D),!0;case"pointerover":var z=D.pointerId;return Ib.set(z,Lb(Ib.get(z)||null,u,f,y,M,D)),!0;case"gotpointercapture":return z=D.pointerId,Ob.set(z,Lb(Ob.get(z)||null,u,f,y,M,D)),!0}return!1}function wP(u){var f=jn(u.target);if(f!==null){var y=s(f);if(y!==null){if(f=y.tag,f===13){if(f=a(y),f!==null){u.blockedOn=f,zt(u.priority,function(){bP(y)});return}}else if(f===31){if(f=o(y),f!==null){u.blockedOn=f,zt(u.priority,function(){bP(y)});return}}else if(f===3&&y.stateNode.current.memoizedState.isDehydrated){u.blockedOn=y.tag===3?y.stateNode.containerInfo:null;return}}}u.blockedOn=null}function L3(u){if(u.blockedOn!==null)return!1;for(var f=u.targetContainers;0<f.length;){var y=oC(u.nativeEvent);if(y===null){y=u.nativeEvent;var M=new y.constructor(y.type,y);Xl=M,y.target.dispatchEvent(M),Xl=null}else return f=Bi(y),f!==null&&yP(f),u.blockedOn=y,!1;f.shift()}return!0}function MP(u,f,y){L3(u)&&y.delete(f)}function UZ(){cC=!1,r0!==null&&L3(r0)&&(r0=null),i0!==null&&L3(i0)&&(i0=null),s0!==null&&L3(s0)&&(s0=null),Ib.forEach(MP),Ob.forEach(MP)}function z3(u,f){u.blockedOn===f&&(u.blockedOn=null,cC||(cC=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,UZ)))}var j3=null;function TP(u){j3!==u&&(j3=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){j3===u&&(j3=null);for(var f=0;f<u.length;f+=3){var y=u[f],M=u[f+1],D=u[f+2];if(typeof M!="function"){if(lC(M||y)===null)continue;break}var z=Bi(y);z!==null&&(u.splice(f,3),f-=3,ub(z,{pending:!0,data:D,method:y.method,action:M},M,D))}}))}function yx(u){function f(rt){return z3(rt,u)}r0!==null&&z3(r0,u),i0!==null&&z3(i0,u),s0!==null&&z3(s0,u),Ib.forEach(f),Ob.forEach(f);for(var y=0;y<a0.length;y++){var M=a0[y];M.blockedOn===u&&(M.blockedOn=null)}for(;0<a0.length&&(y=a0[0],y.blockedOn===null);)wP(y),y.blockedOn===null&&a0.shift();if(y=(u.ownerDocument||u).$$reactFormReplay,y!=null)for(M=0;M<y.length;M+=3){var D=y[M],z=y[M+1],ce=D[Dn]||null;if(typeof z=="function")ce||TP(y);else if(ce){var Ne=null;if(z&&z.hasAttribute("formAction")){if(D=z,ce=z[Dn]||null)Ne=ce.formAction;else if(lC(D)!==null)continue}else Ne=ce.action;typeof Ne=="function"?y[M+1]=Ne:(y.splice(M,3),M-=3),TP(y)}}}function EP(){function u(z){z.canIntercept&&z.info==="react-transition"&&z.intercept({handler:function(){return new Promise(function(ce){return D=ce})},focusReset:"manual",scroll:"manual"})}function f(){D!==null&&(D(),D=null),M||setTimeout(y,20)}function y(){if(!M&&!navigation.transition){var z=navigation.currentEntry;z&&z.url!=null&&navigation.navigate(z.url,{state:z.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var M=!1,D=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(y,100),function(){M=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),D!==null&&(D(),D=null)}}}function uC(u){this._internalRoot=u}F3.prototype.render=uC.prototype.render=function(u){var f=this._internalRoot;if(f===null)throw Error(r(409));var y=f.current,M=Rl();vP(y,M,u,f,null,null)},F3.prototype.unmount=uC.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var f=u.containerInfo;vP(u.current,2,null,u,null,null),Uc(),f[Vt]=null}};function F3(u){this._internalRoot=u}F3.prototype.unstable_scheduleHydration=function(u){if(u){var f=Et();u={blockedOn:null,target:u,priority:f};for(var y=0;y<a0.length&&f!==0&&f<a0[y].priority;y++);a0.splice(y,0,u),y===0&&wP(u)}};var CP=e.version;if(CP!=="19.2.1")throw Error(r(527,CP,"19.2.1"));Y.findDOMNode=function(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(r(188)):(u=Object.keys(u).join(","),Error(r(268,u)));return u=c(f),u=u!==null?d(u):null,u=u===null?null:u.stateNode,u};var BZ={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var U3=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!U3.isDisabled&&U3.supportsFiber)try{Ie=U3.inject(BZ),Fe=U3}catch{}}return jb.createRoot=function(u,f){if(!i(u))throw Error(r(299));var y=!1,M="",D=v3,z=gb,ce=vb;return f!=null&&(f.unstable_strictMode===!0&&(y=!0),f.identifierPrefix!==void 0&&(M=f.identifierPrefix),f.onUncaughtError!==void 0&&(D=f.onUncaughtError),f.onCaughtError!==void 0&&(z=f.onCaughtError),f.onRecoverableError!==void 0&&(ce=f.onRecoverableError)),f=mP(u,1,!1,null,null,y,M,null,D,z,ce,EP),u[Vt]=f.current,WE(u),new uC(f)},jb.hydrateRoot=function(u,f,y){if(!i(u))throw Error(r(299));var M=!1,D="",z=v3,ce=gb,Ne=vb,rt=null;return y!=null&&(y.unstable_strictMode===!0&&(M=!0),y.identifierPrefix!==void 0&&(D=y.identifierPrefix),y.onUncaughtError!==void 0&&(z=y.onUncaughtError),y.onCaughtError!==void 0&&(ce=y.onCaughtError),y.onRecoverableError!==void 0&&(Ne=y.onRecoverableError),y.formState!==void 0&&(rt=y.formState)),f=mP(u,1,!0,f,y??null,M,D,rt,z,ce,Ne,EP),f.context=gP(null),y=f.current,M=Rl(),M=Ve(M),D=gd(M),D.callback=null,uf(y,D,M),y=M,f.current.lanes=y,yt(f,y),qt(f),u[Vt]=f.current,WE(u),new F3(f)},jb.version="19.2.1",jb}var jP;function KZ(){if(jP)return pC.exports;jP=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(),pC.exports=YZ(),pC.exports}var IF=KZ();/**
 * 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 FP="popstate";function UP(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function ZZ(t={}){function e(r,i){var c;let s=(c=i.state)==null?void 0:c.masked,{pathname:a,search:o,hash:l}=s||r.location;return X6("",{pathname:a,search:o,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:q_(i)}return JZ(e,n,null,t)}function na(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Vd(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function QZ(){return Math.random().toString(36).substring(2,10)}function BP(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 X6(t,e,n=null,r,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?uy(e):e,state:n,key:e&&e.key||r||QZ(),unstable_mask:i}}function q_({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 uy(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 JZ(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,a=i.history,o="POP",l=null,c=d();c==null&&(c=0,a.replaceState({...a.state,idx:c},""));function d(){return(a.state||{idx:null}).idx}function h(){o="POP";let w=d(),S=w==null?null:w-c;c=w,l&&l({action:o,location:_.location,delta:S})}function g(w,S){o="PUSH";let E=UP(w)?w:X6(_.location,w,S);c=d()+1;let A=BP(E,c),N=_.createHref(E.unstable_mask||E);try{a.pushState(A,"",N)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(N)}s&&l&&l({action:o,location:_.location,delta:1})}function v(w,S){o="REPLACE";let E=UP(w)?w:X6(_.location,w,S);c=d();let A=BP(E,c),N=_.createHref(E.unstable_mask||E);a.replaceState(A,"",N),s&&l&&l({action:o,location:_.location,delta:0})}function b(w){return eQ(w)}let _={get action(){return o},get location(){return t(i,a)},listen(w){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(FP,h),l=w,()=>{i.removeEventListener(FP,h),l=null}},createHref(w){return e(i,w)},createURL:b,encodeLocation(w){let S=b(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:g,replace:v,go(w){return a.go(w)}};return _}function eQ(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),na(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:q_(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function OF(t,e,n="/"){return tQ(t,e,n,!1)}function tQ(t,e,n,r){let i=typeof e=="string"?uy(e):e,s=up(i.pathname||"/",n);if(s==null)return null;let a=LF(t);nQ(a);let o=null;for(let l=0;o==null&&l<a.length;++l){let c=hQ(s);o=dQ(a[l],c,r)}return o}function LF(t,e=[],n=[],r="",i=!1){let s=(a,o,l=i,c)=>{let d={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;na(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let h=Qf([r,d.relativePath]),g=n.concat(d);a.children&&a.children.length>0&&(na(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),LF(a.children,e,g,h,l)),!(a.path==null&&!a.index)&&e.push({path:h,score:cQ(h,a.index),routesMeta:g})};return t.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))s(a,o);else for(let c of zF(a.path))s(a,o,!0,c)}),e}function zF(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 a=zF(r.join("/")),o=[];return o.push(...a.map(l=>l===""?s:[s,l].join("/"))),i&&o.push(...a),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function nQ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:uQ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var rQ=/^:[\w-]+$/,iQ=3,sQ=2,aQ=1,oQ=10,lQ=-2,HP=t=>t==="*";function cQ(t,e){let n=t.split("/"),r=n.length;return n.some(HP)&&(r+=lQ),e&&(r+=sQ),n.filter(i=>!HP(i)).reduce((i,s)=>i+(rQ.test(s)?iQ:s===""?aQ:oQ),r)}function uQ(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function dQ(t,e,n=!1){let{routesMeta:r}=t,i={},s="/",a=[];for(let o=0;o<r.length;++o){let l=r[o],c=o===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",h=$M({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),g=l.route;if(!h&&c&&n&&!r[r.length-1].route.index&&(h=$M({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!h)return null;Object.assign(i,h.params),a.push({params:i,pathname:Qf([s,h.pathname]),pathnameBase:vQ(Qf([s,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(s=Qf([s,h.pathnameBase]))}return a}function $M(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=fQ(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],a=s.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:h},g)=>{if(d==="*"){let b=o[g]||"";a=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const v=o[g];return h&&!v?c[d]=void 0:c[d]=(v||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:a,pattern:t}}function fQ(t,e=!1,n=!0){Vd(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,(a,o,l,c,d)=>{if(r.push({paramName:o,isOptional:l!=null}),l){let h=d.charAt(c+a.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 hQ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Vd(!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 up(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 pQ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function mQ(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?uy(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=VP(n.substring(1),"/"):s=VP(n,e)):s=e,{pathname:s,search:xQ(r),hash:yQ(i)}}function VP(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 xC(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 gQ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function jF(t){let e=gQ(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function y7(t,e,n,r=!1){let i;typeof t=="string"?i=uy(t):(i={...t},na(!i.pathname||!i.pathname.includes("?"),xC("?","pathname","search",i)),na(!i.pathname||!i.pathname.includes("#"),xC("#","pathname","hash",i)),na(!i.search||!i.search.includes("#"),xC("#","search","hash",i)));let s=t===""||i.pathname==="",a=s?"/":i.pathname,o;if(a==null)o=n;else{let h=e.length-1;if(!r&&a.startsWith("..")){let g=a.split("/");for(;g[0]==="..";)g.shift(),h-=1;i.pathname=g.join("/")}o=h>=0?e[h]:"/"}let l=mQ(i,o),c=a&&a!=="/"&&a.endsWith("/"),d=(s||a===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var Qf=t=>t.join("/").replace(/\/\/+/g,"/"),vQ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),xQ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,yQ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,bQ=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function _Q(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function SQ(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var FF=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function UF(t,e){let n=t;if(typeof n!="string"||!pQ.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(FF)try{let s=new URL(window.location.href),a=n.startsWith("//")?new URL(s.protocol+n):new URL(n),o=up(a.pathname,e);a.origin===s.origin&&o!=null?n=o+a.search+a.hash:i=!0}catch{Vd(!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 BF=["POST","PUT","PATCH","DELETE"];new Set(BF);var wQ=["GET",...BF];new Set(wQ);var dy=T.createContext(null);dy.displayName="DataRouter";var R5=T.createContext(null);R5.displayName="DataRouterState";var MQ=T.createContext(!1),HF=T.createContext({isTransitioning:!1});HF.displayName="ViewTransition";var TQ=T.createContext(new Map);TQ.displayName="Fetchers";var EQ=T.createContext(null);EQ.displayName="Await";var Zu=T.createContext(null);Zu.displayName="Navigation";var WS=T.createContext(null);WS.displayName="Location";var gp=T.createContext({outlet:null,matches:[],isDataRoute:!1});gp.displayName="Route";var b7=T.createContext(null);b7.displayName="RouteError";var VF="REACT_ROUTER_ERROR",CQ="REDIRECT",AQ="ROUTE_ERROR_RESPONSE";function NQ(t){if(t.startsWith(`${VF}:${CQ}:{`))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 RQ(t){if(t.startsWith(`${VF}:${AQ}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new bQ(e.status,e.statusText,e.data)}catch{}}function kQ(t,{relative:e}={}){na($S(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=T.useContext(Zu),{hash:i,pathname:s,search:a}=qS(t,{relative:e}),o=s;return n!=="/"&&(o=s==="/"?n:Qf([n,s])),r.createHref({pathname:o,search:a,hash:i})}function $S(){return T.useContext(WS)!=null}function ch(){return na($S(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(WS).location}var GF="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function WF(t){T.useContext(Zu).static||T.useLayoutEffect(t)}function k5(){let{isDataRoute:t}=T.useContext(gp);return t?GQ():PQ()}function PQ(){na($S(),"useNavigate() may be used only in the context of a <Router> component.");let t=T.useContext(dy),{basename:e,navigator:n}=T.useContext(Zu),{matches:r}=T.useContext(gp),{pathname:i}=ch(),s=JSON.stringify(jF(r)),a=T.useRef(!1);return WF(()=>{a.current=!0}),T.useCallback((l,c={})=>{if(Vd(a.current,GF),!a.current)return;if(typeof l=="number"){n.go(l);return}let d=y7(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Qf([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,i,t])}T.createContext(null);function qS(t,{relative:e}={}){let{matches:n}=T.useContext(gp),{pathname:r}=ch(),i=JSON.stringify(jF(n));return T.useMemo(()=>y7(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function DQ(t,e){return $F(t,e)}function $F(t,e,n){var w;na($S(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=T.useContext(Zu),{matches:i}=T.useContext(gp),s=i[i.length-1],a=s?s.params:{},o=s?s.pathname:"/",l=s?s.pathnameBase:"/",c=s&&s.route;{let S=c&&c.path||"";XF(o,!c||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${S}">) 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="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let d=ch(),h;if(e){let S=typeof e=="string"?uy(e):e;na(l==="/"||((w=S.pathname)==null?void 0:w.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 "${S.pathname}" was given in the \`location\` prop.`),h=S}else h=d;let g=h.pathname||"/",v=g;if(l!=="/"){let S=l.replace(/^\//,"").split("/");v="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let b=OF(t,{pathname:v});Vd(c||b!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),Vd(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 "${h.pathname}${h.search}${h.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 _=jQ(b&&b.map(S=>Object.assign({},S,{params:Object.assign({},a,S.params),pathname:Qf([l,r.encodeLocation?r.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?l:Qf([l,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),i,n);return e&&_?T.createElement(WS.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},_):_}function IQ(){let t=VQ(),e=_Q(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},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:s},"ErrorBoundary")," or"," ",T.createElement("code",{style:s},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},e),n?T.createElement("pre",{style:i},n):null,a)}var OQ=T.createElement(IQ,null),qF=class extends T.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=RQ(t.digest);n&&(t=n)}let e=t!==void 0?T.createElement(gp.Provider,{value:this.props.routeContext},T.createElement(b7.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?T.createElement(LQ,{error:t},e):e}};qF.contextType=MQ;var yC=new WeakMap;function LQ({children:t,error:e}){let{basename:n}=T.useContext(Zu);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=NQ(e.digest);if(r){let i=yC.get(e);if(i)throw i;let s=UF(r.location,n);if(FF&&!yC.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw yC.set(e,a),a}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function zQ({routeContext:t,match:e,children:n}){let r=T.useContext(dy);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),T.createElement(gp.Provider,{value:t},n)}function jQ(t,e=[],n){let r=n==null?void 0:n.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,s=r==null?void 0:r.errors;if(s!=null){let d=i.findIndex(h=>h.route.id&&(s==null?void 0:s[h.route.id])!==void 0);na(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let a=!1,o=-1;if(n&&r){a=r.renderFallback;for(let d=0;d<i.length;d++){let h=i[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(o=d),h.route.id){let{loaderData:g,errors:v}=r,b=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!v||v[h.route.id]===void 0);if(h.route.lazy||b){n.isStatic&&(a=!0),o>=0?i=i.slice(0,o+1):i=[i[0]];break}}}}let l=n==null?void 0:n.onError,c=r&&l?(d,h)=>{var g,v;l(d,{location:r.location,params:((v=(g=r.matches)==null?void 0:g[0])==null?void 0:v.params)??{},unstable_pattern:SQ(r.matches),errorInfo:h})}:void 0;return i.reduceRight((d,h,g)=>{let v,b=!1,_=null,w=null;r&&(v=s&&h.route.id?s[h.route.id]:void 0,_=h.route.errorElement||OQ,a&&(o<0&&g===0?(XF("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,w=null):o===g&&(b=!0,w=h.route.hydrateFallbackElement||null)));let S=e.concat(i.slice(0,g+1)),E=()=>{let A;return v?A=_:b?A=w:h.route.Component?A=T.createElement(h.route.Component,null):h.route.element?A=h.route.element:A=d,T.createElement(zQ,{match:h,routeContext:{outlet:d,matches:S,isDataRoute:r!=null},children:A})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?T.createElement(qF,{location:r.location,revalidation:r.revalidation,component:_,error:v,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:c}):E()},null)}function _7(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function FQ(t){let e=T.useContext(dy);return na(e,_7(t)),e}function UQ(t){let e=T.useContext(R5);return na(e,_7(t)),e}function BQ(t){let e=T.useContext(gp);return na(e,_7(t)),e}function S7(t){let e=BQ(t),n=e.matches[e.matches.length-1];return na(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function HQ(){return S7("useRouteId")}function VQ(){var r;let t=T.useContext(b7),e=UQ("useRouteError"),n=S7("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function GQ(){let{router:t}=FQ("useNavigate"),e=S7("useNavigate"),n=T.useRef(!1);return WF(()=>{n.current=!0}),T.useCallback(async(i,s={})=>{Vd(n.current,GF),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var GP={};function XF(t,e,n){!e&&!GP[t]&&(GP[t]=!0,Vd(!1,n))}T.memo(WQ);function WQ({routes:t,future:e,state:n,isStatic:r,onError:i}){return $F(t,void 0,{state:n,isStatic:r,onError:i})}function If(t){na(!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 $Q({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:a}){na(!$S(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=t.replace(/^\/*/,"/"),l=T.useMemo(()=>({basename:o,navigator:i,static:s,unstable_useTransitions:a,future:{}}),[o,i,s,a]);typeof n=="string"&&(n=uy(n));let{pathname:c="/",search:d="",hash:h="",state:g=null,key:v="default",unstable_mask:b}=n,_=T.useMemo(()=>{let w=up(c,o);return w==null?null:{location:{pathname:w,search:d,hash:h,state:g,key:v,unstable_mask:b},navigationType:r}},[o,c,d,h,g,v,r,b]);return Vd(_!=null,`<Router basename="${o}"> is not able to match the URL "${c}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:T.createElement(Zu.Provider,{value:l},T.createElement(WS.Provider,{children:e,value:_}))}function qQ({children:t,location:e}){return DQ(Y6(t),e)}function Y6(t,e=[]){let n=[];return T.Children.forEach(t,(r,i)=>{if(!T.isValidElement(r))return;let s=[...e,i];if(r.type===T.Fragment){n.push.apply(n,Y6(r.props.children,s));return}na(r.type===If,`[${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>`),na(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={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&&(a.children=Y6(r.props.children,s)),n.push(a)}),n}var NM="get",RM="application/x-www-form-urlencoded";function P5(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function XQ(t){return P5(t)&&t.tagName.toLowerCase()==="button"}function YQ(t){return P5(t)&&t.tagName.toLowerCase()==="form"}function KQ(t){return P5(t)&&t.tagName.toLowerCase()==="input"}function ZQ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function QQ(t,e){return t.button===0&&(!e||e==="_self")&&!ZQ(t)}function K6(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 JQ(t,e){let n=K6(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var H3=null;function eJ(){if(H3===null)try{new FormData(document.createElement("form"),0),H3=!1}catch{H3=!0}return H3}var tJ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function bC(t){return t!=null&&!tJ.has(t)?(Vd(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${RM}"`),null):t}function nJ(t,e){let n,r,i,s,a;if(YQ(t)){let o=t.getAttribute("action");r=o?up(o,e):null,n=t.getAttribute("method")||NM,i=bC(t.getAttribute("enctype"))||RM,s=new FormData(t)}else if(XQ(t)||KQ(t)&&(t.type==="submit"||t.type==="image")){let o=t.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||o.getAttribute("action");if(r=l?up(l,e):null,n=t.getAttribute("formmethod")||o.getAttribute("method")||NM,i=bC(t.getAttribute("formenctype"))||bC(o.getAttribute("enctype"))||RM,s=new FormData(o,t),!eJ()){let{name:c,type:d,value:h}=t;if(d==="image"){let g=c?`${c}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else c&&s.append(c,h)}}else{if(P5(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=NM,r=null,i=RM,a=t}return s&&i==="text/plain"&&(a=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function w7(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function rJ(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&&up(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function iJ(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 sJ(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 aJ(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let a=await iJ(s,n);return a.links?a.links():[]}return[]}));return uJ(r.flat(1).filter(sJ).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 a=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,o=(l,c)=>{var d;return n[c].pathname!==l.pathname||((d=n[c].route.path)==null?void 0:d.endsWith("*"))&&n[c].params["*"]!==l.params["*"]};return s==="assets"?e.filter((l,c)=>a(l,c)||o(l,c)):s==="data"?e.filter((l,c)=>{var h;let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(a(l,c)||o(l,c))return!0;if(l.route.shouldRevalidate){let g=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((h=n[0])==null?void 0:h.params)||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function oJ(t,e,{includeHydrateFallback:n}={}){return lJ(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 lJ(t){return[...new Set(t)]}function cJ(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function uJ(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(cJ(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function YF(){let t=T.useContext(dy);return w7(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function dJ(){let t=T.useContext(R5);return w7(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var M7=T.createContext(void 0);M7.displayName="FrameworkContext";function KF(){let t=T.useContext(M7);return w7(t,"You must render this element inside a <HydratedRouter> element"),t}function fJ(t,e){let n=T.useContext(M7),[r,i]=T.useState(!1),[s,a]=T.useState(!1),{onFocus:o,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:h}=e,g=T.useRef(null);T.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let _=S=>{S.forEach(E=>{a(E.isIntersecting)})},w=new IntersectionObserver(_,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[t]),T.useEffect(()=>{if(r){let _=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(_)}}},[r]);let v=()=>{i(!0)},b=()=>{i(!1),a(!1)};return n?t!=="intent"?[s,g,{}]:[s,g,{onFocus:Fb(o,v),onBlur:Fb(l,b),onMouseEnter:Fb(c,v),onMouseLeave:Fb(d,b),onTouchStart:Fb(h,v)}]:[!1,g,{}]}function Fb(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function hJ({page:t,...e}){let{router:n}=YF(),r=T.useMemo(()=>OF(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?T.createElement(mJ,{page:t,matches:r,...e}):null}function pJ(t){let{manifest:e,routeModules:n}=KF(),[r,i]=T.useState([]);return T.useEffect(()=>{let s=!1;return aJ(t,e,n).then(a=>{s||i(a)}),()=>{s=!0}},[t,e,n]),r}function mJ({page:t,matches:e,...n}){let r=ch(),{future:i,manifest:s,routeModules:a}=KF(),{basename:o}=YF(),{loaderData:l,matches:c}=dJ(),d=T.useMemo(()=>WP(t,e,c,s,r,"data"),[t,e,c,s,r]),h=T.useMemo(()=>WP(t,e,c,s,r,"assets"),[t,e,c,s,r]),g=T.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let _=new Set,w=!1;if(e.forEach(E=>{var N;let A=s.routes[E.route.id];!A||!A.hasLoader||(!d.some(I=>I.route.id===E.route.id)&&E.route.id in l&&((N=a[E.route.id])!=null&&N.shouldRevalidate)||A.hasClientLoader?w=!0:_.add(E.route.id))}),_.size===0)return[];let S=rJ(t,o,i.unstable_trailingSlashAwareDataRequests,"data");return w&&_.size>0&&S.searchParams.set("_routes",e.filter(E=>_.has(E.route.id)).map(E=>E.route.id).join(",")),[S.pathname+S.search]},[o,i.unstable_trailingSlashAwareDataRequests,l,r,s,d,e,t,a]),v=T.useMemo(()=>oJ(h,s),[h,s]),b=pJ(h);return T.createElement(T.Fragment,null,g.map(_=>T.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...n})),v.map(_=>T.createElement("link",{key:_,rel:"modulepreload",href:_,...n})),b.map(({key:_,link:w})=>T.createElement("link",{key:_,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function gJ(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var vJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{vJ&&(window.__reactRouterVersion="7.13.1")}catch{}function xJ({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=T.useRef();i.current==null&&(i.current=ZZ({window:r,v5Compat:!0}));let s=i.current,[a,o]=T.useState({action:s.action,location:s.location}),l=T.useCallback(c=>{n===!1?o(c):T.startTransition(()=>o(c))},[n]);return T.useLayoutEffect(()=>s.listen(l),[s,l]),T.createElement($Q,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:s,unstable_useTransitions:n})}var ZF=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qM=T.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:a,unstable_mask:o,state:l,target:c,to:d,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:v,...b},_){let{basename:w,navigator:S,unstable_useTransitions:E}=T.useContext(Zu),A=typeof d=="string"&&ZF.test(d),N=UF(d,w);d=N.to;let I=kQ(d,{relative:i}),P=ch(),L=null;if(o){let B=y7(o,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);w!=="/"&&(B.pathname=B.pathname==="/"?w:Qf([w,B.pathname])),L=S.createHref(B)}let[R,O,W]=fJ(r,b),U=SJ(d,{replace:a,unstable_mask:o,state:l,target:c,preventScrollReset:h,relative:i,viewTransition:g,unstable_defaultShouldRevalidate:v,unstable_useTransitions:E});function V(B){e&&e(B),B.defaultPrevented||U(B)}let G=!(N.isExternal||s),Z=T.createElement("a",{...b,...W,href:(G?L:void 0)||N.absoluteURL||I,onClick:G?V:e,ref:gJ(_,O),target:c,"data-discover":!A&&n==="render"?"true":void 0});return R&&!A?T.createElement(T.Fragment,null,Z,T.createElement(hJ,{page:I})):Z});qM.displayName="Link";var yJ=T.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:a,viewTransition:o,children:l,...c},d){let h=qS(a,{relative:c.relative}),g=ch(),v=T.useContext(R5),{navigator:b,basename:_}=T.useContext(Zu),w=v!=null&&CJ(h)&&o===!0,S=b.encodeLocation?b.encodeLocation(h).pathname:h.pathname,E=g.pathname,A=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(E=E.toLowerCase(),A=A?A.toLowerCase():null,S=S.toLowerCase()),A&&_&&(A=up(A,_)||A);const N=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let I=E===S||!i&&E.startsWith(S)&&E.charAt(N)==="/",P=A!=null&&(A===S||!i&&A.startsWith(S)&&A.charAt(S.length)==="/"),L={isActive:I,isPending:P,isTransitioning:w},R=I?e:void 0,O;typeof r=="function"?O=r(L):O=[r,I?"active":null,P?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let W=typeof s=="function"?s(L):s;return T.createElement(qM,{...c,"aria-current":R,className:O,ref:d,style:W,to:a,viewTransition:o},typeof l=="function"?l(L):l)});yJ.displayName="NavLink";var bJ=T.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:a=NM,action:o,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:g,...v},b)=>{let{unstable_useTransitions:_}=T.useContext(Zu),w=TJ(),S=EJ(o,{relative:c}),E=a.toLowerCase()==="get"?"get":"post",A=typeof o=="string"&&ZF.test(o),N=I=>{if(l&&l(I),I.defaultPrevented)return;I.preventDefault();let P=I.nativeEvent.submitter,L=(P==null?void 0:P.getAttribute("formmethod"))||a,R=()=>w(P||I.currentTarget,{fetcherKey:e,method:L,navigate:n,replace:i,state:s,relative:c,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:g});_&&n!==!1?T.startTransition(()=>R()):R()};return T.createElement("form",{ref:b,method:E,action:S,onSubmit:r?l:N,...v,"data-discover":!A&&t==="render"?"true":void 0})});bJ.displayName="Form";function _J(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function QF(t){let e=T.useContext(dy);return na(e,_J(t)),e}function SJ(t,{target:e,replace:n,unstable_mask:r,state:i,preventScrollReset:s,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let d=k5(),h=ch(),g=qS(t,{relative:a});return T.useCallback(v=>{if(QQ(v,e)){v.preventDefault();let b=n!==void 0?n:q_(h)===q_(g),_=()=>d(t,{replace:b,unstable_mask:r,state:i,preventScrollReset:s,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:l});c?T.startTransition(()=>_()):_()}},[h,d,g,n,r,i,e,t,s,a,o,l,c])}function T7(t){Vd(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=T.useRef(K6(t)),n=T.useRef(!1),r=ch(),i=T.useMemo(()=>JQ(r.search,n.current?null:e.current),[r.search]),s=k5(),a=T.useCallback((o,l)=>{const c=K6(typeof o=="function"?o(new URLSearchParams(i)):o);n.current=!0,s("?"+c,l)},[s,i]);return[i,a]}var wJ=0,MJ=()=>`__${String(++wJ)}__`;function TJ(){let{router:t}=QF("useSubmit"),{basename:e}=T.useContext(Zu),n=HQ(),r=t.fetch,i=t.navigate;return T.useCallback(async(s,a={})=>{let{action:o,method:l,encType:c,formData:d,body:h}=nJ(s,e);if(a.navigate===!1){let g=a.fetcherKey||MJ();await r(g,n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||l,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||l,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,e,n])}function EJ(t,{relative:e}={}){let{basename:n}=T.useContext(Zu),r=T.useContext(gp);na(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...qS(t||".",{relative:e})},a=ch();if(t==null){s.search=a.search;let o=new URLSearchParams(s.search),l=o.getAll("index");if(l.some(d=>d==="")){o.delete("index"),l.filter(h=>h).forEach(h=>o.append("index",h));let d=o.toString();s.search=d?`?${d}`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Qf([n,s.pathname])),q_(s)}function CJ(t,{relative:e}={}){let n=T.useContext(HF);na(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=QF("useViewTransitionState"),i=qS(t,{relative:e});if(!n.isTransitioning)return!1;let s=up(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=up(n.nextLocation.pathname,r)||n.nextLocation.pathname;return $M(i.pathname,a)!=null||$M(i.pathname,s)!=null}var Ld=DF();const AJ=cy(Ld);var fy=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(){}},NJ={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},A0,x7,bF,RJ=(bF=class{constructor(){Ln(this,A0,NJ);Ln(this,x7,!1)}setTimeoutProvider(t){un(this,A0,t)}setTimeout(t,e){return it(this,A0).setTimeout(t,e)}clearTimeout(t){it(this,A0).clearTimeout(t)}setInterval(t,e){return it(this,A0).setInterval(t,e)}clearInterval(t){it(this,A0).clearInterval(t)}},A0=new WeakMap,x7=new WeakMap,bF),Ag=new RJ;function kJ(t){setTimeout(t,0)}var Yg=typeof window>"u"||"Deno"in globalThis;function Ol(){}function PJ(t,e){return typeof t=="function"?t(e):t}function Z6(t){return typeof t=="number"&&t>=0&&t!==1/0}function JF(t,e){return Math.max(t+(e||0)-Date.now(),0)}function H0(t,e){return typeof t=="function"?t(e):t}function zu(t,e){return typeof t=="function"?t(e):t}function $P(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=t;if(a){if(r){if(e.queryHash!==E7(a,e.options))return!1}else if(!Y_(e.queryKey,a))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||i&&i!==e.state.fetchStatus||s&&!s(e))}function qP(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(X_(e.options.mutationKey)!==X_(s))return!1}else if(!Y_(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function E7(t,e){return((e==null?void 0:e.queryKeyHashFn)||X_)(t)}function X_(t){return JSON.stringify(t,(e,n)=>Q6(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Y_(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Y_(t[n],e[n])):!1}var DJ=Object.prototype.hasOwnProperty;function C7(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=XP(t)&&XP(e);if(!r&&!(Q6(t)&&Q6(e)))return e;const s=(r?t:Object.keys(t)).length,a=r?e:Object.keys(e),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d<o;d++){const h=r?d:a[d],g=t[h],v=e[h];if(g===v){l[h]=g,(r?d<s:DJ.call(t,h))&&c++;continue}if(g===null||v===null||typeof g!="object"||typeof v!="object"){l[h]=v;continue}const b=C7(g,v,n+1);l[h]=b,b===g&&c++}return s===o&&c===s?t:l}function XM(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 XP(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Q6(t){if(!YP(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!YP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function YP(t){return Object.prototype.toString.call(t)==="[object Object]"}function IJ(t){return new Promise(e=>{Ag.setTimeout(e,t)})}function J6(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?C7(t,e):e}function Xd(t){return t}function OJ(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function LJ(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var A7=Symbol();function eU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===A7?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function tU(t,e){return typeof t=="function"?t(...e):!!t}function zJ(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 Ig,N0,w1,_F,jJ=(_F=class extends fy{constructor(){super();Ln(this,Ig);Ln(this,N0);Ln(this,w1);un(this,w1,e=>{if(!Yg&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){it(this,N0)||this.setEventListener(it(this,w1))}onUnsubscribe(){var e;this.hasListeners()||((e=it(this,N0))==null||e.call(this),un(this,N0,void 0))}setEventListener(e){var n;un(this,w1,e),(n=it(this,N0))==null||n.call(this),un(this,N0,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){it(this,Ig)!==e&&(un(this,Ig,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof it(this,Ig)=="boolean"?it(this,Ig):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ig=new WeakMap,N0=new WeakMap,w1=new WeakMap,_F),N7=new jJ;function eN(){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 FJ=kJ;function UJ(){let t=[],e=0,n=o=>{o()},r=o=>{o()},i=FJ;const s=o=>{e?t.push(o):i(()=>{n(o)})},a=()=>{const o=t;t=[],o.length&&i(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{s(()=>{o(...l)})},schedule:s,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var Ha=UJ(),M1,R0,T1,SF,BJ=(SF=class extends fy{constructor(){super();Ln(this,M1,!0);Ln(this,R0);Ln(this,T1);un(this,T1,e=>{if(!Yg&&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(){it(this,R0)||this.setEventListener(it(this,T1))}onUnsubscribe(){var e;this.hasListeners()||((e=it(this,R0))==null||e.call(this),un(this,R0,void 0))}setEventListener(e){var n;un(this,T1,e),(n=it(this,R0))==null||n.call(this),un(this,R0,e(this.setOnline.bind(this)))}setOnline(e){it(this,M1)!==e&&(un(this,M1,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return it(this,M1)}},M1=new WeakMap,R0=new WeakMap,T1=new WeakMap,SF),YM=new BJ;function HJ(t){return Math.min(1e3*2**t,3e4)}function nU(t){return(t??"online")==="online"?YM.isOnline():!0}var tN=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function rU(t){let e=!1,n=0,r;const i=eN(),s=()=>i.status!=="pending",a=_=>{var w;if(!s()){const S=new tN(_);g(S),(w=t.onCancel)==null||w.call(t,S)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>N7.isFocused()&&(t.networkMode==="always"||YM.isOnline())&&t.canRun(),d=()=>nU(t.networkMode)&&t.canRun(),h=_=>{s()||(r==null||r(),i.resolve(_))},g=_=>{s()||(r==null||r(),i.reject(_))},v=()=>new Promise(_=>{var w;r=S=>{(s()||c())&&_(S)},(w=t.onPause)==null||w.call(t)}).then(()=>{var _;r=void 0,s()||(_=t.onContinue)==null||_.call(t)}),b=()=>{if(s())return;let _;const w=n===0?t.initialPromise:void 0;try{_=w??t.fn()}catch(S){_=Promise.reject(S)}Promise.resolve(_).then(h).catch(S=>{var P;if(s())return;const E=t.retry??(Yg?0:3),A=t.retryDelay??HJ,N=typeof A=="function"?A(n,S):A,I=E===!0||typeof E=="number"&&n<E||typeof E=="function"&&E(n,S);if(e||!I){g(S);return}n++,(P=t.onFail)==null||P.call(t,n,S),IJ(N).then(()=>c()?void 0:v()).then(()=>{e?g(S):b()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(r==null||r(),i),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?b():v().then(b),i)}}var Og,wF,iU=(wF=class{constructor(){Ln(this,Og)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Z6(this.gcTime)&&un(this,Og,Ag.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Yg?1/0:300*1e3))}clearGcTimeout(){it(this,Og)&&(Ag.clearTimeout(it(this,Og)),un(this,Og,void 0))}},Og=new WeakMap,wF),Lg,E1,Ou,zg,xo,OS,jg,kd,Kh,MF,VJ=(MF=class extends iU{constructor(e){super();Ln(this,kd);Ln(this,Lg);Ln(this,E1);Ln(this,Ou);Ln(this,zg);Ln(this,xo);Ln(this,OS);Ln(this,jg);un(this,jg,!1),un(this,OS,e.defaultOptions),this.setOptions(e.options),this.observers=[],un(this,zg,e.client),un(this,Ou,it(this,zg).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,un(this,Lg,ZP(this.options)),this.state=e.state??it(this,Lg),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=it(this,xo))==null?void 0:e.promise}setOptions(e){if(this.options={...it(this,OS),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ZP(this.options);n.data!==void 0&&(this.setState(KP(n.data,n.dataUpdatedAt)),un(this,Lg,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&it(this,Ou).remove(this)}setData(e,n){const r=J6(this.state.data,e,this.options);return fr(this,kd,Kh).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){fr(this,kd,Kh).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=it(this,xo))==null?void 0:r.promise;return(i=it(this,xo))==null||i.cancel(e),n?n.then(Ol).catch(Ol):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(it(this,Lg))}isActive(){return this.observers.some(e=>zu(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A7||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>H0(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:!JF(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=it(this,xo))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=it(this,xo))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),it(this,Ou).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(it(this,xo)&&(it(this,jg)?it(this,xo).cancel({revert:!0}):it(this,xo).cancelRetry()),this.scheduleGc()),it(this,Ou).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fr(this,kd,Kh).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,d,h,g,v,b,_,w,S,E,A;if(this.state.fetchStatus!=="idle"&&((l=it(this,xo))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(it(this,xo))return it(this,xo).continueRetry(),it(this,xo).promise}if(e&&this.setOptions(e),!this.options.queryFn){const N=this.observers.find(I=>I.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,i=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(un(this,jg,!0),r.signal)})},s=()=>{const N=eU(this.options,n),P=(()=>{const L={client:it(this,zg),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return un(this,jg,!1),this.options.persister?this.options.persister(N,P,this):N(P)},o=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:it(this,zg),state:this.state,fetchFn:s};return i(N),N})();(c=this.options.behavior)==null||c.onFetch(o,this),un(this,E1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&fr(this,kd,Kh).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),un(this,xo,rU({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:N=>{N instanceof tN&&N.revert&&this.setState({...it(this,E1),fetchStatus:"idle"}),r.abort()},onFail:(N,I)=>{fr(this,kd,Kh).call(this,{type:"failed",failureCount:N,error:I})},onPause:()=>{fr(this,kd,Kh).call(this,{type:"pause"})},onContinue:()=>{fr(this,kd,Kh).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const N=await it(this,xo).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(v=(g=it(this,Ou).config).onSuccess)==null||v.call(g,N,this),(_=(b=it(this,Ou).config).onSettled)==null||_.call(b,N,this.state.error,this),N}catch(N){if(N instanceof tN){if(N.silent)return it(this,xo).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw fr(this,kd,Kh).call(this,{type:"error",error:N}),(S=(w=it(this,Ou).config).onError)==null||S.call(w,N,this),(A=(E=it(this,Ou).config).onSettled)==null||A.call(E,this.state.data,N,this),N}finally{this.scheduleGc()}}},Lg=new WeakMap,E1=new WeakMap,Ou=new WeakMap,zg=new WeakMap,xo=new WeakMap,OS=new WeakMap,jg=new WeakMap,kd=new WeakSet,Kh=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,...sU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...KP(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return un(this,E1,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),Ha.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),it(this,Ou).notify({query:this,type:"updated",action:e})})},MF);function sU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:nU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function KP(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ZP(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 bc,oi,LS,Il,Fg,C1,ep,k0,zS,A1,N1,Ug,Bg,P0,R1,Ui,u_,nN,rN,iN,sN,aN,oN,lN,aU,TF,R7=(TF=class extends fy{constructor(e,n){super();Ln(this,Ui);Ln(this,bc);Ln(this,oi);Ln(this,LS);Ln(this,Il);Ln(this,Fg);Ln(this,C1);Ln(this,ep);Ln(this,k0);Ln(this,zS);Ln(this,A1);Ln(this,N1);Ln(this,Ug);Ln(this,Bg);Ln(this,P0);Ln(this,R1,new Set);this.options=n,un(this,bc,e),un(this,k0,null),un(this,ep,eN()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(it(this,oi).addObserver(this),QP(it(this,oi),this.options)?fr(this,Ui,u_).call(this):this.updateResult(),fr(this,Ui,sN).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cN(it(this,oi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cN(it(this,oi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fr(this,Ui,aN).call(this),fr(this,Ui,oN).call(this),it(this,oi).removeObserver(this)}setOptions(e){const n=this.options,r=it(this,oi);if(this.options=it(this,bc).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof zu(this.options.enabled,it(this,oi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fr(this,Ui,lN).call(this),it(this,oi).setOptions(this.options),n._defaulted&&!XM(this.options,n)&&it(this,bc).getQueryCache().notify({type:"observerOptionsUpdated",query:it(this,oi),observer:this});const i=this.hasListeners();i&&JP(it(this,oi),r,this.options,n)&&fr(this,Ui,u_).call(this),this.updateResult(),i&&(it(this,oi)!==r||zu(this.options.enabled,it(this,oi))!==zu(n.enabled,it(this,oi))||H0(this.options.staleTime,it(this,oi))!==H0(n.staleTime,it(this,oi)))&&fr(this,Ui,nN).call(this);const s=fr(this,Ui,rN).call(this);i&&(it(this,oi)!==r||zu(this.options.enabled,it(this,oi))!==zu(n.enabled,it(this,oi))||s!==it(this,P0))&&fr(this,Ui,iN).call(this,s)}getOptimisticResult(e){const n=it(this,bc).getQueryCache().build(it(this,bc),e),r=this.createResult(n,e);return WJ(this,r)&&(un(this,Il,r),un(this,C1,this.options),un(this,Fg,it(this,oi).state)),r}getCurrentResult(){return it(this,Il)}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&&it(this,ep).status==="pending"&&it(this,ep).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){it(this,R1).add(e)}getCurrentQuery(){return it(this,oi)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=it(this,bc).defaultQueryOptions(e),r=it(this,bc).getQueryCache().build(it(this,bc),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return fr(this,Ui,u_).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),it(this,Il)))}createResult(e,n){var O;const r=it(this,oi),i=this.options,s=it(this,Il),a=it(this,Fg),o=it(this,C1),c=e!==r?e.state:it(this,LS),{state:d}=e;let h={...d},g=!1,v;if(n._optimisticResults){const W=this.hasListeners(),U=!W&&QP(e,n),V=W&&JP(e,r,n,i);(U||V)&&(h={...h,...sU(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:b,errorUpdatedAt:_,status:w}=h;v=h.data;let S=!1;if(n.placeholderData!==void 0&&v===void 0&&w==="pending"){let W;s!=null&&s.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(W=s.data,S=!0):W=typeof n.placeholderData=="function"?n.placeholderData((O=it(this,N1))==null?void 0:O.state.data,it(this,N1)):n.placeholderData,W!==void 0&&(w="success",v=J6(s==null?void 0:s.data,W,n),g=!0)}if(n.select&&v!==void 0&&!S)if(s&&v===(a==null?void 0:a.data)&&n.select===it(this,zS))v=it(this,A1);else try{un(this,zS,n.select),v=n.select(v),v=J6(s==null?void 0:s.data,v,n),un(this,A1,v),un(this,k0,null)}catch(W){un(this,k0,W)}it(this,k0)&&(b=it(this,k0),v=it(this,A1),_=Date.now(),w="error");const E=h.fetchStatus==="fetching",A=w==="pending",N=w==="error",I=A&&E,P=v!==void 0,R={status:w,fetchStatus:h.fetchStatus,isPending:A,isSuccess:w==="success",isError:N,isInitialLoading:I,isLoading:I,data:v,dataUpdatedAt:h.dataUpdatedAt,error:b,errorUpdatedAt:_,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:E,isRefetching:E&&!A,isLoadingError:N&&!P,isPaused:h.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:N&&P,isStale:k7(e,n),refetch:this.refetch,promise:it(this,ep),isEnabled:zu(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const W=R.data!==void 0,U=R.status==="error"&&!W,V=B=>{U?B.reject(R.error):W&&B.resolve(R.data)},G=()=>{const B=un(this,ep,R.promise=eN());V(B)},Z=it(this,ep);switch(Z.status){case"pending":e.queryHash===r.queryHash&&V(Z);break;case"fulfilled":(U||R.data!==Z.value)&&G();break;case"rejected":(!U||R.error!==Z.reason)&&G();break}}return R}updateResult(){const e=it(this,Il),n=this.createResult(it(this,oi),this.options);if(un(this,Fg,it(this,oi).state),un(this,C1,this.options),it(this,Fg).data!==void 0&&un(this,N1,it(this,oi)),XM(n,e))return;un(this,Il,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!it(this,R1).size)return!0;const a=new Set(s??it(this,R1));return this.options.throwOnError&&a.add("error"),Object.keys(it(this,Il)).some(o=>{const l=o;return it(this,Il)[l]!==e[l]&&a.has(l)})};fr(this,Ui,aU).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fr(this,Ui,sN).call(this)}},bc=new WeakMap,oi=new WeakMap,LS=new WeakMap,Il=new WeakMap,Fg=new WeakMap,C1=new WeakMap,ep=new WeakMap,k0=new WeakMap,zS=new WeakMap,A1=new WeakMap,N1=new WeakMap,Ug=new WeakMap,Bg=new WeakMap,P0=new WeakMap,R1=new WeakMap,Ui=new WeakSet,u_=function(e){fr(this,Ui,lN).call(this);let n=it(this,oi).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ol)),n},nN=function(){fr(this,Ui,aN).call(this);const e=H0(this.options.staleTime,it(this,oi));if(Yg||it(this,Il).isStale||!Z6(e))return;const r=JF(it(this,Il).dataUpdatedAt,e)+1;un(this,Ug,Ag.setTimeout(()=>{it(this,Il).isStale||this.updateResult()},r))},rN=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(it(this,oi)):this.options.refetchInterval)??!1},iN=function(e){fr(this,Ui,oN).call(this),un(this,P0,e),!(Yg||zu(this.options.enabled,it(this,oi))===!1||!Z6(it(this,P0))||it(this,P0)===0)&&un(this,Bg,Ag.setInterval(()=>{(this.options.refetchIntervalInBackground||N7.isFocused())&&fr(this,Ui,u_).call(this)},it(this,P0)))},sN=function(){fr(this,Ui,nN).call(this),fr(this,Ui,iN).call(this,fr(this,Ui,rN).call(this))},aN=function(){it(this,Ug)&&(Ag.clearTimeout(it(this,Ug)),un(this,Ug,void 0))},oN=function(){it(this,Bg)&&(Ag.clearInterval(it(this,Bg)),un(this,Bg,void 0))},lN=function(){const e=it(this,bc).getQueryCache().build(it(this,bc),this.options);if(e===it(this,oi))return;const n=it(this,oi);un(this,oi,e),un(this,LS,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},aU=function(e){Ha.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(it(this,Il))}),it(this,bc).getQueryCache().notify({query:it(this,oi),type:"observerResultsUpdated"})})},TF);function GJ(t,e){return zu(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function QP(t,e){return GJ(t,e)||t.state.data!==void 0&&cN(t,e,e.refetchOnMount)}function cN(t,e,n){if(zu(e.enabled,t)!==!1&&H0(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&k7(t,e)}return!1}function JP(t,e,n,r){return(t!==e||zu(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&k7(t,n)}function k7(t,e){return zu(e.enabled,t)!==!1&&t.isStaleByTime(H0(e.staleTime,t))}function WJ(t,e){return!XM(t.getCurrentResult(),e)}function eD(t){return{onFetch:(e,n)=>{var d,h,g,v,b;const r=e.options,i=(g=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:g.direction,s=((v=e.state.data)==null?void 0:v.pages)||[],a=((b=e.state.data)==null?void 0:b.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let _=!1;const w=A=>{zJ(A,()=>e.signal,()=>_=!0)},S=eU(e.options,e.fetchOptions),E=async(A,N,I)=>{if(_)return Promise.reject();if(N==null&&A.pages.length)return Promise.resolve(A);const L=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:N,direction:I?"backward":"forward",meta:e.options.meta};return w(U),U})(),R=await S(L),{maxPages:O}=e.options,W=I?LJ:OJ;return{pages:W(A.pages,R,O),pageParams:W(A.pageParams,N,O)}};if(i&&s.length){const A=i==="backward",N=A?$J:tD,I={pages:s,pageParams:a},P=N(r,I);o=await E(I,P,A)}else{const A=t??s.length;do{const N=l===0?a[0]??r.initialPageParam:tD(r,o);if(l>0&&N==null)break;o=await E(o,N),l++}while(l<A)}return o};e.options.persister?e.fetchFn=()=>{var _,w;return(w=(_=e.options).persister)==null?void 0:w.call(_,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function tD(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 $J(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 jS,zf,ol,Hg,jf,_0,EF,qJ=(EF=class extends iU{constructor(e){super();Ln(this,jf);Ln(this,jS);Ln(this,zf);Ln(this,ol);Ln(this,Hg);un(this,jS,e.client),this.mutationId=e.mutationId,un(this,ol,e.mutationCache),un(this,zf,[]),this.state=e.state||XJ(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){it(this,zf).includes(e)||(it(this,zf).push(e),this.clearGcTimeout(),it(this,ol).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){un(this,zf,it(this,zf).filter(n=>n!==e)),this.scheduleGc(),it(this,ol).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){it(this,zf).length||(this.state.status==="pending"?this.scheduleGc():it(this,ol).remove(this))}continue(){var e;return((e=it(this,Hg))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,d,h,g,v,b,_,w,S,E,A,N,I,P,L;const n=()=>{fr(this,jf,_0).call(this,{type:"continue"})},r={client:it(this,jS),meta:this.options.meta,mutationKey:this.options.mutationKey};un(this,Hg,rU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,O)=>{fr(this,jf,_0).call(this,{type:"failed",failureCount:R,error:O})},onPause:()=>{fr(this,jf,_0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>it(this,ol).canRun(this)}));const i=this.state.status==="pending",s=!it(this,Hg).canStart();try{if(i)n();else{fr(this,jf,_0).call(this,{type:"pending",variables:e,isPaused:s}),it(this,ol).config.onMutate&&await it(this,ol).config.onMutate(e,this,r);const O=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,e,r));O!==this.state.context&&fr(this,jf,_0).call(this,{type:"pending",context:O,variables:e,isPaused:s})}const R=await it(this,Hg).start();return await((c=(l=it(this,ol).config).onSuccess)==null?void 0:c.call(l,R,e,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,R,e,this.state.context,r)),await((v=(g=it(this,ol).config).onSettled)==null?void 0:v.call(g,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)),fr(this,jf,_0).call(this,{type:"success",data:R}),R}catch(R){try{await((S=(w=it(this,ol).config).onError)==null?void 0:S.call(w,R,e,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((A=(E=this.options).onError)==null?void 0:A.call(E,R,e,this.state.context,r))}catch(O){Promise.reject(O)}try{await((I=(N=it(this,ol).config).onSettled)==null?void 0:I.call(N,void 0,R,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((L=(P=this.options).onSettled)==null?void 0:L.call(P,void 0,R,e,this.state.context,r))}catch(O){Promise.reject(O)}throw fr(this,jf,_0).call(this,{type:"error",error:R}),R}finally{it(this,ol).runNext(this)}}},jS=new WeakMap,zf=new WeakMap,ol=new WeakMap,Hg=new WeakMap,jf=new WeakSet,_0=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),Ha.batch(()=>{it(this,zf).forEach(r=>{r.onMutationUpdate(e)}),it(this,ol).notify({mutation:this,type:"updated",action:e})})},EF);function XJ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var tp,Pd,FS,CF,YJ=(CF=class extends fy{constructor(e={}){super();Ln(this,tp);Ln(this,Pd);Ln(this,FS);this.config=e,un(this,tp,new Set),un(this,Pd,new Map),un(this,FS,0)}build(e,n,r){const i=new qJ({client:e,mutationCache:this,mutationId:++B3(this,FS)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){it(this,tp).add(e);const n=V3(e);if(typeof n=="string"){const r=it(this,Pd).get(n);r?r.push(e):it(this,Pd).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(it(this,tp).delete(e)){const n=V3(e);if(typeof n=="string"){const r=it(this,Pd).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&it(this,Pd).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=V3(e);if(typeof n=="string"){const r=it(this,Pd).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=V3(e);if(typeof n=="string"){const i=(r=it(this,Pd).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(){Ha.batch(()=>{it(this,tp).forEach(e=>{this.notify({type:"removed",mutation:e})}),it(this,tp).clear(),it(this,Pd).clear()})}getAll(){return Array.from(it(this,tp))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>qP(n,r))}findAll(e={}){return this.getAll().filter(n=>qP(e,n))}notify(e){Ha.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Ha.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ol))))}},tp=new WeakMap,Pd=new WeakMap,FS=new WeakMap,CF);function V3(t){var e;return(e=t.options.scope)==null?void 0:e.id}function nD(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function KJ(t,e,n){const r=t.slice(0);return r[e]=n,r}var k1,Wc,P1,D1,Lu,D0,US,BS,HS,VS,Ho,uN,dN,fN,hN,pN,AF,ZJ=(AF=class extends fy{constructor(e,n,r){super();Ln(this,Ho);Ln(this,k1);Ln(this,Wc);Ln(this,P1);Ln(this,D1);Ln(this,Lu);Ln(this,D0);Ln(this,US);Ln(this,BS);Ln(this,HS);Ln(this,VS,[]);un(this,k1,e),un(this,D1,r),un(this,P1,[]),un(this,Lu,[]),un(this,Wc,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&it(this,Lu).forEach(e=>{e.subscribe(n=>{fr(this,Ho,hN).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,it(this,Lu).forEach(e=>{e.destroy()})}setQueries(e,n){un(this,P1,e),un(this,D1,n),Ha.batch(()=>{const r=it(this,Lu),i=fr(this,Ho,fN).call(this,it(this,P1));i.forEach(h=>h.observer.setOptions(h.defaultedQueryOptions));const s=i.map(h=>h.observer),a=s.map(h=>h.getCurrentResult()),o=r.length!==s.length,l=s.some((h,g)=>h!==r[g]),c=o||l,d=c?!0:a.some((h,g)=>{const v=it(this,Wc)[g];return!v||!XM(h,v)});!c&&!d||(c&&(un(this,VS,i),un(this,Lu,s)),un(this,Wc,a),this.hasListeners()&&(c&&(nD(r,s).forEach(h=>{h.destroy()}),nD(s,r).forEach(h=>{h.subscribe(g=>{fr(this,Ho,hN).call(this,h,g)})})),fr(this,Ho,pN).call(this)))})}getCurrentResult(){return it(this,Wc)}getQueries(){return it(this,Lu).map(e=>e.getCurrentQuery())}getObservers(){return it(this,Lu)}getOptimisticResult(e,n){const r=fr(this,Ho,fN).call(this,e),i=r.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),s=r.map(a=>a.defaultedQueryOptions.queryHash);return[i,a=>fr(this,Ho,dN).call(this,a??i,n,s),()=>fr(this,Ho,uN).call(this,i,r)]}},k1=new WeakMap,Wc=new WeakMap,P1=new WeakMap,D1=new WeakMap,Lu=new WeakMap,D0=new WeakMap,US=new WeakMap,BS=new WeakMap,HS=new WeakMap,VS=new WeakMap,Ho=new WeakSet,uN=function(e,n){return n.map((r,i)=>{const s=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?s:r.observer.trackResult(s,a=>{n.forEach(o=>{o.observer.trackProp(a)})})})},dN=function(e,n,r){if(n){const i=it(this,HS),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((a,o)=>a!==i[o]));return(!it(this,D0)||it(this,Wc)!==it(this,BS)||s||n!==it(this,US))&&(un(this,US,n),un(this,BS,it(this,Wc)),r!==void 0&&un(this,HS,r),un(this,D0,C7(it(this,D0),n(e)))),it(this,D0)}return e},fN=function(e){const n=new Map;it(this,Lu).forEach(i=>{const s=i.options.queryHash;if(!s)return;const a=n.get(s);a?a.push(i):n.set(s,[i])});const r=[];return e.forEach(i=>{var l;const s=it(this,k1).defaultQueryOptions(i),o=((l=n.get(s.queryHash))==null?void 0:l.shift())??new R7(it(this,k1),s);r.push({defaultedQueryOptions:s,observer:o})}),r},hN=function(e,n){const r=it(this,Lu).indexOf(e);r!==-1&&(un(this,Wc,KJ(it(this,Wc),r,n)),fr(this,Ho,pN).call(this))},pN=function(){var e;if(this.hasListeners()){const n=it(this,D0),r=fr(this,Ho,uN).call(this,it(this,Wc),it(this,VS)),i=fr(this,Ho,dN).call(this,r,(e=it(this,D1))==null?void 0:e.combine);n!==i&&Ha.batch(()=>{this.listeners.forEach(s=>{s(it(this,Wc))})})}},AF),Ff,NF,QJ=(NF=class extends fy{constructor(e={}){super();Ln(this,Ff);this.config=e,un(this,Ff,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??E7(i,n);let a=this.get(s);return a||(a=new VJ({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){it(this,Ff).has(e.queryHash)||(it(this,Ff).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=it(this,Ff).get(e.queryHash);n&&(e.destroy(),n===e&&it(this,Ff).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ha.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return it(this,Ff).get(e)}getAll(){return[...it(this,Ff).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>$P(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>$P(e,r)):n}notify(e){Ha.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Ha.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ha.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ff=new WeakMap,NF),ha,I0,O0,I1,O1,L0,L1,z1,RF,JJ=(RF=class{constructor(t={}){Ln(this,ha);Ln(this,I0);Ln(this,O0);Ln(this,I1);Ln(this,O1);Ln(this,L0);Ln(this,L1);Ln(this,z1);un(this,ha,t.queryCache||new QJ),un(this,I0,t.mutationCache||new YJ),un(this,O0,t.defaultOptions||{}),un(this,I1,new Map),un(this,O1,new Map),un(this,L0,0)}mount(){B3(this,L0)._++,it(this,L0)===1&&(un(this,L1,N7.subscribe(async t=>{t&&(await this.resumePausedMutations(),it(this,ha).onFocus())})),un(this,z1,YM.subscribe(async t=>{t&&(await this.resumePausedMutations(),it(this,ha).onOnline())})))}unmount(){var t,e;B3(this,L0)._--,it(this,L0)===0&&((t=it(this,L1))==null||t.call(this),un(this,L1,void 0),(e=it(this,z1))==null||e.call(this),un(this,z1,void 0))}isFetching(t){return it(this,ha).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return it(this,I0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=it(this,ha).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=it(this,ha).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(H0(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return it(this,ha).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=it(this,ha).get(r.queryHash),s=i==null?void 0:i.state.data,a=PJ(e,s);if(a!==void 0)return it(this,ha).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return Ha.batch(()=>it(this,ha).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=it(this,ha).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=it(this,ha);Ha.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=it(this,ha);return Ha.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Ha.batch(()=>it(this,ha).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ol).catch(Ol)}invalidateQueries(t,e={}){return Ha.batch(()=>(it(this,ha).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=Ha.batch(()=>it(this,ha).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ol)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ol)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=it(this,ha).build(this,e);return n.isStaleByTime(H0(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ol).catch(Ol)}fetchInfiniteQuery(t){return t.behavior=eD(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ol).catch(Ol)}ensureInfiniteQueryData(t){return t.behavior=eD(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return YM.isOnline()?it(this,I0).resumePausedMutations():Promise.resolve()}getQueryCache(){return it(this,ha)}getMutationCache(){return it(this,I0)}getDefaultOptions(){return it(this,O0)}setDefaultOptions(t){un(this,O0,t)}setQueryDefaults(t,e){it(this,I1).set(X_(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...it(this,I1).values()],n={};return e.forEach(r=>{Y_(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){it(this,O1).set(X_(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...it(this,O1).values()],n={};return e.forEach(r=>{Y_(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...it(this,O0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=E7(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===A7&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...it(this,O0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){it(this,ha).clear(),it(this,I0).clear()}},ha=new WeakMap,I0=new WeakMap,O0=new WeakMap,I1=new WeakMap,O1=new WeakMap,L0=new WeakMap,L1=new WeakMap,z1=new WeakMap,RF),oU=T.createContext(void 0),hy=t=>{const e=T.useContext(oU);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},eee=({client:t,children:e})=>(T.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),p.jsx(oU.Provider,{value:t,children:e})),lU=T.createContext(!1),cU=()=>T.useContext(lU);lU.Provider;function tee(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var nee=T.createContext(tee()),uU=()=>T.useContext(nee),dU=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?tU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},fU=t=>{T.useEffect(()=>{t.clearReset()},[t])},hU=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||tU(n,[t.error,r])),pU=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))}},ree=(t,e)=>t.isLoading&&t.isFetching&&!e,mN=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,gN=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function iee({queries:t,...e},n){const r=hy(),i=cU(),s=uU(),a=T.useMemo(()=>t.map(_=>{const w=r.defaultQueryOptions(_);return w._optimisticResults=i?"isRestoring":"optimistic",w}),[t,r,i]);a.forEach(_=>{pU(_);const w=r.getQueryCache().get(_.queryHash);dU(_,s,w)}),fU(s);const[o]=T.useState(()=>new ZJ(r,a,e)),[l,c,d]=o.getOptimisticResult(a,e.combine),h=!i&&e.subscribed!==!1;T.useSyncExternalStore(T.useCallback(_=>h?o.subscribe(Ha.batchCalls(_)):Ol,[o,h]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),T.useEffect(()=>{o.setQueries(a,e)},[a,e,o]);const v=l.some((_,w)=>mN(a[w],_))?l.flatMap((_,w)=>{const S=a[w];if(S&&mN(S,_)){const E=new R7(r,S);return gN(S,E,s)}return[]}):[];if(v.length>0)throw Promise.all(v);const b=l.find((_,w)=>{const S=a[w];return S&&hU({result:_,errorResetBoundary:s,throwOnError:S.throwOnError,query:r.getQueryCache().get(S.queryHash),suspense:S.suspense})});if(b!=null&&b.error)throw b.error;return c(d())}function see(t,e,n){var g,v,b,_;const r=cU(),i=uU(),s=hy(),a=s.defaultQueryOptions(t);(v=(g=s.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||v.call(g,a);const o=s.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",pU(a),dU(a,i,o),fU(i);const l=!s.getQueryCache().get(a.queryHash),[c]=T.useState(()=>new e(s,a)),d=c.getOptimisticResult(a),h=!r&&t.subscribed!==!1;if(T.useSyncExternalStore(T.useCallback(w=>{const S=h?c.subscribe(Ha.batchCalls(w)):Ol;return c.updateResult(),S},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),T.useEffect(()=>{c.setOptions(a)},[a,c]),mN(a,d))throw gN(a,c,i);if(hU({result:d,errorResetBoundary:i,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw d.error;if((_=(b=s.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||_.call(b,a,d),a.experimental_prefetchInRender&&!Yg&&ree(d,r)){const w=l?gN(a,c,i):o==null?void 0:o.promise;w==null||w.catch(Ol).finally(()=>{c.updateResult()})}return a.notifyOnChangeProps?d:c.trackResult(d)}function ps(t,e){return see(t,R7)}const Bf={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function mU(t){return"init"in t}function vN(t){return!!t.write}function rD(t){return"v"in t||"e"in t}function KM(t){if("e"in t)throw t.e;if((Bf?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}function ZM(t){return typeof(t==null?void 0:t.then)=="function"}function gU(t,e,n){if(!n.p.has(t)){n.p.add(t);const r=()=>n.p.delete(t);e.then(r,r)}}function vU(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 aee=(t,e,...n)=>e.read(...n),oee=(t,e,...n)=>e.write(...n),lee=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},cee=(t,e,n)=>{var r;return(r=e.onMount)==null?void 0:r.call(e,n)},uee=(t,e)=>{var n;const r=io(t),i=r[0],s=r[6],a=r[9];if((Bf?"production":void 0)!=="production"&&!e)throw new Error("Atom is undefined or null");let o=i.get(e);return o||(o={d:new Map,p:new Set,n:0},i.set(e,o),(n=s.i)==null||n.call(s,e),a==null||a(t,e)),o},dee=t=>{const e=io(t),n=e[1],r=e[3],i=e[4],s=e[5],a=e[6],o=e[13],l=[],c=d=>{try{d()}catch(h){l.push(h)}};do{a.f&&c(a.f);const d=new Set,h=d.add.bind(d);r.forEach(g=>{var v;return(v=n.get(g))==null?void 0:v.l.forEach(h)}),r.clear(),s.forEach(h),s.clear(),i.forEach(h),i.clear(),d.forEach(c),r.size&&o(t)}while(r.size||s.size||i.size);if(l.length)throw new AggregateError(l)},fee=t=>{const e=io(t),n=e[1],r=e[2],i=e[3],s=e[11],a=e[14],o=e[17],l=[],c=new WeakSet,d=new WeakSet,h=Array.from(i);for(;h.length;){const g=h[h.length-1],v=s(t,g);if(d.has(g)){h.pop();continue}if(c.has(g)){if(r.get(g)===v.n)l.push([g,v]);else if((Bf?"production":void 0)!=="production"&&r.has(g))throw new Error("[Bug] invalidated atom exists");d.add(g),h.pop();continue}c.add(g);for(const b of vU(g,v,n))c.has(b)||h.push(b)}for(let g=l.length-1;g>=0;--g){const[v,b]=l[g];let _=!1;for(const w of b.d.keys())if(w!==v&&i.has(w)){_=!0;break}_&&(a(t,v),o(t,v)),r.delete(v)}},xN=new WeakSet,hee=(t,e)=>{var n,r;const i=io(t),s=i[1],a=i[2],o=i[3],l=i[6],c=i[7],d=i[11],h=i[12],g=i[13],v=i[14],b=i[16],_=i[17],w=i[20],S=i[26],E=d(t,e);if(rD(E)){if(s.has(e)&&a.get(e)!==E.n)return E;let G=!1;for(const[Z,B]of E.d)if(v(t,Z).n!==B){G=!0;break}if(!G)return E}let A=!0;const N=new Set(E.d.keys()),I=new Map,P=()=>{for(const G of N)I.has(G)||E.d.delete(G)},L=()=>{if(s.has(e)){const G=!o.size;_(t,e),G&&(g(t),h(t))}},R=G=>{var Z;if(G===e){const q=d(t,G);if(!rD(q))if(mU(G))w(t,G,G.init);else throw new Error("no atom init");return KM(q)}const B=v(t,G);try{return KM(B)}finally{I.set(G,B.n),E.d.set(G,B.n),ZM(E.v)&&gU(e,E.v,B),s.has(e)&&((Z=s.get(G))==null||Z.t.add(e)),A||L()}};let O,W;const U={get signal(){return O||(O=new AbortController),O.signal},get setSelf(){return(Bf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(Bf?"production":void 0)!=="production"&&!vN(e)&&console.warn("setSelf function cannot be used with read-only atom"),!W&&vN(e)&&(W=(...G)=>{if((Bf?"production":void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)try{return b(t,e,...G)}finally{g(t),h(t)}}),W}},V=E.n;try{(Bf?"production":void 0)!=="production"&&xN.delete(t);const G=c(t,e,R,U);if((Bf?"production":void 0)!=="production"&&xN.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),w(t,e,G),ZM(G)){S(t,G,()=>O==null?void 0:O.abort());const Z=()=>{P(),L()};G.then(Z,Z)}else P();return(n=l.r)==null||n.call(l,e),E}catch(G){return delete E.v,E.e=G,++E.n,E}finally{A=!1,V!==E.n&&a.get(e)===V&&(a.set(e,E.n),o.add(e),(r=l.c)==null||r.call(l,e))}},pee=(t,e)=>{const n=io(t),r=n[1],i=n[2],s=n[11],a=[e];for(;a.length;){const o=a.pop(),l=s(t,o);for(const c of vU(o,l,r)){const d=s(t,c);i.get(c)!==d.n&&(i.set(c,d.n),a.push(c))}}},mee=(t,e,...n)=>{const r=io(t),i=r[3],s=r[6],a=r[8],o=r[11],l=r[12],c=r[13],d=r[14],h=r[15],g=r[16],v=r[17],b=r[20];let _=!0;const w=E=>KM(d(t,E)),S=(E,...A)=>{var N;const I=o(t,E);try{if(E===e){if(!mU(E))throw new Error("atom not writable");(Bf?"production":void 0)!=="production"&&xN.add(t);const P=I.n,L=A[0];b(t,E,L),v(t,E),P!==I.n&&(i.add(E),h(t,E),(N=s.c)==null||N.call(s,E));return}else return g(t,E,...A)}finally{_||(c(t),l(t))}};try{return a(t,e,w,S,...n)}finally{_=!1}},gee=(t,e)=>{var n;const r=io(t),i=r[1],s=r[3],a=r[6],o=r[11],l=r[15],c=r[18],d=r[19],h=o(t,e),g=i.get(e);if(g){for(const[v,b]of h.d)if(!g.d.has(v)){const _=o(t,v);c(t,v).t.add(e),g.d.add(v),b!==_.n&&(s.add(v),l(t,v),(n=a.c)==null||n.call(a,v))}for(const v of g.d)if(!h.d.has(v)){g.d.delete(v);const b=d(t,v);b==null||b.t.delete(e)}}},vee=(t,e)=>{var n;const r=io(t),i=r[1],s=r[4],a=r[6],o=r[10],l=r[11],c=r[12],d=r[13],h=r[14],g=r[16],v=r[18],b=l(t,e);let _=i.get(e);if(!_){h(t,e);for(const w of b.d.keys())v(t,w).t.add(e);if(_={l:new Set,d:new Set(b.d.keys()),t:new Set},i.set(e,_),vN(e)){const w=()=>{let S=!0;const E=(...A)=>{try{return g(t,e,...A)}finally{S||(d(t),c(t))}};try{const A=o(t,e,E);A&&(_.u=()=>{S=!0;try{A()}finally{S=!1}})}finally{S=!1}};s.add(w)}(n=a.m)==null||n.call(a,e)}return _},xee=(t,e)=>{var n,r;const i=io(t),s=i[1],a=i[5],o=i[6],l=i[11],c=i[19],d=l(t,e);let h=s.get(e);if(!h||h.l.size)return h;let g=!1;for(const v of h.t)if((n=s.get(v))!=null&&n.d.has(e)){g=!0;break}if(!g){h.u&&a.add(h.u),h=void 0,s.delete(e);for(const v of d.d.keys()){const b=c(t,v);b==null||b.t.delete(e)}(r=o.u)==null||r.call(o,e);return}return h},yee=(t,e,n)=>{const r=io(t),i=r[11],s=r[27],a=i(t,e),o="v"in a,l=a.v;if(ZM(n))for(const c of a.d.keys())gU(e,n,i(t,c));a.v=n,delete a.e,(!o||!Object.is(l,a.v))&&(++a.n,ZM(l)&&s(t,l))},bee=(t,e)=>{const n=io(t)[14];return KM(n(t,e))},_ee=(t,e,...n)=>{const r=io(t),i=r[12],s=r[13],a=r[16];try{return a(t,e,...n)}finally{s(t),i(t)}},See=(t,e,n)=>{const r=io(t),i=r[12],s=r[18],a=r[19],l=s(t,e).l;return l.add(n),i(t),()=>{l.delete(n),a(t,e),i(t)}},wee=(t,e,n)=>{const i=io(t)[25];let s=i.get(e);if(!s){s=new Set,i.set(e,s);const a=()=>i.delete(e);e.then(a,a)}s.add(n)},Mee=(t,e)=>{const i=io(t)[25].get(e);i==null||i.forEach(s=>s())},xU=new WeakMap,io=t=>{const e=xU.get(t);if((Bf?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function Tee(t){const e=io(t),n=e[24];return n?n(e):e}function Eee(...t){const e={get(r){const i=io(e)[21];return i(e,r)},set(r,...i){const s=io(e)[22];return s(e,r,...i)},sub(r,i){const s=io(e)[23];return s(e,r,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},aee,oee,lee,cee,uee,dee,fee,hee,pee,mee,gee,vee,xee,yee,bee,_ee,See,void 0,new WeakMap,wee,Mee].map((r,i)=>t[i]||r);return xU.set(e,Object.freeze(n)),e}const yU={};let Cee=0;function Qr(t,e){const n=`atom${++Cee}`,r={toString(){return(yU?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Aee,r.write=Nee),e&&(r.write=e),r}function Aee(t){return t(this)}function Nee(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function bU(){return Eee()}let Ub;function Ree(){return Ub||(Ub=bU(),(yU?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Ub),globalThis.__JOTAI_DEFAULT_STORE__!==Ub&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Ub}const kee={},yN=T.createContext(void 0);function _U(t){return T.useContext(yN)||Ree()}function Pee({children:t,store:e}){const n=T.useRef(null);return e?T.createElement(yN.Provider,{value:e},t):(n.current===null&&(n.current=bU()),T.createElement(yN.Provider,{value:n.current},t))}const bN=t=>typeof(t==null?void 0:t.then)=="function",_N=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},Dee=Zr.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(_N(t),t)}),_C=new WeakMap,iD=(t,e,n)=>{const i=Tee(t)[26];let s=_C.get(e);return s||(s=new Promise((a,o)=>{let l=e;const c=g=>v=>{l===g&&a(v)},d=g=>v=>{l===g&&o(v)},h=()=>{try{const g=n();bN(g)?(_C.set(g,s),l=g,g.then(c(g),d(g)),i(t,g,h)):a(g)}catch(g){o(g)}};e.then(c(e),d(e)),i(t,e,h)}),_C.set(e,s)),s};function ki(t,e){const{delay:n,unstable_promiseStatus:r=!Zr.use}={},i=_U(),[[s,a,o],l]=T.useReducer(d=>{const h=i.get(t);return Object.is(d[0],h)&&d[1]===i&&d[2]===t?d:[h,i,t]},void 0,()=>[i.get(t),i,t]);let c=s;if((a!==i||o!==t)&&(l(),c=i.get(t)),T.useEffect(()=>{const d=i.sub(t,()=>{if(r)try{const h=i.get(t);bN(h)&&_N(iD(i,h,()=>i.get(t)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),d},[i,t,n,r]),T.useDebugValue(c),bN(c)){const d=iD(i,c,()=>i.get(t));return r&&_N(d),Dee(d)}return c}function zd(t,e){const n=_U();return T.useCallback((...i)=>{if((kee?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function cn(t,e){return[ki(t),zd(t)]}function sD(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function D5(...t){return e=>{let n=!1;const r=t.map(i=>{const s=sD(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():sD(t[i],null)}}}}function Lr(...t){return T.useCallback(D5(...t),t)}function W0(t){const e=Iee(t),n=T.forwardRef((r,i)=>{const{children:s,...a}=r,o=T.Children.toArray(s),l=o.find(Oee);if(l){const c=l.props.children,d=o.map(h=>h===l?T.Children.count(c)>1?T.Children.only(null):T.isValidElement(c)?c.props.children:null:h);return p.jsx(e,{...a,ref:i,children:T.isValidElement(c)?T.cloneElement(c,void 0,d):null})}return p.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var SU=W0("Slot");function Iee(t){const e=T.forwardRef((n,r)=>{const{children:i,...s}=n;if(T.isValidElement(i)){const a=zee(i),o=Lee(s,i.props);return i.type!==T.Fragment&&(o.ref=r?D5(r,a):a),T.cloneElement(i,o)}return T.Children.count(i)>1?T.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var wU=Symbol("radix.slottable");function MU(t){const e=({children:n})=>p.jsx(p.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=wU,e}function Oee(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===wU}function Lee(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]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function zee(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 jee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ar=jee.reduce((t,e)=>{const n=W0(`Primitive.${e}`),r=T.forwardRef((i,s)=>{const{asChild:a,...o}=i,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...o,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function TU(t,e){t&&Ld.flushSync(()=>t.dispatchEvent(e))}var EU=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"}),Fee="VisuallyHidden",CU=T.forwardRef((t,e)=>p.jsx(ar.span,{...t,ref:e,style:{...EU,...t.style}}));CU.displayName=Fee;var Uee=CU;function Bee(t,e){const n=T.createContext(e),r=s=>{const{children:a,...o}=s,l=T.useMemo(()=>o,Object.values(o));return p.jsx(n.Provider,{value:l,children:a})};r.displayName=t+"Provider";function i(s){const a=T.useContext(n);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function ou(t,e=[]){let n=[];function r(s,a){const o=T.createContext(a),l=n.length;n=[...n,a];const c=h=>{var S;const{scope:g,children:v,...b}=h,_=((S=g==null?void 0:g[t])==null?void 0:S[l])||o,w=T.useMemo(()=>b,Object.values(b));return p.jsx(_.Provider,{value:w,children:v})};c.displayName=s+"Provider";function d(h,g){var _;const v=((_=g==null?void 0:g[t])==null?void 0:_[l])||o,b=T.useContext(v);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(a=>T.createContext(a));return function(o){const l=(o==null?void 0:o[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])}};return i.scopeName=t,[r,Hee(i,...e)]}function Hee(...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 a=r.reduce((o,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...o,...h}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function P7(t){const e=t+"CollectionProvider",[n,r]=ou(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=_=>{const{scope:w,children:S}=_,E=Zr.useRef(null),A=Zr.useRef(new Map).current;return p.jsx(i,{scope:w,itemMap:A,collectionRef:E,children:S})};a.displayName=e;const o=t+"CollectionSlot",l=W0(o),c=Zr.forwardRef((_,w)=>{const{scope:S,children:E}=_,A=s(o,S),N=Lr(w,A.collectionRef);return p.jsx(l,{ref:N,children:E})});c.displayName=o;const d=t+"CollectionItemSlot",h="data-radix-collection-item",g=W0(d),v=Zr.forwardRef((_,w)=>{const{scope:S,children:E,...A}=_,N=Zr.useRef(null),I=Lr(w,N),P=s(d,S);return Zr.useEffect(()=>(P.itemMap.set(N,{ref:N,...A}),()=>void P.itemMap.delete(N))),p.jsx(g,{[h]:"",ref:I,children:E})});v.displayName=d;function b(_){const w=s(t+"CollectionConsumer",_);return Zr.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const A=Array.from(E.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((P,L)=>A.indexOf(P.ref.current)-A.indexOf(L.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:c,ItemSlot:v},b,r]}function gn(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 bo=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{},Vee=kF[" useInsertionEffect ".trim().toString()]||bo;function Gd({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,a]=Gee({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:i;{const d=T.useRef(t!==void 0);T.useEffect(()=>{const h=d.current;h!==o&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,r])}const c=T.useCallback(d=>{var h;if(o){const g=Wee(d)?d(t):d;g!==t&&((h=a.current)==null||h.call(a,g))}else s(d)},[o,t,s,a]);return[l,c]}function Gee({defaultProp:t,onChange:e}){const[n,r]=T.useState(t),i=T.useRef(n),s=T.useRef(e);return Vee(()=>{s.current=e},[e]),T.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}function Wee(t){return typeof t=="function"}function $ee(t,e){return T.useReducer((n,r)=>e[n][r]??n,t)}var Vo=t=>{const{present:e,children:n}=t,r=qee(e),i=typeof n=="function"?n({present:r.isPresent}):T.Children.only(n),s=Lr(r.ref,Xee(i));return typeof n=="function"||r.isPresent?T.cloneElement(i,{ref:s}):null};Vo.displayName="Presence";function qee(t){const[e,n]=T.useState(),r=T.useRef(null),i=T.useRef(t),s=T.useRef("none"),a=t?"mounted":"unmounted",[o,l]=$ee(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const c=G3(r.current);s.current=o==="mounted"?c:"none"},[o]),bo(()=>{const c=r.current,d=i.current;if(d!==t){const g=s.current,v=G3(c);t?l("MOUNT"):v==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&g!==v?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),bo(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,h=v=>{const _=G3(r.current).includes(CSS.escape(v.animationName));if(v.target===e&&_&&(l("ANIMATION_END"),!i.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},g=v=>{v.target===e&&(s.current=G3(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:T.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function G3(t){return(t==null?void 0:t.animationName)||"none"}function Xee(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 Yee=kF[" useId ".trim().toString()]||(()=>{}),Kee=0;function Gu(t){const[e,n]=T.useState(Yee());return bo(()=>{n(r=>r??String(Kee++))},[t]),t||(e?`radix-${e}`:"")}var I5="Collapsible",[Zee]=ou(I5),[Qee,D7]=Zee(I5),AU=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:a,...o}=t,[l,c]=Gd({prop:r,defaultProp:i??!1,onChange:a,caller:I5});return p.jsx(Qee,{scope:n,disabled:s,contentId:Gu(),open:l,onOpenToggle:T.useCallback(()=>c(d=>!d),[c]),children:p.jsx(ar.div,{"data-state":O7(l),"data-disabled":s?"":void 0,...o,ref:e})})});AU.displayName=I5;var NU="CollapsibleTrigger",RU=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=D7(NU,n);return p.jsx(ar.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":O7(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:gn(t.onClick,i.onOpenToggle)})});RU.displayName=NU;var I7="CollapsibleContent",kU=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=D7(I7,t.__scopeCollapsible);return p.jsx(Vo,{present:n||i.open,children:({present:s})=>p.jsx(Jee,{...r,ref:e,present:s})})});kU.displayName=I7;var Jee=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,a=D7(I7,n),[o,l]=T.useState(r),c=T.useRef(null),d=Lr(e,c),h=T.useRef(0),g=h.current,v=T.useRef(0),b=v.current,_=a.open||o,w=T.useRef(_),S=T.useRef(void 0);return T.useEffect(()=>{const E=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(E)},[]),bo(()=>{const E=c.current;if(E){S.current=S.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const A=E.getBoundingClientRect();h.current=A.height,v.current=A.width,w.current||(E.style.transitionDuration=S.current.transitionDuration,E.style.animationName=S.current.animationName),l(r)}},[a.open,r]),p.jsx(ar.div,{"data-state":O7(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!_,...s,ref:d,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...t.style},children:_&&i})});function O7(t){return t?"open":"closed"}var ete=AU,tte=RU,nte=kU,rte=T.createContext(void 0);function XS(t){const e=T.useContext(rte);return t||e||"ltr"}function Fo(t){const e=T.useRef(t);return T.useEffect(()=>{e.current=t}),T.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function ite(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(t);T.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 ste="DismissableLayer",SN="dismissableLayer.update",ate="dismissableLayer.pointerDownOutside",ote="dismissableLayer.focusOutside",aD,PU=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),py=T.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:o,...l}=t,c=T.useContext(PU),[d,h]=T.useState(null),g=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=T.useState({}),b=Lr(e,L=>h(L)),_=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),S=_.indexOf(w),E=d?_.indexOf(d):-1,A=c.layersWithOutsidePointerEventsDisabled.size>0,N=E>=S,I=ute(L=>{const R=L.target,O=[...c.branches].some(W=>W.contains(R));!N||O||(i==null||i(L),a==null||a(L),L.defaultPrevented||o==null||o())},g),P=dte(L=>{const R=L.target;[...c.branches].some(W=>W.contains(R))||(s==null||s(L),a==null||a(L),L.defaultPrevented||o==null||o())},g);return ite(L=>{E===c.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&o&&(L.preventDefault(),o()))},g),T.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(aD=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),oD(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=aD)}},[d,g,n,c]),T.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),oD())},[d,c]),T.useEffect(()=>{const L=()=>v({});return document.addEventListener(SN,L),()=>document.removeEventListener(SN,L)},[]),p.jsx(ar.div,{...l,ref:b,style:{pointerEvents:A?N?"auto":"none":void 0,...t.style},onFocusCapture:gn(t.onFocusCapture,P.onFocusCapture),onBlurCapture:gn(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:gn(t.onPointerDownCapture,I.onPointerDownCapture)})});py.displayName=ste;var lte="DismissableLayerBranch",cte=T.forwardRef((t,e)=>{const n=T.useContext(PU),r=T.useRef(null),i=Lr(e,r);return T.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),p.jsx(ar.div,{...t,ref:i})});cte.displayName=lte;function ute(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(t),r=T.useRef(!1),i=T.useRef(()=>{});return T.useEffect(()=>{const s=o=>{if(o.target&&!r.current){let l=function(){DU(ate,n,c,{discrete:!0})};const c={originalEvent:o};o.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},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function dte(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(t),r=T.useRef(!1);return T.useEffect(()=>{const i=s=>{s.target&&!r.current&&DU(ote,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 oD(){const t=new CustomEvent(SN);document.dispatchEvent(t)}function DU(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?TU(i,s):i.dispatchEvent(s)}var SC="focusScope.autoFocusOnMount",wC="focusScope.autoFocusOnUnmount",lD={bubbles:!1,cancelable:!0},fte="FocusScope",YS=T.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,l]=T.useState(null),c=Fo(i),d=Fo(s),h=T.useRef(null),g=Lr(e,_=>l(_)),v=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(r){let _=function(A){if(v.paused||!o)return;const N=A.target;o.contains(N)?h.current=N:S0(h.current,{select:!0})},w=function(A){if(v.paused||!o)return;const N=A.relatedTarget;N!==null&&(o.contains(N)||S0(h.current,{select:!0}))},S=function(A){if(document.activeElement===document.body)for(const I of A)I.removedNodes.length>0&&S0(o)};document.addEventListener("focusin",_),document.addEventListener("focusout",w);const E=new MutationObserver(S);return o&&E.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),E.disconnect()}}},[r,o,v.paused]),T.useEffect(()=>{if(o){uD.add(v);const _=document.activeElement;if(!o.contains(_)){const S=new CustomEvent(SC,lD);o.addEventListener(SC,c),o.dispatchEvent(S),S.defaultPrevented||(hte(xte(IU(o)),{select:!0}),document.activeElement===_&&S0(o))}return()=>{o.removeEventListener(SC,c),setTimeout(()=>{const S=new CustomEvent(wC,lD);o.addEventListener(wC,d),o.dispatchEvent(S),S.defaultPrevented||S0(_??document.body,{select:!0}),o.removeEventListener(wC,d),uD.remove(v)},0)}}},[o,c,d,v]);const b=T.useCallback(_=>{if(!n&&!r||v.paused)return;const w=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,S=document.activeElement;if(w&&S){const E=_.currentTarget,[A,N]=pte(E);A&&N?!_.shiftKey&&S===N?(_.preventDefault(),n&&S0(A,{select:!0})):_.shiftKey&&S===A&&(_.preventDefault(),n&&S0(N,{select:!0})):S===E&&_.preventDefault()}},[n,r,v.paused]);return p.jsx(ar.div,{tabIndex:-1,...a,ref:g,onKeyDown:b})});YS.displayName=fte;function hte(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(S0(r,{select:e}),document.activeElement!==n)return}function pte(t){const e=IU(t),n=cD(e,t),r=cD(e.reverse(),t);return[n,r]}function IU(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 cD(t,e){for(const n of t)if(!mte(n,{upTo:e}))return n}function mte(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 gte(t){return t instanceof HTMLInputElement&&"select"in t}function S0(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&gte(t)&&e&&t.select()}}var uD=vte();function vte(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=dD(t,e),t.unshift(e)},remove(e){var n;t=dD(t,e),(n=t[0])==null||n.resume()}}}function dD(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function xte(t){return t.filter(e=>e.tagName!=="A")}var yte="Portal",my=T.forwardRef((t,e)=>{var o;const{container:n,...r}=t,[i,s]=T.useState(!1);bo(()=>s(!0),[]);const a=n||i&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return a?AJ.createPortal(p.jsx(ar.div,{...r,ref:e}),a):null});my.displayName=yte;var MC=0;function O5(){T.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??fD()),document.body.insertAdjacentElement("beforeend",t[1]??fD()),MC++,()=>{MC===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),MC--}},[])}function fD(){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 Hf=function(){return Hf=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},Hf.apply(this,arguments)};function OU(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function bte(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var kM="right-scroll-bar-position",PM="width-before-scroll-bar",_te="with-scroll-bars-hidden",Ste="--removed-body-scroll-bar-size";function TC(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function wte(t,e){var n=T.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 Mte=typeof window<"u"?T.useLayoutEffect:T.useEffect,hD=new WeakMap;function Tte(t,e){var n=wte(null,function(r){return t.forEach(function(i){return TC(i,r)})});return Mte(function(){var r=hD.get(n);if(r){var i=new Set(r),s=new Set(t),a=n.current;i.forEach(function(o){s.has(o)||TC(o,null)}),s.forEach(function(o){i.has(o)||TC(o,a)})}hD.set(n,t)},[t]),n}function Ete(t){return t}function Cte(t,e){e===void 0&&(e=Ete);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 a=e(s,r);return n.push(a),function(){n=n.filter(function(o){return o!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(o){return s(o)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var o=n;n=[],o.forEach(s),a=n}var l=function(){var d=a;a=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){a.push(d),c()},filter:function(d){return a=a.filter(d),n}}}};return i}function Ate(t){t===void 0&&(t={});var e=Cte(null);return e.options=Hf({async:!0,ssr:!1},t),e}var LU=function(t){var e=t.sideCar,n=OU(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 T.createElement(r,Hf({},n))};LU.isSideCarExport=!0;function Nte(t,e){return t.useMedium(e),LU}var zU=Ate(),EC=function(){},L5=T.forwardRef(function(t,e){var n=T.useRef(null),r=T.useState({onScrollCapture:EC,onWheelCapture:EC,onTouchMoveCapture:EC}),i=r[0],s=r[1],a=t.forwardProps,o=t.children,l=t.className,c=t.removeScrollBar,d=t.enabled,h=t.shards,g=t.sideCar,v=t.noRelative,b=t.noIsolation,_=t.inert,w=t.allowPinchZoom,S=t.as,E=S===void 0?"div":S,A=t.gapMode,N=OU(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=g,P=Tte([n,e]),L=Hf(Hf({},N),i);return T.createElement(T.Fragment,null,d&&T.createElement(I,{sideCar:zU,removeScrollBar:c,shards:h,noRelative:v,noIsolation:b,inert:_,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:A}),a?T.cloneElement(T.Children.only(o),Hf(Hf({},L),{ref:P})):T.createElement(E,Hf({},L,{className:l,ref:P}),o))});L5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};L5.classNames={fullWidth:PM,zeroRight:kM};var Rte=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kte(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Rte();return e&&t.setAttribute("nonce",e),t}function Pte(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Dte(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Ite=function(){var t=0,e=null;return{add:function(n){t==0&&(e=kte())&&(Pte(e,n),Dte(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Ote=function(){var t=Ite();return function(e,n){T.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},jU=function(){var t=Ote(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},Lte={left:0,top:0,right:0,gap:0},CC=function(t){return parseInt(t||"",10)||0},zte=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[CC(n),CC(r),CC(i)]},jte=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Lte;var e=zte(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])}},Fte=jU(),o1="data-scroll-locked",Ute=function(t,e,n,r){var i=t.left,s=t.top,a=t.right,o=t.gap;return n===void 0&&(n="margin"),`
  .`.concat(_te,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(o,"px ").concat(r,`;
  }
  body[`).concat(o1,`] {
    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(a,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(o,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(kM,` {
    right: `).concat(o,"px ").concat(r,`;
  }
  
  .`).concat(PM,` {
    margin-right: `).concat(o,"px ").concat(r,`;
  }
  
  .`).concat(kM," .").concat(kM,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(PM," .").concat(PM,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(o1,`] {
    `).concat(Ste,": ").concat(o,`px;
  }
`)},pD=function(){var t=parseInt(document.body.getAttribute(o1)||"0",10);return isFinite(t)?t:0},Bte=function(){T.useEffect(function(){return document.body.setAttribute(o1,(pD()+1).toString()),function(){var t=pD()-1;t<=0?document.body.removeAttribute(o1):document.body.setAttribute(o1,t.toString())}},[])},Hte=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;Bte();var s=T.useMemo(function(){return jte(i)},[i]);return T.createElement(Fte,{styles:Ute(s,!e,i,n?"":"!important")})},wN=!1;if(typeof window<"u")try{var W3=Object.defineProperty({},"passive",{get:function(){return wN=!0,!0}});window.addEventListener("test",W3,W3),window.removeEventListener("test",W3,W3)}catch{wN=!1}var bx=wN?{passive:!1}:!1,Vte=function(t){return t.tagName==="TEXTAREA"},FU=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Vte(t)&&n[e]==="visible")},Gte=function(t){return FU(t,"overflowY")},Wte=function(t){return FU(t,"overflowX")},mD=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=UU(t,r);if(i){var s=BU(t,r),a=s[1],o=s[2];if(a>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$te=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},qte=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},UU=function(t,e){return t==="v"?Gte(e):Wte(e)},BU=function(t,e){return t==="v"?$te(e):qte(e)},Xte=function(t,e){return t==="h"&&e==="rtl"?-1:1},Yte=function(t,e,n,r,i){var s=Xte(t,window.getComputedStyle(e).direction),a=s*r,o=n.target,l=e.contains(o),c=!1,d=a>0,h=0,g=0;do{if(!o)break;var v=BU(t,o),b=v[0],_=v[1],w=v[2],S=_-w-s*b;(b||S)&&UU(t,o)&&(h+=S,g+=b);var E=o.parentNode;o=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));return(d&&Math.abs(h)<1||!d&&Math.abs(g)<1)&&(c=!0),c},$3=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},gD=function(t){return[t.deltaX,t.deltaY]},vD=function(t){return t&&"current"in t?t.current:t},Kte=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Zte=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Qte=0,_x=[];function Jte(t){var e=T.useRef([]),n=T.useRef([0,0]),r=T.useRef(),i=T.useState(Qte++)[0],s=T.useState(jU)[0],a=T.useRef(t);T.useEffect(function(){a.current=t},[t]),T.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var _=bte([t.lockRef.current],(t.shards||[]).map(vD),!0).filter(Boolean);return _.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var o=T.useCallback(function(_,w){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!a.current.allowPinchZoom;var S=$3(_),E=n.current,A="deltaX"in _?_.deltaX:E[0]-S[0],N="deltaY"in _?_.deltaY:E[1]-S[1],I,P=_.target,L=Math.abs(A)>Math.abs(N)?"h":"v";if("touches"in _&&L==="h"&&P.type==="range")return!1;var R=window.getSelection(),O=R&&R.anchorNode,W=O?O===P||O.contains(P):!1;if(W)return!1;var U=mD(L,P);if(!U)return!0;if(U?I=L:(I=L==="v"?"h":"v",U=mD(L,P)),!U)return!1;if(!r.current&&"changedTouches"in _&&(A||N)&&(r.current=I),!I)return!0;var V=r.current||I;return Yte(V,w,_,V==="h"?A:N)},[]),l=T.useCallback(function(_){var w=_;if(!(!_x.length||_x[_x.length-1]!==s)){var S="deltaY"in w?gD(w):$3(w),E=e.current.filter(function(I){return I.name===w.type&&(I.target===w.target||w.target===I.shadowParent)&&Kte(I.delta,S)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var A=(a.current.shards||[]).map(vD).filter(Boolean).filter(function(I){return I.contains(w.target)}),N=A.length>0?o(w,A[0]):!a.current.noIsolation;N&&w.cancelable&&w.preventDefault()}}},[]),c=T.useCallback(function(_,w,S,E){var A={name:_,delta:w,target:S,should:E,shadowParent:ene(S)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(N){return N!==A})},1)},[]),d=T.useCallback(function(_){n.current=$3(_),r.current=void 0},[]),h=T.useCallback(function(_){c(_.type,gD(_),_.target,o(_,t.lockRef.current))},[]),g=T.useCallback(function(_){c(_.type,$3(_),_.target,o(_,t.lockRef.current))},[]);T.useEffect(function(){return _x.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",l,bx),document.addEventListener("touchmove",l,bx),document.addEventListener("touchstart",d,bx),function(){_x=_x.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,bx),document.removeEventListener("touchmove",l,bx),document.removeEventListener("touchstart",d,bx)}},[]);var v=t.removeScrollBar,b=t.inert;return T.createElement(T.Fragment,null,b?T.createElement(s,{styles:Zte(i)}):null,v?T.createElement(Hte,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function ene(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const tne=Nte(zU,Jte);var KS=T.forwardRef(function(t,e){return T.createElement(L5,Hf({},t,{ref:e,sideCar:tne}))});KS.classNames=L5.classNames;var nne=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Sx=new WeakMap,q3=new WeakMap,X3={},AC=0,HU=function(t){return t&&(t.host||HU(t.parentNode))},rne=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=HU(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})},ine=function(t,e,n,r){var i=rne(e,Array.isArray(t)?t:[t]);X3[n]||(X3[n]=new WeakMap);var s=X3[n],a=[],o=new Set,l=new Set(i),c=function(h){!h||o.has(h)||(o.add(h),c(h.parentNode))};i.forEach(c);var d=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(g){if(o.has(g))d(g);else try{var v=g.getAttribute(r),b=v!==null&&v!=="false",_=(Sx.get(g)||0)+1,w=(s.get(g)||0)+1;Sx.set(g,_),s.set(g,w),a.push(g),_===1&&b&&q3.set(g,!0),w===1&&g.setAttribute(n,"true"),b||g.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",g,S)}})};return d(e),o.clear(),AC++,function(){a.forEach(function(h){var g=Sx.get(h)-1,v=s.get(h)-1;Sx.set(h,g),s.set(h,v),g||(q3.has(h)||h.removeAttribute(r),q3.delete(h)),v||h.removeAttribute(n)}),AC--,AC||(Sx=new WeakMap,Sx=new WeakMap,q3=new WeakMap,X3={})}},z5=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=nne(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),ine(r,i,n,"aria-hidden")):function(){return null}},j5="Dialog",[VU,GU]=ou(j5),[sne,Yd]=VU(j5),WU=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,o=T.useRef(null),l=T.useRef(null),[c,d]=Gd({prop:r,defaultProp:i??!1,onChange:s,caller:j5});return p.jsx(sne,{scope:e,triggerRef:o,contentRef:l,contentId:Gu(),titleId:Gu(),descriptionId:Gu(),open:c,onOpenChange:d,onOpenToggle:T.useCallback(()=>d(h=>!h),[d]),modal:a,children:n})};WU.displayName=j5;var $U="DialogTrigger",qU=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd($U,n),s=Lr(e,i.triggerRef);return p.jsx(ar.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":j7(i.open),...r,ref:s,onClick:gn(t.onClick,i.onOpenToggle)})});qU.displayName=$U;var L7="DialogPortal",[ane,XU]=VU(L7,{forceMount:void 0}),YU=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Yd(L7,e);return p.jsx(ane,{scope:e,forceMount:n,children:T.Children.map(r,a=>p.jsx(Vo,{present:n||s.open,children:p.jsx(my,{asChild:!0,container:i,children:a})}))})};YU.displayName=L7;var QM="DialogOverlay",KU=T.forwardRef((t,e)=>{const n=XU(QM,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Yd(QM,t.__scopeDialog);return s.modal?p.jsx(Vo,{present:r||s.open,children:p.jsx(lne,{...i,ref:e})}):null});KU.displayName=QM;var one=W0("DialogOverlay.RemoveScroll"),lne=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(QM,n);return p.jsx(KS,{as:one,allowPinchZoom:!0,shards:[i.contentRef],children:p.jsx(ar.div,{"data-state":j7(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Kg="DialogContent",ZU=T.forwardRef((t,e)=>{const n=XU(Kg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Yd(Kg,t.__scopeDialog);return p.jsx(Vo,{present:r||s.open,children:s.modal?p.jsx(cne,{...i,ref:e}):p.jsx(une,{...i,ref:e})})});ZU.displayName=Kg;var cne=T.forwardRef((t,e)=>{const n=Yd(Kg,t.__scopeDialog),r=T.useRef(null),i=Lr(e,n.contentRef,r);return T.useEffect(()=>{const s=r.current;if(s)return z5(s)},[]),p.jsx(QU,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gn(t.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:gn(t.onPointerDownOutside,s=>{const a=s.detail.originalEvent,o=a.button===0&&a.ctrlKey===!0;(a.button===2||o)&&s.preventDefault()}),onFocusOutside:gn(t.onFocusOutside,s=>s.preventDefault())})}),une=T.forwardRef((t,e)=>{const n=Yd(Kg,t.__scopeDialog),r=T.useRef(!1),i=T.useRef(!1);return p.jsx(QU,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.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 a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),QU=T.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=t,o=Yd(Kg,n),l=T.useRef(null),c=Lr(e,l);return O5(),p.jsxs(p.Fragment,{children:[p.jsx(YS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(py,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":j7(o.open),...a,ref:c,onDismiss:()=>o.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(fne,{titleId:o.titleId}),p.jsx(pne,{contentRef:l,descriptionId:o.descriptionId})]})]})}),z7="DialogTitle",JU=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(z7,n);return p.jsx(ar.h2,{id:i.titleId,...r,ref:e})});JU.displayName=z7;var eB="DialogDescription",tB=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(eB,n);return p.jsx(ar.p,{id:i.descriptionId,...r,ref:e})});tB.displayName=eB;var nB="DialogClose",rB=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(nB,n);return p.jsx(ar.button,{type:"button",...r,ref:e,onClick:gn(t.onClick,()=>i.onOpenChange(!1))})});rB.displayName=nB;function j7(t){return t?"open":"closed"}var iB="DialogTitleWarning",[dne,sB]=Bee(iB,{contentName:Kg,titleName:z7,docsSlug:"dialog"}),fne=({titleId:t})=>{const e=sB(iB),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 T.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},hne="DialogDescriptionWarning",pne=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sB(hne).contentName}}.`;return T.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},aB=WU,oB=qU,lB=YU,cB=KU,uB=ZU,dB=JU,fB=tB,F7=rB,hB="AlertDialog",[mne]=ou(hB,[GU]),vp=GU(),pB=t=>{const{__scopeAlertDialog:e,...n}=t,r=vp(e);return p.jsx(aB,{...r,...n,modal:!0})};pB.displayName=hB;var gne="AlertDialogTrigger",vne=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=vp(n);return p.jsx(oB,{...i,...r,ref:e})});vne.displayName=gne;var xne="AlertDialogPortal",mB=t=>{const{__scopeAlertDialog:e,...n}=t,r=vp(e);return p.jsx(lB,{...r,...n})};mB.displayName=xne;var yne="AlertDialogOverlay",gB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=vp(n);return p.jsx(cB,{...i,...r,ref:e})});gB.displayName=yne;var l1="AlertDialogContent",[bne,_ne]=mne(l1),Sne=MU("AlertDialogContent"),vB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=vp(n),a=T.useRef(null),o=Lr(e,a),l=T.useRef(null);return p.jsx(dne,{contentName:l1,titleName:xB,docsSlug:"alert-dialog",children:p.jsx(bne,{scope:n,cancelRef:l,children:p.jsxs(uB,{role:"alertdialog",...s,...i,ref:o,onOpenAutoFocus:gn(i.onOpenAutoFocus,c=>{var d;c.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[p.jsx(Sne,{children:r}),p.jsx(Mne,{contentRef:a})]})})})});vB.displayName=l1;var xB="AlertDialogTitle",yB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=vp(n);return p.jsx(dB,{...i,...r,ref:e})});yB.displayName=xB;var bB="AlertDialogDescription",_B=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=vp(n);return p.jsx(fB,{...i,...r,ref:e})});_B.displayName=bB;var wne="AlertDialogAction",SB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=vp(n);return p.jsx(F7,{...i,...r,ref:e})});SB.displayName=wne;var wB="AlertDialogCancel",MB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=_ne(wB,n),s=vp(n),a=Lr(e,i);return p.jsx(F7,{...s,...r,ref:a})});MB.displayName=wB;var Mne=({contentRef:t})=>{const e=`\`${l1}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${l1}\` by passing a \`${bB}\` 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 \`${l1}\`. 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 T.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Tne=pB,Ene=mB,Cne=gB,Ane=vB,Nne=SB,Rne=MB,kne=yB,Pne=_B,NC={exports:{}},RC={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var xD;function Dne(){if(xD)return RC;xD=1;var t=GS();function e(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue;function o(h,g){var v=g(),b=r({inst:{value:v,getSnapshot:g}}),_=b[0].inst,w=b[1];return s(function(){_.value=v,_.getSnapshot=g,l(_)&&w({inst:_})},[h,v,g]),i(function(){return l(_)&&w({inst:_}),h(function(){l(_)&&w({inst:_})})},[h]),a(v),v}function l(h){var g=h.getSnapshot;h=h.value;try{var v=g();return!n(h,v)}catch{return!0}}function c(h,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return RC.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,RC}var yD;function Ine(){return yD||(yD=1,NC.exports=Dne()),NC.exports}function One(t){const e=T.useRef({value:t,previous:t});return T.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function Lne(t){const[e,n]=T.useState(void 0);return bo(()=>{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 a,o;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,o=c.blockSize}else a=t.offsetWidth,o=t.offsetHeight;n({width:a,height:o})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const zne=["top","right","bottom","left"],$0=Math.min,qc=Math.max,JM=Math.round,Y3=Math.floor,Jf=t=>({x:t,y:t}),jne={left:"right",right:"left",bottom:"top",top:"bottom"},Fne={start:"end",end:"start"};function MN(t,e,n){return qc(t,$0(e,n))}function dp(t,e){return typeof t=="function"?t(e):t}function fp(t){return t.split("-")[0]}function gy(t){return t.split("-")[1]}function U7(t){return t==="x"?"y":"x"}function B7(t){return t==="y"?"height":"width"}const Une=new Set(["top","bottom"]);function Wf(t){return Une.has(fp(t))?"y":"x"}function H7(t){return U7(Wf(t))}function Bne(t,e,n){n===void 0&&(n=!1);const r=gy(t),i=H7(t),s=B7(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=e2(a)),[a,e2(a)]}function Hne(t){const e=e2(t);return[TN(t),e,TN(e)]}function TN(t){return t.replace(/start|end/g,e=>Fne[e])}const bD=["left","right"],_D=["right","left"],Vne=["top","bottom"],Gne=["bottom","top"];function Wne(t,e,n){switch(t){case"top":case"bottom":return n?e?_D:bD:e?bD:_D;case"left":case"right":return e?Vne:Gne;default:return[]}}function $ne(t,e,n,r){const i=gy(t);let s=Wne(fp(t),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(TN)))),s}function e2(t){return t.replace(/left|right|bottom|top/g,e=>jne[e])}function qne(t){return{top:0,right:0,bottom:0,left:0,...t}}function TB(t){return typeof t!="number"?qne(t):{top:t,right:t,bottom:t,left:t}}function t2(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 SD(t,e,n){let{reference:r,floating:i}=t;const s=Wf(e),a=H7(e),o=B7(a),l=fp(e),c=s==="y",d=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[o]/2-i[o]/2;let v;switch(l){case"top":v={x:d,y:r.y-i.height};break;case"bottom":v={x:d,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:h};break;case"left":v={x:r.x-i.width,y:h};break;default:v={x:r.x,y:r.y}}switch(gy(e)){case"start":v[a]-=g*(n&&c?-1:1);break;case"end":v[a]+=g*(n&&c?-1:1);break}return v}async function Xne(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:a,elements:o,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=dp(e,t),b=TB(v),w=o[g?h==="floating"?"reference":"floating":h],S=t2(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:d,strategy:l})),E=h==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(o.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},I=t2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:E,offsetParent:A,strategy:l}):E);return{top:(S.top-I.top+b.top)/N.y,bottom:(I.bottom-S.bottom+b.bottom)/N.y,left:(S.left-I.left+b.left)/N.x,right:(I.right-S.right+b.right)/N.x}}const Yne=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,o=s.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:h}=SD(c,r,l),g=r,v={},b=0;for(let w=0;w<o.length;w++){var _;const{name:S,fn:E}=o[w],{x:A,y:N,data:I,reset:P}=await E({x:d,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:v,rects:c,platform:{...a,detectOverflow:(_=a.detectOverflow)!=null?_:Xne},elements:{reference:t,floating:e}});d=A??d,h=N??h,v={...v,[S]:{...v[S],...I}},P&&b<=50&&(b++,typeof P=="object"&&(P.placement&&(g=P.placement),P.rects&&(c=P.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):P.rects),{x:d,y:h}=SD(c,g,l)),w=-1)}return{x:d,y:h,placement:g,strategy:i,middlewareData:v}},Kne=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:a,elements:o,middlewareData:l}=e,{element:c,padding:d=0}=dp(t,e)||{};if(c==null)return{};const h=TB(d),g={x:n,y:r},v=H7(i),b=B7(v),_=await a.getDimensions(c),w=v==="y",S=w?"top":"left",E=w?"bottom":"right",A=w?"clientHeight":"clientWidth",N=s.reference[b]+s.reference[v]-g[v]-s.floating[b],I=g[v]-s.reference[v],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let L=P?P[A]:0;(!L||!await(a.isElement==null?void 0:a.isElement(P)))&&(L=o.floating[A]||s.floating[b]);const R=N/2-I/2,O=L/2-_[b]/2-1,W=$0(h[S],O),U=$0(h[E],O),V=W,G=L-_[b]-U,Z=L/2-_[b]/2+R,B=MN(V,Z,G),q=!l.arrow&&gy(i)!=null&&Z!==B&&s.reference[b]/2-(Z<V?W:U)-_[b]/2<0,Y=q?Z<V?Z-V:Z-G:0;return{[v]:g[v]+Y,data:{[v]:B,centerOffset:Z-B-Y,...q&&{alignmentOffset:Y}},reset:q}}}),Zne=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:o,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0,...w}=dp(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const S=fp(i),E=Wf(o),A=fp(o)===o,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),I=g||(A||!_?[e2(o)]:Hne(o)),P=b!=="none";!g&&P&&I.push(...$ne(o,_,b,N));const L=[o,...I],R=await l.detectOverflow(e,w),O=[];let W=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&O.push(R[S]),h){const Z=Bne(i,a,N);O.push(R[Z[0]],R[Z[1]])}if(W=[...W,{placement:i,overflows:O}],!O.every(Z=>Z<=0)){var U,V;const Z=(((U=s.flip)==null?void 0:U.index)||0)+1,B=L[Z];if(B&&(!(h==="alignment"?E!==Wf(B):!1)||W.every(K=>Wf(K.placement)===E?K.overflows[0]>0:!0)))return{data:{index:Z,overflows:W},reset:{placement:B}};let q=(V=W.filter(Y=>Y.overflows[0]<=0).sort((Y,K)=>Y.overflows[1]-K.overflows[1])[0])==null?void 0:V.placement;if(!q)switch(v){case"bestFit":{var G;const Y=(G=W.filter(K=>{if(P){const J=Wf(K.placement);return J===E||J==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(J=>J>0).reduce((J,F)=>J+F,0)]).sort((K,J)=>K[1]-J[1])[0])==null?void 0:G[0];Y&&(q=Y);break}case"initialPlacement":q=o;break}if(i!==q)return{reset:{placement:q}}}return{}}}};function wD(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function MD(t){return zne.some(e=>t[e]>=0)}const Qne=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=dp(t,e);switch(i){case"referenceHidden":{const a=await r.detectOverflow(e,{...s,elementContext:"reference"}),o=wD(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:MD(o)}}}case"escaped":{const a=await r.detectOverflow(e,{...s,altBoundary:!0}),o=wD(a,n.floating);return{data:{escapedOffsets:o,escaped:MD(o)}}}default:return{}}}}},EB=new Set(["left","top"]);async function Jne(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=fp(n),o=gy(n),l=Wf(n)==="y",c=EB.has(a)?-1:1,d=s&&l?-1:1,h=dp(e,t);let{mainAxis:g,crossAxis:v,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof b=="number"&&(v=o==="end"?b*-1:b),l?{x:v*d,y:g*c}:{x:g*c,y:v*d}}const ere=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:a,middlewareData:o}=e,l=await Jne(e,t);return a===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:a}}}}},tre=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:a=!0,crossAxis:o=!1,limiter:l={fn:S=>{let{x:E,y:A}=S;return{x:E,y:A}}},...c}=dp(t,e),d={x:n,y:r},h=await s.detectOverflow(e,c),g=Wf(fp(i)),v=U7(g);let b=d[v],_=d[g];if(a){const S=v==="y"?"top":"left",E=v==="y"?"bottom":"right",A=b+h[S],N=b-h[E];b=MN(A,b,N)}if(o){const S=g==="y"?"top":"left",E=g==="y"?"bottom":"right",A=_+h[S],N=_-h[E];_=MN(A,_,N)}const w=l.fn({...e,[v]:b,[g]:_});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[v]:a,[g]:o}}}}}},nre=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=e,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=dp(t,e),d={x:n,y:r},h=Wf(i),g=U7(h);let v=d[g],b=d[h];const _=dp(o,e),w=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(l){const A=g==="y"?"height":"width",N=s.reference[g]-s.floating[A]+w.mainAxis,I=s.reference[g]+s.reference[A]-w.mainAxis;v<N?v=N:v>I&&(v=I)}if(c){var S,E;const A=g==="y"?"width":"height",N=EB.has(fp(i)),I=s.reference[h]-s.floating[A]+(N&&((S=a.offset)==null?void 0:S[h])||0)+(N?0:w.crossAxis),P=s.reference[h]+s.reference[A]+(N?0:((E=a.offset)==null?void 0:E[h])||0)-(N?w.crossAxis:0);b<I?b=I:b>P&&(b=P)}return{[g]:v,[h]:b}}}},rre=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:a,elements:o}=e,{apply:l=()=>{},...c}=dp(t,e),d=await a.detectOverflow(e,c),h=fp(i),g=gy(i),v=Wf(i)==="y",{width:b,height:_}=s.floating;let w,S;h==="top"||h==="bottom"?(w=h,S=g===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(S=h,w=g==="end"?"top":"bottom");const E=_-d.top-d.bottom,A=b-d.left-d.right,N=$0(_-d[w],E),I=$0(b-d[S],A),P=!e.middlewareData.shift;let L=N,R=I;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=A),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=E),P&&!g){const W=qc(d.left,0),U=qc(d.right,0),V=qc(d.top,0),G=qc(d.bottom,0);v?R=b-2*(W!==0||U!==0?W+U:qc(d.left,d.right)):L=_-2*(V!==0||G!==0?V+G:qc(d.top,d.bottom))}await l({...e,availableWidth:R,availableHeight:L});const O=await a.getDimensions(o.floating);return b!==O.width||_!==O.height?{reset:{rects:!0}}:{}}}};function F5(){return typeof window<"u"}function vy(t){return CB(t)?(t.nodeName||"").toLowerCase():"#document"}function Jc(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function uh(t){var e;return(e=(CB(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function CB(t){return F5()?t instanceof Node||t instanceof Jc(t).Node:!1}function Wd(t){return F5()?t instanceof Element||t instanceof Jc(t).Element:!1}function nh(t){return F5()?t instanceof HTMLElement||t instanceof Jc(t).HTMLElement:!1}function TD(t){return!F5()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Jc(t).ShadowRoot}const ire=new Set(["inline","contents"]);function ZS(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=$d(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!ire.has(i)}const sre=new Set(["table","td","th"]);function are(t){return sre.has(vy(t))}const ore=[":popover-open",":modal"];function U5(t){return ore.some(e=>{try{return t.matches(e)}catch{return!1}})}const lre=["transform","translate","scale","rotate","perspective"],cre=["transform","translate","scale","rotate","perspective","filter"],ure=["paint","layout","strict","content"];function V7(t){const e=G7(),n=Wd(t)?$d(t):t;return lre.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)||cre.some(r=>(n.willChange||"").includes(r))||ure.some(r=>(n.contain||"").includes(r))}function dre(t){let e=q0(t);for(;nh(e)&&!j1(e);){if(V7(e))return e;if(U5(e))return null;e=q0(e)}return null}function G7(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const fre=new Set(["html","body","#document"]);function j1(t){return fre.has(vy(t))}function $d(t){return Jc(t).getComputedStyle(t)}function B5(t){return Wd(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function q0(t){if(vy(t)==="html")return t;const e=t.assignedSlot||t.parentNode||TD(t)&&t.host||uh(t);return TD(e)?e.host:e}function AB(t){const e=q0(t);return j1(e)?t.ownerDocument?t.ownerDocument.body:t.body:nh(e)&&ZS(e)?e:AB(e)}function K_(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=AB(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),a=Jc(i);if(s){const o=EN(a);return e.concat(a,a.visualViewport||[],ZS(i)?i:[],o&&n?K_(o):[])}return e.concat(i,K_(i,[],n))}function EN(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function NB(t){const e=$d(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=nh(t),s=i?t.offsetWidth:n,a=i?t.offsetHeight:r,o=JM(n)!==s||JM(r)!==a;return o&&(n=s,r=a),{width:n,height:r,$:o}}function W7(t){return Wd(t)?t:t.contextElement}function c1(t){const e=W7(t);if(!nh(e))return Jf(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=NB(e);let a=(s?JM(n.width):n.width)/r,o=(s?JM(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const hre=Jf(0);function RB(t){const e=Jc(t);return!G7()||!e.visualViewport?hre:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function pre(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Jc(t)?!1:e}function Zg(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=W7(t);let a=Jf(1);e&&(r?Wd(r)&&(a=c1(r)):a=c1(t));const o=pre(s,n,r)?RB(s):Jf(0);let l=(i.left+o.x)/a.x,c=(i.top+o.y)/a.y,d=i.width/a.x,h=i.height/a.y;if(s){const g=Jc(s),v=r&&Wd(r)?Jc(r):r;let b=g,_=EN(b);for(;_&&r&&v!==b;){const w=c1(_),S=_.getBoundingClientRect(),E=$d(_),A=S.left+(_.clientLeft+parseFloat(E.paddingLeft))*w.x,N=S.top+(_.clientTop+parseFloat(E.paddingTop))*w.y;l*=w.x,c*=w.y,d*=w.x,h*=w.y,l+=A,c+=N,b=Jc(_),_=EN(b)}}return t2({width:d,height:h,x:l,y:c})}function H5(t,e){const n=B5(t).scrollLeft;return e?e.left+n:Zg(uh(t)).left+n}function kB(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-H5(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function mre(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",a=uh(r),o=e?U5(e.floating):!1;if(r===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Jf(1);const d=Jf(0),h=nh(r);if((h||!h&&!s)&&((vy(r)!=="body"||ZS(a))&&(l=B5(r)),nh(r))){const v=Zg(r);c=c1(r),d.x=v.x+r.clientLeft,d.y=v.y+r.clientTop}const g=a&&!h&&!s?kB(a,l):Jf(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+g.x,y:n.y*c.y-l.scrollTop*c.y+d.y+g.y}}function gre(t){return Array.from(t.getClientRects())}function vre(t){const e=uh(t),n=B5(t),r=t.ownerDocument.body,i=qc(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=qc(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+H5(t);const o=-n.scrollTop;return $d(r).direction==="rtl"&&(a+=qc(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:o}}const ED=25;function xre(t,e){const n=Jc(t),r=uh(t),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,o=0,l=0;if(i){s=i.width,a=i.height;const d=G7();(!d||d&&e==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}const c=H5(r);if(c<=0){const d=r.ownerDocument,h=d.body,g=getComputedStyle(h),v=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,b=Math.abs(r.clientWidth-h.clientWidth-v);b<=ED&&(s-=b)}else c<=ED&&(s+=c);return{width:s,height:a,x:o,y:l}}const yre=new Set(["absolute","fixed"]);function bre(t,e){const n=Zg(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=nh(t)?c1(t):Jf(1),a=t.clientWidth*s.x,o=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:a,height:o,x:l,y:c}}function CD(t,e,n){let r;if(e==="viewport")r=xre(t,n);else if(e==="document")r=vre(uh(t));else if(Wd(e))r=bre(e,n);else{const i=RB(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return t2(r)}function PB(t,e){const n=q0(t);return n===e||!Wd(n)||j1(n)?!1:$d(n).position==="fixed"||PB(n,e)}function _re(t,e){const n=e.get(t);if(n)return n;let r=K_(t,[],!1).filter(o=>Wd(o)&&vy(o)!=="body"),i=null;const s=$d(t).position==="fixed";let a=s?q0(t):t;for(;Wd(a)&&!j1(a);){const o=$d(a),l=V7(a);!l&&o.position==="fixed"&&(i=null),(s?!l&&!i:!l&&o.position==="static"&&!!i&&yre.has(i.position)||ZS(a)&&!l&&PB(t,a))?r=r.filter(d=>d!==a):i=o,a=q0(a)}return e.set(t,r),r}function Sre(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const a=[...n==="clippingAncestors"?U5(e)?[]:_re(e,this._c):[].concat(n),r],o=a[0],l=a.reduce((c,d)=>{const h=CD(e,d,i);return c.top=qc(h.top,c.top),c.right=$0(h.right,c.right),c.bottom=$0(h.bottom,c.bottom),c.left=qc(h.left,c.left),c},CD(e,o,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function wre(t){const{width:e,height:n}=NB(t);return{width:e,height:n}}function Mre(t,e,n){const r=nh(e),i=uh(e),s=n==="fixed",a=Zg(t,!0,s,e);let o={scrollLeft:0,scrollTop:0};const l=Jf(0);function c(){l.x=H5(i)}if(r||!r&&!s)if((vy(e)!=="body"||ZS(i))&&(o=B5(e)),r){const v=Zg(e,!0,s,e);l.x=v.x+e.clientLeft,l.y=v.y+e.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?kB(i,o):Jf(0),h=a.left+o.scrollLeft-l.x-d.x,g=a.top+o.scrollTop-l.y-d.y;return{x:h,y:g,width:a.width,height:a.height}}function kC(t){return $d(t).position==="static"}function AD(t,e){if(!nh(t)||$d(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return uh(t)===n&&(n=n.ownerDocument.body),n}function DB(t,e){const n=Jc(t);if(U5(t))return n;if(!nh(t)){let i=q0(t);for(;i&&!j1(i);){if(Wd(i)&&!kC(i))return i;i=q0(i)}return n}let r=AD(t,e);for(;r&&are(r)&&kC(r);)r=AD(r,e);return r&&j1(r)&&kC(r)&&!V7(r)?n:r||dre(t)||n}const Tre=async function(t){const e=this.getOffsetParent||DB,n=this.getDimensions,r=await n(t.floating);return{reference:Mre(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ere(t){return $d(t).direction==="rtl"}const Cre={convertOffsetParentRelativeRectToViewportRelativeRect:mre,getDocumentElement:uh,getClippingRect:Sre,getOffsetParent:DB,getElementRects:Tre,getClientRects:gre,getDimensions:wre,getScale:c1,isElement:Wd,isRTL:Ere};function IB(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Are(t,e){let n=null,r;const i=uh(t);function s(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:d,top:h,width:g,height:v}=c;if(o||e(),!g||!v)return;const b=Y3(h),_=Y3(i.clientWidth-(d+g)),w=Y3(i.clientHeight-(h+v)),S=Y3(d),A={rootMargin:-b+"px "+-_+"px "+-w+"px "+-S+"px",threshold:qc(0,$0(1,l))||1};let N=!0;function I(P){const L=P[0].intersectionRatio;if(L!==l){if(!N)return a();L?a(!1,L):r=setTimeout(()=>{a(!1,1e-7)},1e3)}L===1&&!IB(c,t.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(I,{...A,root:i.ownerDocument})}catch{n=new IntersectionObserver(I,A)}n.observe(t)}return a(!0),s}function Nre(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=W7(t),d=i||s?[...c?K_(c):[],...K_(e)]:[];d.forEach(S=>{i&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const h=c&&o?Are(c,n):null;let g=-1,v=null;a&&(v=new ResizeObserver(S=>{let[E]=S;E&&E.target===c&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var A;(A=v)==null||A.observe(e)})),n()}),c&&!l&&v.observe(c),v.observe(e));let b,_=l?Zg(t):null;l&&w();function w(){const S=Zg(t);_&&!IB(_,S)&&n(),_=S,b=requestAnimationFrame(w)}return n(),()=>{var S;d.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),h==null||h(),(S=v)==null||S.disconnect(),v=null,l&&cancelAnimationFrame(b)}}const Rre=ere,kre=tre,Pre=Zne,Dre=rre,Ire=Qne,ND=Kne,Ore=nre,Lre=(t,e,n)=>{const r=new Map,i={platform:Cre,...n},s={...i.platform,_c:r};return Yne(t,e,{...i,platform:s})};var zre=typeof document<"u",jre=function(){},DM=zre?T.useLayoutEffect:jre;function n2(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(!n2(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)&&!n2(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function OB(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function RD(t,e){const n=OB(t);return Math.round(e*n)/n}function PC(t){const e=T.useRef(t);return DM(()=>{e.current=t}),e}function Fre(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:l,open:c}=t,[d,h]=T.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,v]=T.useState(r);n2(g,r)||v(r);const[b,_]=T.useState(null),[w,S]=T.useState(null),E=T.useCallback(K=>{K!==P.current&&(P.current=K,_(K))},[]),A=T.useCallback(K=>{K!==L.current&&(L.current=K,S(K))},[]),N=s||b,I=a||w,P=T.useRef(null),L=T.useRef(null),R=T.useRef(d),O=l!=null,W=PC(l),U=PC(i),V=PC(c),G=T.useCallback(()=>{if(!P.current||!L.current)return;const K={placement:e,strategy:n,middleware:g};U.current&&(K.platform=U.current),Lre(P.current,L.current,K).then(J=>{const F={...J,isPositioned:V.current!==!1};Z.current&&!n2(R.current,F)&&(R.current=F,Ld.flushSync(()=>{h(F)}))})},[g,e,n,U,V]);DM(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,h(K=>({...K,isPositioned:!1})))},[c]);const Z=T.useRef(!1);DM(()=>(Z.current=!0,()=>{Z.current=!1}),[]),DM(()=>{if(N&&(P.current=N),I&&(L.current=I),N&&I){if(W.current)return W.current(N,I,G);G()}},[N,I,G,W,O]);const B=T.useMemo(()=>({reference:P,floating:L,setReference:E,setFloating:A}),[E,A]),q=T.useMemo(()=>({reference:N,floating:I}),[N,I]),Y=T.useMemo(()=>{const K={position:n,left:0,top:0};if(!q.floating)return K;const J=RD(q.floating,d.x),F=RD(q.floating,d.y);return o?{...K,transform:"translate("+J+"px, "+F+"px)",...OB(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:F}},[n,o,q.floating,d.x,d.y]);return T.useMemo(()=>({...d,update:G,refs:B,elements:q,floatingStyles:Y}),[d,G,B,q,Y])}const Ure=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?ND({element:r.current,padding:i}).fn(n):{}:r?ND({element:r,padding:i}).fn(n):{}}}},Bre=(t,e)=>({...Rre(t),options:[t,e]}),Hre=(t,e)=>({...kre(t),options:[t,e]}),Vre=(t,e)=>({...Ore(t),options:[t,e]}),Gre=(t,e)=>({...Pre(t),options:[t,e]}),Wre=(t,e)=>({...Dre(t),options:[t,e]}),$re=(t,e)=>({...Ire(t),options:[t,e]}),qre=(t,e)=>({...Ure(t),options:[t,e]});var Xre="Arrow",LB=T.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return p.jsx(ar.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});LB.displayName=Xre;var Yre=LB,$7="Popper",[zB,am]=ou($7),[Kre,jB]=zB($7),FB=t=>{const{__scopePopper:e,children:n}=t,[r,i]=T.useState(null);return p.jsx(Kre,{scope:e,anchor:r,onAnchorChange:i,children:n})};FB.displayName=$7;var UB="PopperAnchor",BB=T.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=jB(UB,n),a=T.useRef(null),o=Lr(e,a),l=T.useRef(null);return T.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||a.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:p.jsx(ar.div,{...i,ref:o})});BB.displayName=UB;var q7="PopperContent",[Zre,Qre]=zB(q7),HB=T.forwardRef((t,e)=>{var ue,le,fe,xe,he,Te;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:o=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:b,..._}=t,w=jB(q7,n),[S,E]=T.useState(null),A=Lr(e,We=>E(We)),[N,I]=T.useState(null),P=Lne(N),L=(P==null?void 0:P.width)??0,R=(P==null?void 0:P.height)??0,O=r+(s!=="center"?"-"+s:""),W=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},U=Array.isArray(c)?c:[c],V=U.length>0,G={padding:W,boundary:U.filter(eie),altBoundary:V},{refs:Z,floatingStyles:B,placement:q,isPositioned:Y,middlewareData:K}=Fre({strategy:"fixed",placement:O,whileElementsMounted:(...We)=>Nre(...We,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[Bre({mainAxis:i+R,alignmentAxis:a}),l&&Hre({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Vre():void 0,...G}),l&&Gre({...G}),Wre({...G,apply:({elements:We,rects:Se,availableWidth:Le,availableHeight:pe})=>{const{width:Re,height:ne}=Se.reference,Xe=We.floating.style;Xe.setProperty("--radix-popper-available-width",`${Le}px`),Xe.setProperty("--radix-popper-available-height",`${pe}px`),Xe.setProperty("--radix-popper-anchor-width",`${Re}px`),Xe.setProperty("--radix-popper-anchor-height",`${ne}px`)}}),N&&qre({element:N,padding:o}),tie({arrowWidth:L,arrowHeight:R}),g&&$re({strategy:"referenceHidden",...G})]}),[J,F]=WB(q),j=Fo(b);bo(()=>{Y&&(j==null||j())},[Y,j]);const X=(ue=K.arrow)==null?void 0:ue.x,H=(le=K.arrow)==null?void 0:le.y,se=((fe=K.arrow)==null?void 0:fe.centerOffset)!==0,[re,ie]=T.useState();return bo(()=>{S&&ie(window.getComputedStyle(S).zIndex)},[S]),p.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:Y?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[(xe=K.transformOrigin)==null?void 0:xe.x,(he=K.transformOrigin)==null?void 0:he.y].join(" "),...((Te=K.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:p.jsx(Zre,{scope:n,placedSide:J,onArrowChange:I,arrowX:X,arrowY:H,shouldHideArrow:se,children:p.jsx(ar.div,{"data-side":J,"data-align":F,..._,ref:A,style:{..._.style,animation:Y?void 0:"none"}})})})});HB.displayName=q7;var VB="PopperArrow",Jre={top:"bottom",right:"left",bottom:"top",left:"right"},GB=T.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=Qre(VB,r),a=Jre[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]: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:p.jsx(Yre,{...i,ref:n,style:{...i.style,display:"block"}})})});GB.displayName=VB;function eie(t){return t!==null}var tie=t=>({name:"transformOrigin",options:t,fn(e){var w,S,E;const{placement:n,rects:r,middlewareData:i}=e,a=((w=i.arrow)==null?void 0:w.centerOffset)!==0,o=a?0:t.arrowWidth,l=a?0:t.arrowHeight,[c,d]=WB(n),h={start:"0%",center:"50%",end:"100%"}[d],g=(((S=i.arrow)==null?void 0:S.x)??0)+o/2,v=(((E=i.arrow)==null?void 0:E.y)??0)+l/2;let b="",_="";return c==="bottom"?(b=a?h:`${g}px`,_=`${-l}px`):c==="top"?(b=a?h:`${g}px`,_=`${r.floating.height+l}px`):c==="right"?(b=`${-l}px`,_=a?h:`${v}px`):c==="left"&&(b=`${r.floating.width+l}px`,_=a?h:`${v}px`),{data:{x:b,y:_}}}});function WB(t){const[e,n="center"]=t.split("-");return[e,n]}var V5=FB,QS=BB,G5=HB,W5=GB,DC="rovingFocusGroup.onEntryFocus",nie={bubbles:!1,cancelable:!0},JS="RovingFocusGroup",[CN,$B,rie]=P7(JS),[iie,$5]=ou(JS,[rie]),[sie,aie]=iie(JS),qB=T.forwardRef((t,e)=>p.jsx(CN.Provider,{scope:t.__scopeRovingFocusGroup,children:p.jsx(CN.Slot,{scope:t.__scopeRovingFocusGroup,children:p.jsx(oie,{...t,ref:e})})}));qB.displayName=JS;var oie=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...h}=t,g=T.useRef(null),v=Lr(e,g),b=XS(s),[_,w]=Gd({prop:a,defaultProp:o??null,onChange:l,caller:JS}),[S,E]=T.useState(!1),A=Fo(c),N=$B(n),I=T.useRef(!1),[P,L]=T.useState(0);return T.useEffect(()=>{const R=g.current;if(R)return R.addEventListener(DC,A),()=>R.removeEventListener(DC,A)},[A]),p.jsx(sie,{scope:n,orientation:r,dir:b,loop:i,currentTabStopId:_,onItemFocus:T.useCallback(R=>w(R),[w]),onItemShiftTab:T.useCallback(()=>E(!0),[]),onFocusableItemAdd:T.useCallback(()=>L(R=>R+1),[]),onFocusableItemRemove:T.useCallback(()=>L(R=>R-1),[]),children:p.jsx(ar.div,{tabIndex:S||P===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...t.style},onMouseDown:gn(t.onMouseDown,()=>{I.current=!0}),onFocus:gn(t.onFocus,R=>{const O=!I.current;if(R.target===R.currentTarget&&O&&!S){const W=new CustomEvent(DC,nie);if(R.currentTarget.dispatchEvent(W),!W.defaultPrevented){const U=N().filter(q=>q.focusable),V=U.find(q=>q.active),G=U.find(q=>q.id===_),B=[V,G,...U].filter(Boolean).map(q=>q.ref.current);KB(B,d)}}I.current=!1}),onBlur:gn(t.onBlur,()=>E(!1))})})}),XB="RovingFocusGroupItem",YB=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:a,...o}=t,l=Gu(),c=s||l,d=aie(XB,n),h=d.currentTabStopId===c,g=$B(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:_}=d;return T.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),p.jsx(CN.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:p.jsx(ar.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...o,ref:e,onMouseDown:gn(t.onMouseDown,w=>{r?d.onItemFocus(c):w.preventDefault()}),onFocus:gn(t.onFocus,()=>d.onItemFocus(c)),onKeyDown:gn(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){d.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const S=uie(w,d.orientation,d.dir);if(S!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let A=g().filter(N=>N.focusable).map(N=>N.ref.current);if(S==="last")A.reverse();else if(S==="prev"||S==="next"){S==="prev"&&A.reverse();const N=A.indexOf(w.currentTarget);A=d.loop?die(A,N+1):A.slice(N+1)}setTimeout(()=>KB(A))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:_!=null}):a})})});YB.displayName=XB;var lie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cie(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function uie(t,e,n){const r=cie(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return lie[r]}function KB(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function die(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var ZB=qB,QB=YB,AN=["Enter"," "],fie=["ArrowDown","PageUp","Home"],JB=["ArrowUp","PageDown","End"],hie=[...fie,...JB],pie={ltr:[...AN,"ArrowRight"],rtl:[...AN,"ArrowLeft"]},mie={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ew="Menu",[Z_,gie,vie]=P7(ew),[fv,eH]=ou(ew,[vie,am,$5]),q5=am(),tH=$5(),[xie,hv]=fv(ew),[yie,tw]=fv(ew),nH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:a=!0}=t,o=q5(e),[l,c]=T.useState(null),d=T.useRef(!1),h=Fo(s),g=XS(i);return T.useEffect(()=>{const v=()=>{d.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>d.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),p.jsx(V5,{...o,children:p.jsx(xie,{scope:e,open:n,onOpenChange:h,content:l,onContentChange:c,children:p.jsx(yie,{scope:e,onClose:T.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:g,modal:a,children:r})})})};nH.displayName=ew;var bie="MenuAnchor",X7=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=q5(n);return p.jsx(QS,{...i,...r,ref:e})});X7.displayName=bie;var Y7="MenuPortal",[_ie,rH]=fv(Y7,{forceMount:void 0}),iH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=hv(Y7,e);return p.jsx(_ie,{scope:e,forceMount:n,children:p.jsx(Vo,{present:n||s.open,children:p.jsx(my,{asChild:!0,container:i,children:r})})})};iH.displayName=Y7;var Wu="MenuContent",[Sie,K7]=fv(Wu),sH=T.forwardRef((t,e)=>{const n=rH(Wu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=hv(Wu,t.__scopeMenu),a=tw(Wu,t.__scopeMenu);return p.jsx(Z_.Provider,{scope:t.__scopeMenu,children:p.jsx(Vo,{present:r||s.open,children:p.jsx(Z_.Slot,{scope:t.__scopeMenu,children:a.modal?p.jsx(wie,{...i,ref:e}):p.jsx(Mie,{...i,ref:e})})})})}),wie=T.forwardRef((t,e)=>{const n=hv(Wu,t.__scopeMenu),r=T.useRef(null),i=Lr(e,r);return T.useEffect(()=>{const s=r.current;if(s)return z5(s)},[]),p.jsx(Z7,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:gn(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Mie=T.forwardRef((t,e)=>{const n=hv(Wu,t.__scopeMenu);return p.jsx(Z7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Tie=W0("MenuContent.ScrollLock"),Z7=T.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:b,..._}=t,w=hv(Wu,n),S=tw(Wu,n),E=q5(n),A=tH(n),N=gie(n),[I,P]=T.useState(null),L=T.useRef(null),R=Lr(e,L,w.onContentChange),O=T.useRef(0),W=T.useRef(""),U=T.useRef(0),V=T.useRef(null),G=T.useRef("right"),Z=T.useRef(0),B=b?KS:T.Fragment,q=b?{as:Tie,allowPinchZoom:!0}:void 0,Y=J=>{var ue,le;const F=W.current+J,j=N().filter(fe=>!fe.disabled),X=document.activeElement,H=(ue=j.find(fe=>fe.ref.current===X))==null?void 0:ue.textValue,se=j.map(fe=>fe.textValue),re=zie(se,F,H),ie=(le=j.find(fe=>fe.textValue===re))==null?void 0:le.ref.current;(function fe(xe){W.current=xe,window.clearTimeout(O.current),xe!==""&&(O.current=window.setTimeout(()=>fe(""),1e3))})(F),ie&&setTimeout(()=>ie.focus())};T.useEffect(()=>()=>window.clearTimeout(O.current),[]),O5();const K=T.useCallback(J=>{var j,X;return G.current===((j=V.current)==null?void 0:j.side)&&Fie(J,(X=V.current)==null?void 0:X.area)},[]);return p.jsx(Sie,{scope:n,searchRef:W,onItemEnter:T.useCallback(J=>{K(J)&&J.preventDefault()},[K]),onItemLeave:T.useCallback(J=>{var F;K(J)||((F=L.current)==null||F.focus(),P(null))},[K]),onTriggerLeave:T.useCallback(J=>{K(J)&&J.preventDefault()},[K]),pointerGraceTimerRef:U,onPointerGraceIntentChange:T.useCallback(J=>{V.current=J},[]),children:p.jsx(B,{...q,children:p.jsx(YS,{asChild:!0,trapped:i,onMountAutoFocus:gn(s,J=>{var F;J.preventDefault(),(F=L.current)==null||F.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:p.jsx(py,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:p.jsx(ZB,{asChild:!0,...A,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:I,onCurrentTabStopIdChange:P,onEntryFocus:gn(l,J=>{S.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(G5,{role:"menu","aria-orientation":"vertical","data-state":_H(w.open),"data-radix-menu-content":"",dir:S.dir,...E,..._,ref:R,style:{outline:"none",..._.style},onKeyDown:gn(_.onKeyDown,J=>{const j=J.target.closest("[data-radix-menu-content]")===J.currentTarget,X=J.ctrlKey||J.altKey||J.metaKey,H=J.key.length===1;j&&(J.key==="Tab"&&J.preventDefault(),!X&&H&&Y(J.key));const se=L.current;if(J.target!==se||!hie.includes(J.key))return;J.preventDefault();const ie=N().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);JB.includes(J.key)&&ie.reverse(),Oie(ie)}),onBlur:gn(t.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(O.current),W.current="")}),onPointerMove:gn(t.onPointerMove,Q_(J=>{const F=J.target,j=Z.current!==J.clientX;if(J.currentTarget.contains(F)&&j){const X=J.clientX>Z.current?"right":"left";G.current=X,Z.current=J.clientX}}))})})})})})})});sH.displayName=Wu;var Eie="MenuGroup",Q7=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{role:"group",...r,ref:e})});Q7.displayName=Eie;var Cie="MenuLabel",aH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{...r,ref:e})});aH.displayName=Cie;var r2="MenuItem",kD="menu.itemSelect",X5=T.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=T.useRef(null),a=tw(r2,t.__scopeMenu),o=K7(r2,t.__scopeMenu),l=Lr(e,s),c=T.useRef(!1),d=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(kD,{bubbles:!0,cancelable:!0});h.addEventListener(kD,v=>r==null?void 0:r(v),{once:!0}),TU(h,g),g.defaultPrevented?c.current=!1:a.onClose()}};return p.jsx(oH,{...i,ref:l,disabled:n,onClick:gn(t.onClick,d),onPointerDown:h=>{var g;(g=t.onPointerDown)==null||g.call(t,h),c.current=!0},onPointerUp:gn(t.onPointerUp,h=>{var g;c.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:gn(t.onKeyDown,h=>{const g=o.searchRef.current!=="";n||g&&h.key===" "||AN.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});X5.displayName=r2;var oH=T.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,a=K7(r2,n),o=tH(n),l=T.useRef(null),c=Lr(e,l),[d,h]=T.useState(!1),[g,v]=T.useState("");return T.useEffect(()=>{const b=l.current;b&&v((b.textContent??"").trim())},[s.children]),p.jsx(Z_.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:p.jsx(QB,{asChild:!0,...o,focusable:!r,children:p.jsx(ar.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:gn(t.onPointerMove,Q_(b=>{r?a.onItemLeave(b):(a.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:gn(t.onPointerLeave,Q_(b=>a.onItemLeave(b))),onFocus:gn(t.onFocus,()=>h(!0)),onBlur:gn(t.onBlur,()=>h(!1))})})})}),Aie="MenuCheckboxItem",lH=T.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return p.jsx(hH,{scope:t.__scopeMenu,checked:n,children:p.jsx(X5,{role:"menuitemcheckbox","aria-checked":i2(n)?"mixed":n,...i,ref:e,"data-state":e8(n),onSelect:gn(i.onSelect,()=>r==null?void 0:r(i2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});lH.displayName=Aie;var cH="MenuRadioGroup",[Nie,Rie]=fv(cH,{value:void 0,onValueChange:()=>{}}),uH=T.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Fo(r);return p.jsx(Nie,{scope:t.__scopeMenu,value:n,onValueChange:s,children:p.jsx(Q7,{...i,ref:e})})});uH.displayName=cH;var dH="MenuRadioItem",fH=T.forwardRef((t,e)=>{const{value:n,...r}=t,i=Rie(dH,t.__scopeMenu),s=n===i.value;return p.jsx(hH,{scope:t.__scopeMenu,checked:s,children:p.jsx(X5,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":e8(s),onSelect:gn(r.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,n)},{checkForDefaultPrevented:!1})})})});fH.displayName=dH;var J7="MenuItemIndicator",[hH,kie]=fv(J7,{checked:!1}),pH=T.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=kie(J7,n);return p.jsx(Vo,{present:r||i2(s.checked)||s.checked===!0,children:p.jsx(ar.span,{...i,ref:e,"data-state":e8(s.checked)})})});pH.displayName=J7;var Pie="MenuSeparator",mH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});mH.displayName=Pie;var Die="MenuArrow",gH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=q5(n);return p.jsx(W5,{...i,...r,ref:e})});gH.displayName=Die;var Iie="MenuSub",[W6e,vH]=fv(Iie),d_="MenuSubTrigger",xH=T.forwardRef((t,e)=>{const n=hv(d_,t.__scopeMenu),r=tw(d_,t.__scopeMenu),i=vH(d_,t.__scopeMenu),s=K7(d_,t.__scopeMenu),a=T.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},d=T.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return T.useEffect(()=>d,[d]),T.useEffect(()=>{const h=o.current;return()=>{window.clearTimeout(h),l(null)}},[o,l]),p.jsx(X7,{asChild:!0,...c,children:p.jsx(oH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":_H(n.open),...t,ref:D5(e,i.onTriggerChange),onClick:h=>{var g;(g=t.onClick)==null||g.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:gn(t.onPointerMove,Q_(h=>{s.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:gn(t.onPointerLeave,Q_(h=>{var v,b;d();const g=(v=n.content)==null?void 0:v.getBoundingClientRect();if(g){const _=(b=n.content)==null?void 0:b.dataset.side,w=_==="right",S=w?-5:5,E=g[w?"left":"right"],A=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+S,y:h.clientY},{x:E,y:g.top},{x:A,y:g.top},{x:A,y:g.bottom},{x:E,y:g.bottom}],side:_}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:gn(t.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";t.disabled||g&&h.key===" "||pie[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});xH.displayName=d_;var yH="MenuSubContent",bH=T.forwardRef((t,e)=>{const n=rH(Wu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=hv(Wu,t.__scopeMenu),a=tw(Wu,t.__scopeMenu),o=vH(yH,t.__scopeMenu),l=T.useRef(null),c=Lr(e,l);return p.jsx(Z_.Provider,{scope:t.__scopeMenu,children:p.jsx(Vo,{present:r||s.open,children:p.jsx(Z_.Slot,{scope:t.__scopeMenu,children:p.jsx(Z7,{id:o.contentId,"aria-labelledby":o.triggerId,...i,ref:c,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;a.isUsingKeyboardRef.current&&((h=l.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:gn(t.onFocusOutside,d=>{d.target!==o.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:gn(t.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:gn(t.onKeyDown,d=>{var v;const h=d.currentTarget.contains(d.target),g=mie[a.dir].includes(d.key);h&&g&&(s.onOpenChange(!1),(v=o.trigger)==null||v.focus(),d.preventDefault())})})})})})});bH.displayName=yH;function _H(t){return t?"open":"closed"}function i2(t){return t==="indeterminate"}function e8(t){return i2(t)?"indeterminate":t?"checked":"unchecked"}function Oie(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Lie(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function zie(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 a=Lie(t,Math.max(s,0));i.length===1&&(a=a.filter(c=>c!==n));const l=a.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function jie(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const o=e[s],l=e[a],c=o.x,d=o.y,h=l.x,g=l.y;d>r!=g>r&&n<(h-c)*(r-d)/(g-d)+c&&(i=!i)}return i}function Fie(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return jie(n,e)}function Q_(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Uie=nH,Bie=X7,Hie=iH,Vie=sH,Gie=Q7,Wie=aH,$ie=X5,qie=lH,Xie=uH,Yie=fH,Kie=pH,Zie=mH,Qie=gH,Jie=xH,ese=bH,Y5="DropdownMenu",[tse]=ou(Y5,[eH]),Gl=eH(),[nse,SH]=tse(Y5),wH=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:a,modal:o=!0}=t,l=Gl(e),c=T.useRef(null),[d,h]=Gd({prop:i,defaultProp:s??!1,onChange:a,caller:Y5});return p.jsx(nse,{scope:e,triggerId:Gu(),triggerRef:c,contentId:Gu(),open:d,onOpenChange:h,onOpenToggle:T.useCallback(()=>h(g=>!g),[h]),modal:o,children:p.jsx(Uie,{...l,open:d,onOpenChange:h,dir:r,modal:o,children:n})})};wH.displayName=Y5;var MH="DropdownMenuTrigger",TH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=SH(MH,n),a=Gl(n);return p.jsx(Bie,{asChild:!0,...a,children:p.jsx(ar.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:D5(e,s.triggerRef),onPointerDown:gn(t.onPointerDown,o=>{!r&&o.button===0&&o.ctrlKey===!1&&(s.onOpenToggle(),s.open||o.preventDefault())}),onKeyDown:gn(t.onKeyDown,o=>{r||(["Enter"," "].includes(o.key)&&s.onOpenToggle(),o.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});TH.displayName=MH;var rse="DropdownMenuPortal",EH=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Gl(e);return p.jsx(Hie,{...r,...n})};EH.displayName=rse;var CH="DropdownMenuContent",AH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=SH(CH,n),s=Gl(n),a=T.useRef(!1);return p.jsx(Vie,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:gn(t.onCloseAutoFocus,o=>{var l;a.current||(l=i.triggerRef.current)==null||l.focus(),a.current=!1,o.preventDefault()}),onInteractOutside:gn(t.onInteractOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!i.modal||d)&&(a.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)"}})});AH.displayName=CH;var ise="DropdownMenuGroup",sse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Gie,{...i,...r,ref:e})});sse.displayName=ise;var ase="DropdownMenuLabel",NH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Wie,{...i,...r,ref:e})});NH.displayName=ase;var ose="DropdownMenuItem",RH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx($ie,{...i,...r,ref:e})});RH.displayName=ose;var lse="DropdownMenuCheckboxItem",kH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(qie,{...i,...r,ref:e})});kH.displayName=lse;var cse="DropdownMenuRadioGroup",use=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Xie,{...i,...r,ref:e})});use.displayName=cse;var dse="DropdownMenuRadioItem",fse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Yie,{...i,...r,ref:e})});fse.displayName=dse;var hse="DropdownMenuItemIndicator",PH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Kie,{...i,...r,ref:e})});PH.displayName=hse;var pse="DropdownMenuSeparator",DH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Zie,{...i,...r,ref:e})});DH.displayName=pse;var mse="DropdownMenuArrow",gse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Qie,{...i,...r,ref:e})});gse.displayName=mse;var vse="DropdownMenuSubTrigger",xse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Jie,{...i,...r,ref:e})});xse.displayName=vse;var yse="DropdownMenuSubContent",bse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(ese,{...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)"}})});bse.displayName=yse;var _se=wH,Sse=TH,wse=EH,Mse=AH,Tse=NH,Ese=RH,Cse=kH,Ase=PH,Nse=DH,Rse="Label",IH=T.forwardRef((t,e)=>p.jsx(ar.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())}}));IH.displayName=Rse;var kse=IH;function NN(t,[e,n]){return Math.min(n,Math.max(e,t))}var K5="Popover",[OH]=ou(K5,[am]),nw=am(),[Pse,om]=OH(K5),LH=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=t,o=nw(e),l=T.useRef(null),[c,d]=T.useState(!1),[h,g]=Gd({prop:r,defaultProp:i??!1,onChange:s,caller:K5});return p.jsx(V5,{...o,children:p.jsx(Pse,{scope:e,contentId:Gu(),triggerRef:l,open:h,onOpenChange:g,onOpenToggle:T.useCallback(()=>g(v=>!v),[g]),hasCustomAnchor:c,onCustomAnchorAdd:T.useCallback(()=>d(!0),[]),onCustomAnchorRemove:T.useCallback(()=>d(!1),[]),modal:a,children:n})})};LH.displayName=K5;var zH="PopoverAnchor",Dse=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=om(zH,n),s=nw(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=i;return T.useEffect(()=>(a(),()=>o()),[a,o]),p.jsx(QS,{...s,...r,ref:e})});Dse.displayName=zH;var jH="PopoverTrigger",FH=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=om(jH,n),s=nw(n),a=Lr(e,i.triggerRef),o=p.jsx(ar.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":GH(i.open),...r,ref:a,onClick:gn(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?o:p.jsx(QS,{asChild:!0,...s,children:o})});FH.displayName=jH;var t8="PopoverPortal",[Ise,Ose]=OH(t8,{forceMount:void 0}),UH=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=om(t8,e);return p.jsx(Ise,{scope:e,forceMount:n,children:p.jsx(Vo,{present:n||s.open,children:p.jsx(my,{asChild:!0,container:i,children:r})})})};UH.displayName=t8;var F1="PopoverContent",BH=T.forwardRef((t,e)=>{const n=Ose(F1,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=om(F1,t.__scopePopover);return p.jsx(Vo,{present:r||s.open,children:s.modal?p.jsx(zse,{...i,ref:e}):p.jsx(jse,{...i,ref:e})})});BH.displayName=F1;var Lse=W0("PopoverContent.RemoveScroll"),zse=T.forwardRef((t,e)=>{const n=om(F1,t.__scopePopover),r=T.useRef(null),i=Lr(e,r),s=T.useRef(!1);return T.useEffect(()=>{const a=r.current;if(a)return z5(a)},[]),p.jsx(KS,{as:Lse,allowPinchZoom:!0,children:p.jsx(HH,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gn(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),s.current||(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:gn(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0,c=o.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:gn(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),jse=T.forwardRef((t,e)=>{const n=om(F1,t.__scopePopover),r=T.useRef(!1),i=T.useRef(!1);return p.jsx(HH,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.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 a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),HH=T.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...h}=t,g=om(F1,n),v=nw(n);return O5(),p.jsx(YS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(py,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>g.onOpenChange(!1),children:p.jsx(G5,{"data-state":GH(g.open),role:"dialog",id:g.contentId,...v,...h,ref:e,style:{...h.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)"}})})})}),VH="PopoverClose",Fse=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=om(VH,n);return p.jsx(ar.button,{type:"button",...r,ref:e,onClick:gn(t.onClick,()=>i.onOpenChange(!1))})});Fse.displayName=VH;var Use="PopoverArrow",Bse=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=nw(n);return p.jsx(W5,{...i,...r,ref:e})});Bse.displayName=Use;function GH(t){return t?"open":"closed"}var Hse=LH,Vse=FH,Gse=UH,Wse=BH;function $se(t,e){return T.useReducer((n,r)=>e[n][r]??n,t)}var n8="ScrollArea",[WH]=ou(n8),[qse,Qu]=WH(n8),$H=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...a}=t,[o,l]=T.useState(null),[c,d]=T.useState(null),[h,g]=T.useState(null),[v,b]=T.useState(null),[_,w]=T.useState(null),[S,E]=T.useState(0),[A,N]=T.useState(0),[I,P]=T.useState(!1),[L,R]=T.useState(!1),O=Lr(e,U=>l(U)),W=XS(i);return p.jsx(qse,{scope:n,type:r,dir:W,scrollHideDelay:s,scrollArea:o,viewport:c,onViewportChange:d,content:h,onContentChange:g,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:I,onScrollbarXEnabledChange:P,scrollbarY:_,onScrollbarYChange:w,scrollbarYEnabled:L,onScrollbarYEnabledChange:R,onCornerWidthChange:E,onCornerHeightChange:N,children:p.jsx(ar.div,{dir:W,...a,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});$H.displayName=n8;var qH="ScrollAreaViewport",XH=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...s}=t,a=Qu(qH,n),o=T.useRef(null),l=Lr(e,o,a.onViewportChange);return p.jsxs(p.Fragment,{children:[p.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}),p.jsx(ar.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:p.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});XH.displayName=qH;var dh="ScrollAreaScrollbar",YH=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qu(dh,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:a}=i,o=t.orientation==="horizontal";return T.useEffect(()=>(o?s(!0):a(!0),()=>{o?s(!1):a(!1)}),[o,s,a]),i.type==="hover"?p.jsx(Xse,{...r,ref:e,forceMount:n}):i.type==="scroll"?p.jsx(Yse,{...r,ref:e,forceMount:n}):i.type==="auto"?p.jsx(KH,{...r,ref:e,forceMount:n}):i.type==="always"?p.jsx(r8,{...r,ref:e}):null});YH.displayName=dh;var Xse=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qu(dh,t.__scopeScrollArea),[s,a]=T.useState(!1);return T.useEffect(()=>{const o=i.scrollArea;let l=0;if(o){const c=()=>{window.clearTimeout(l),a(!0)},d=()=>{l=window.setTimeout(()=>a(!1),i.scrollHideDelay)};return o.addEventListener("pointerenter",c),o.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),o.removeEventListener("pointerenter",c),o.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),p.jsx(Vo,{present:n||s,children:p.jsx(KH,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Yse=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qu(dh,t.__scopeScrollArea),s=t.orientation==="horizontal",a=Q5(()=>l("SCROLL_END"),100),[o,l]=$se("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 T.useEffect(()=>{if(o==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[o,i.scrollHideDelay,l]),T.useEffect(()=>{const c=i.viewport,d=s?"scrollLeft":"scrollTop";if(c){let h=c[d];const g=()=>{const v=c[d];h!==v&&(l("SCROLL"),a()),h=v};return c.addEventListener("scroll",g),()=>c.removeEventListener("scroll",g)}},[i.viewport,s,l,a]),p.jsx(Vo,{present:n||o!=="hidden",children:p.jsx(r8,{"data-state":o==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:gn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:gn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),KH=T.forwardRef((t,e)=>{const n=Qu(dh,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,a]=T.useState(!1),o=t.orientation==="horizontal",l=Q5(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;a(o?c:d)}},10);return U1(n.viewport,l),U1(n.content,l),p.jsx(Vo,{present:r||s,children:p.jsx(r8,{"data-state":s?"visible":"hidden",...i,ref:e})})}),r8=T.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=Qu(dh,t.__scopeScrollArea),s=T.useRef(null),a=T.useRef(0),[o,l]=T.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=tV(o.viewport,o.content),d={...r,sizes:o,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function h(g,v){return tae(g,a.current,o,v)}return n==="horizontal"?p.jsx(Kse,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollLeft,v=PD(g,o,i.dir);s.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollLeft=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollLeft=h(g,i.dir))}}):n==="vertical"?p.jsx(Zse,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollTop,v=PD(g,o);s.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollTop=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollTop=h(g))}}):null}),Kse=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=Qu(dh,t.__scopeScrollArea),[a,o]=T.useState(),l=T.useRef(null),c=Lr(e,l,s.onScrollbarXChange);return T.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),p.jsx(QH,{"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":Z5(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(g),rV(g,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:a2(a.paddingLeft),paddingEnd:a2(a.paddingRight)}})}})}),Zse=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=Qu(dh,t.__scopeScrollArea),[a,o]=T.useState(),l=T.useRef(null),c=Lr(e,l,s.onScrollbarYChange);return T.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),p.jsx(QH,{"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":Z5(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const g=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(g),rV(g,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:a2(a.paddingTop),paddingEnd:a2(a.paddingBottom)}})}})}),[Qse,ZH]=WH(dh),QH=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:h,...g}=t,v=Qu(dh,n),[b,_]=T.useState(null),w=Lr(e,O=>_(O)),S=T.useRef(null),E=T.useRef(""),A=v.viewport,N=r.content-r.viewport,I=Fo(d),P=Fo(l),L=Q5(h,10);function R(O){if(S.current){const W=O.clientX-S.current.left,U=O.clientY-S.current.top;c({x:W,y:U})}}return T.useEffect(()=>{const O=W=>{const U=W.target;(b==null?void 0:b.contains(U))&&I(W,N)};return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[A,b,N,I]),T.useEffect(P,[r,P]),U1(b,L),U1(v.content,L),p.jsx(Qse,{scope:n,scrollbar:b,hasThumb:i,onThumbChange:Fo(s),onThumbPointerUp:Fo(a),onThumbPositionChange:P,onThumbPointerDown:Fo(o),children:p.jsx(ar.div,{...g,ref:w,style:{position:"absolute",...g.style},onPointerDown:gn(t.onPointerDown,O=>{O.button===0&&(O.target.setPointerCapture(O.pointerId),S.current=b.getBoundingClientRect(),E.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),R(O))}),onPointerMove:gn(t.onPointerMove,R),onPointerUp:gn(t.onPointerUp,O=>{const W=O.target;W.hasPointerCapture(O.pointerId)&&W.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=E.current,v.viewport&&(v.viewport.style.scrollBehavior=""),S.current=null})})})}),s2="ScrollAreaThumb",JH=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=ZH(s2,t.__scopeScrollArea);return p.jsx(Vo,{present:n||i.hasThumb,children:p.jsx(Jse,{ref:e,...r})})}),Jse=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=Qu(s2,n),a=ZH(s2,n),{onThumbPositionChange:o}=a,l=Lr(e,h=>a.onThumbChange(h)),c=T.useRef(void 0),d=Q5(()=>{c.current&&(c.current(),c.current=void 0)},100);return T.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(d(),!c.current){const v=nae(h,o);c.current=v,o()}};return o(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,d,o]),p.jsx(ar.div,{"data-state":a.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:gn(t.onPointerDownCapture,h=>{const v=h.target.getBoundingClientRect(),b=h.clientX-v.left,_=h.clientY-v.top;a.onThumbPointerDown({x:b,y:_})}),onPointerUp:gn(t.onPointerUp,a.onThumbPointerUp)})});JH.displayName=s2;var i8="ScrollAreaCorner",eV=T.forwardRef((t,e)=>{const n=Qu(i8,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(eae,{...t,ref:e}):null});eV.displayName=i8;var eae=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=Qu(i8,n),[s,a]=T.useState(0),[o,l]=T.useState(0),c=!!(s&&o);return U1(i.scrollbarX,()=>{var h;const d=((h=i.scrollbarX)==null?void 0:h.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),U1(i.scrollbarY,()=>{var h;const d=((h=i.scrollbarY)==null?void 0:h.offsetWidth)||0;i.onCornerWidthChange(d),a(d)}),c?p.jsx(ar.div,{...r,ref:e,style:{width:s,height:o,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function a2(t){return t?parseInt(t,10):0}function tV(t,e){const n=t/e;return isNaN(n)?0:n}function Z5(t){const e=tV(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function tae(t,e,n,r="ltr"){const i=Z5(n),s=i/2,a=e||s,o=i-a,l=n.scrollbar.paddingStart+a,c=n.scrollbar.size-n.scrollbar.paddingEnd-o,d=n.content-n.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return nV([l,c],h)(t)}function PD(t,e,n="ltr"){const r=Z5(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,a=e.content-e.viewport,o=s-r,l=n==="ltr"?[0,a]:[a*-1,0],c=NN(t,l);return nV([0,a],[0,o])(c)}function nV(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 rV(t,e){return t>0&&t<e}var nae=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},a=n.left!==s.left,o=n.top!==s.top;(a||o)&&e(),n=s,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Q5(t,e){const n=Fo(t),r=T.useRef(0);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),T.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function U1(t,e){const n=Fo(e);bo(()=>{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 rae=$H,iae=XH,sae=eV,aae=[" ","Enter","ArrowUp","ArrowDown"],oae=[" ","Enter"],Qg="Select",[J5,eT,lae]=P7(Qg),[xy]=ou(Qg,[lae,am]),tT=am(),[cae,lm]=xy(Qg),[uae,dae]=xy(Qg),iV=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:a,defaultValue:o,onValueChange:l,dir:c,name:d,autoComplete:h,disabled:g,required:v,form:b}=t,_=tT(e),[w,S]=T.useState(null),[E,A]=T.useState(null),[N,I]=T.useState(!1),P=XS(c),[L,R]=Gd({prop:r,defaultProp:i??!1,onChange:s,caller:Qg}),[O,W]=Gd({prop:a,defaultProp:o,onChange:l,caller:Qg}),U=T.useRef(null),V=w?b||!!w.closest("form"):!0,[G,Z]=T.useState(new Set),B=Array.from(G).map(q=>q.props.value).join(";");return p.jsx(V5,{..._,children:p.jsxs(cae,{required:v,scope:e,trigger:w,onTriggerChange:S,valueNode:E,onValueNodeChange:A,valueNodeHasChildren:N,onValueNodeHasChildrenChange:I,contentId:Gu(),value:O,onValueChange:W,open:L,onOpenChange:R,dir:P,triggerPointerDownPosRef:U,disabled:g,children:[p.jsx(J5.Provider,{scope:e,children:p.jsx(uae,{scope:t.__scopeSelect,onNativeOptionAdd:T.useCallback(q=>{Z(Y=>new Set(Y).add(q))},[]),onNativeOptionRemove:T.useCallback(q=>{Z(Y=>{const K=new Set(Y);return K.delete(q),K})},[]),children:n})}),V?p.jsxs(EV,{"aria-hidden":!0,required:v,tabIndex:-1,name:d,autoComplete:h,value:O,onChange:q=>W(q.target.value),disabled:g,form:b,children:[O===void 0?p.jsx("option",{value:""}):null,Array.from(G)]},B):null]})})};iV.displayName=Qg;var sV="SelectTrigger",aV=T.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=tT(n),a=lm(sV,n),o=a.disabled||r,l=Lr(e,a.onTriggerChange),c=eT(n),d=T.useRef("touch"),[h,g,v]=AV(_=>{const w=c().filter(A=>!A.disabled),S=w.find(A=>A.value===a.value),E=NV(w,_,S);E!==void 0&&a.onValueChange(E.value)}),b=_=>{o||(a.onOpenChange(!0),v()),_&&(a.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return p.jsx(QS,{asChild:!0,...s,children:p.jsx(ar.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":CV(a.value)?"":void 0,...i,ref:l,onClick:gn(i.onClick,_=>{_.currentTarget.focus(),d.current!=="mouse"&&b(_)}),onPointerDown:gn(i.onPointerDown,_=>{d.current=_.pointerType;const w=_.target;w.hasPointerCapture(_.pointerId)&&w.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(b(_),_.preventDefault())}),onKeyDown:gn(i.onKeyDown,_=>{const w=h.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&g(_.key),!(w&&_.key===" ")&&aae.includes(_.key)&&(b(),_.preventDefault())})})})});aV.displayName=sV;var oV="SelectValue",lV=T.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:a="",...o}=t,l=lm(oV,n),{onValueNodeHasChildrenChange:c}=l,d=s!==void 0,h=Lr(e,l.onValueNodeChange);return bo(()=>{c(d)},[c,d]),p.jsx(ar.span,{...o,ref:h,style:{pointerEvents:"none"},children:CV(l.value)?p.jsx(p.Fragment,{children:a}):s})});lV.displayName=oV;var fae="SelectIcon",cV=T.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return p.jsx(ar.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});cV.displayName=fae;var hae="SelectPortal",uV=t=>p.jsx(my,{asChild:!0,...t});uV.displayName=hae;var Jg="SelectContent",dV=T.forwardRef((t,e)=>{const n=lm(Jg,t.__scopeSelect),[r,i]=T.useState();if(bo(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?Ld.createPortal(p.jsx(fV,{scope:t.__scopeSelect,children:p.jsx(J5.Slot,{scope:t.__scopeSelect,children:p.jsx("div",{children:t.children})})}),s):null}return p.jsx(hV,{...t,ref:e})});dV.displayName=Jg;var Rd=10,[fV,cm]=xy(Jg),pae="SelectContentImpl",mae=W0("SelectContent.RemoveScroll"),hV=T.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:_,avoidCollisions:w,...S}=t,E=lm(Jg,n),[A,N]=T.useState(null),[I,P]=T.useState(null),L=Lr(e,ue=>N(ue)),[R,O]=T.useState(null),[W,U]=T.useState(null),V=eT(n),[G,Z]=T.useState(!1),B=T.useRef(!1);T.useEffect(()=>{if(A)return z5(A)},[A]),O5();const q=T.useCallback(ue=>{const[le,...fe]=V().map(Te=>Te.ref.current),[xe]=fe.slice(-1),he=document.activeElement;for(const Te of ue)if(Te===he||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===le&&I&&(I.scrollTop=0),Te===xe&&I&&(I.scrollTop=I.scrollHeight),Te==null||Te.focus(),document.activeElement!==he))return},[V,I]),Y=T.useCallback(()=>q([R,A]),[q,R,A]);T.useEffect(()=>{G&&Y()},[G,Y]);const{onOpenChange:K,triggerPointerDownPosRef:J}=E;T.useEffect(()=>{if(A){let ue={x:0,y:0};const le=xe=>{var he,Te;ue={x:Math.abs(Math.round(xe.pageX)-(((he=J.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(xe.pageY)-(((Te=J.current)==null?void 0:Te.y)??0))}},fe=xe=>{ue.x<=10&&ue.y<=10?xe.preventDefault():A.contains(xe.target)||K(!1),document.removeEventListener("pointermove",le),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",fe,{capture:!0})}}},[A,K,J]),T.useEffect(()=>{const ue=()=>K(!1);return window.addEventListener("blur",ue),window.addEventListener("resize",ue),()=>{window.removeEventListener("blur",ue),window.removeEventListener("resize",ue)}},[K]);const[F,j]=AV(ue=>{const le=V().filter(he=>!he.disabled),fe=le.find(he=>he.ref.current===document.activeElement),xe=NV(le,ue,fe);xe&&setTimeout(()=>xe.ref.current.focus())}),X=T.useCallback((ue,le,fe)=>{const xe=!B.current&&!fe;(E.value!==void 0&&E.value===le||xe)&&(O(ue),xe&&(B.current=!0))},[E.value]),H=T.useCallback(()=>A==null?void 0:A.focus(),[A]),se=T.useCallback((ue,le,fe)=>{const xe=!B.current&&!fe;(E.value!==void 0&&E.value===le||xe)&&U(ue)},[E.value]),re=r==="popper"?RN:pV,ie=re===RN?{side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:_,avoidCollisions:w}:{};return p.jsx(fV,{scope:n,content:A,viewport:I,onViewportChange:P,itemRefCallback:X,selectedItem:R,onItemLeave:H,itemTextRefCallback:se,focusSelectedItem:Y,selectedItemText:W,position:r,isPositioned:G,searchRef:F,children:p.jsx(KS,{as:mae,allowPinchZoom:!0,children:p.jsx(YS,{asChild:!0,trapped:E.open,onMountAutoFocus:ue=>{ue.preventDefault()},onUnmountAutoFocus:gn(i,ue=>{var le;(le=E.trigger)==null||le.focus({preventScroll:!0}),ue.preventDefault()}),children:p.jsx(py,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:ue=>ue.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:p.jsx(re,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:ue=>ue.preventDefault(),...S,...ie,onPlaced:()=>Z(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:gn(S.onKeyDown,ue=>{const le=ue.ctrlKey||ue.altKey||ue.metaKey;if(ue.key==="Tab"&&ue.preventDefault(),!le&&ue.key.length===1&&j(ue.key),["ArrowUp","ArrowDown","Home","End"].includes(ue.key)){let xe=V().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(ue.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ue.key)){const he=ue.target,Te=xe.indexOf(he);xe=xe.slice(Te+1)}setTimeout(()=>q(xe)),ue.preventDefault()}})})})})})})});hV.displayName=pae;var gae="SelectItemAlignedPosition",pV=T.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=lm(Jg,n),a=cm(Jg,n),[o,l]=T.useState(null),[c,d]=T.useState(null),h=Lr(e,L=>d(L)),g=eT(n),v=T.useRef(!1),b=T.useRef(!0),{viewport:_,selectedItem:w,selectedItemText:S,focusSelectedItem:E}=a,A=T.useCallback(()=>{if(s.trigger&&s.valueNode&&o&&c&&_&&w&&S){const L=s.trigger.getBoundingClientRect(),R=c.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),W=S.getBoundingClientRect();if(s.dir!=="rtl"){const he=W.left-R.left,Te=O.left-he,We=L.left-Te,Se=L.width+We,Le=Math.max(Se,R.width),pe=window.innerWidth-Rd,Re=NN(Te,[Rd,Math.max(Rd,pe-Le)]);o.style.minWidth=Se+"px",o.style.left=Re+"px"}else{const he=R.right-W.right,Te=window.innerWidth-O.right-he,We=window.innerWidth-L.right-Te,Se=L.width+We,Le=Math.max(Se,R.width),pe=window.innerWidth-Rd,Re=NN(Te,[Rd,Math.max(Rd,pe-Le)]);o.style.minWidth=Se+"px",o.style.right=Re+"px"}const U=g(),V=window.innerHeight-Rd*2,G=_.scrollHeight,Z=window.getComputedStyle(c),B=parseInt(Z.borderTopWidth,10),q=parseInt(Z.paddingTop,10),Y=parseInt(Z.borderBottomWidth,10),K=parseInt(Z.paddingBottom,10),J=B+q+G+K+Y,F=Math.min(w.offsetHeight*5,J),j=window.getComputedStyle(_),X=parseInt(j.paddingTop,10),H=parseInt(j.paddingBottom,10),se=L.top+L.height/2-Rd,re=V-se,ie=w.offsetHeight/2,ue=w.offsetTop+ie,le=B+q+ue,fe=J-le;if(le<=se){const he=U.length>0&&w===U[U.length-1].ref.current;o.style.bottom="0px";const Te=c.clientHeight-_.offsetTop-_.offsetHeight,We=Math.max(re,ie+(he?H:0)+Te+Y),Se=le+We;o.style.height=Se+"px"}else{const he=U.length>0&&w===U[0].ref.current;o.style.top="0px";const We=Math.max(se,B+_.offsetTop+(he?X:0)+ie)+fe;o.style.height=We+"px",_.scrollTop=le-se+_.offsetTop}o.style.margin=`${Rd}px 0`,o.style.minHeight=F+"px",o.style.maxHeight=V+"px",r==null||r(),requestAnimationFrame(()=>v.current=!0)}},[g,s.trigger,s.valueNode,o,c,_,w,S,s.dir,r]);bo(()=>A(),[A]);const[N,I]=T.useState();bo(()=>{c&&I(window.getComputedStyle(c).zIndex)},[c]);const P=T.useCallback(L=>{L&&b.current===!0&&(A(),E==null||E(),b.current=!1)},[A,E]);return p.jsx(xae,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:v,onScrollButtonChange:P,children:p.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:p.jsx(ar.div,{...i,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});pV.displayName=gae;var vae="SelectPopperPosition",RN=T.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Rd,...s}=t,a=tT(n);return p.jsx(G5,{...a,...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)"}})});RN.displayName=vae;var[xae,s8]=xy(Jg,{}),kN="SelectViewport",mV=T.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=cm(kN,n),a=s8(kN,n),o=Lr(e,s.onViewportChange),l=T.useRef(0);return p.jsxs(p.Fragment,{children:[p.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}),p.jsx(J5.Slot,{scope:n,children:p.jsx(ar.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:gn(i.onScroll,c=>{const d=c.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:g}=a;if(g!=null&&g.current&&h){const v=Math.abs(l.current-d.scrollTop);if(v>0){const b=window.innerHeight-Rd*2,_=parseFloat(h.style.minHeight),w=parseFloat(h.style.height),S=Math.max(_,w);if(S<b){const E=S+v,A=Math.min(b,E),N=E-A;h.style.height=A+"px",h.style.bottom==="0px"&&(d.scrollTop=N>0?N:0,h.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});mV.displayName=kN;var gV="SelectGroup",[yae,bae]=xy(gV),_ae=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Gu();return p.jsx(yae,{scope:n,id:i,children:p.jsx(ar.div,{role:"group","aria-labelledby":i,...r,ref:e})})});_ae.displayName=gV;var vV="SelectLabel",Sae=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=bae(vV,n);return p.jsx(ar.div,{id:i.id,...r,ref:e})});Sae.displayName=vV;var o2="SelectItem",[wae,xV]=xy(o2),yV=T.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...a}=t,o=lm(o2,n),l=cm(o2,n),c=o.value===r,[d,h]=T.useState(s??""),[g,v]=T.useState(!1),b=Lr(e,E=>{var A;return(A=l.itemRefCallback)==null?void 0:A.call(l,E,r,i)}),_=Gu(),w=T.useRef("touch"),S=()=>{i||(o.onValueChange(r),o.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 p.jsx(wae,{scope:n,value:r,disabled:i,textId:_,isSelected:c,onItemTextChange:T.useCallback(E=>{h(A=>A||((E==null?void 0:E.textContent)??"").trim())},[]),children:p.jsx(J5.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:p.jsx(ar.div,{role:"option","aria-labelledby":_,"data-highlighted":g?"":void 0,"aria-selected":c&&g,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:b,onFocus:gn(a.onFocus,()=>v(!0)),onBlur:gn(a.onBlur,()=>v(!1)),onClick:gn(a.onClick,()=>{w.current!=="mouse"&&S()}),onPointerUp:gn(a.onPointerUp,()=>{w.current==="mouse"&&S()}),onPointerDown:gn(a.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:gn(a.onPointerMove,E=>{var A;w.current=E.pointerType,i?(A=l.onItemLeave)==null||A.call(l):w.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:gn(a.onPointerLeave,E=>{var A;E.currentTarget===document.activeElement&&((A=l.onItemLeave)==null||A.call(l))}),onKeyDown:gn(a.onKeyDown,E=>{var N;((N=l.searchRef)==null?void 0:N.current)!==""&&E.key===" "||(oae.includes(E.key)&&S(),E.key===" "&&E.preventDefault())})})})})});yV.displayName=o2;var f_="SelectItemText",bV=T.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,a=lm(f_,n),o=cm(f_,n),l=xV(f_,n),c=dae(f_,n),[d,h]=T.useState(null),g=Lr(e,S=>h(S),l.onItemTextChange,S=>{var E;return(E=o.itemTextRefCallback)==null?void 0:E.call(o,S,l.value,l.disabled)}),v=d==null?void 0:d.textContent,b=T.useMemo(()=>p.jsx("option",{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:_,onNativeOptionRemove:w}=c;return bo(()=>(_(b),()=>w(b)),[_,w,b]),p.jsxs(p.Fragment,{children:[p.jsx(ar.span,{id:l.textId,...s,ref:g}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Ld.createPortal(s.children,a.valueNode):null]})});bV.displayName=f_;var _V="SelectItemIndicator",SV=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return xV(_V,n).isSelected?p.jsx(ar.span,{"aria-hidden":!0,...r,ref:e}):null});SV.displayName=_V;var PN="SelectScrollUpButton",wV=T.forwardRef((t,e)=>{const n=cm(PN,t.__scopeSelect),r=s8(PN,t.__scopeSelect),[i,s]=T.useState(!1),a=Lr(e,r.onScrollButtonChange);return bo(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),i?p.jsx(TV,{...t,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop-l.offsetHeight)}}):null});wV.displayName=PN;var DN="SelectScrollDownButton",MV=T.forwardRef((t,e)=>{const n=cm(DN,t.__scopeSelect),r=s8(DN,t.__scopeSelect),[i,s]=T.useState(!1),a=Lr(e,r.onScrollButtonChange);return bo(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;s(d)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),i?p.jsx(TV,{...t,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop+l.offsetHeight)}}):null});MV.displayName=DN;var TV=T.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=cm("SelectScrollButton",n),a=T.useRef(null),o=eT(n),l=T.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return T.useEffect(()=>()=>l(),[l]),bo(()=>{var d;const c=o().find(h=>h.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),p.jsx(ar.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:gn(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:gn(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:gn(i.onPointerLeave,()=>{l()})})}),Mae="SelectSeparator",Tae=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return p.jsx(ar.div,{"aria-hidden":!0,...r,ref:e})});Tae.displayName=Mae;var IN="SelectArrow",Eae=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=tT(n),s=lm(IN,n),a=cm(IN,n);return s.open&&a.position==="popper"?p.jsx(W5,{...i,...r,ref:e}):null});Eae.displayName=IN;var Cae="SelectBubbleInput",EV=T.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=T.useRef(null),s=Lr(r,i),a=One(e);return T.useEffect(()=>{const o=i.current;if(!o)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==e&&d){const h=new Event("change",{bubbles:!0});d.call(o,e),o.dispatchEvent(h)}},[a,e]),p.jsx(ar.select,{...n,style:{...EU,...n.style},ref:s,defaultValue:e})});EV.displayName=Cae;function CV(t){return t===""||t===void 0}function AV(t){const e=Fo(t),n=T.useRef(""),r=T.useRef(0),i=T.useCallback(a=>{const o=n.current+a;e(o),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(o)},[e]),s=T.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function NV(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 a=Aae(t,Math.max(s,0));i.length===1&&(a=a.filter(c=>c!==n));const l=a.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Aae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Nae=iV,Rae=aV,kae=lV,Pae=cV,Dae=uV,Iae=dV,Oae=mV,Lae=yV,zae=bV,jae=SV,Fae=wV,Uae=MV,RV="Toggle",a8=T.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...s}=t,[a,o]=Gd({prop:n,onChange:i,defaultProp:r??!1,caller:RV});return p.jsx(ar.button,{type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:gn(t.onClick,()=>{t.disabled||o(!a)})})});a8.displayName=RV;var Bae=a8,um="ToggleGroup",[kV]=ou(um,[$5]),PV=$5(),o8=Zr.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const i=r;return p.jsx(Hae,{...i,ref:e})}if(n==="multiple"){const i=r;return p.jsx(Vae,{...i,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${um}\``)});o8.displayName=um;var[DV,IV]=kV(um),Hae=Zr.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[a,o]=Gd({prop:n,defaultProp:r??"",onChange:i,caller:um});return p.jsx(DV,{scope:t.__scopeToggleGroup,type:"single",value:Zr.useMemo(()=>a?[a]:[],[a]),onItemActivate:o,onItemDeactivate:Zr.useCallback(()=>o(""),[o]),children:p.jsx(OV,{...s,ref:e})})}),Vae=Zr.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[a,o]=Gd({prop:n,defaultProp:r??[],onChange:i,caller:um}),l=Zr.useCallback(d=>o((h=[])=>[...h,d]),[o]),c=Zr.useCallback(d=>o((h=[])=>h.filter(g=>g!==d)),[o]);return p.jsx(DV,{scope:t.__scopeToggleGroup,type:"multiple",value:a,onItemActivate:l,onItemDeactivate:c,children:p.jsx(OV,{...s,ref:e})})});o8.displayName=um;var[Gae,Wae]=kV(um),OV=Zr.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:s,dir:a,loop:o=!0,...l}=t,c=PV(n),d=XS(a),h={role:"group",dir:d,...l};return p.jsx(Gae,{scope:n,rovingFocus:i,disabled:r,children:i?p.jsx(ZB,{asChild:!0,...c,orientation:s,dir:d,loop:o,children:p.jsx(ar.div,{...h,ref:e})}):p.jsx(ar.div,{...h,ref:e})})}),l2="ToggleGroupItem",LV=Zr.forwardRef((t,e)=>{const n=IV(l2,t.__scopeToggleGroup),r=Wae(l2,t.__scopeToggleGroup),i=PV(t.__scopeToggleGroup),s=n.value.includes(t.value),a=r.disabled||t.disabled,o={...t,pressed:s,disabled:a},l=Zr.useRef(null);return r.rovingFocus?p.jsx(QB,{asChild:!0,...i,focusable:!a,active:s,ref:l,children:p.jsx(DD,{...o,ref:e})}):p.jsx(DD,{...o,ref:e})});LV.displayName=l2;var DD=Zr.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...i}=t,s=IV(l2,n),a={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},o=s.type==="single"?a:void 0;return p.jsx(a8,{...o,...i,ref:e,onPressedChange:l=>{l?s.onItemActivate(r):s.onItemDeactivate(r)}})}),$ae=o8,qae=LV,[nT]=ou("Tooltip",[am]),rT=am(),zV="TooltipProvider",Xae=700,ON="tooltip.open",[Yae,l8]=nT(zV),jV=t=>{const{__scopeTooltip:e,delayDuration:n=Xae,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,a=T.useRef(!0),o=T.useRef(!1),l=T.useRef(0);return T.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),p.jsx(Yae,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:T.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:T.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:T.useCallback(c=>{o.current=c},[]),disableHoverableContent:i,children:s})};jV.displayName=zV;var J_="Tooltip",[Kae,rw]=nT(J_),FV=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:a,delayDuration:o}=t,l=l8(J_,t.__scopeTooltip),c=rT(e),[d,h]=T.useState(null),g=Gu(),v=T.useRef(0),b=a??l.disableHoverableContent,_=o??l.delayDuration,w=T.useRef(!1),[S,E]=Gd({prop:r,defaultProp:i??!1,onChange:L=>{L?(l.onOpen(),document.dispatchEvent(new CustomEvent(ON))):l.onClose(),s==null||s(L)},caller:J_}),A=T.useMemo(()=>S?w.current?"delayed-open":"instant-open":"closed",[S]),N=T.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,E(!0)},[E]),I=T.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),P=T.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,E(!0),v.current=0},_)},[_,E]);return T.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),p.jsx(V5,{...c,children:p.jsx(Kae,{scope:e,contentId:g,open:S,stateAttribute:A,trigger:d,onTriggerChange:h,onTriggerEnter:T.useCallback(()=>{l.isOpenDelayedRef.current?P():N()},[l.isOpenDelayedRef,P,N]),onTriggerLeave:T.useCallback(()=>{b?I():(window.clearTimeout(v.current),v.current=0)},[I,b]),onOpen:N,onClose:I,disableHoverableContent:b,children:n})})};FV.displayName=J_;var LN="TooltipTrigger",UV=T.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=rw(LN,n),s=l8(LN,n),a=rT(n),o=T.useRef(null),l=Lr(e,o,i.onTriggerChange),c=T.useRef(!1),d=T.useRef(!1),h=T.useCallback(()=>c.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),p.jsx(QS,{asChild:!0,...a,children:p.jsx(ar.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:gn(t.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:gn(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:gn(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:gn(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:gn(t.onBlur,i.onClose),onClick:gn(t.onClick,i.onClose)})})});UV.displayName=LN;var c8="TooltipPortal",[Zae,Qae]=nT(c8,{forceMount:void 0}),BV=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=rw(c8,e);return p.jsx(Zae,{scope:e,forceMount:n,children:p.jsx(Vo,{present:n||s.open,children:p.jsx(my,{asChild:!0,container:i,children:r})})})};BV.displayName=c8;var B1="TooltipContent",HV=T.forwardRef((t,e)=>{const n=Qae(B1,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,a=rw(B1,t.__scopeTooltip);return p.jsx(Vo,{present:r||a.open,children:a.disableHoverableContent?p.jsx(VV,{side:i,...s,ref:e}):p.jsx(Jae,{side:i,...s,ref:e})})}),Jae=T.forwardRef((t,e)=>{const n=rw(B1,t.__scopeTooltip),r=l8(B1,t.__scopeTooltip),i=T.useRef(null),s=Lr(e,i),[a,o]=T.useState(null),{trigger:l,onClose:c}=n,d=i.current,{onPointerInTransitChange:h}=r,g=T.useCallback(()=>{o(null),h(!1)},[h]),v=T.useCallback((b,_)=>{const w=b.currentTarget,S={x:b.clientX,y:b.clientY},E=ioe(S,w.getBoundingClientRect()),A=soe(S,E),N=aoe(_.getBoundingClientRect()),I=loe([...A,...N]);o(I),h(!0)},[h]);return T.useEffect(()=>()=>g(),[g]),T.useEffect(()=>{if(l&&d){const b=w=>v(w,d),_=w=>v(w,l);return l.addEventListener("pointerleave",b),d.addEventListener("pointerleave",_),()=>{l.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",_)}}},[l,d,v,g]),T.useEffect(()=>{if(a){const b=_=>{const w=_.target,S={x:_.clientX,y:_.clientY},E=(l==null?void 0:l.contains(w))||(d==null?void 0:d.contains(w)),A=!ooe(S,a);E?g():A&&(g(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,d,a,c,g]),p.jsx(VV,{...t,ref:s})}),[eoe,toe]=nT(J_,{isInside:!1}),noe=MU("TooltipContent"),VV=T.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:a,...o}=t,l=rw(B1,n),c=rT(n),{onClose:d}=l;return T.useEffect(()=>(document.addEventListener(ON,d),()=>document.removeEventListener(ON,d)),[d]),T.useEffect(()=>{if(l.trigger){const h=g=>{const v=g.target;v!=null&&v.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),p.jsx(py,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:p.jsxs(G5,{"data-state":l.stateAttribute,...c,...o,ref:e,style:{...o.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:[p.jsx(noe,{children:r}),p.jsx(eoe,{scope:n,isInside:!0,children:p.jsx(Uee,{id:l.contentId,role:"tooltip",children:i||r})})]})})});HV.displayName=B1;var GV="TooltipArrow",roe=T.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=rT(n);return toe(GV,n).isInside?null:p.jsx(W5,{...i,...r,ref:e})});roe.displayName=GV;function ioe(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 soe(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 aoe(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 ooe(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const o=e[s],l=e[a],c=o.x,d=o.y,h=l.x,g=l.y;d>r!=g>r&&n<(h-c)*(r-d)/(g-d)+c&&(i=!i)}return i}function loe(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),coe(e)}function coe(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],a=e[e.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.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],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.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 uoe=jV,doe=FV,foe=UV,hoe=BV,poe=HV;function WV(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=WV(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function $V(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=WV(t))&&(r&&(r+=" "),r+=e);return r}const moe=(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},goe=(t,e)=>({classGroupId:t,validator:e}),qV=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),c2="-",ID=[],voe="arbitrary..",xoe=t=>{const e=boe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return yoe(a);const o=a.split(c2),l=o[0]===""&&o.length>1?1:0;return XV(o,l,e)},getConflictingClassGroupIds:(a,o)=>{if(o){const l=r[a],c=n[a];return l?c?moe(c,l):l:c||ID}return n[a]||ID}}},XV=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=XV(t,e+1,s);if(c)return c}const a=n.validators;if(a===null)return;const o=e===0?t.join(c2):t.slice(e).join(c2),l=a.length;for(let c=0;c<l;c++){const d=a[c];if(d.validator(o))return d.classGroupId}},yoe=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?voe+r:void 0})(),boe=t=>{const{theme:e,classGroups:n}=t;return _oe(n,e)},_oe=(t,e)=>{const n=qV();for(const r in t){const i=t[r];u8(i,n,r,e)}return n},u8=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const a=t[s];Soe(a,e,n,r)}},Soe=(t,e,n,r)=>{if(typeof t=="string"){woe(t,e,n);return}if(typeof t=="function"){Moe(t,e,n,r);return}Toe(t,e,n,r)},woe=(t,e,n)=>{const r=t===""?e:YV(e,t);r.classGroupId=n},Moe=(t,e,n,r)=>{if(Eoe(t)){u8(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(goe(n,t))},Toe=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let a=0;a<s;a++){const[o,l]=i[a];u8(l,YV(e,o),n,r)}},YV=(t,e)=>{let n=t;const r=e.split(c2),i=r.length;for(let s=0;s<i;s++){const a=r[s];let o=n.nextPart.get(a);o||(o=qV(),n.nextPart.set(a,o)),n=o}return n},Eoe=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Coe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(s,a)=>{n[s]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return i(s,a),a},set(s,a){s in n?n[s]=a:i(s,a)}}},zN="!",OD=":",Aoe=[],LD=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Noe=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let a=0,o=0,l=0,c;const d=i.length;for(let _=0;_<d;_++){const w=i[_];if(a===0&&o===0){if(w===OD){s.push(i.slice(l,_)),l=_+1;continue}if(w==="/"){c=_;continue}}w==="["?a++:w==="]"?a--:w==="("?o++:w===")"&&o--}const h=s.length===0?i:i.slice(l);let g=h,v=!1;h.endsWith(zN)?(g=h.slice(0,-1),v=!0):h.startsWith(zN)&&(g=h.slice(1),v=!0);const b=c&&c>l?c-l:void 0;return LD(s,v,g,b)};if(e){const i=e+OD,s=r;r=a=>a.startsWith(i)?s(a.slice(i.length)):LD(Aoe,!1,a,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},Roe=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 a=n[s],o=a[0]==="[",l=e.has(a);o||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(a)):i.push(a)}return i.length>0&&(i.sort(),r.push(...i)),r}},koe=t=>({cache:Coe(t.cacheSize),parseClassName:Noe(t),sortModifiers:Roe(t),...xoe(t)}),Poe=/\s+/,Doe=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,a=[],o=t.trim().split(Poe);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:_}=n(d);if(h){l=d+(l.length>0?" "+l:l);continue}let w=!!_,S=r(w?b.substring(0,_):b);if(!S){if(!w){l=d+(l.length>0?" "+l:l);continue}if(S=r(b),!S){l=d+(l.length>0?" "+l:l);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:s(g).join(":"),A=v?E+zN:E,N=A+S;if(a.indexOf(N)>-1)continue;a.push(N);const I=i(S,w);for(let P=0;P<I.length;++P){const L=I[P];a.push(A+L)}l=d+(l.length>0?" "+l:l)}return l},Ioe=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=KV(n))&&(i&&(i+=" "),i+=r);return i},KV=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=KV(t[r]))&&(n&&(n+=" "),n+=e);return n},Ooe=(t,...e)=>{let n,r,i,s;const a=l=>{const c=e.reduce((d,h)=>h(d),t());return n=koe(c),r=n.cache.get,i=n.cache.set,s=o,o(l)},o=l=>{const c=r(l);if(c)return c;const d=Doe(l,n);return i(l,d),d};return s=a,(...l)=>s(Ioe(...l))},Loe=[],eo=t=>{const e=n=>n[t]||Loe;return e.isThemeGetter=!0,e},ZV=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,QV=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zoe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,joe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Foe=/\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$/,Uoe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Boe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Hoe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,l0=t=>zoe.test(t),Br=t=>!!t&&!Number.isNaN(Number(t)),c0=t=>!!t&&Number.isInteger(Number(t)),IC=t=>t.endsWith("%")&&Br(t.slice(0,-1)),Hh=t=>joe.test(t),JV=()=>!0,Voe=t=>Foe.test(t)&&!Uoe.test(t),d8=()=>!1,Goe=t=>Boe.test(t),Woe=t=>Hoe.test(t),$oe=t=>!Pn(t)&&!In(t),qoe=t=>dm(t,nG,d8),Pn=t=>ZV.test(t),eg=t=>dm(t,rG,Voe),zD=t=>dm(t,tle,Br),Xoe=t=>dm(t,sG,JV),Yoe=t=>dm(t,iG,d8),jD=t=>dm(t,eG,d8),Koe=t=>dm(t,tG,Woe),K3=t=>dm(t,aG,Goe),In=t=>QV.test(t),Bb=t=>pv(t,rG),Zoe=t=>pv(t,iG),FD=t=>pv(t,eG),Qoe=t=>pv(t,nG),Joe=t=>pv(t,tG),Z3=t=>pv(t,aG,!0),ele=t=>pv(t,sG,!0),dm=(t,e,n)=>{const r=ZV.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},pv=(t,e,n=!1)=>{const r=QV.exec(t);return r?r[1]?e(r[1]):n:!1},eG=t=>t==="position"||t==="percentage",tG=t=>t==="image"||t==="url",nG=t=>t==="length"||t==="size"||t==="bg-size",rG=t=>t==="length",tle=t=>t==="number",iG=t=>t==="family-name",sG=t=>t==="number"||t==="weight",aG=t=>t==="shadow",nle=()=>{const t=eo("color"),e=eo("font"),n=eo("text"),r=eo("font-weight"),i=eo("tracking"),s=eo("leading"),a=eo("breakpoint"),o=eo("container"),l=eo("spacing"),c=eo("radius"),d=eo("shadow"),h=eo("inset-shadow"),g=eo("text-shadow"),v=eo("drop-shadow"),b=eo("blur"),_=eo("perspective"),w=eo("aspect"),S=eo("ease"),E=eo("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"],I=()=>[...N(),In,Pn],P=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],R=()=>[In,Pn,l],O=()=>[l0,"full","auto",...R()],W=()=>[c0,"none","subgrid",In,Pn],U=()=>["auto",{span:["full",c0,In,Pn]},c0,In,Pn],V=()=>[c0,"auto",In,Pn],G=()=>["auto","min","max","fr",In,Pn],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...R()],Y=()=>[l0,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],K=()=>[l0,"screen","full","dvw","lvw","svw","min","max","fit",...R()],J=()=>[l0,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],F=()=>[t,In,Pn],j=()=>[...N(),FD,jD,{position:[In,Pn]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",Qoe,qoe,{size:[In,Pn]}],se=()=>[IC,Bb,eg],re=()=>["","none","full",c,In,Pn],ie=()=>["",Br,Bb,eg],ue=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Br,IC,FD,jD],xe=()=>["","none",b,In,Pn],he=()=>["none",Br,In,Pn],Te=()=>["none",Br,In,Pn],We=()=>[Br,In,Pn],Se=()=>[l0,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Hh],breakpoint:[Hh],color:[JV],container:[Hh],"drop-shadow":[Hh],ease:["in","out","in-out"],font:[$oe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Hh],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Hh],shadow:[Hh],spacing:["px",Br],text:[Hh],"text-shadow":[Hh],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",l0,Pn,In,w]}],container:["container"],columns:[{columns:[Br,Pn,In,o]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{"inset-s":O(),start:O()}],end:[{"inset-e":O(),end:O()}],"inset-bs":[{"inset-bs":O()}],"inset-be":[{"inset-be":O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[c0,"auto",In,Pn]}],basis:[{basis:[l0,"full","auto",o,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Br,l0,"auto","initial","none",Pn]}],grow:[{grow:["",Br,In,Pn]}],shrink:[{shrink:["",Br,In,Pn]}],order:[{order:[c0,"first","last","none",In,Pn]}],"grid-cols":[{"grid-cols":W()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":W()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"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:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],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:Y()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...J()]}],"min-block-size":[{"min-block":["auto",...J()]}],"max-block-size":[{"max-block":["none",...J()]}],w:[{w:[o,"screen",...Y()]}],"min-w":[{"min-w":[o,"screen","none",...Y()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,Bb,eg]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ele,Xoe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",IC,Pn]}],"font-family":[{font:[Zoe,Yoe,e]}],"font-features":[{"font-features":[Pn]}],"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,In,Pn]}],"line-clamp":[{"line-clamp":[Br,"none",In,zD]}],leading:[{leading:[s,...R()]}],"list-image":[{"list-image":["none",In,Pn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",In,Pn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:[Br,"from-font","auto",In,eg]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Br,"auto",In,Pn]}],"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",In,Pn]}],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",In,Pn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},c0,In,Pn],radial:["",In,Pn],conic:[c0,In,Pn]},Joe,Koe]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ue(),"hidden","none"]}],"divide-style":[{divide:[...ue(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ue(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Br,In,Pn]}],"outline-w":[{outline:["",Br,Bb,eg]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",d,Z3,K3]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",h,Z3,K3]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Br,eg]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",g,Z3,K3]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Br,In,Pn]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Br]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[In,Pn]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":[Br]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",In,Pn]}],filter:[{filter:["","none",In,Pn]}],blur:[{blur:xe()}],brightness:[{brightness:[Br,In,Pn]}],contrast:[{contrast:[Br,In,Pn]}],"drop-shadow":[{"drop-shadow":["","none",v,Z3,K3]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Br,In,Pn]}],"hue-rotate":[{"hue-rotate":[Br,In,Pn]}],invert:[{invert:["",Br,In,Pn]}],saturate:[{saturate:[Br,In,Pn]}],sepia:[{sepia:["",Br,In,Pn]}],"backdrop-filter":[{"backdrop-filter":["","none",In,Pn]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Br,In,Pn]}],"backdrop-contrast":[{"backdrop-contrast":[Br,In,Pn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Br,In,Pn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Br,In,Pn]}],"backdrop-invert":[{"backdrop-invert":["",Br,In,Pn]}],"backdrop-opacity":[{"backdrop-opacity":[Br,In,Pn]}],"backdrop-saturate":[{"backdrop-saturate":[Br,In,Pn]}],"backdrop-sepia":[{"backdrop-sepia":["",Br,In,Pn]}],"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",In,Pn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Br,"initial",In,Pn]}],ease:[{ease:["linear","initial",S,In,Pn]}],delay:[{delay:[Br,In,Pn]}],animate:[{animate:["none",E,In,Pn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,In,Pn]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:We()}],"skew-x":[{"skew-x":We()}],"skew-y":[{"skew-y":We()}],transform:[{transform:[In,Pn,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"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",In,Pn]}],"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",In,Pn]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Br,Bb,eg,zD]}],stroke:[{stroke:["none",...F()]}],"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"]}},rle=Ooe(nle);function Rt(...t){return rle($V(t))}function oG({delayDuration:t=0,...e}){return p.jsx(uoe,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function mv({...t}){return p.jsx(oG,{children:p.jsx(doe,{"data-slot":"tooltip",...t})})}function gv({...t}){return p.jsx(foe,{"data-slot":"tooltip-trigger",...t})}function vv({className:t,sideOffset:e=4,children:n,...r}){return p.jsx(hoe,{children:p.jsx(poe,{"data-slot":"tooltip-content",sideOffset:e,className:Rt("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs bg-foreground text-background z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin)",t),...r,children:n})})}function ile({children:t}){const[e]=T.useState(()=>new JJ({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1}}}));return p.jsx(Pee,{children:p.jsx(eee,{client:e,children:p.jsx(oG,{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 sle=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ale=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),UD=t=>{const e=ale(t);return e.charAt(0).toUpperCase()+e.slice(1)},lG=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),ole=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 lle={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 cle=T.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...o},l)=>T.createElement("svg",{ref:l,...lle,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:lG("lucide",i),...!s&&!ole(o)&&{"aria-hidden":"true"},...o},[...a.map(([c,d])=>T.createElement(c,d)),...Array.isArray(s)?s:[s]]));/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ti=(t,e)=>{const n=T.forwardRef(({className:r,...i},s)=>T.createElement(cle,{ref:s,iconNode:e,className:lG(`lucide-${sle(UD(t))}`,`lucide-${t}`,r),...i}));return n.displayName=UD(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 ule=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],dle=Ti("arrow-down",ule);/**
 * @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 fle=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],OC=Ti("arrow-left",fle);/**
 * @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 hle=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ple=Ti("arrow-right",hle);/**
 * @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 mle=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],gle=Ti("arrow-up",mle);/**
 * @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 vle=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],xv=Ti("check",vle);/**
 * @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 xle=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Vr=Ti("chevron-down",xle);/**
 * @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 yle=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],f8=Ti("chevron-left",yle);/**
 * @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 ble=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],u1=Ti("chevron-right",ble);/**
 * @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 _le=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],h8=Ti("chevron-up",_le);/**
 * @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 Sle=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],wle=Ti("chevrons-left",Sle);/**
 * @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 Mle=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Tle=Ti("chevrons-right",Mle);/**
 * @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 Ele=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Cle=Ti("circle-check",Ele);/**
 * @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 Ale=[["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"}]],Nle=Ti("circle-x",Ale);/**
 * @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 Rle=[["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"}]],iT=Ti("copy",Rle);/**
 * @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 kle=[["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"}]],Ple=Ti("database",kle);/**
 * @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 Dle=[["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"}]],Ile=Ti("file-code-corner",Dle);/**
 * @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 Ole=[["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"}]],Lle=Ti("folder-open",Ole);/**
 * @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 zle=[["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"}]],jle=Ti("folder",zle);/**
 * @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 Fle=[["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"}]],p8=Ti("grip-vertical",Fle);/**
 * @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 Ule=[["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"}]],Ble=Ti("layers",Ule);/**
 * @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 Hle=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kd=Ti("loader-circle",Hle);/**
 * @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 Vle=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],jN=Ti("menu",Vle);/**
 * @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 Gle=[["path",{d:"M5 12h14",key:"1ays0h"}]],Wle=Ti("minus",Gle);/**
 * @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 $le=[["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"}]],qle=Ti("panel-left-close",$le);/**
 * @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 Xle=[["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"}]],Yle=Ti("panel-right-close",Xle);/**
 * @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 Kle=[["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"}]],cG=Ti("pencil",Kle);/**
 * @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 Zle=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ip=Ti("plus",Zle);/**
 * @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 Qle=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],uG=Ti("settings",Qle);/**
 * @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 Jle=[["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"}]],iw=Ti("sliders-horizontal",Jle);/**
 * @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 ece=[["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"}]],tce=Ti("trash-2",ece);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nce=[["path",{d:"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"}]],rce=Ti("triangle-alert",nce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ice=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ju=Ti("x",ice);function $f({...t}){return p.jsx(aB,{"data-slot":"dialog",...t})}function sT({...t}){return p.jsx(oB,{"data-slot":"dialog-trigger",...t})}function sce({...t}){return p.jsx(lB,{"data-slot":"dialog-portal",...t})}function ace({className:t,...e}){return p.jsx(cB,{"data-slot":"dialog-overlay",className:Rt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function qf({className:t,children:e,...n}){return p.jsxs(sce,{children:[p.jsx(ace,{}),p.jsxs(uB,{"data-slot":"dialog-content",className:Rt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[e,p.jsxs(F7,{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:[p.jsx(Ju,{}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function jd({className:t,...e}){return p.jsx("div",{"data-slot":"dialog-header",className:Rt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function m8({className:t,...e}){return p.jsx("div",{"data-slot":"dialog-footer",className:Rt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Fd({className:t,...e}){return p.jsx(dB,{"data-slot":"dialog-title",className:Rt("text-lg leading-none font-semibold",t),...e})}function Ng({className:t,...e}){return p.jsx(fB,{"data-slot":"dialog-description",className:Rt("text-muted-foreground text-sm",t),...e})}function fl({...t}){return p.jsx(_se,{"data-slot":"dropdown-menu",...t})}function hl({...t}){return p.jsx(Sse,{"data-slot":"dropdown-menu-trigger",...t})}function pl({className:t,align:e="start",sideOffset:n=4,...r}){return p.jsx(wse,{children:p.jsx(Mse,{"data-slot":"dropdown-menu-content",sideOffset:n,align:e,className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden",t),...r})})}function _c({className:t,inset:e,variant:n="default",...r}){return p.jsx(Ese,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Rt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}function vi({className:t,children:e,checked:n,...r}){return p.jsxs(Cse,{"data-slot":"dropdown-menu-checkbox-item",className:Rt("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),checked:n,...r,children:[p.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:p.jsx(Ase,{children:p.jsx(xv,{})})}),e]})}function eS({className:t,inset:e,...n}){return p.jsx(Tse,{"data-slot":"dropdown-menu-label","data-inset":e,className:Rt("text-muted-foreground px-1.5 py-1 text-xs font-medium data-[inset]:pl-8",t),...n})}function Hl({className:t,...e}){return p.jsx(Nse,{"data-slot":"dropdown-menu-separator",className:Rt("bg-border -mx-1 my-1 h-px",t),...e})}const BD=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HD=$V,g8=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return HD(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,a=Object.keys(i).map(c=>{const d=n==null?void 0:n[c],h=s==null?void 0:s[c];if(d===null)return null;const g=BD(d)||BD(h);return i[c][g]}),o=n&&Object.entries(n).reduce((c,d)=>{let[h,g]=d;return g===void 0||(c[h]=g),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:h,className:g,...v}=d;return Object.entries(v).every(b=>{let[_,w]=b;return Array.isArray(w)?w.includes({...s,...o}[_]):{...s,...o}[_]===w})?[...c,h,g]:c},[]);return HD(t,a,l,n==null?void 0:n.class,n==null?void 0:n.className)},oce=g8("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 Tn({className:t,variant:e="default",size:n="default",asChild:r=!1,...i}){const s=r?SU:"button";return p.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:Rt(oce({variant:e,size:n,className:t})),...i})}function V0({className:t,type:e,...n}){return p.jsx("input",{type:e,"data-slot":"input",className:Rt("dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",t),...n})}function lce({className:t,...e}){return p.jsx(kse,{"data-slot":"label",className:Rt("gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",t),...e})}function ll({className:t,...e}){return p.jsx(Kd,{role:"status","aria-label":"Loading",className:Rt("size-4 animate-spin",t),...e})}function yv({className:t,children:e,...n}){return p.jsxs(rae,{"data-slot":"scroll-area",className:Rt("relative",t),...n,children:[p.jsx(iae,{"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}),p.jsx(cce,{}),p.jsx(sae,{})]})}function cce({className:t,orientation:e="vertical",...n}){return p.jsx(YH,{"data-slot":"scroll-area-scrollbar","data-orientation":e,orientation:e,className:Rt("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",t),...n,children:p.jsx(JH,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function aT({...t}){return p.jsx(Hse,{"data-slot":"popover",...t})}function oT({...t}){return p.jsx(Vse,{"data-slot":"popover-trigger",...t})}function lT({className:t,align:e="center",sideOffset:n=4,...r}){return p.jsx(Gse,{children:p.jsx(Wse,{"data-slot":"popover-content",align:e,sideOffset:n,className:Rt("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-2.5 rounded-lg p-2.5 text-sm shadow-md ring-1 duration-100 z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",t),...r})})}function FN({...t}){return p.jsx(Tne,{"data-slot":"alert-dialog",...t})}function uce({...t}){return p.jsx(Ene,{"data-slot":"alert-dialog-portal",...t})}function dce({className:t,...e}){return p.jsx(Cne,{"data-slot":"alert-dialog-overlay",className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...e})}function UN({className:t,size:e="default",...n}){return p.jsxs(uce,{children:[p.jsx(dce,{}),p.jsx(Ane,{"data-slot":"alert-dialog-content","data-size":e,className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-4 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",t),...n})]})}function BN({className:t,...e}){return p.jsx("div",{"data-slot":"alert-dialog-header",className:Rt("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...e})}function HN({className:t,...e}){return p.jsx("div",{"data-slot":"alert-dialog-footer",className:Rt("bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...e})}function fce({className:t,...e}){return p.jsx("div",{"data-slot":"alert-dialog-media",className:Rt("bg-muted mb-2 inline-flex size-10 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",t),...e})}function VN({className:t,...e}){return p.jsx(kne,{"data-slot":"alert-dialog-title",className:Rt("text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...e})}function GN({className:t,...e}){return p.jsx(Pne,{"data-slot":"alert-dialog-description",className:Rt("text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",t),...e})}function WN({className:t,variant:e="default",size:n="default",...r}){return p.jsx(Tn,{variant:e,size:n,asChild:!0,children:p.jsx(Nne,{"data-slot":"alert-dialog-action",className:Rt(t),...r})})}function $N({className:t,variant:e="outline",size:n="default",...r}){return p.jsx(Tn,{variant:e,size:n,asChild:!0,children:p.jsx(Rne,{"data-slot":"alert-dialog-cancel",className:Rt(t),...r})})}const v8={},hce=Symbol((v8?"production":void 0)!=="production"?"RESET":""),dG=t=>typeof(t==null?void 0:t.then)=="function";function pce(t=()=>{try{return window.localStorage}catch(n){(v8?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,i;const s={getItem:(l,c)=>{var d,h;const g=b=>{if(b=b||"",r!==b){try{i=JSON.parse(b,e==null?void 0:e.reviver)}catch{return c}r=b}return i},v=(h=(d=t())==null?void 0:d.getItem(l))!=null?h:null;return dG(v)?v.then(g):g(v)},setItem:(l,c)=>{var d;return(d=t())==null?void 0:d.setItem(l,JSON.stringify(c,void 0))},removeItem:l=>{var c;return(c=t())==null?void 0:c.removeItem(l)}},a=l=>(c,d,h)=>l(c,g=>{let v;try{v=JSON.parse(g||"")}catch{v=h}d(v)});let o;try{o=(n=t())==null?void 0:n.subscribe}catch{}return!o&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(o=(l,c)=>{if(!(t()instanceof window.Storage))return()=>{};const d=h=>{h.storageArea===t()&&h.key===l&&c(h.newValue)};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}}),o&&(s.subscribe=a(o)),s}const mce=pce();function Aa(t,e,n=mce,r){const i=Qr(e);return(v8?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=a=>{a(n.getItem(t,e));let o;return n.subscribe&&(o=n.subscribe(t,a,e)),o},Qr(a=>a(i),(a,o,l)=>{const c=typeof l=="function"?l(a(i)):l;return c===hce?(o(i,e),n.removeItem(t)):dG(c)?c.then(d=>(o(i,d),n.setItem(t,d))):(o(i,c),n.setItem(t,c))})}const fG=Qr(!1),hG=Qr(!1),pG=Qr(!1),ml=Aa("selected-run-path",null),cT=Aa("visible-runs",[]),mG=Qr(!1),gG=Qr(!1);function ms(t){const e=Qr({});return Qr(n=>{const r=n(ml);if(!r)return t;const i=n(e);return Object.prototype.hasOwnProperty.call(i,r)?i[r]:t},(n,r,i)=>{const s=n(ml);if(!s)return;const a=n(e),o=Object.prototype.hasOwnProperty.call(a,s)?a[s]:t,l=typeof i=="function"?i(o):i;r(e,{...a,[s]:l})})}const vG=Qr(!1),gce=Aa("overview-show-ema",!1),vce=Aa("overview-ema-span",10),xce=Aa("overview-show-all-runs",!1),yce=[{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"}],bce=Aa("overview-plots",yce),_ce=Qr(!1),Sce=Qr(10),wce=Qr("step"),Mce=Qr(!1),Tce=Qr(100),Ece=Qr(3600),Cce=Qr(0),Ace=Qr("all"),xG=Qr({}),Nce=ms(0),Rce=Qr(30),uT=ms(null),VD=ms(null),kce=Qr(0),Pce=Qr(0),dT=Qr(!0),Dce=Qr(!0),yG=Qr(!1),Ice=Qr(14),Oce=Qr(0),Lce=Aa("inference-max-lanes",128),bG=ms(null),_G=ms(null),zce=Aa("rollouts-selected-metrics",[]),jce=Aa("rollouts-discarded-selected-metrics",[]),x8=Aa("rollouts-metrics-sidebar-open",!0),LC=Aa("rollouts-discarded-metrics-sidebar-open",!0),y8=Aa("rollouts-sample-picker-sidebar-open",!0),zC=Aa("rollouts-discarded-sample-picker-sidebar-open",!0),SG=ms(null),GD=ms(null),wG=ms(null),WD=ms(null),MG=ms(null),$D=ms(null),TG=Qr("groups"),Fce=Aa("rollouts-sample-picker-display-metrics",["gen_length_avg","reward"]),Uce=Aa("rollouts-sample-picker-tooltips",!0),Bce=Aa("rollouts-sample-view-metrics",[]),qD=Qr("groups"),XD=ms(null),Hce=ms(null),YD=ms(null),KD=ms(null),ZD=ms(null),jC=Aa("evals-sample-picker-sidebar-open",!0),QD=Qr("groups"),FC=Aa("evals-metrics-sidebar-open",!0),Vce=Aa("evals-selected-metrics",[]),Gce=Qr("metrics"),Wce=ms(0),$ce=Qr(60),qce=Qr(!0),Xce=Qr(!1),Yce=Qr(1),Kce=ms(0),Zce=ms("separated"),Qce=ms(!0),Jce=ms(!0),eue=ms(!0),tue=ms(!0),nue=ms("combined"),rue=ms("combined"),iue=ms(!0),fT=Qr(null),hT=Aa("rollouts-render-options",["markdown","latex","code"]),pT=Aa("rollouts-format-think",!0),EG=Qr(null),Ar="",_o=5e3,UC={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"},Q3={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"},IM="#0284c7",BC="#10b981",qN="#ababab",CG="#c9c9c9",JD={request:IM,weight_broadcast:"#f97316"},H1="#e6e9ed",b8="#6b7280";function _8(t){if(UC[t])return UC[t];for(const[e,n]of Object.entries(UC))if(t.startsWith(e))return n;return b8}function u2(t){if(Q3[t])return Q3[t];if(t.includes("/")){const e=t.split("/")[0];if(Q3[e])return Q3[e]}return b8}function AG(t){return JD[t]?JD[t]:b8}function S8(t){return t.replace(/_step_\d+$/,"").replace(/_/g," ")}function NG(t,e,n,r){const i=t.replace(/_/g," ").split(" ").map(a=>a.charAt(0).toUpperCase()+a.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 fm(){return ps({queryKey:["runs"],queryFn:async()=>{const t=await fetch(`${Ar}/runs`);if(!t.ok)throw new Error("Failed to fetch runs");return t.json()},refetchInterval:t=>{var n,r;return((r=(n=t.state.data)==null?void 0:n.discovery)==null?void 0:r.status)==="discovering"?1500:_o}})}function sue(t=!0){return ps({queryKey:["removed-runs"],queryFn:async()=>{const e=await fetch(`${Ar}/removed-runs`);if(!e.ok)throw new Error("Failed to fetch removed runs");return e.json()},enabled:t})}function aue(t=!0){return ps({queryKey:["known-projects"],queryFn:async()=>{const e=await fetch(`${Ar}/known-projects`);if(!e.ok)throw new Error("Failed to fetch known projects");return e.json()},enabled:t})}function oue(t,e,n,r){return ps({queryKey:["rollouts",t,e],queryFn:async()=>{const i=await fetch(`${Ar}/rollouts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e})});if(!i.ok)throw new Error("Failed to fetch rollouts");return i.json()},enabled:n&&!!t,refetchInterval:_o})}function lue(t,e,n,r){return ps({queryKey:["rollouts-discarded",t,e],queryFn:async()=>{const i=await fetch(`${Ar}/rollouts-discarded`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,trainer_step:e})});if(!i.ok)throw new Error("Failed to fetch discarded rollouts");return i.json()},enabled:n&&!!t,refetchInterval:_o})}function cue(t,e,n,r,i){return ps({queryKey:["evals",t,e,n],queryFn:async()=>{const s=await fetch(`${Ar}/evals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e,eval_name:n})});if(!s.ok)throw new Error("Failed to fetch evals");return s.json()},enabled:r&&!!t,refetchInterval:_o})}function RG(t,e,n,r,i){return ps({queryKey:["sample-details",t,e,n,i??!1],queryFn:async()=>{const s=await fetch(`${Ar}/sample-details`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,group_id:e,sample_idx:n,is_eval:i??!1})});if(!s.ok)throw new Error("Failed to fetch sample details");return s.json()},enabled:r&&!!t&&e!=null&&n!=null})}function w8(t,e,n){const r=T.useMemo(()=>{const s=new Set,a=[];for(const o of e){const l=`${o.group_id}:${o.sample_idx}`;s.has(l)||(s.add(l),a.push(o))}return a.sort((o,l)=>o.group_id-l.group_id||o.sample_idx-l.sample_idx)},[e]),i=T.useMemo(()=>r.map(s=>`${s.group_id}:${s.sample_idx}`).join("|"),[r]);return ps({queryKey:["sample-statuses",t,i],queryFn:async()=>{const s=await fetch(`${Ar}/sample-statuses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,samples:r})});if(!s.ok)throw new Error("Failed to fetch sample statuses");return s.json()},enabled:n&&!!t&&r.length>0})}function ed(t,e,n){return ps({queryKey:["run-summary",t],queryFn:async()=>{const r=await fetch(`${Ar}/run-summary/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch run summary");return r.json()},enabled:e&&!!t,refetchInterval:n?_o:!1})}function eI(t,e){return ps({queryKey:["run-code-tree",t],queryFn:async()=>{const n=await fetch(`${Ar}/run-code/tree/${encodeURIComponent(t)}`);if(!n.ok)throw new Error("Failed to fetch run code tree");return n.json()},enabled:e&&!!t,staleTime:6e4})}function tI(t,e,n){return ps({queryKey:["run-code-file",t,e],queryFn:async()=>{const r=await fetch(`${Ar}/run-code/file/${encodeURIComponent(t)}?file_path=${encodeURIComponent(e)}`);if(!r.ok)throw new Error("Failed to fetch run code file");return r.json()},enabled:n&&!!t&&!!e,staleTime:6e4,placeholderData:Xd})}function uue(t,e,n){return ps({queryKey:["run-code-diff-summary",t,e],queryFn:async()=>{const r=await fetch(`${Ar}/run-code/diff-summary/${encodeURIComponent(t)}?right_run_path=${encodeURIComponent(e)}`);if(!r.ok)throw new Error("Failed to fetch run code diff summary");return r.json()},enabled:n&&!!t&&!!e,staleTime:6e4,placeholderData:Xd})}function due(t,e,n,r,i){return ps({queryKey:["timeline-paginated",t,e,n],queryFn:async()=>{const s=await fetch(`${Ar}/events/timeline-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n})});if(!s.ok)throw new Error("Failed to fetch paginated timeline");return s.json()},enabled:r&&!!t,refetchInterval:_o,placeholderData:Xd,gcTime:0})}function fue(t,e,n){return ps({queryKey:["inference-events-by-group",t,e],queryFn:async()=>{const r=await fetch(`${Ar}/events/inference-by-group`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,group_id:e})});if(!r.ok)throw new Error("Failed to fetch inference events by group");return r.json()},enabled:n&&!!t&&e!==null})}function hue(t,e,n,r,i){return ps({queryKey:["trainer-breakdown-events",t,e,n,r],queryFn:async()=>{const s=await fetch(`${Ar}/events/trainer-breakdown`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,parent_event_type:e,rank:n,step:r})});if(!s.ok)throw new Error("Failed to fetch trainer breakdown events");return s.json()},enabled:i&&!!t&&!!e&&n!==null&&r!==null})}function pue(t,e,n,r,i,s,a){const o=n.filter(l=>Number.isFinite(l.rank));return iee({queries:o.map(l=>({queryKey:["gpu-metrics-rank",t,e,l.rank,l.node_id??null,l.local_rank??null,l.source??null,r,i],queryFn:async()=>{const c=await fetch(`${Ar}/system-metrics/gpu`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_names:e,rank:l.rank,node_id:l.node_id??null,local_rank:l.local_rank??null,source:l.source??null,include_associated_system_metrics:!0,include_edge_points:!0,start_time:r,end_time:i,limit:5e4})});if(!c.ok)throw new Error("Failed to fetch rank-scoped GPU metrics");return c.json()},enabled:s&&!!t&&Number.isFinite(l.rank),refetchInterval:_o,placeholderData:Xd}))})}function mue(t,e,n,r,i,s){return ps({queryKey:["gpu-metrics-paginated",t,e,n,r],queryFn:async()=>{const a=await fetch(`${Ar}/system-metrics/gpu-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,align_to_latest:r})});if(!a.ok)throw new Error("Failed to fetch paginated GPU metrics");return a.json()},enabled:i&&!!t,refetchInterval:_o,placeholderData:Xd})}function gue(t,e,n,r,i,s,a,o){return ps({queryKey:["cpu-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Ar}/system-metrics/cpu-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,anchor_start_time:r,align_to_latest:i,metric_names:s})});if(!l.ok)throw new Error("Failed to fetch paginated CPU metrics");return l.json()},enabled:a&&!!t,refetchInterval:_o,placeholderData:Xd})}function vue(t,e,n,r,i,s,a,o){return ps({queryKey:["vllm-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Ar}/vllm-metrics/paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,anchor_start_time:r,align_to_latest:i,metric_names:s})});if(!l.ok)throw new Error("Failed to fetch paginated vLLM metrics");return l.json()},enabled:a&&!!t,refetchInterval:_o,placeholderData:Xd})}function xue(t,e,n,r){const i=hy(),s=T.useRef([]),a=t.join("\0"),o=s.current.join("\0");if(a!==o){const l=s.current;if(l.length>0&&t.length<l.length){const c=new Set(l);if(t.every(h=>c.has(h))){const h=["step-metrics-multi",l,e],g=i.getQueryData(h);if(g){const v=new Set(t),b=["step-metrics-multi",t,e];i.setQueryData(b,{runs:g.runs.filter(_=>v.has(_.run_path))})}}}s.current=t}return ps({queryKey:["step-metrics-multi",t,e],queryFn:async()=>{const l=await fetch(`${Ar}/step-metrics/multi`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_paths:t,metric_names:e,limit:1e5})});if(!l.ok)throw new Error("Failed to fetch step metrics (multi-run)");return l.json()},enabled:n&&t.length>0,refetchInterval:r?_o:!1,staleTime:_o})}function Or(t,e,n){return ps({queryKey:["step-times",t],queryFn:async()=>{const r=await fetch(`${Ar}/step-times`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t})});if(!r.ok)throw new Error("Failed to fetch step times");return r.json()},enabled:e&&!!t,refetchInterval:n?_o:!1})}function kG(t,e,n,r){return ps({queryKey:["step-metric-single",t,e],queryFn:async()=>{const i=await fetch(`${Ar}/step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_names:[e],limit:1e5})});if(!i.ok)throw new Error("Failed to fetch step metric");return i.json()},enabled:n&&!!t&&!!e,refetchInterval:r?_o:!1,placeholderData:Xd})}function yue(t,e,n,r,i,s){return ps({queryKey:["eval-step-metric-single",t,e,n,s??null],queryFn:async()=>{const a={run_path:t,eval_name:e,metric_names:[n],limit:1e5};s!==void 0&&(a.sample_idx=s);const o=await fetch(`${Ar}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error("Failed to fetch eval step metric");return o.json()},enabled:r&&!!t&&!!e&&!!n,refetchInterval:i?_o:!1,placeholderData:Xd})}function bue(t,e,n,r,i){const s=hy(),a=T.useRef([]),o=t.join("\0"),l=a.current.join("\0");if(o!==l){const c=a.current;if(c.length>0&&t.length<c.length){const d=new Set(c);if(t.every(g=>d.has(g))){const g=["eval-step-metrics-multi",c,e,n],v=s.getQueryData(g);if(v){const b=new Set(t),_=["eval-step-metrics-multi",t,e,n];s.setQueryData(_,{runs:v.runs.filter(w=>b.has(w.run_path))})}}}a.current=t}return ps({queryKey:["eval-step-metrics-multi",t,e,n],queryFn:async()=>({runs:await Promise.all(t.map(async d=>{const h=await fetch(`${Ar}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:d,eval_name:e,metric_names:n,limit:1e5})});if(!h.ok)return{run_path:d,metrics:[]};const g=await h.json();return{run_path:d,metrics:g.metrics??[]}}))}),enabled:r&&t.length>0&&!!e&&n.length>0,refetchInterval:i?_o:!1,staleTime:_o})}function _ue(t,e,n,r){return ps({queryKey:["step-histogram",t,e,n],queryFn:async()=>{const i=await fetch(`${Ar}/step-histogram`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e,metric_type:n})});if(!i.ok)throw new Error("Failed to fetch step histogram");return i.json()},enabled:r&&!!t&&e!==null&&!!n,staleTime:6e4,placeholderData:Xd})}function PG(t,e,n,r){return ps({queryKey:["step-distribution-over-time",t,e],queryFn:async()=>{const i=await fetch(`${Ar}/step-distribution-over-time`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_type:e,num_bins:10})});if(!i.ok)throw new Error("Failed to fetch step distribution over time");return i.json()},enabled:n&&!!t&&!!e,refetchInterval:r?_o:!1,staleTime:3e4,placeholderData:Xd})}function DG(){return ps({queryKey:["custom-metrics-layout"],queryFn:async()=>{const t=await fetch(`${Ar}/custom-metrics-layout`);if(!t.ok)throw new Error("Failed to fetch custom metrics layout");return t.json()},staleTime:6e4})}function X0(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 sp(t){return`${t.toFixed(0)}s`}function qu(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 IG(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 mT(t){if(t<60)return`${IG(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 nI(t){const e=`${IG(t)}s`;return t<60?e:`${mT(t)} <span class="text-muted-foreground font-normal">(${e})</span>`}function ev(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 gT(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 V1(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)),a=Math.floor(i/(1e3*60*60)),o=Math.floor(i/(1e3*60*60*24)),l=Math.floor(o/30),c=Math.floor(o/365);return c>=1?`${c}y`:l>=1?`${l}mo`:o>=1?`${o}d`:a>=1?`${a}h`:`${Math.max(1,s)}m`}const d1=16,Sue=6,rI=4,wue=2;function OG(t,e=d1){const n=Math.max(Sue,e);if(!t||t.length<=n)return{prefix:t,suffix:"",isTruncated:!1};const r=Math.max(wue,n-rI);return{prefix:t.slice(0,r),suffix:t.slice(-rI),isTruncated:!0}}function Ki({...t}){return p.jsx(ete,{"data-slot":"collapsible",...t})}function Zi({...t}){return p.jsx(tte,{"data-slot":"collapsible-trigger",...t})}function Qi({...t}){return p.jsx(nte,{"data-slot":"collapsible-content",...t})}function Mue(t,e=0){try{return JSON.stringify(t,(r,i)=>i&&typeof i=="object"&&!Array.isArray(i)?Object.keys(i).sort().reduce((s,a)=>(s[a]=i[a],s),{}):i,e)??String(t)}catch{return String(t)}}function Tue(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 Eue(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"?Mue(t,2):String(t)}function Cue(t){if(typeof t!="string")return t;const e=t.trim();if(!e)return t;const n=e.startsWith("{")&&e.endsWith("}"),r=e.startsWith("[")&&e.endsWith("]");if(!n&&!r)return t;try{const i=JSON.parse(e);if(Array.isArray(i)||i&&typeof i=="object")return i}catch{}return t}function iI(t){const e=t.split("/"),n=e[e.length-1],r=n.replace(/^_+/,"");return(r.length>0?r:n).replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Aue(t){const e=[{key:"general",label:"General",match:l=>l==="debug",order:["debug"]},{key:"model",label:"Model",match:l=>l==="model"||l==="model_dtype"||l==="mixed_precision_dtype",order:["model","model_dtype","mixed_precision_dtype"]},{key:"ray_cluster",label:"Ray Cluster",match:l=>l.startsWith("ray_")&&l!=="ray_torch_memory_drain_interval_seconds",order:["ray_address","ray_auto_start_local","ray_namespace","ray_log_to_driver","ray_disable_runtime_env_hook","ray_pin_py_executable","ray_propagate_active_venv","ray_propagate_run_dir","ray_broadcast_init_timeout_s","ray_broadcast_prefer_loopback_if_single_node","ray_shutdown_on_exit","ray_inference_cpus_per_worker","ray_trainer_cpus_per_worker","ray_inference_placement_strategy","ray_trainer_placement_strategy","ray_placement_timeout_s"]},{key:"workers",label:"Workers",match:l=>["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"].includes(l),order:["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"]},{key:"orchestrator",label:"Orchestrator",match:l=>["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"].includes(l),order:["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"]},{key:"trainer",label:"Trainer",match:l=>["learning_rate","weight_decay","grad_clip","lr_scheduler","warmup_steps","min_lr_ratio","train_backend","fsdp_activation_checkpointing","jit"].includes(l)||l.startsWith("megatron_"),order:["learning_rate","weight_decay","grad_clip","lr_scheduler","warmup_steps","min_lr_ratio","train_backend","fsdp_activation_checkpointing","jit","megatron_tensor_parallel_size","megatron_pipeline_parallel_size","megatron_context_parallel_size","megatron_expert_parallel_size","megatron_disable_unified_memory_jit","megatron_optimizer_cpu_offload","megatron_optimizer_offload_fraction","megatron_overlap_cpu_optimizer_d2h_h2d","megatron_use_precision_aware_optimizer","megatron_main_grads_dtype","megatron_main_params_dtype","megatron_exp_avg_dtype","megatron_exp_avg_sq_dtype"]},{key:"algorithm",label:"Algorithm",match:l=>["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","dr_grpo_loss_agg_mode","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"].includes(l),order:["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","dr_grpo_loss_agg_mode","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"]},{key:"weight_sync",label:"Weight Sync",match:l=>l.startsWith("weight_broadcast_"),order:["weight_broadcast_mode","weight_broadcast_bucket_mb","weight_broadcast_cpu_staging"]},{key:"sequence_packing",label:"Sequence Packing",match:l=>l==="seq_len"||l==="pad_to_multiple_of",order:["seq_len","pad_to_multiple_of"]},{key:"inference",label:"Inference",match:l=>["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"].includes(l),order:["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"]},{key:"rollout",label:"Rollout / Sampling",match:l=>["group_size","temperature","max_tokens","top_p","interleaved_rollouts"].includes(l),order:["group_size","temperature","max_tokens","top_p","interleaved_rollouts"]},{key:"checkpoint",label:"Checkpoint",match:l=>["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"].includes(l),order:["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"]},{key:"logging",label:"Logging",match:l=>l==="use_wandb"||l.startsWith("wandb_")||l==="_wandb"||l.startsWith("event_")||l.endsWith("_interval_seconds")||l==="rollout_block_size"||l==="track_gpu_events",order:["use_wandb","wandb_project","wandb_run_name","wandb_tags","wandb_upload_code","wandb_code_max_file_size_mb","wandb_code_exclude_patterns","system_metrics_collection_interval_seconds","torch_memory_sample_interval_seconds","event_tail_window_seconds","event_block_duration_seconds","event_upload_interval_seconds","metrics_logger_interval_seconds","ray_torch_memory_drain_interval_seconds","rollout_block_size","track_gpu_events"]},{key:"evals",label:"Evals",match:l=>l.startsWith("eval_")||l==="evals",order:["eval_before_training","eval_after_training","eval_num_servers","eval_start_end_use_all_servers","evals"]},{key:"vllm_tracing",label:"vLLM Tracing",match:l=>l==="enable_vllm_tracing"||l==="otlp_receiver_port",order:["enable_vllm_tracing","otlp_receiver_port"]},{key:"environments",label:"Environments",match:l=>l==="environments"},{key:"setup/gpu",label:"GPU",match:l=>l.startsWith("setup/gpu/")},{key:"setup/cpu",label:"CPU",match:l=>l.startsWith("setup/cpu/")},{key:"setup/memory",label:"Memory",match:l=>l.startsWith("setup/memory/")},{key:"setup/disk",label:"Disk",match:l=>l.startsWith("setup/disk/")},{key:"setup/network",label:"Network",match:l=>l.startsWith("setup/network/")},{key:"setup/os",label:"Operating System",match:l=>l.startsWith("setup/os/")},{key:"setup/package_versions",label:"Package Versions",match:l=>l.startsWith("setup/package_versions/")}],n=new Map;for(const l of e)n.set(l.key,{key:l.key,label:l.label,items:[]});for(const[l,c]of Object.entries(t)){const d=Tue(c),h=l==="environments"?Cue(d):d;let g=!1;for(const v of e)if(v.match(l)){n.get(v.key).items.push({key:l,displayKey:iI(l),value:h}),g=!0;break}g||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:iI(l),value:h}))}const r=new Map(e.map(l=>[l.key,l]));for(const[,l]of n){const c=r.get(l.key);if(c!=null&&c.order&&l.items.length>1){const d=new Map(c.order.map((h,g)=>[h,g]));l.items.sort((h,g)=>{const v=d.get(h.key)??1/0,b=d.get(g.key)??1/0;return v!==b?v-b:h.key.localeCompare(g.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"],a=[];for(const l of i){const c=n.get(l);c&&c.items.length>0&&a.push(c)}const o=[];for(const l of s)if(l==="hardware")a.length>0&&o.push({key:"hardware",label:"Hardware & Environment",items:[],subcategories:a});else{const c=n.get(l);c&&c.items.length>0&&o.push(c)}return o}function Nue({displayKey:t,value:e}){const n=Eue(e);return typeof e=="object"&&e!==null?p.jsxs("div",{className:"py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[p.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:t}),p.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})]}):p.jsxs("div",{className:"flex items-baseline gap-2 py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[p.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors whitespace-nowrap",children:t}),p.jsx("span",{className:"text-sm font-sans font-medium break-all",children:n})]})}const Rue="ml-[22px]",kue="ml-[38px]";function LG({category:t,defaultOpen:e=!1,nested:n=!1,collapseAllSignal:r=0,expandAllSignal:i=0}){const[s,a]=T.useState(e),[o,l]=T.useState(r),[c,d]=T.useState(i);r!==o&&(l(r),a(!1)),i!==c&&(d(i),a(!0));const h=t.subcategories&&t.subcategories.length>0;return p.jsxs(Ki,{open:s,onOpenChange:a,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:Rt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",n&&"ml-4"),children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!s&&"-rotate-90")}),p.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),p.jsx(Qi,{children:h?p.jsx("div",{className:"mt-1",children:t.subcategories.map(g=>p.jsx(LG,{category:g,nested:!0,collapseAllSignal:r,expandAllSignal:i},g.key))}):p.jsx("div",{className:Rt("mt-1",n?kue:Rue),children:t.items.map(g=>p.jsx(Nue,{displayKey:g.displayKey,value:g.value},g.key))})})]})}function zG({config:t,collapseAllSignal:e=0,expandAllSignal:n=0}){const r=T.useMemo(()=>Aue(t),[t]),i=new Set(["model","environments"]);return r.length===0?p.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"}):p.jsx("div",{className:"space-y-1",children:r.map(s=>p.jsx(LG,{category:s,defaultOpen:i.has(s.key),collapseAllSignal:e,expandAllSignal:n},s.key))})}const jG="#e67439",Pue="linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",Due=["#865ed6","#f07fdd","#e67439","#87cec0","#dc4cdc","#ffb83e","#5ac5db","#239487","#fab796","#9bc750","#ad6f51","#c2337a","#a2a9ad","#538ae6","#f1444f","#479a60"];function f1(t){return Math.max(0,Math.min(1,t))}function Vg(t){return Math.max(0,Math.min(255,Math.round(t)))}function d2({r:t,g:e,b:n}){const r=i=>i.toString(16).padStart(2,"0");return`#${r(Vg(t))}${r(Vg(e))}${r(Vg(n))}`}function M8(t){const e=t.trim(),n=/^#([0-9a-f]{3})$/i.exec(e);if(n){const[i,s,a]=n[1].split("");return{r:Number.parseInt(i+i,16),g:Number.parseInt(s+s,16),b:Number.parseInt(a+a,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 Iue({r:t,g:e,b:n}){const r=t/255,i=e/255,s=n/255,a=Math.max(r,i,s),o=Math.min(r,i,s),l=a-o;let c=0;return l!==0&&(a===r?c=60*((i-s)/l%6):a===i?c=60*((s-r)/l+2):c=60*((r-i)/l+4)),c<0&&(c+=360),{h:c,s:a===0?0:l/a,v:a}}function Oue({h:t,s:e,v:n}){const r=(t%360+360)%360,i=f1(e),s=f1(n),a=s*i,o=a*(1-Math.abs(r/60%2-1)),l=s-a;let c=0,d=0,h=0;return r<60?(c=a,d=o):r<120?(c=o,d=a):r<180?(d=a,h=o):r<240?(d=o,h=a):r<300?(c=o,h=a):(c=a,h=o),{r:Vg((c+l)*255),g:Vg((d+l)*255),b:Vg((h+l)*255)}}function Lue(t,e){const n=M8(t);if(!n)return"#000000";const r=f1(1-e);return d2({r:n.r*r,g:n.g*r,b:n.b*r})}function S_(t,e=jG){const n=M8(t);return n?d2(n):e}function zue({value:t,onChange:e,className:n}){const r=T.useMemo(()=>S_(t,jG),[t]),i=T.useMemo(()=>M8(r),[r]),s=T.useMemo(()=>Iue(i),[i]),[a,o]=T.useState(r.slice(1).toUpperCase());T.useEffect(()=>{o(r.slice(1).toUpperCase())},[r]);const l=T.useCallback(v=>{const b=d2(Oue(v));e(b)},[e]),c=T.useCallback(v=>{const b=v.currentTarget.getBoundingClientRect(),_=f1((v.clientX-b.left)/b.width),w=f1((v.clientY-b.top)/b.height);l({h:s.h,s:_,v:1-w})},[s.h,l]),d=T.useCallback(v=>{const b=v.currentTarget.getBoundingClientRect(),_=f1((v.clientX-b.left)/b.width);l({h:_*360,s:s.s,v:s.v})},[s.s,s.v,l]),h=T.useCallback(()=>{const b=`#${a.replace(/[^0-9a-f]/gi,"")}`,_=S_(b,r);o(_.slice(1).toUpperCase()),_!==r&&e(_)},[a,r,e]),g=T.useCallback((v,b)=>{const _=Number.parseInt(b,10);if(Number.isNaN(_))return;const w={...i,[v]:Vg(_)};e(d2(w))},[e,i]);return p.jsxs("div",{className:Rt("w-[196px] space-y-1.5 text-[10px]",n),children:[p.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:v=>{v.preventDefault(),v.currentTarget.setPointerCapture(v.pointerId),c(v)},onPointerMove:v=>{v.currentTarget.hasPointerCapture(v.pointerId)&&c(v)},onPointerUp:v=>{v.currentTarget.hasPointerCapture(v.pointerId)&&v.currentTarget.releasePointerCapture(v.pointerId)},children:[p.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white to-transparent"}),p.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black to-transparent"}),p.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}%`}})]}),p.jsx("div",{className:"relative h-2 w-full cursor-ew-resize rounded-md border border-border touch-none select-none",style:{background:Pue},onPointerDown:v=>{v.preventDefault(),v.currentTarget.setPointerCapture(v.pointerId),d(v)},onPointerMove:v=>{v.currentTarget.hasPointerCapture(v.pointerId)&&d(v)},onPointerUp:v=>{v.currentTarget.hasPointerCapture(v.pointerId)&&v.currentTarget.releasePointerCapture(v.pointerId)},children:p.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)`}})}),p.jsxs("div",{className:"grid grid-cols-[1fr_48px] items-end gap-1",children:[p.jsxs("div",{className:"space-y-0.5",children:[p.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:"Hex"}),p.jsx(V0,{value:a,onChange:v=>{o(v.target.value.replace(/[^0-9a-f]/gi,"").slice(0,6).toUpperCase())},onBlur:h,onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h())},className:"h-6 px-1.5 font-sans !text-[11px] md:!text-[11px] uppercase","aria-label":"Hex color"})]}),p.jsx("div",{className:"h-6 rounded-md border border-border",style:{backgroundColor:r},"aria-label":"Selected color preview"})]}),p.jsx("div",{className:"grid grid-cols-3 gap-1",children:[["R",i.r,"r"],["G",i.g,"g"],["B",i.b,"b"]].map(([v,b,_])=>p.jsxs("div",{className:"space-y-0.5",children:[p.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:v}),p.jsx(V0,{type:"number",min:0,max:255,value:b,onChange:w=>g(_,w.target.value),className:"h-6 px-1.5 !text-[11px] md:!text-[11px]","aria-label":`${v} channel`})]},v))}),p.jsx("div",{className:"grid grid-cols-8 gap-x-0.5 gap-y-1.5 pt-0.5",children:Due.map(v=>p.jsx("button",{type:"button",className:Rt("h-4 w-4 rounded-[3px] border transition",r===v?"ring-1 ring-foreground/70 ring-offset-0":"hover:brightness-[0.97]"),style:{backgroundColor:v,borderColor:Lue(v,.2)},onClick:()=>e(v),"aria-label":`Use color ${v}`},v))})]})}const FG=[{key:"pausing_syncs",label:"Pausing syncs"},{key:"exporting",label:"Exporting database"},{key:"importing",label:"Compressing data"},{key:"finalizing",label:"Finalizing"}],jue=FG.map(t=>t.key);function Fue(t){return jue.indexOf(t)}function HC(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 Uue({open:t,onOpenChange:e}){const[n,r]=T.useState(null),[i,s]=T.useState(!1),[a,o]=T.useState(null),l=T.useRef(null),c=a!=null&&a.status!=="idle"&&a.status!=="done"&&a.status!=="error",d=T.useCallback(async()=>{s(!0);try{const S=await fetch(`${Ar}/database-info`);if(S.ok){const E=await S.json();r(E.size_bytes)}}catch{}finally{s(!1)}},[]);T.useEffect(()=>(t&&(d(),o(null)),()=>{l.current&&clearInterval(l.current),l.current=null}),[t,d]);const h=async()=>{try{const S=await fetch(`${Ar}/compact-database`,{method:"POST"});if(!S.ok){const E=await S.json().catch(()=>({}));o({status:"error",error:E.detail||"Failed to start compaction",size_before:null,size_after:null});return}o({status:"pausing_syncs",error:null,size_before:null,size_after:null}),l.current=setInterval(async()=>{try{const E=await fetch(`${Ar}/compact-database/status`);if(E.ok){const A=await E.json();o(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(S){o({status:"error",error:S instanceof Error?S.message:"Unknown error",size_before:null,size_after:null})}},g=S=>{c&&!S||e(S)},v=a?Fue(a.status):-1,b=(a==null?void 0:a.status)==="done",_=(a==null?void 0:a.status)==="error",w=a!=null&&a.status!=="idle";return p.jsx($f,{open:t,onOpenChange:g,children:p.jsxs(qf,{className:Rt("sm:max-w-md",c&&"[&>[data-slot=dialog-close]]:hidden"),onInteractOutside:S=>{c&&S.preventDefault()},onEscapeKeyDown:S=>{c&&S.preventDefault()},children:[p.jsxs(jd,{children:[p.jsxs(Fd,{className:"flex items-center gap-2",children:[p.jsx(Ple,{className:"h-4 w-4"}),"Database"]}),!w&&p.jsx(Ng,{children:"Manage your local database storage."})]}),!w&&p.jsxs("div",{className:"space-y-4 py-2",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"Database size"}),p.jsx("span",{className:"text-sm font-medium",children:i?p.jsx(ll,{className:"h-3.5 w-3.5"}):n!=null?HC(n):"—"})]}),p.jsx("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:p.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."})})]}),w&&p.jsxs("div",{className:"space-y-3 py-2",children:[FG.map((S,E)=>{const A=S.key===a.status,N=b||v>E||_&&v>E,I=_&&S.key===a.status;return p.jsxs("div",{className:"flex items-center gap-2.5",children:[N?p.jsx(Cle,{className:"h-4 w-4 text-green-500 shrink-0"}):I?p.jsx(Nle,{className:"h-4 w-4 text-destructive shrink-0"}):A?p.jsx(ll,{className:"h-4 w-4 text-primary shrink-0"}):p.jsx("div",{className:"h-4 w-4 rounded-full border border-border shrink-0"}),p.jsxs("span",{className:Rt("text-sm",N&&"text-muted-foreground",A&&!_&&"text-foreground font-medium",I&&"text-destructive font-medium",!N&&!A&&!I&&"text-muted-foreground/60"),children:[S.label,A&&!b&&!_&&"…"]})]},S.key)}),c&&p.jsx("p",{className:"text-xs text-muted-foreground pt-1",children:"Do not close the application while compressing."}),b&&a.size_before!=null&&a.size_after!=null&&p.jsx("div",{className:"rounded-md border border-green-500/20 bg-green-500/5 p-3 mt-2",children:p.jsxs("p",{className:"text-sm text-foreground",children:[p.jsx("span",{className:"font-medium",children:HC(a.size_before)})," → ",p.jsx("span",{className:"font-medium text-green-600 dark:text-green-400",children:HC(a.size_after)}),p.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",Math.round((1-a.size_after/a.size_before)*100),"% reduction)"]})]})}),_&&a.error&&p.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/5 p-3 mt-2",children:[p.jsx("p",{className:"text-sm text-destructive",children:a.error}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The original database has been restored."})]})]}),p.jsxs(m8,{children:[!w&&p.jsx(Tn,{onClick:h,disabled:i||n==null,children:"Compress Database"}),(b||_)&&p.jsx(Tn,{onClick:()=>e(!1),children:"Close"})]})]})})}function J3({name:t,className:e,maxChars:n=d1}){const r=e??"text-xs font-sans",{isTruncated:i,prefix:s,suffix:a}=OG(t,n);return i?p.jsxs(mv,{delayDuration:300,children:[p.jsx(gv,{asChild:!0,children:p.jsxs("span",{className:Rt("flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",r),children:[p.jsx("span",{className:"shrink-0",children:s}),p.jsxs("span",{className:"relative shrink-0 inline-flex items-center px-0.5 text-muted-foreground/50",style:{backgroundColor:"var(--run-item-bg)"},children:[p.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"}),"..."]}),p.jsx("span",{className:"shrink-0",children:a})]})}),p.jsx(vv,{side:"top",className:"max-w-56 break-all text-xs font-sans",children:t})]}):p.jsx("span",{className:Rt("truncate",r),children:s})}function Bue(){const{pathname:t}=ch(),e=hy(),[n,r]=cn(ml),[i,s]=cn(cT),[a,o]=cn(fG),[l,c]=cn(hG),d=zd(fT),h=zd(vG),[g,v]=T.useState(!1),[b,_]=cn(pG),[w,S]=T.useState(""),[E,A]=T.useState(!1),[N,I]=T.useState(null),[P,L]=T.useState(null),[R,O]=T.useState(!1),[W,U]=T.useState(""),[V,G]=T.useState(!1),[Z,B]=T.useState(!1),[q,Y]=T.useState(null),[K,J]=T.useState(null),[F,j]=T.useState("removed_at"),[X,H]=T.useState("desc"),[se,re]=T.useState(null),[ie,ue]=T.useState(null),[le,fe]=T.useState(null),[xe,he]=T.useState(null),[Te,We]=T.useState(!1),[Se,Le]=T.useState(""),[pe,Re]=T.useState(null),[ne,Xe]=T.useState(!1),[Ae,Pe]=T.useState(null),[Ke,oe]=T.useState({}),te=zd(gG),_e=zd(mG),{data:ve,isLoading:ye}=fm(),{data:ke,isLoading:Be}=sue(g),{data:ge,refetch:Ye}=aue(b),Qe=T.useRef(new Map);T.useEffect(()=>{if(!(ve!=null&&ve.runs))return;const Ve=Qe.current,wt=[];for(const Et of ve.runs){const zt=Ve.get(Et.run_id);zt!=null&&zt.is_syncing&&!Et.is_syncing&&wt.push(Et.run_id),zt!=null&&zt.is_tracking&&!Et.is_tracking&&wt.push(Et.run_id),Ve.set(Et.run_id,{is_syncing:Et.is_syncing,is_tracking:Et.is_tracking})}if(wt.length>0){const Et=[...new Set(wt)];for(const zt of Et)e.invalidateQueries({predicate:Ht=>{const an=Ht.queryKey;return Array.isArray(an)?an.some(Dn=>!!(Dn===zt||Array.isArray(Dn)&&Dn.includes(zt))):!1}});e.invalidateQueries({queryKey:["runs"]})}},[ve==null?void 0:ve.runs,e]),T.useEffect(()=>{if(!(ve!=null&&ve.runs)||!n)return;const Ve=ve.runs.find(wt=>wt.run_id===n);Ve&&(te(Ve.is_syncing),_e(Ve.is_tracking))},[ve==null?void 0:ve.runs,n,te,_e]),T.useEffect(()=>{t!=="/"&&h(!1)},[t,h]),T.useEffect(()=>{if(!(ve!=null&&ve.runs))return;const Ve=new Set(ve.runs.map(wt=>wt.run_id));s(wt=>{const Et=wt.filter(zt=>Ve.has(zt));return Et.length===wt.length?wt:Et}),n&&!Ve.has(n)&&(r(null),te(!1),_e(!1))},[ve==null?void 0:ve.runs,n,r,s,te,_e]);const Ie=T.useMemo(()=>{const Ve=(ke==null?void 0:ke.runs)??[];return Ve.length===0?Ve:[...Ve].sort((wt,Et)=>{const zt=F;let Ht,an;if(zt==="run_id"?(Ht=wt.run_id.split("/").pop()??wt.run_id,an=Et.run_id.split("/").pop()??Et.run_id):(Ht=wt[zt],an=Et[zt]),Ht==null&&an==null)return 0;if(Ht==null)return 1;if(an==null)return-1;const Dn=Ht.localeCompare(an);return X==="asc"?Dn:-Dn})},[ke==null?void 0:ke.runs,F,X]),Fe=Ve=>{F===Ve?H(wt=>wt==="asc"?"desc":"asc"):(j(Ve),H("asc"))},Ge=async Ve=>{Ve.preventDefault();const wt=V?{use_netrc:!0}:{api_key:W.trim(),use_netrc:!1};if(!(!V&&!W.trim())){B(!0);try{const Et=await fetch(`${Ar}/wandb-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(wt)});if(!Et.ok){const zt=await Et.json();throw new Error(zt.detail||"Failed to configure W&B")}o(!0),e.invalidateQueries({queryKey:["runs"]}),c(!1),U("")}catch(Et){console.error("Failed to configure W&B:",Et)}finally{B(!1)}}},Me=Ve=>{v(!1),r(Ve),fetch(`${Ar}/add-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ve})}).then(wt=>{if(!wt.ok)return wt.json().then(Et=>{throw new Error(Et.detail||"Failed to add run")})}).then(()=>{e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}).catch(wt=>{console.error("Failed to add run:",wt)})},$e=async()=>{const Ve=w.trim();if(Ve){A(!0),I(null);try{const wt=await fetch(`${Ar}/add-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Ve})});if(!wt.ok){const Et=await wt.json();I(Et.detail||"Failed to add project");return}S(""),_(!1),Ye(),e.invalidateQueries({queryKey:["runs"]})}catch{I("Failed to add project")}finally{A(!1)}}},dt=async Ve=>{L(Ve);try{const wt=await fetch(`${Ar}/remove-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Ve})});if(!wt.ok){const Et=await wt.json();throw new Error(Et.detail||"Failed to remove project")}Ye()}catch(wt){console.error("Failed to remove project:",wt)}finally{L(null)}},Oe=async Ve=>{if(Ve){Y(Ve);try{const wt=await fetch(`${Ar}/remove-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ve})});if(!wt.ok){const Et=await wt.json();throw new Error(Et.detail||"Failed to remove run")}s(Et=>Et.filter(zt=>zt!==Ve)),n===Ve&&r(null),e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}catch(wt){console.error("Failed to remove run:",wt)}finally{Y(null),J(null)}}},st=Ve=>{s(wt=>wt.includes(Ve)?wt.filter(Et=>Et!==Ve):[...wt,Ve])},ft=T.useCallback((Ve,wt)=>{e.setQueryData(["runs"],Et=>Et&&{...Et,runs:Et.runs.map(zt=>zt.run_id===Ve?{...zt,color:wt}:zt)})},[e]),pt=T.useCallback(async(Ve,wt,Et)=>{const zt=S_(wt,Et);if(zt.toLowerCase()!==Et.toLowerCase()){ft(Ve,zt);try{const Ht=await fetch(`${Ar}/set-run-color`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ve,color:zt})});if(!Ht.ok){let an="Failed to update run color";try{an=(await Ht.json()).detail??an}catch{}throw new Error(an)}}catch(Ht){console.error("Failed to update run color:",Ht),ft(Ve,Et)}finally{e.invalidateQueries({queryKey:["runs"]})}}},[e,ft]),et=T.useCallback((Ve,wt,Et)=>{if(wt){Pe(Ve),oe(Ht=>Ht[Ve]===Et?Ht:{...Ht,[Ve]:Et});return}Pe(Ht=>Ht===Ve?null:Ht);const zt=Ke[Ve];zt&&pt(Ve,zt,Et),oe(Ht=>{if(!(Ve in Ht))return Ht;const an={...Ht};return delete an[Ve],an})},[pt,Ke]),Ze=T.useCallback(async Ve=>{fe(Ve);try{const wt=ve==null?void 0:ve.runs.find(zt=>zt.run_id===Ve);wt!=null&&wt.is_tracking&&await fetch(`${Ar}/stop-tracking`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ve})});const Et=await fetch(`${Ar}/delete-run-data`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ve})});if(!Et.ok){const zt=await Et.json();throw new Error(zt.detail||"Failed to delete run data")}await fetch(`${Ar}/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ve})}),e.invalidateQueries({queryKey:["run-summary",Ve]}),e.invalidateQueries({queryKey:["runs"]})}catch(wt){console.error("Failed to force full resync:",wt)}finally{fe(null),ue(null)}},[ve==null?void 0:ve.runs,e]),me=T.useCallback(async Ve=>{he(Ve);try{const wt=await fetch(`${Ar}/sync-evals-after-training`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ve})});if(!wt.ok){const Et=await wt.json();throw new Error(Et.detail||"Failed to start evals sync")}e.invalidateQueries({queryKey:["run-summary",Ve]}),e.invalidateQueries({queryKey:["runs"]})}catch(wt){console.error("Failed to sync evals after training:",wt)}finally{he(null)}},[e]),je=Se.trimStart().toLowerCase().startsWith("config:"),He=T.useCallback(async()=>{const wt=Se.trimStart().slice(7).trim();if(wt){Xe(!0);try{const Et=await fetch(`${Ar}/search-runs-by-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:wt})});if(!Et.ok){Re([]);return}const zt=await Et.json();Re(zt.run_ids??[])}catch{Re([])}finally{Xe(!1)}}},[Se]);T.useEffect(()=>{je||Re(null)},[je]);const nt=(ve==null?void 0:ve.runs)||[],yt=ve==null?void 0:ve.discovery,lt=(ve==null?void 0:ve.has_wandb_key)??a,bt=(ve==null?void 0:ve.has_netrc_wandb_key)??!1,Nt=(ve==null?void 0:ve.wandb_key_source)??"unconfigured";T.useEffect(()=>{l&&G(Nt==="netrc")},[l,Nt]);const Pt=[{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 p.jsxs(p.Fragment,{children:[p.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:[p.jsx("div",{className:"py-2.5 px-4 border-b border-sidebar-border shrink-0",children:p.jsx(qM,{to:"/about",className:"flex items-center h-7 hover:opacity-80 transition-opacity",children:p.jsx("img",{src:"/logo-full.svg",alt:"Telescope",className:"h-5"})})}),p.jsx("nav",{className:"flex flex-col gap-1 p-2 border-b border-sidebar-border shrink-0",children:Pt.map(Ve=>p.jsx(qM,{to:Ve.href,onClick:()=>{Ve.href==="/"&&h(!1)},className:Rt("rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",Ve.isActive&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),children:Ve.title},Ve.href))}),p.jsxs("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsxs("div",{className:"px-2 py-2 shrink-0 flex items-center gap-1",children:[p.jsxs("div",{className:"relative flex-1 min-w-0",children:[p.jsx(V0,{type:"text",placeholder:"Search runs…",value:Se,onChange:Ve=>Le(Ve.target.value),onKeyDown:Ve=>{Ve.key==="Enter"&&je&&(Ve.preventDefault(),He())},className:Rt("h-6 text-[11px] w-full placeholder:text-muted-foreground/60 placeholder:text-[10px]",je&&"pr-10")}),je&&p.jsx(Tn,{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:He,disabled:ne,children:ne?p.jsx(ll,{className:"h-2.5 w-2.5"}):"Go"})]}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-foreground",children:p.jsx(jN,{className:"h-3.5 w-3.5"})})}),p.jsxs(pl,{align:"end",className:"w-48",children:[p.jsx(_c,{className:"text-xs",onClick:()=>_(!0),children:"Add Project"}),p.jsx(_c,{className:"text-xs",onClick:()=>v(!0),children:"Add Run"}),p.jsxs(_c,{className:"text-xs",onClick:()=>c(!0),children:["W&B Key"," ",lt?p.jsx("span",{className:"!text-green-500 ml-1",children:"added"}):p.jsx("span",{className:"!text-red-500 ml-1",children:"missing"})]}),p.jsx(Hl,{}),p.jsx(_c,{className:"text-xs",onClick:()=>{s([]),r(null)},children:"Unselect All"}),p.jsxs(_c,{className:"text-xs flex items-center justify-between",onClick:()=>We(Ve=>!Ve),children:["Only Show Selected",p.jsx(xv,{className:Rt("h-3.5 w-3.5",Te?"opacity-100":"opacity-0")})]}),p.jsx(Hl,{}),p.jsx(_c,{className:"text-xs flex items-center gap-1.5",onClick:()=>O(!0),children:"Database"})]})]})]}),(yt==null?void 0:yt.status)==="discovering"?p.jsx("div",{className:"px-4 pb-2 shrink-0",children:p.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-muted/50 px-2.5 py-2",children:[p.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Fetching runs from W&B…"}),p.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[p.jsx(ll,{className:"h-3 w-3 shrink-0"}),(yt==null?void 0:yt.runs_found)??0," found"]}),p.jsx("span",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Looking for telescope-tagged runs…"})]})}):null,p.jsx(yv,{className:"flex-1 min-h-0 overflow-hidden",children:p.jsx("div",{className:"px-2 pb-2",children:ye?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(ll,{className:"h-4 w-4"})}):p.jsxs("div",{className:"flex flex-col",children:[nt.filter(Ve=>{if(Te&&n!==Ve.run_id&&!i.includes(Ve.run_id))return!1;if(je){if(pe!==null&&!pe.includes(Ve.run_id))return!1}else if(Se.trim()){const wt=Se.trim().toLowerCase(),Et=(Ve.name||"").toLowerCase(),zt=Ve.run_id.toLowerCase();if(!Et.includes(wt)&&!zt.includes(wt))return!1}return!0}).map(Ve=>{const wt=n===Ve.run_id,Et=wt||i.includes(Ve.run_id),zt=Ke[Ve.run_id],Ht=S_(zt??Ve.color,Ve.color),an=Ve.last_rollout_step===-1&&!Ve.is_syncing&&!Ve.is_tracking,Dn=Number(Ve.is_tracking)+Number(Ve.is_syncing),Vt=Dn>=2?d1-4:Dn===1?d1-2:d1-1,pn=Ve.name||Ve.run_id.split("/").pop()||Ve.run_id;return p.jsxs("div",{className:Rt("group flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors w-full cursor-pointer",!wt&&"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [--run-item-bg:var(--sidebar)] hover:[--run-item-bg:var(--sidebar-accent)]",wt&&"bg-[var(--sidebar-selected)] text-sidebar-accent-foreground [--run-item-bg:var(--sidebar-selected)]"),onClick:()=>r(Ve.run_id),onMouseEnter:()=>{Et&&d(Ve.run_id)},onMouseLeave:()=>d(null),children:[p.jsx("button",{onClick:Bt=>{Bt.stopPropagation(),wt||st(Ve.run_id)},disabled:wt,className:Rt("w-3 h-3 rounded-sm border shrink-0 flex items-center justify-center transition-colors",Et?"bg-foreground border-foreground":"border-muted-foreground/50",wt&&"opacity-50 cursor-not-allowed"),children:Et&&p.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",className:"text-background",children:p.jsx("path",{d:"M1 4L3 6L7 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),p.jsxs(aT,{open:Ae===Ve.run_id,onOpenChange:Bt=>et(Ve.run_id,Bt,Ve.color),children:[p.jsx(oT,{asChild:!0,children:p.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:Ht},onClick:Bt=>Bt.stopPropagation(),"aria-label":`Change color for ${pn}`})}),p.jsx(lT,{side:"right",align:"start",className:"w-auto p-1.5",onClick:Bt=>Bt.stopPropagation(),onOpenAutoFocus:Bt=>Bt.preventDefault(),children:p.jsx(zue,{value:Ht,onChange:Bt=>{oe(Cn=>({...Cn,[Ve.run_id]:S_(Bt,Ve.color)}))}})})]}),p.jsx("div",{className:Rt("flex-1 min-w-0 text-left",an&&"text-muted-foreground/60"),children:p.jsx(J3,{name:pn,maxChars:Vt})}),Ve.is_tracking&&p.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0",title:"Live"}),Ve.is_syncing&&p.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),p.jsxs("div",{className:"ml-auto relative h-6 w-6 flex items-center justify-center",children:[p.jsx("span",{className:"absolute text-[10px] text-muted-foreground transition-opacity group-hover:opacity-0",children:V1(Ve.created_at)}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx(Tn,{variant:"ghost",size:"icon",className:"absolute h-6 w-6 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-transparent",disabled:q===Ve.run_id,onClick:Bt=>Bt.stopPropagation(),children:p.jsx(jN,{className:"h-3.5 w-3.5"})})}),p.jsxs(pl,{align:"end",className:"w-auto",children:[p.jsx(eS,{className:"text-xs font-normal",children:p.jsx("span",{className:"font-sans",children:Ve.run_id})}),p.jsx(Hl,{}),p.jsx(_c,{disabled:le===Ve.run_id,onClick:Bt=>{Bt.stopPropagation(),ue(Ve.run_id)},children:le===Ve.run_id?"Resyncing...":"Force Full Resync"}),p.jsx(_c,{disabled:xe===Ve.run_id,onClick:Bt=>{Bt.stopPropagation(),me(Ve.run_id)},children:xe===Ve.run_id?"Syncing evals...":"Sync Evals After Training"}),p.jsx(_c,{className:"text-destructive",disabled:q===Ve.run_id,onClick:Bt=>{Bt.stopPropagation(),J(Ve.run_id)},children:"Remove"})]})]})]})]},Ve.run_id)}),nt.length===0&&p.jsx("div",{className:"text-center py-4 px-2",children:lt?p.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"}):p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs text-muted-foreground",children:"No wandb key added yet"}),p.jsx(Tn,{size:"sm",className:"h-6 px-2 text-[11px] bg-green-600 hover:bg-green-700",onClick:()=>c(!0),children:"Add wandb key"})]})})]})})})]})]}),p.jsx($f,{open:l,onOpenChange:c,children:p.jsxs(qf,{className:"sm:max-w-md",children:[p.jsxs(jd,{children:[p.jsx(Fd,{children:"Configure W&B"}),p.jsx(Ng,{children:V?p.jsxs(p.Fragment,{children:["Use the API key saved by"," ",p.jsx("span",{className:"font-sans",children:"wandb login"})," to fetch all runs tagged ",p.jsx("span",{className:"font-sans",children:"telescope"}),"."]}):p.jsxs(p.Fragment,{children:["Paste your W&B API key to fetch all runs tagged"," ",p.jsx("span",{className:"font-sans",children:"telescope"}),"."]})})]}),p.jsxs("form",{onSubmit:Ge,children:[p.jsxs("div",{className:"space-y-4 py-4",children:[p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:V,onChange:Ve=>G(Ve.target.checked),className:"accent-primary h-3.5 w-3.5"}),p.jsxs("span",{className:"text-sm",children:["Use key from"," ",p.jsx("span",{className:"font-sans text-xs",children:"wandb login"})]}),V&&!bt&&p.jsxs("span",{className:"text-[11px] text-red-500 font-medium",children:["Not found — run"," ",p.jsx("code",{className:"text-[10px]",children:"wandb login"})]}),V&&bt&&p.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Found"})]}),!V&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(lce,{htmlFor:"config-api-key",children:"W&B API Key"}),lt&&Nt==="custom"?p.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Key added"}):p.jsx("span",{className:"text-[11px] text-red-500 font-medium",children:"No key configured"})]}),p.jsx(V0,{id:"config-api-key",type:"password",placeholder:"Enter API key",value:W,onChange:Ve=>U(Ve.target.value),required:!0})]})]}),p.jsxs(m8,{children:[p.jsx(Tn,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),p.jsx(Tn,{type:"submit",disabled:Z||(V?!bt:!W.trim()),children:Z?p.jsxs(p.Fragment,{children:[p.jsx(ll,{className:"mr-2 h-4 w-4"}),"Saving..."]}):"Ok"})]})]})]})}),p.jsx($f,{open:g,onOpenChange:v,children:p.jsxs(qf,{className:"sm:max-w-3xl !grid-rows-[auto_1fr] !gap-0 max-h-[80vh] overflow-hidden",onOpenAutoFocus:Ve=>{Ve.preventDefault();const wt=Ve.currentTarget;wt==null||wt.focus()},children:[p.jsxs(jd,{className:"pb-3",children:[p.jsx(Fd,{children:"Add Run"}),p.jsx(Ng,{children:"Select a removed run to add it back. Uses the stored W&B API key."})]}),p.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[p.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:[p.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(Ve=>p.jsxs("button",{className:Rt("flex items-center gap-0.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors whitespace-nowrap select-none",Ve.cls),onClick:()=>Fe(Ve.key),children:[Ve.label,F===Ve.key&&(X==="asc"?p.jsx(gle,{className:"h-2.5 w-2.5"}):p.jsx(dle,{className:"h-2.5 w-2.5"}))]},Ve.key)),p.jsx("span",{className:"text-[10px] font-medium text-muted-foreground text-center",children:"Config"})]}),p.jsx("div",{className:"py-1",children:Be?p.jsx("div",{className:"flex items-center justify-center py-6",children:p.jsx(ll,{className:"h-4 w-4"})}):p.jsxs(p.Fragment,{children:[Ie.map(Ve=>{const wt=Ve.run_id.split("/").pop()??Ve.run_id;return p.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:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-full cursor-pointer",style:{backgroundColor:Ve.color??"#888"},onClick:()=>Me(Ve.run_id)}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Me(Ve.run_id),children:p.jsx(J3,{name:Ve.name??"Unnamed"})}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Me(Ve.run_id),children:p.jsx(J3,{name:Ve.entity??"—",className:"text-xs font-sans text-muted-foreground"})}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Me(Ve.run_id),children:p.jsx(J3,{name:Ve.project??"—",className:"text-xs font-sans text-muted-foreground"})}),p.jsx("span",{className:"text-xs font-sans text-muted-foreground truncate cursor-pointer",onClick:()=>Me(Ve.run_id),children:wt}),p.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap cursor-pointer",onClick:()=>Me(Ve.run_id),children:Ve.created_at?new Date(Ve.created_at).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"}):"—"}),p.jsx("span",{className:"text-[10px] text-red-400 whitespace-nowrap text-center cursor-pointer",onClick:()=>Me(Ve.run_id),children:Ve.removed_at?V1(Ve.removed_at):"—"}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:Et=>{Et.stopPropagation(),re(Ve)},disabled:!Ve.config,children:"View"})]},Ve.run_id)}),Ie.length===0&&p.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No removed runs"})]})})]})]})}),p.jsx($f,{open:b,onOpenChange:_,children:p.jsxs(qf,{className:"sm:max-w-lg max-h-[70vh] !grid-rows-[auto_1fr] !gap-0 overflow-hidden",children:[p.jsxs(jd,{className:"pb-3",children:[p.jsx(Fd,{children:"Known Projects"}),p.jsx(Ng,{children:"Projects polled for new telescope-tagged runs. Add an entity/project pair to start discovering runs from it."})]}),p.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[p.jsxs("div",{className:"flex flex-col gap-1 mb-3",children:[p.jsxs("div",{className:"flex gap-2",children:[p.jsx(V0,{className:"h-7 text-xs flex-1",placeholder:"entity/project",value:w,onChange:Ve=>{S(Ve.target.value),N&&I(null)},onKeyDown:Ve=>{Ve.key==="Enter"&&$e()}}),p.jsx(Tn,{variant:"default",size:"sm",className:"h-7 px-3 text-xs",onClick:$e,disabled:E||!w.trim(),children:E?p.jsx(ll,{className:"h-3 w-3"}):"Ok"})]}),N&&p.jsx("span",{className:"text-[11px] text-red-500",children:N})]}),p.jsxs("div",{className:"space-y-1",children:[ge==null?void 0:ge.projects.map(Ve=>p.jsxs("div",{className:"flex items-center justify-between rounded-md px-3 py-1.5 hover:bg-muted transition-colors group",children:[p.jsxs("div",{className:"flex flex-col min-w-0",children:[p.jsx("span",{className:"text-xs font-mono truncate",children:Ve.project}),p.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Ve.source==="user"?"User-added":"From existing runs",Ve.added_at&&` · ${new Date(Ve.added_at).toLocaleDateString()}`]})]}),Ve.source==="user"&&p.jsx(Tn,{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:()=>dt(Ve.project),disabled:P===Ve.project,children:P===Ve.project?p.jsx(ll,{className:"h-3 w-3"}):p.jsx(tce,{className:"h-3 w-3"})})]},Ve.project)),(ge==null?void 0:ge.projects.length)===0&&p.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."})]})]})]})}),p.jsx($f,{open:!!se,onOpenChange:Ve=>{Ve||re(null)},children:p.jsxs(qf,{className:"sm:max-w-2xl max-h-[85vh] !grid-rows-[auto_1fr] overflow-hidden",children:[p.jsxs(jd,{children:[p.jsxs(Fd,{className:"flex items-center gap-2",children:[(se==null?void 0:se.color)&&p.jsx("div",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:se.color}}),"Configuration —"," ",(se==null?void 0:se.name)??(se==null?void 0:se.run_id.split("/").pop())]}),p.jsx(Ng,{children:se==null?void 0:se.run_id})]}),p.jsx("div",{className:"overflow-y-auto -mx-6 px-6",children:se!=null&&se.config?p.jsx(zG,{config:se.config}):p.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"})})]})}),p.jsx(FN,{open:!!K,onOpenChange:Ve=>{Ve||J(null)},children:p.jsxs(UN,{children:[p.jsxs(BN,{children:[p.jsx(VN,{children:"Remove run locally?"}),p.jsx(GN,{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."})]}),p.jsxs(HN,{children:[p.jsx($N,{children:"Cancel"}),p.jsx(WN,{onClick:()=>{K&&Oe(K)},children:"Remove"})]})]})}),p.jsx(FN,{open:!!ie,onOpenChange:Ve=>{Ve||ue(null)},children:p.jsxs(UN,{children:[p.jsxs(BN,{children:[p.jsx(fce,{className:"bg-destructive/10",children:p.jsx(rce,{className:"text-destructive"})}),p.jsx(VN,{children:"Force Full Resync"}),p.jsx(GN,{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."})]}),p.jsxs(HN,{children:[p.jsx($N,{children:"Cancel"}),p.jsx(WN,{variant:"destructive",onClick:()=>{ie&&Ze(ie)},children:"Yes, Delete & Resync"})]})]})}),p.jsx(Uue,{open:R,onOpenChange:O})]})}function Hue(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return T.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const vT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yy(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function T8(t){return"nodeType"in t}function Cc(t){var e,n;return t?yy(t)?t:T8(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function E8(t){const{Document:e}=Cc(t);return t instanceof e}function sw(t){return yy(t)?!1:t instanceof Cc(t).HTMLElement}function UG(t){return t instanceof Cc(t).SVGElement}function by(t){return t?yy(t)?t.document:T8(t)?E8(t)?t:sw(t)||UG(t)?t.ownerDocument:document:document:document}const rh=vT?T.useLayoutEffect:T.useEffect;function C8(t){const e=T.useRef(t);return rh(()=>{e.current=t}),T.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 Vue(){const t=T.useRef(null),e=T.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=T.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function tS(t,e){e===void 0&&(e=[t]);const n=T.useRef(t);return rh(()=>{n.current!==t&&(n.current=t)},e),n}function aw(t,e){const n=T.useRef();return T.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function f2(t){const e=C8(t),n=T.useRef(null),r=T.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}function XN(t){const e=T.useRef();return T.useEffect(()=>{e.current=t},[t]),e.current}let VC={};function ow(t,e){return T.useMemo(()=>{if(e)return e;const n=VC[t]==null?0:VC[t]+1;return VC[t]=n,t+"-"+n},[t,e])}function BG(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,a)=>{const o=Object.entries(a);for(const[l,c]of o){const d=s[l];d!=null&&(s[l]=d+t*c)}return s},{...e})}}const h1=BG(1),nS=BG(-1);function Gue(t){return"clientX"in t&&"clientY"in t}function A8(t){if(!t)return!1;const{KeyboardEvent:e}=Cc(t.target);return e&&t instanceof e}function Wue(t){if(!t)return!1;const{TouchEvent:e}=Cc(t.target);return e&&t instanceof e}function YN(t){if(Wue(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 Gue(t)?{x:t.clientX,y:t.clientY}:null}const G1=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[G1.Translate.toString(t),G1.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),sI="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function $ue(t){return t.matches(sI)?t:t.querySelector(sI)}const que={display:"none"};function Xue(t){let{id:e,value:n}=t;return Zr.createElement("div",{id:e,style:que},n)}function Yue(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 Zr.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Kue(){const[t,e]=T.useState("");return{announce:T.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const HG=T.createContext(null);function Zue(t){const e=T.useContext(HG);T.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Que(){const[t]=T.useState(()=>new Set),e=T.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[T.useCallback(r=>{let{type:i,event:s}=r;t.forEach(a=>{var o;return(o=a[i])==null?void 0:o.call(a,s)})},[t]),e]}const Jue={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.
  `},ede={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 tde(t){let{announcements:e=ede,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Jue}=t;const{announce:s,announcement:a}=Kue(),o=ow("DndLiveRegion"),[l,c]=T.useState(!1);if(T.useEffect(()=>{c(!0)},[]),Zue(T.useMemo(()=>({onDragStart(h){let{active:g}=h;s(e.onDragStart({active:g}))},onDragMove(h){let{active:g,over:v}=h;e.onDragMove&&s(e.onDragMove({active:g,over:v}))},onDragOver(h){let{active:g,over:v}=h;s(e.onDragOver({active:g,over:v}))},onDragEnd(h){let{active:g,over:v}=h;s(e.onDragEnd({active:g,over:v}))},onDragCancel(h){let{active:g,over:v}=h;s(e.onDragCancel({active:g,over:v}))}}),[s,e])),!l)return null;const d=Zr.createElement(Zr.Fragment,null,Zr.createElement(Xue,{id:r,value:i.draggable}),Zr.createElement(Yue,{id:o,announcement:a}));return n?Ld.createPortal(d,n):d}var ro;(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"})(ro||(ro={}));function h2(){}function Xf(t,e){return T.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function rS(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return T.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const qd=Object.freeze({x:0,y:0});function VG(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function GG(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function nde(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function aI(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 WG(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function oI(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 iS=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=oI(e,e.left,e.top),s=[];for(const a of r){const{id:o}=a,l=n.get(o);if(l){const c=VG(oI(l),i);s.push({id:o,data:{droppableContainer:a,value:c}})}}return s.sort(GG)},rde=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=aI(e),s=[];for(const a of r){const{id:o}=a,l=n.get(o);if(l){const c=aI(l),d=i.reduce((g,v,b)=>g+VG(c[b],v),0),h=Number((d/4).toFixed(4));s.push({id:o,data:{droppableContainer:a,value:h}})}}return s.sort(GG)};function ide(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),a=i-r,o=s-n;if(r<i&&n<s){const l=e.width*e.height,c=t.width*t.height,d=a*o,h=d/(l+c-d);return Number(h.toFixed(4))}return 0}const sde=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const s of r){const{id:a}=s,o=n.get(a);if(o){const l=ide(o,e);l>0&&i.push({id:a,data:{droppableContainer:s,value:l}})}}return i.sort(nde)};function ade(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function $G(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:qd}function ode(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((a,o)=>({...a,top:a.top+t*o.y,bottom:a.bottom+t*o.y,left:a.left+t*o.x,right:a.right+t*o.x}),{...n})}}const lde=ode(1);function cde(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 ude(t,e,n){const r=cde(e);if(!r)return t;const{scaleX:i,scaleY:s,x:a,y:o}=r,l=t.left-a-(1-i)*parseFloat(n),c=t.top-o-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?t.width/i:t.width,h=s?t.height/s:t.height;return{width:d,height:h,top:c,right:l+d,bottom:c+h,left:l}}const dde={ignoreTransform:!1};function _y(t,e){e===void 0&&(e=dde);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Cc(t).getComputedStyle(t);c&&(n=ude(n,c,d))}const{top:r,left:i,width:s,height:a,bottom:o,right:l}=n;return{top:r,left:i,width:s,height:a,bottom:o,right:l}}function lI(t){return _y(t,{ignoreTransform:!0})}function fde(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function hde(t,e){return e===void 0&&(e=Cc(t).getComputedStyle(t)),e.position==="fixed"}function pde(t,e){e===void 0&&(e=Cc(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 xT(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(E8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!sw(i)||UG(i)||n.includes(i))return n;const s=Cc(t).getComputedStyle(i);return i!==t&&pde(i,s)&&n.push(i),hde(i,s)?n:r(i.parentNode)}return t?r(t):n}function qG(t){const[e]=xT(t,1);return e??null}function GC(t){return!vT||!t?null:yy(t)?t:T8(t)?E8(t)||t===by(t).scrollingElement?window:sw(t)?t:null:null}function XG(t){return yy(t)?t.scrollX:t.scrollLeft}function YG(t){return yy(t)?t.scrollY:t.scrollTop}function KN(t){return{x:XG(t),y:YG(t)}}var yo;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(yo||(yo={}));function KG(t){return!vT||!t?!1:t===document.scrollingElement}function ZG(t){const e={x:0,y:0},n=KG(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,a=t.scrollTop>=r.y,o=t.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:a,isRight:o,maxScroll:r,minScroll:e}}const mde={x:.2,y:.2};function gde(t,e,n,r,i){let{top:s,left:a,right:o,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=mde);const{isTop:c,isBottom:d,isLeft:h,isRight:g}=ZG(t),v={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?(v.y=yo.Backward,b.y=r*Math.abs((e.top+_.height-s)/_.height)):!d&&l>=e.bottom-_.height&&(v.y=yo.Forward,b.y=r*Math.abs((e.bottom-_.height-l)/_.height)),!g&&o>=e.right-_.width?(v.x=yo.Forward,b.x=r*Math.abs((e.right-_.width-o)/_.width)):!h&&a<=e.left+_.width&&(v.x=yo.Backward,b.x=r*Math.abs((e.left+_.width-a)/_.width)),{direction:v,speed:b}}function vde(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}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 QG(t){return t.reduce((e,n)=>h1(e,KN(n)),qd)}function xde(t){return t.reduce((e,n)=>e+XG(n),0)}function yde(t){return t.reduce((e,n)=>e+YG(n),0)}function bde(t,e){if(e===void 0&&(e=_y),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);qG(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const _de=[["x",["left","right"],xde],["y",["top","bottom"],yde]];class N8{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=xT(n),i=QG(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,a,o]of _de)for(const l of a)Object.defineProperty(this,l,{get:()=>{const c=o(r),d=i[s]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class w_{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 Sde(t){const{EventTarget:e}=Cc(t);return t instanceof e?t:by(t)}function WC(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 ju;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(ju||(ju={}));function cI(t){t.preventDefault()}function wde(t){t.stopPropagation()}var li;(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"})(li||(li={}));const JG={start:[li.Space,li.Enter],cancel:[li.Esc],end:[li.Space,li.Enter,li.Tab]},Mde=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case li.Right:return{...n,x:n.x+25};case li.Left:return{...n,x:n.x-25};case li.Down:return{...n,y:n.y+25};case li.Up:return{...n,y:n.y-25}}};class tv{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 w_(by(n)),this.windowListeners=new w_(Cc(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ju.Resize,this.handleCancel),this.windowListeners.add(ju.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ju.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&bde(r),n(qd)}handleKeyDown(e){if(A8(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=JG,coordinateGetter:a=Mde,scrollBehavior:o="smooth"}=i,{code:l}=e;if(s.end.includes(l)){this.handleEnd(e);return}if(s.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:qd;this.referenceCoordinates||(this.referenceCoordinates=d);const h=a(e,{active:n,context:r.current,currentCoordinates:d});if(h){const g=nS(h,d),v={x:0,y:0},{scrollableAncestors:b}=r.current;for(const _ of b){const w=e.code,{isTop:S,isRight:E,isLeft:A,isBottom:N,maxScroll:I,minScroll:P}=ZG(_),L=vde(_),R={x:Math.min(w===li.Right?L.right-L.width/2:L.right,Math.max(w===li.Right?L.left:L.left+L.width/2,h.x)),y:Math.min(w===li.Down?L.bottom-L.height/2:L.bottom,Math.max(w===li.Down?L.top:L.top+L.height/2,h.y))},O=w===li.Right&&!E||w===li.Left&&!A,W=w===li.Down&&!N||w===li.Up&&!S;if(O&&R.x!==h.x){const U=_.scrollLeft+g.x,V=w===li.Right&&U<=I.x||w===li.Left&&U>=P.x;if(V&&!g.y){_.scrollTo({left:U,behavior:o});return}V?v.x=_.scrollLeft-U:v.x=w===li.Right?_.scrollLeft-I.x:_.scrollLeft-P.x,v.x&&_.scrollBy({left:-v.x,behavior:o});break}else if(W&&R.y!==h.y){const U=_.scrollTop+g.y,V=w===li.Down&&U<=I.y||w===li.Up&&U>=P.y;if(V&&!g.x){_.scrollTo({top:U,behavior:o});return}V?v.y=_.scrollTop-U:v.y=w===li.Down?_.scrollTop-I.y:_.scrollTop-P.y,v.y&&_.scrollBy({top:-v.y,behavior:o});break}}this.handleMove(e,h1(nS(h,this.referenceCoordinates),v))}}}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()}}tv.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=JG,onActivation:i}=e,{active:s}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const o=s.activatorNode.current;return o&&t.target!==o?!1:(t.preventDefault(),i==null||i({event:t.nativeEvent}),!0)}return!1}}];function uI(t){return!!(t&&"distance"in t)}function dI(t){return!!(t&&"delay"in t)}class R8{constructor(e,n,r){var i;r===void 0&&(r=Sde(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:a}=s;this.props=e,this.events=n,this.document=by(a),this.documentListeners=new w_(this.document),this.listeners=new w_(r),this.windowListeners=new w_(Cc(a)),this.initialCoordinates=(i=YN(s))!=null?i:qd,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(ju.Resize,this.handleCancel),this.windowListeners.add(ju.DragStart,cI),this.windowListeners.add(ju.VisibilityChange,this.handleCancel),this.windowListeners.add(ju.ContextMenu,cI),this.documentListeners.add(ju.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(dI(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(uI(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(ju.Click,wde,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ju.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:a,options:{activationConstraint:o}}=s;if(!i)return;const l=(n=YN(e))!=null?n:qd,c=nS(i,l);if(!r&&o){if(uI(o)){if(o.tolerance!=null&&WC(c,o.tolerance))return this.handleCancel();if(WC(c,o.distance))return this.handleStart()}if(dI(o)&&WC(c,o.tolerance))return this.handleCancel();this.handlePending(o,c);return}e.cancelable&&e.preventDefault(),a(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===li.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Tde={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class nv extends R8{constructor(e){const{event:n}=e,r=by(n.target);super(e,Tde,r)}}nv.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 Ede={move:{name:"mousemove"},end:{name:"mouseup"}};var ZN;(function(t){t[t.RightClick=2]="RightClick"})(ZN||(ZN={}));class Cde extends R8{constructor(e){super(e,Ede,by(e.event.target))}}Cde.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===ZN.RightClick?!1:(r==null||r({event:n}),!0)}}];const $C={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ade extends R8{constructor(e){super(e,$C)}static setup(){return window.addEventListener($C.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($C.move.name,e)};function e(){}}}Ade.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 M_;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(M_||(M_={}));var p2;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(p2||(p2={}));function Nde(t){let{acceleration:e,activator:n=M_.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:a=5,order:o=p2.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:h,threshold:g}=t;const v=kde({delta:h,disabled:!s}),[b,_]=Vue(),w=T.useRef({x:0,y:0}),S=T.useRef({x:0,y:0}),E=T.useMemo(()=>{switch(n){case M_.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case M_.DraggableRect:return i}},[n,i,l]),A=T.useRef(null),N=T.useCallback(()=>{const P=A.current;if(!P)return;const L=w.current.x*S.current.x,R=w.current.y*S.current.y;P.scrollBy(L,R)},[]),I=T.useMemo(()=>o===p2.TreeOrder?[...c].reverse():c,[o,c]);T.useEffect(()=>{if(!s||!c.length||!E){_();return}for(const P of I){if((r==null?void 0:r(P))===!1)continue;const L=c.indexOf(P),R=d[L];if(!R)continue;const{direction:O,speed:W}=gde(P,R,E,e,g);for(const U of["x","y"])v[U][O[U]]||(W[U]=0,O[U]=0);if(W.x>0||W.y>0){_(),A.current=P,b(N,a),w.current=W,S.current=O;return}}w.current={x:0,y:0},S.current={x:0,y:0},_()},[e,N,r,_,s,a,JSON.stringify(E),JSON.stringify(v),b,c,I,d,JSON.stringify(g)])}const Rde={x:{[yo.Backward]:!1,[yo.Forward]:!1},y:{[yo.Backward]:!1,[yo.Forward]:!1}};function kde(t){let{delta:e,disabled:n}=t;const r=XN(e);return aw(i=>{if(n||!r||!i)return Rde;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[yo.Backward]:i.x[yo.Backward]||s.x===-1,[yo.Forward]:i.x[yo.Forward]||s.x===1},y:{[yo.Backward]:i.y[yo.Backward]||s.y===-1,[yo.Forward]:i.y[yo.Forward]||s.y===1}}},[n,e,r])}function Pde(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return aw(i=>{var s;return e==null?null:(s=r??i)!=null?s:null},[r,e])}function Dde(t,e){return T.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...s]},[]),[t,e])}var sS;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(sS||(sS={}));var QN;(function(t){t.Optimized="optimized"})(QN||(QN={}));const fI=new Map;function Ide(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,a]=T.useState(null),{frequency:o,measure:l,strategy:c}=i,d=T.useRef(t),h=w(),g=tS(h),v=T.useCallback(function(S){S===void 0&&(S=[]),!g.current&&a(E=>E===null?S:E.concat(S.filter(A=>!E.includes(A))))},[g]),b=T.useRef(null),_=aw(S=>{if(h&&!n)return fI;if(!S||S===fI||d.current!==t||s!=null){const E=new Map;for(let A of t){if(!A)continue;if(s&&s.length>0&&!s.includes(A.id)&&A.rect.current){E.set(A.id,A.rect.current);continue}const N=A.node.current,I=N?new N8(l(N),N):null;A.rect.current=I,I&&E.set(A.id,I)}return E}return S},[t,s,n,h,l]);return T.useEffect(()=>{d.current=t},[t]),T.useEffect(()=>{h||v()},[n,h]),T.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),T.useEffect(()=>{h||typeof o!="number"||b.current!==null||(b.current=setTimeout(()=>{v(),b.current=null},o))},[o,h,v,...r]),{droppableRects:_,measureDroppableContainers:v,measuringScheduled:s!=null};function w(){switch(c){case sS.Always:return!1;case sS.BeforeDragging:return n;default:return!n}}}function eW(t,e){return aw(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Ode(t,e){return eW(t,e)}function Lde(t){let{callback:e,disabled:n}=t;const r=C8(e),i=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return T.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function yT(t){let{callback:e,disabled:n}=t;const r=C8(e),i=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return T.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function zde(t){return new N8(_y(t),t)}function hI(t,e,n){e===void 0&&(e=zde);const[r,i]=T.useState(null);function s(){i(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const a=Lde({callback(l){if(t)for(const c of l){const{type:d,target:h}=c;if(d==="childList"&&h instanceof HTMLElement&&h.contains(t)){s();break}}}}),o=yT({callback:s});return rh(()=>{s(),t?(o==null||o.observe(t),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(o==null||o.disconnect(),a==null||a.disconnect())},[t]),r}function jde(t){const e=eW(t);return $G(t,e)}const pI=[];function Fde(t){const e=T.useRef(t),n=aw(r=>t?r&&r!==pI&&t&&e.current&&t.parentNode===e.current.parentNode?r:xT(t):pI,[t]);return T.useEffect(()=>{e.current=t},[t]),n}function Ude(t){const[e,n]=T.useState(null),r=T.useRef(t),i=T.useCallback(s=>{const a=GC(s.target);a&&n(o=>o?(o.set(a,KN(a)),new Map(o)):null)},[]);return T.useEffect(()=>{const s=r.current;if(t!==s){a(s);const o=t.map(l=>{const c=GC(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,KN(c)]):null}).filter(l=>l!=null);n(o.length?new Map(o):null),r.current=t}return()=>{a(t),a(s)};function a(o){o.forEach(l=>{const c=GC(l);c==null||c.removeEventListener("scroll",i)})}},[i,t]),T.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,a)=>h1(s,a),qd):QG(t):qd,[t,e])}function mI(t,e){e===void 0&&(e=[]);const n=T.useRef(null);return T.useEffect(()=>{n.current=null},e),T.useEffect(()=>{const r=t!==qd;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?nS(t,n.current):qd}function Bde(t){T.useEffect(()=>{if(!vT)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 Hde(t,e){return T.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=a=>{s(a,e)},n},{}),[t,e])}function tW(t){return T.useMemo(()=>t?fde(t):null,[t])}const gI=[];function Vde(t,e){e===void 0&&(e=_y);const[n]=t,r=tW(n?Cc(n):null),[i,s]=T.useState(gI);function a(){s(()=>t.length?t.map(l=>KG(l)?r:new N8(e(l),l)):gI)}const o=yT({callback:a});return rh(()=>{o==null||o.disconnect(),a(),t.forEach(l=>o==null?void 0:o.observe(l))},[t]),i}function Gde(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return sw(e)?e:t}function Wde(t){let{measure:e}=t;const[n,r]=T.useState(null),i=T.useCallback(c=>{for(const{target:d}of c)if(sw(d)){r(h=>{const g=e(d);return h?{...h,width:g.width,height:g.height}:g});break}},[e]),s=yT({callback:i}),a=T.useCallback(c=>{const d=Gde(c);s==null||s.disconnect(),d&&(s==null||s.observe(d)),r(d?e(d):null)},[e,s]),[o,l]=f2(a);return T.useMemo(()=>({nodeRef:o,rect:n,setRef:l}),[n,o,l])}const $de=[{sensor:nv,options:{}},{sensor:tv,options:{}}],qde={current:{}},OM={draggable:{measure:lI},droppable:{measure:lI,strategy:sS.WhileDragging,frequency:QN.Optimized},dragOverlay:{measure:_y}};class T_ 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 Xde={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new T_,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:h2},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:OM,measureDroppableContainers:h2,windowRect:null,measuringScheduled:!1},Yde={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:h2,draggableNodes:new Map,over:null,measureDroppableContainers:h2},bT=T.createContext(Yde),nW=T.createContext(Xde);function Kde(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new T_}}}function Zde(t,e){switch(e.type){case ro.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ro.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 ro.DragEnd:case ro.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ro.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new T_(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case ro.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const a=new T_(t.droppable.containers);return a.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:a}}}case ro.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new T_(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function Qde(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=T.useContext(bT),s=XN(r),a=XN(n==null?void 0:n.id);return T.useEffect(()=>{if(!e&&!r&&s&&a!=null){if(!A8(s)||document.activeElement===s.target)return;const o=i.get(a);if(!o)return;const{activatorNode:l,node:c}=o;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const h=$ue(d);if(h){h.focus();break}}})}},[r,e,i,a,s]),null}function Jde(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function efe(t){return T.useMemo(()=>({draggable:{...OM.draggable,...t==null?void 0:t.draggable},droppable:{...OM.droppable,...t==null?void 0:t.droppable},dragOverlay:{...OM.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 tfe(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=T.useRef(!1),{x:a,y:o}=typeof i=="boolean"?{x:i,y:i}:i;rh(()=>{if(!a&&!o||!e){s.current=!1;return}if(s.current||!r)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const d=n(c),h=$G(d,r);if(a||(h.x=0),o||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=qG(c);g&&g.scrollBy({top:h.y,left:h.x})}},[e,a,o,r,n])}const rW=T.createContext({...qd,scaleX:1,scaleY:1});var w0;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(w0||(w0={}));const aS=T.memo(function(e){var n,r,i,s;let{id:a,accessibility:o,autoScroll:l=!0,children:c,sensors:d=$de,collisionDetection:h=sde,measuring:g,modifiers:v,...b}=e;const _=T.useReducer(Zde,void 0,Kde),[w,S]=_,[E,A]=Que(),[N,I]=T.useState(w0.Uninitialized),P=N===w0.Initialized,{draggable:{active:L,nodes:R,translate:O},droppable:{containers:W}}=w,U=L!=null?R.get(L):null,V=T.useRef({initial:null,translated:null}),G=T.useMemo(()=>{var pt;return L!=null?{id:L,data:(pt=U==null?void 0:U.data)!=null?pt:qde,rect:V}:null},[L,U]),Z=T.useRef(null),[B,q]=T.useState(null),[Y,K]=T.useState(null),J=tS(b,Object.values(b)),F=ow("DndDescribedBy",a),j=T.useMemo(()=>W.getEnabled(),[W]),X=efe(g),{droppableRects:H,measureDroppableContainers:se,measuringScheduled:re}=Ide(j,{dragging:P,dependencies:[O.x,O.y],config:X.droppable}),ie=Pde(R,L),ue=T.useMemo(()=>Y?YN(Y):null,[Y]),le=ft(),fe=Ode(ie,X.draggable.measure);tfe({activeNode:L!=null?R.get(L):null,config:le.layoutShiftCompensation,initialRect:fe,measure:X.draggable.measure});const xe=hI(ie,X.draggable.measure,fe),he=hI(ie?ie.parentElement:null),Te=T.useRef({activatorEvent:null,active:null,activeNode:ie,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),We=W.getNodeFor((n=Te.current.over)==null?void 0:n.id),Se=Wde({measure:X.dragOverlay.measure}),Le=(r=Se.nodeRef.current)!=null?r:ie,pe=P?(i=Se.rect)!=null?i:xe:null,Re=!!(Se.nodeRef.current&&Se.rect),ne=jde(Re?null:xe),Xe=tW(Le?Cc(Le):null),Ae=Fde(P?We??ie:null),Pe=Vde(Ae),Ke=Jde(v,{transform:{x:O.x-ne.x,y:O.y-ne.y,scaleX:1,scaleY:1},activatorEvent:Y,active:G,activeNodeRect:xe,containerNodeRect:he,draggingNodeRect:pe,over:Te.current.over,overlayNodeRect:Se.rect,scrollableAncestors:Ae,scrollableAncestorRects:Pe,windowRect:Xe}),oe=ue?h1(ue,O):null,te=Ude(Ae),_e=mI(te),ve=mI(te,[xe]),ye=h1(Ke,_e),ke=pe?lde(pe,Ke):null,Be=G&&ke?h({active:G,collisionRect:ke,droppableRects:H,droppableContainers:j,pointerCoordinates:oe}):null,ge=WG(Be,"id"),[Ye,Qe]=T.useState(null),Ie=Re?Ke:h1(Ke,ve),Fe=ade(Ie,(s=Ye==null?void 0:Ye.rect)!=null?s:null,xe),Ge=T.useRef(null),Me=T.useCallback((pt,et)=>{let{sensor:Ze,options:me}=et;if(Z.current==null)return;const je=R.get(Z.current);if(!je)return;const He=pt.nativeEvent,nt=new Ze({active:Z.current,activeNode:je,event:He,options:me,context:Te,onAbort(lt){if(!R.get(lt))return;const{onDragAbort:Nt}=J.current,Pt={id:lt};Nt==null||Nt(Pt),E({type:"onDragAbort",event:Pt})},onPending(lt,bt,Nt,Pt){if(!R.get(lt))return;const{onDragPending:wt}=J.current,Et={id:lt,constraint:bt,initialCoordinates:Nt,offset:Pt};wt==null||wt(Et),E({type:"onDragPending",event:Et})},onStart(lt){const bt=Z.current;if(bt==null)return;const Nt=R.get(bt);if(!Nt)return;const{onDragStart:Pt}=J.current,Ve={activatorEvent:He,active:{id:bt,data:Nt.data,rect:V}};Ld.unstable_batchedUpdates(()=>{Pt==null||Pt(Ve),I(w0.Initializing),S({type:ro.DragStart,initialCoordinates:lt,active:bt}),E({type:"onDragStart",event:Ve}),q(Ge.current),K(He)})},onMove(lt){S({type:ro.DragMove,coordinates:lt})},onEnd:yt(ro.DragEnd),onCancel:yt(ro.DragCancel)});Ge.current=nt;function yt(lt){return async function(){const{active:Nt,collisions:Pt,over:Ve,scrollAdjustedTranslate:wt}=Te.current;let Et=null;if(Nt&&wt){const{cancelDrop:zt}=J.current;Et={activatorEvent:He,active:Nt,collisions:Pt,delta:wt,over:Ve},lt===ro.DragEnd&&typeof zt=="function"&&await Promise.resolve(zt(Et))&&(lt=ro.DragCancel)}Z.current=null,Ld.unstable_batchedUpdates(()=>{S({type:lt}),I(w0.Uninitialized),Qe(null),q(null),K(null),Ge.current=null;const zt=lt===ro.DragEnd?"onDragEnd":"onDragCancel";if(Et){const Ht=J.current[zt];Ht==null||Ht(Et),E({type:zt,event:Et})}})}}},[R]),$e=T.useCallback((pt,et)=>(Ze,me)=>{const je=Ze.nativeEvent,He=R.get(me);if(Z.current!==null||!He||je.dndKit||je.defaultPrevented)return;const nt={active:He};pt(Ze,et.options,nt)===!0&&(je.dndKit={capturedBy:et.sensor},Z.current=me,Me(Ze,et))},[R,Me]),dt=Dde(d,$e);Bde(d),rh(()=>{xe&&N===w0.Initializing&&I(w0.Initialized)},[xe,N]),T.useEffect(()=>{const{onDragMove:pt}=J.current,{active:et,activatorEvent:Ze,collisions:me,over:je}=Te.current;if(!et||!Ze)return;const He={active:et,activatorEvent:Ze,collisions:me,delta:{x:ye.x,y:ye.y},over:je};Ld.unstable_batchedUpdates(()=>{pt==null||pt(He),E({type:"onDragMove",event:He})})},[ye.x,ye.y]),T.useEffect(()=>{const{active:pt,activatorEvent:et,collisions:Ze,droppableContainers:me,scrollAdjustedTranslate:je}=Te.current;if(!pt||Z.current==null||!et||!je)return;const{onDragOver:He}=J.current,nt=me.get(ge),yt=nt&&nt.rect.current?{id:nt.id,rect:nt.rect.current,data:nt.data,disabled:nt.disabled}:null,lt={active:pt,activatorEvent:et,collisions:Ze,delta:{x:je.x,y:je.y},over:yt};Ld.unstable_batchedUpdates(()=>{Qe(yt),He==null||He(lt),E({type:"onDragOver",event:lt})})},[ge]),rh(()=>{Te.current={activatorEvent:Y,active:G,activeNode:ie,collisionRect:ke,collisions:Be,droppableRects:H,draggableNodes:R,draggingNode:Le,draggingNodeRect:pe,droppableContainers:W,over:Ye,scrollableAncestors:Ae,scrollAdjustedTranslate:ye},V.current={initial:pe,translated:ke}},[G,ie,Be,ke,R,Le,pe,H,W,Ye,Ae,ye]),Nde({...le,delta:O,draggingRect:ke,pointerCoordinates:oe,scrollableAncestors:Ae,scrollableAncestorRects:Pe});const Oe=T.useMemo(()=>({active:G,activeNode:ie,activeNodeRect:xe,activatorEvent:Y,collisions:Be,containerNodeRect:he,dragOverlay:Se,draggableNodes:R,droppableContainers:W,droppableRects:H,over:Ye,measureDroppableContainers:se,scrollableAncestors:Ae,scrollableAncestorRects:Pe,measuringConfiguration:X,measuringScheduled:re,windowRect:Xe}),[G,ie,xe,Y,Be,he,Se,R,W,H,Ye,se,Ae,Pe,X,re,Xe]),st=T.useMemo(()=>({activatorEvent:Y,activators:dt,active:G,activeNodeRect:xe,ariaDescribedById:{draggable:F},dispatch:S,draggableNodes:R,over:Ye,measureDroppableContainers:se}),[Y,dt,G,xe,S,F,R,Ye,se]);return Zr.createElement(HG.Provider,{value:A},Zr.createElement(bT.Provider,{value:st},Zr.createElement(nW.Provider,{value:Oe},Zr.createElement(rW.Provider,{value:Fe},c)),Zr.createElement(Qde,{disabled:(o==null?void 0:o.restoreFocus)===!1})),Zr.createElement(tde,{...o,hiddenTextDescribedById:F}));function ft(){const pt=(B==null?void 0:B.autoScrollEnabled)===!1,et=typeof l=="object"?l.enabled===!1:l===!1,Ze=P&&!pt&&!et;return typeof l=="object"?{...l,enabled:Ze}:{enabled:Ze}}}),nfe=T.createContext(null),vI="button",rfe="Draggable";function ife(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=ow(rfe),{activators:a,activatorEvent:o,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:h,over:g}=T.useContext(bT),{role:v=vI,roleDescription:b="draggable",tabIndex:_=0}=i??{},w=(l==null?void 0:l.id)===e,S=T.useContext(w?rW:nfe),[E,A]=f2(),[N,I]=f2(),P=Hde(a,e),L=tS(n);rh(()=>(h.set(e,{id:e,key:s,node:E,activatorNode:N,data:L}),()=>{const O=h.get(e);O&&O.key===s&&h.delete(e)}),[h,e]);const R=T.useMemo(()=>({role:v,tabIndex:_,"aria-disabled":r,"aria-pressed":w&&v===vI?!0:void 0,"aria-roledescription":b,"aria-describedby":d.draggable}),[r,v,_,w,b,d.draggable]);return{active:l,activatorEvent:o,activeNodeRect:c,attributes:R,isDragging:w,listeners:r?void 0:P,node:E,over:g,setNodeRef:A,setActivatorNodeRef:I,transform:S}}function sfe(){return T.useContext(nW)}const afe="Droppable",ofe={timeout:25};function lfe(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=ow(afe),{active:a,dispatch:o,over:l,measureDroppableContainers:c}=T.useContext(bT),d=T.useRef({disabled:n}),h=T.useRef(!1),g=T.useRef(null),v=T.useRef(null),{disabled:b,updateMeasurementsFor:_,timeout:w}={...ofe,...i},S=tS(_??r),E=T.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),v.current=null},w)},[w]),A=yT({callback:E,disabled:b||!a}),N=T.useCallback((R,O)=>{A&&(O&&(A.unobserve(O),h.current=!1),R&&A.observe(R))},[A]),[I,P]=f2(N),L=tS(e);return T.useEffect(()=>{!A||!I.current||(A.disconnect(),h.current=!1,A.observe(I.current))},[I,A]),T.useEffect(()=>(o({type:ro.RegisterDroppable,element:{id:r,key:s,disabled:n,node:I,rect:g,data:L}}),()=>o({type:ro.UnregisterDroppable,key:s,id:r})),[r]),T.useEffect(()=>{n!==d.current.disabled&&(o({type:ro.SetDroppableDisabled,id:r,key:s,disabled:n}),d.current.disabled=n)},[r,s,n,o]),{active:a,rect:g,isOver:(l==null?void 0:l.id)===r,node:I,over:l,setNodeRef:P}}function rv(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function cfe(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function e4(t){return t!==null&&t>=0}function ufe(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 dfe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const lw=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=rv(e,r,n),a=e[i],o=s[i];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},t4={scaleX:1,scaleY:1},iW=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:a}=t;const o=(e=s[n])!=null?e:r;if(!o)return null;if(i===n){const c=s[a];return c?{x:0,y:n<a?c.top+c.height-(o.top+o.height):c.top-o.top,...t4}:null}const l=ffe(s,i,n);return i>n&&i<=a?{x:0,y:-o.height-l,...t4}:i<n&&i>=a?{x:0,y:o.height+l,...t4}:{x:0,y:0,...t4}};function ffe(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 sW="Sortable",aW=Zr.createContext({activeIndex:-1,containerId:sW,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:lw,disabled:{draggable:!1,droppable:!1}});function oS(t){let{children:e,id:n,items:r,strategy:i=lw,disabled:s=!1}=t;const{active:a,dragOverlay:o,droppableRects:l,over:c,measureDroppableContainers:d}=sfe(),h=ow(sW,n),g=o.rect!==null,v=T.useMemo(()=>r.map(P=>typeof P=="object"&&"id"in P?P.id:P),[r]),b=a!=null,_=a?v.indexOf(a.id):-1,w=c?v.indexOf(c.id):-1,S=T.useRef(v),E=!ufe(v,S.current),A=w!==-1&&_===-1||E,N=dfe(s);rh(()=>{E&&b&&d(v)},[E,v,b,d]),T.useEffect(()=>{S.current=v},[v]);const I=T.useMemo(()=>({activeIndex:_,containerId:h,disabled:N,disableTransforms:A,items:v,overIndex:w,useDragOverlay:g,sortedRects:cfe(v,l),strategy:i}),[_,h,N.draggable,N.droppable,A,v,w,l,g,i]);return Zr.createElement(aW.Provider,{value:I},e)}const hfe=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return rv(n,r,i).indexOf(e)},pfe=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:s,newIndex:a,previousItems:o,previousContainerId:l,transition:c}=t;return!c||!r||o!==s&&i===a?!1:n?!0:a!==i&&e===l},mfe={duration:200,easing:"ease"},oW="transform",gfe=G1.Transition.toString({property:oW,duration:0,easing:"linear"}),vfe={roleDescription:"sortable"};function xfe(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,a]=T.useState(null),o=T.useRef(n);return rh(()=>{if(!e&&n!==o.current&&r.current){const l=i.current;if(l){const c=_y(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&a(d)}}n!==o.current&&(o.current=n)},[e,n,r,i]),T.useEffect(()=>{s&&a(null)},[s]),s}function k8(t){let{animateLayoutChanges:e=pfe,attributes:n,disabled:r,data:i,getNewIndex:s=hfe,id:a,strategy:o,resizeObserverConfig:l,transition:c=mfe}=t;const{items:d,containerId:h,activeIndex:g,disabled:v,disableTransforms:b,sortedRects:_,overIndex:w,useDragOverlay:S,strategy:E}=T.useContext(aW),A=yfe(r,v),N=d.indexOf(a),I=T.useMemo(()=>({sortable:{containerId:h,index:N,items:d},...i}),[h,i,N,d]),P=T.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:L,node:R,isOver:O,setNodeRef:W}=lfe({id:a,data:I,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:U,activatorEvent:V,activeNodeRect:G,attributes:Z,setNodeRef:B,listeners:q,isDragging:Y,over:K,setActivatorNodeRef:J,transform:F}=ife({id:a,data:I,attributes:{...vfe,...n},disabled:A.draggable}),j=Hue(W,B),X=!!U,H=X&&!b&&e4(g)&&e4(w),se=!S&&Y,re=se&&H?F:null,ue=H?re??(o??E)({rects:_,activeNodeRect:G,activeIndex:g,overIndex:w,index:N}):null,le=e4(g)&&e4(w)?s({id:a,items:d,activeIndex:g,overIndex:w}):N,fe=U==null?void 0:U.id,xe=T.useRef({activeId:fe,items:d,newIndex:le,containerId:h}),he=d!==xe.current.items,Te=e({active:U,containerId:h,isDragging:Y,isSorting:X,id:a,index:N,items:d,newIndex:xe.current.newIndex,previousItems:xe.current.items,previousContainerId:xe.current.containerId,transition:c,wasDragging:xe.current.activeId!=null}),We=xfe({disabled:!Te,index:N,node:R,rect:L});return T.useEffect(()=>{X&&xe.current.newIndex!==le&&(xe.current.newIndex=le),h!==xe.current.containerId&&(xe.current.containerId=h),d!==xe.current.items&&(xe.current.items=d)},[X,le,h,d]),T.useEffect(()=>{if(fe===xe.current.activeId)return;if(fe!=null&&xe.current.activeId==null){xe.current.activeId=fe;return}const Le=setTimeout(()=>{xe.current.activeId=fe},50);return()=>clearTimeout(Le)},[fe]),{active:U,activeIndex:g,attributes:Z,data:I,rect:L,index:N,newIndex:le,items:d,isOver:O,isSorting:X,isDragging:Y,listeners:q,node:R,overIndex:w,over:K,setNodeRef:j,setActivatorNodeRef:J,setDroppableNodeRef:W,setDraggableNodeRef:B,transform:We??ue,transition:Se()};function Se(){if(We||he&&xe.current.newIndex===N)return gfe;if(!(se&&!A8(V)||!c)&&(X||Te))return G1.Transition.toString({...c,property:oW})}}function yfe(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 m2(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 bfe=[li.Down,li.Right,li.Up,li.Left],lS=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:a,scrollableAncestors:o}}=e;if(bfe.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];s.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=i.get(h.id);if(g)switch(t.code){case li.Down:r.top<g.top&&l.push(h);break;case li.Up:r.top>g.top&&l.push(h);break;case li.Left:r.left>g.left&&l.push(h);break;case li.Right:r.left<g.left&&l.push(h);break}});const c=rde({collisionRect:r,droppableRects:i,droppableContainers:l});let d=WG(c,"id");if(d===(a==null?void 0:a.id)&&c.length>1&&(d=c[1].id),d!=null){const h=s.get(n.id),g=s.get(d),v=g?i.get(g.id):null,b=g==null?void 0:g.node.current;if(b&&v&&h&&g){const w=xT(b).some((P,L)=>o[L]!==P),S=lW(h,g),E=_fe(h,g),A=w||!S?{x:0,y:0}:{x:E?r.width-v.width:0,y:E?r.height-v.height:0},N={x:v.left,y:v.top};return A.x&&A.y?N:nS(N,A)}}}};function lW(t,e){return!m2(t)||!m2(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function _fe(t,e){return!m2(t)||!m2(e)||!lW(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function $u({className:t,size:e="default",...n}){return p.jsx("div",{"data-slot":"card","data-size":e,className:Rt("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col",t),...n})}function xI({className:t,...e}){return p.jsx("div",{"data-slot":"card-header",className:Rt("gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",t),...e})}function n4({className:t,...e}){return p.jsx("div",{"data-slot":"card-title",className:Rt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function r4({className:t,...e}){return p.jsx("div",{"data-slot":"card-description",className:Rt("text-muted-foreground text-sm",t),...e})}function eh({className:t,...e}){return p.jsx("div",{"data-slot":"card-content",className:Rt("px-4 group-data-[size=sm]/card:px-3",t),...e})}function Zh({className:t,...e}){return p.jsx("div",{"data-slot":"skeleton",className:Rt("bg-muted rounded-md animate-pulse",t),...e})}const cW=g8("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 p1({className:t,variant:e="default",size:n="default",...r}){return p.jsx(Bae,{"data-slot":"toggle",className:Rt(cW({variant:e,size:n,className:t})),...r})}const uW=T.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function Y0({className:t,variant:e,size:n,spacing:r=0,orientation:i="horizontal",children:s,...a}){return p.jsx($ae,{"data-slot":"toggle-group","data-variant":e,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Rt("rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",t),...a,children:p.jsx(uW.Provider,{value:{variant:e,size:n,spacing:r,orientation:i},children:s})})}function Uo({className:t,children:e,variant:n="default",size:r="default",...i}){const s=T.useContext(uW);return p.jsx(qae,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:Rt("group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",cW({variant:s.variant||n,size:s.size||r}),t),...i,children:e})}function cS({label:t,enabled:e,onEnabledChange:n,value:r,onValueChange:i,onValueCommit:s,inputType:a="number",inputMin:o,inputMax:l,inputWidth:c="w-12",icon:d,variant:h="default",size:g="default",className:v}){const b=S=>{S.key==="Enter"&&(e||n(!0),s(r),S.currentTarget.blur())},_=()=>{s(r)},w=h==="selecting";return p.jsxs("div",{className:Rt("inline-flex items-center rounded-lg transition-colors",h==="default"&&"border border-input bg-transparent",h==="default"&&e&&"bg-muted",h==="outline"&&"border border-input bg-transparent",h==="outline"&&e&&"bg-muted",w&&"bg-accent",w&&e&&"bg-primary",v),children:[p.jsxs(p1,{variant:h,size:g,pressed:e,onPressedChange:n,className:Rt("gap-1.5 border-0 rounded-r-none pr-1",g==="sm"&&"text-xs px-2"),children:[d,p.jsx("span",{children:t})]}),p.jsx("input",{type:a,min:o,max:l,value:r,onChange:S=>i(S.target.value),onKeyDown:b,onBlur:_,className:Rt("bg-transparent text-center font-medium outline-none rounded-r-lg transition-colors",c,g==="default"&&"h-8 text-sm",g==="sm"&&"h-7 text-xs",w?e?"text-secondary":"text-muted-foreground/50":e?"text-foreground":"text-muted-foreground/50")})]})}const Sfe=g8("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 W1({className:t,variant:e="default",asChild:n=!1,...r}){const i=n?SU:"span";return p.jsx(i,{"data-slot":"badge","data-variant":e,className:Rt(Sfe({variant:e}),t),...r})}const dW="...";function wfe(t,e){if(!t||e<=0||t.length<=e)return{prefix:t,suffix:"",isTruncated:!1};const n=e-dW.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 t1({text:t,className:e,tooltipClassName:n,ellipsisClassName:r,ellipsisFadeClassName:i,tooltipDelay:s=300}){const a=T.useRef(null),o=T.useRef(null),[l,c]=T.useState({prefix:t,suffix:"",isTruncated:!1}),d=T.useCallback(()=>{const g=a.current,v=o.current;if(!g||!v)return;const b=g.getBoundingClientRect().width,_=v.getBoundingClientRect().width;if(!b||!_)return;if(_<=b){c(A=>A.isTruncated||A.prefix!==t?{prefix:t,suffix:"",isTruncated:!1}:A);return}const w=_/Math.max(1,t.length),S=Math.max(1,Math.floor(b/w)),E=wfe(t,S);c(A=>A.prefix===E.prefix&&A.suffix===E.suffix&&A.isTruncated===E.isTruncated?A:E)},[t]);T.useLayoutEffect(()=>{d();const g=a.current;if(!g||typeof ResizeObserver>"u")return;const v=new ResizeObserver(()=>{d()});return v.observe(g),()=>v.disconnect()},[d]);const h=p.jsxs("span",{ref:a,className:Rt("relative flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",e),children:[p.jsx("span",{ref:o,className:"pointer-events-none absolute -z-10 opacity-0","aria-hidden":"true",children:t||"M"}),l.isTruncated?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"shrink-0",children:l.prefix}),p.jsx("span",{className:Rt("relative inline-flex items-center rounded-[2px] px-0.5 text-muted-foreground","before:absolute before:inset-y-0 before:-left-2 before:w-2 before:bg-gradient-to-r before:from-transparent before:content-['']",r??"bg-background",i??"before:to-background"),children:dW}),p.jsx("span",{className:"shrink-0",children:l.suffix})]}):p.jsx("span",{className:"truncate",children:t})]});return l.isTruncated?p.jsxs(mv,{delayDuration:s,children:[p.jsx(gv,{asChild:!0,children:h}),p.jsx(vv,{side:"top",className:Rt("max-w-xs break-all text-[11px]",n),children:t})]}):h}function JN(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 fW(t){if(t==null)return null;const e=typeof t=="object"&&t!==null&&"value"in t?t.value:t;return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)||typeof e=="object"&&e!==null?e:null}function yI(t){return t==null?"—":typeof t=="boolean"?t?"True":"False":typeof t=="number"?Number.isInteger(t)?t.toLocaleString():Math.abs(t)<.001&&t!==0?t.toExponential(2):t.toLocaleString(void 0,{maximumFractionDigits:6}):typeof t=="object"?JN(t):String(t)}function bI(t){const e=t.split("/");return e[e.length-1].replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function P8(t,e){return t===e?!0:t==null?e==null:e==null?!1:typeof t=="object"||typeof e=="object"?JN(t)===JN(e):String(t)===String(e)}function Mfe(t){const e=[{key:"general",label:"General",match:l=>l==="debug",order:["debug"]},{key:"model",label:"Model",match:l=>l==="model"||l==="model_dtype"||l==="mixed_precision_dtype",order:["model","model_dtype","mixed_precision_dtype"]},{key:"ray_cluster",label:"Ray Cluster",match:l=>l.startsWith("ray_")&&l!=="ray_torch_memory_drain_interval_seconds",order:["ray_address","ray_auto_start_local","ray_namespace","ray_log_to_driver","ray_disable_runtime_env_hook","ray_pin_py_executable","ray_propagate_active_venv","ray_propagate_run_dir","ray_broadcast_init_timeout_s","ray_broadcast_prefer_loopback_if_single_node","ray_shutdown_on_exit","ray_inference_cpus_per_worker","ray_trainer_cpus_per_worker","ray_inference_placement_strategy","ray_trainer_placement_strategy","ray_placement_timeout_s"]},{key:"workers",label:"Workers",match:l=>["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"].includes(l),order:["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"]},{key:"orchestrator",label:"Orchestrator",match:l=>["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"].includes(l),order:["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"]},{key:"trainer",label:"Trainer",match:l=>["learning_rate","weight_decay","warmup_steps","grad_clip","train_backend","fsdp_activation_checkpointing","jit"].includes(l)||l.startsWith("megatron_"),order:["learning_rate","weight_decay","warmup_steps","grad_clip","train_backend","fsdp_activation_checkpointing","jit","megatron_tensor_parallel_size","megatron_pipeline_parallel_size","megatron_context_parallel_size","megatron_expert_parallel_size","megatron_disable_unified_memory_jit","megatron_optimizer_cpu_offload","megatron_optimizer_offload_fraction","megatron_overlap_cpu_optimizer_d2h_h2d","megatron_use_precision_aware_optimizer","megatron_main_grads_dtype","megatron_main_params_dtype","megatron_exp_avg_dtype","megatron_exp_avg_sq_dtype"]},{key:"algorithm",label:"Algorithm",match:l=>["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"].includes(l),order:["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"]},{key:"weight_sync",label:"Weight Sync",match:l=>l.startsWith("weight_broadcast_"),order:["weight_broadcast_mode","weight_broadcast_bucket_mb","weight_broadcast_cpu_staging"]},{key:"sequence_packing",label:"Sequence Packing",match:l=>l==="seq_len"||l==="pad_to_multiple_of",order:["seq_len","pad_to_multiple_of"]},{key:"inference",label:"Inference",match:l=>["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"].includes(l),order:["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"]},{key:"rollout",label:"Rollout / Sampling",match:l=>["group_size","temperature","max_tokens","top_p","interleaved_rollouts"].includes(l),order:["group_size","temperature","max_tokens","top_p","interleaved_rollouts"]},{key:"checkpoint",label:"Checkpoint",match:l=>["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"].includes(l),order:["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"]},{key:"logging",label:"Logging",match:l=>l==="use_wandb"||l.startsWith("wandb_")||l==="_wandb"||l.startsWith("event_")||l.endsWith("_interval_seconds")||l==="rollout_block_size"||l==="track_gpu_events",order:["use_wandb","wandb_project","wandb_run_name","wandb_tags","wandb_upload_code","wandb_code_max_file_size_mb","wandb_code_exclude_patterns","system_metrics_collection_interval_seconds","torch_memory_sample_interval_seconds","event_tail_window_seconds","event_block_duration_seconds","event_upload_interval_seconds","metrics_logger_interval_seconds","ray_torch_memory_drain_interval_seconds","rollout_block_size","track_gpu_events"]},{key:"evals",label:"Evals",match:l=>l.startsWith("eval_"),order:["eval_before_training","eval_after_training","eval_num_servers","eval_start_end_use_all_servers"]},{key:"vllm_tracing",label:"vLLM Tracing",match:l=>l==="enable_vllm_tracing"||l==="otlp_receiver_port",order:["enable_vllm_tracing","otlp_receiver_port"]},{key:"environments",label:"Environments",match:l=>l==="environments"||l==="evals"},{key:"setup/gpu",label:"GPU",match:l=>l.startsWith("setup/gpu/")},{key:"setup/cpu",label:"CPU",match:l=>l.startsWith("setup/cpu/")},{key:"setup/memory",label:"Memory",match:l=>l.startsWith("setup/memory/")},{key:"setup/disk",label:"Disk",match:l=>l.startsWith("setup/disk/")},{key:"setup/network",label:"Network",match:l=>l.startsWith("setup/network/")},{key:"setup/os",label:"Operating System",match:l=>l.startsWith("setup/os/")},{key:"setup/package_versions",label:"Package Versions",match:l=>l.startsWith("setup/package_versions/")}],n=new Map;for(const l of e)n.set(l.key,{key:l.key,label:l.label,items:[]});for(const[l,c]of Object.entries(t)){if(l==="_wandb")continue;const d=fW(c);if(d===null)continue;let h=!1;for(const g of e)if(g.match(l)){n.get(g.key).items.push({key:l,displayKey:bI(l),value:d}),h=!0;break}h||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:bI(l),value:d}))}const r=new Map(e.map(l=>[l.key,l]));for(const[,l]of n){const c=r.get(l.key);if(c!=null&&c.order&&l.items.length>1){const d=new Map(c.order.map((h,g)=>[h,g]));l.items.sort((h,g)=>{const v=d.get(h.key)??1/0,b=d.get(g.key)??1/0;return v!==b?v-b:h.key.localeCompare(g.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"],a=[];for(const l of i){const c=n.get(l);c&&c.items.length>0&&a.push(c)}const o=[];for(const l of s)if(l==="hardware")a.length>0&&o.push({key:"hardware",label:"Hardware & Environment",items:[],subcategories:a});else{const c=n.get(l);c&&c.items.length>0&&o.push(c)}return o}function _I(t){const e=new Map;for(const[n,r]of Object.entries(t)){if(n==="_wandb")continue;const i=fW(r);i!==null&&e.set(n,i)}return e}function D8(t,e,n){return t.subcategories?t.subcategories.some(r=>D8(r,e,n)):t.items.some(r=>{const i=e.get(r.key),s=n.get(r.key);return!P8(i,s)})}function Tfe({runs:t,currentRunId:e,onSelect:n}){return p.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 p.jsxs("button",{onClick:()=>!i&&n(r.run_id),disabled:i,className:Rt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",i?"opacity-40 cursor-not-allowed":"hover:bg-muted cursor-pointer"),children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:r.color}}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"min-w-0",children:p.jsx(t1,{text:s,className:"text-sm font-medium"})}),p.jsx("div",{className:"truncate text-xs text-muted-foreground",children:r.run_id})]}),i&&p.jsx(W1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),r.is_tracking&&p.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),r.is_syncing&&p.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),r.created_at&&p.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:V1(r.created_at)})]},r.run_id)}),t.length===0&&p.jsx("div",{className:"text-sm text-muted-foreground text-center py-4",children:"No other runs available"})]})}function SI({value:t,formatted:e,isDifferent:n}){const r=e.length>20,i=p.jsx("span",{className:Rt("text-sm font-sans truncate block max-w-full overflow-hidden text-ellipsis",n?"font-medium":"text-muted-foreground"),children:e});return r?p.jsxs(mv,{children:[p.jsx(gv,{asChild:!0,children:i}),p.jsx(vv,{side:"top",className:"max-w-xs break-all font-sans text-xs",children:e})]}):i}function Efe({displayKey:t,value1:e,value2:n,showOnlyDifferences:r}){const i=yI(e),s=yI(n),a=!P8(e,n);return r&&!a?null:p.jsxs("div",{className:Rt("grid grid-cols-[1fr_2fr_2fr] gap-3 py-1.5 rounded-md transition-colors min-w-0",a?"hover:bg-muted/50":"opacity-40 hover:opacity-60"),children:[p.jsxs(mv,{children:[p.jsx(gv,{asChild:!0,children:p.jsx("span",{className:Rt("text-sm truncate min-w-0",a?"text-foreground":"text-muted-foreground"),children:t})}),p.jsx(vv,{side:"left",className:"text-xs",children:t})]}),p.jsx("div",{className:"min-w-0 overflow-hidden",children:p.jsx(SI,{value:e,formatted:i,isDifferent:a})}),p.jsx("div",{className:"min-w-0 overflow-hidden",children:p.jsx(SI,{value:n,formatted:s,isDifferent:a})})]})}const Cfe="ml-[22px]",Afe="ml-[38px]";function hW({category:t,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:i=!1,defaultOpen:s}){const a=D8(t,e,n),[o,l]=T.useState(s??a);if(r&&!a)return null;const c=t.subcategories&&t.subcategories.length>0;return p.jsxs(Ki,{open:o,onOpenChange:l,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:Rt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",i&&"ml-4",!a&&"opacity-40"),children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!o&&"-rotate-90")}),p.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),p.jsx(Qi,{children:c?p.jsx("div",{className:"mt-1",children:t.subcategories.map(d=>p.jsx(hW,{category:d,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:!0},d.key))}):p.jsx("div",{className:Rt("mt-1",i?Afe:Cfe),children:t.items.map(d=>p.jsx(Efe,{displayKey:d.displayKey,value1:e.get(d.key),value2:n.get(d.key),showOnlyDifferences:r},d.key))})})]})}function Nfe({config1:t,config2:e,run1Name:n,run2Name:r,run1Path:i,run2Path:s,run1Color:a,run2Color:o}){const[l,c]=T.useState(!0),d=T.useMemo(()=>_I(t),[t]),h=T.useMemo(()=>_I(e),[e]),g=T.useMemo(()=>{const _={...t};for(const[w,S]of Object.entries(e))w in _||(_[w]=S);return _},[t,e]),v=T.useMemo(()=>Mfe(g),[g]),b=T.useMemo(()=>{let _=0;for(const[w,S]of d){const E=h.get(w);P8(S,E)||_++}for(const[w]of h)d.has(w)||_++;return _},[d,h]);return p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-4 pb-2 border-b",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(W1,{variant:"secondary",className:"text-xs",children:[b," difference",b!==1?"s":""]})}),p.jsxs(Y0,{type:"single",value:l?"differences":"everything",onValueChange:_=>{_&&c(_==="differences")},variant:"outline",size:"sm",children:[p.jsx(Uo,{value:"everything",className:"text-xs px-3",children:"Everything"}),p.jsx(Uo,{value:"differences",className:"text-xs px-3",children:"Only differences"})]})]}),p.jsxs("div",{className:"grid grid-cols-[1fr_2fr_2fr] gap-3 pb-2 border-b text-sm font-medium",children:[p.jsx("span",{className:"text-muted-foreground",children:"Config"}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:a}}),p.jsx(t1,{text:n,className:"text-sm font-medium min-w-0"})]}),p.jsx("div",{className:"ml-4",children:p.jsx(t1,{text:i,className:"text-xs font-normal text-muted-foreground min-w-0"})})]}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:o}}),p.jsx(t1,{text:r,className:"text-sm font-medium min-w-0"})]}),p.jsx("div",{className:"ml-4",children:p.jsx(t1,{text:s,className:"text-xs font-normal text-muted-foreground min-w-0"})})]})]}),p.jsx(yv,{className:"h-[72vh]",children:p.jsx("div",{className:"space-y-1 pr-4",children:v.map(_=>{let w;return _.key==="hardware"&&(w=v.filter(E=>E.key!=="hardware"&&D8(E,d,h)).length===0),p.jsx(hW,{category:_,config1Map:d,config2Map:h,showOnlyDifferences:l,defaultOpen:w},_.key)})})})]})}function Rfe({currentRunId:t,currentConfig:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(null),{data:a,isLoading:o}=fm(),l=(a==null?void 0:a.runs)||[],{data:c,isLoading:d}=ed(i||"",!!i,!1),h=l.find(N=>N.run_id===t),g=l.find(N=>N.run_id===i),v=(h==null?void 0:h.color)??"",b=(g==null?void 0:g.color)??"",_=N=>{s(N)},w=()=>{s(null)},S=()=>{r(!1),setTimeout(()=>s(null),200)},E=(h==null?void 0:h.name)||t.split("/").pop()||t,A=(g==null?void 0:g.name)||(i==null?void 0:i.split("/").pop())||"";return p.jsxs($f,{open:n,onOpenChange:N=>{N?r(!0):S()},children:[p.jsx(sT,{asChild:!0,children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Compare"})}),p.jsx(qf,{className:"sm:max-w-4xl max-h-[95vh]",children:i?p.jsxs(p.Fragment,{children:[p.jsx(jd,{children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Tn,{variant:"ghost",size:"sm",onClick:w,className:"h-7 px-2",children:"← Back"}),p.jsx("div",{children:p.jsx(Fd,{children:"Configuration Comparison"})})]})}),d?p.jsxs("div",{className:"flex items-center justify-center py-16",children:[p.jsx(ll,{className:"h-6 w-6"}),p.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading configuration..."})]}):c!=null&&c.config?p.jsx(Nfe,{config1:c.config,config2:e,run1Name:A,run2Name:E,run1Path:i||"",run2Path:t,run1Color:b,run2Color:v}):p.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No configuration data available for the selected run."})]}):p.jsxs(p.Fragment,{children:[p.jsxs(jd,{children:[p.jsx(Fd,{children:"Compare Configuration"}),p.jsxs(Ng,{children:["Select another run to compare its configuration with"," ",p.jsx("span",{className:"font-sans text-foreground",children:E})]})]}),p.jsx(yv,{className:"h-[500px] pr-4",children:o?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(ll,{className:"h-5 w-5"})}):p.jsx(Tfe,{runs:l,currentRunId:t,onSelect:_})})]})})]})}class kfe{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),a=this.castInput(n,r),o=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(o,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const a=E=>{if(E=this.postProcess(E,r),i){setTimeout(function(){i(E)},0);return}else return E},o=n.length,l=e.length;let c=1,d=o+l;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,g=Date.now()+h,v=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(v[0],n,e,0,r);if(v[0].oldPos+1>=l&&b+1>=o)return a(this.buildValues(v[0].lastComponent,n,e));let _=-1/0,w=1/0;const S=()=>{for(let E=Math.max(_,-c);E<=Math.min(w,c);E+=2){let A;const N=v[E-1],I=v[E+1];N&&(v[E-1]=void 0);let P=!1;if(I){const R=I.oldPos-E;P=I&&0<=R&&R<o}const L=N&&N.oldPos+1<l;if(!P&&!L){v[E]=void 0;continue}if(!L||P&&N.oldPos<I.oldPos?A=this.addToPath(I,!0,!1,0,r):A=this.addToPath(N,!1,!0,1,r),b=this.extractCommon(A,n,e,E,r),A.oldPos+1>=l&&b+1>=o)return a(this.buildValues(A.lastComponent,n,e))||!0;v[E]=A,A.oldPos+1>=l&&(w=Math.min(w,E-1)),b+1>=o&&(_=Math.max(_,E+1))}c++};if(i)(function E(){setTimeout(function(){if(c>d||Date.now()>g)return i(void 0);S()||E()},0)})();else for(;c<=d&&Date.now()<=g;){const E=S();if(E)return E}}addToPath(e,n,r,i,s){const a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(e,n,r,i,s){const a=n.length,o=r.length;let l=e.oldPos,c=l-i,d=0;for(;c+1<a&&l+1<o&&this.equals(r[l+1],n[c+1],s);)c++,l++,d++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const a=i.length;let o=0,l=0,c=0;for(;o<a;o++){const d=i[o];if(d.removed)d.value=this.join(r.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&this.useLongestToken){let h=n.slice(l,l+d.count);h=h.map(function(g,v){const b=r[c+v];return b.length>g.length?b:g}),d.value=this.join(h)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return i}}class Pfe extends kfe{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const Dfe=new Pfe;function Ife(t,e,n){return Dfe.diff(t,e,n)}function Ofe({runs:t,currentRunId:e,selectedCompareRunId:n,onSelect:r}){return p.jsxs("div",{className:"flex flex-col gap-1",children:[t.map(i=>{const s=i.run_id===e,a=i.run_id===n,o=i.name||i.run_id.split("/").pop()||i.run_id;return p.jsxs("button",{onClick:()=>!s&&r(i.run_id),disabled:s,className:Rt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",s?"cursor-not-allowed opacity-40":Rt("cursor-pointer hover:bg-muted",a&&"bg-muted")),children:[p.jsx("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:i.color}}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"min-w-0",children:p.jsx(t1,{text:o,className:"text-sm font-medium"})}),p.jsx("div",{className:"truncate text-xs text-muted-foreground",children:i.run_id})]}),s&&p.jsx(W1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),!s&&a&&p.jsx(W1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Comparing"}),i.is_tracking&&p.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),i.is_syncing&&p.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),i.created_at&&p.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:V1(i.created_at)})]},i.run_id)}),t.length===0&&p.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No other runs available."})]})}function wI({currentRunId:t,selectedCompareRunId:e,onSelectCompareRun:n,disabled:r=!1}){const[i,s]=T.useState(!1),{data:a,isLoading:o}=fm(),l=(a==null?void 0:a.runs)??[],c=l.find(v=>v.run_id===t)??null,d=(c==null?void 0:c.name)||t.split("/").pop()||t,h=l.find(v=>v.run_id===e)??null,g=(h==null?void 0:h.name)||(h==null?void 0:h.run_id.split("/").pop())||null;return p.jsxs($f,{open:i,onOpenChange:v=>{s(v)},children:[p.jsx(sT,{asChild:!0,children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:r,children:"Compare"})}),p.jsxs(qf,{className:"sm:max-w-4xl max-h-[90vh]",children:[p.jsxs(jd,{children:[p.jsx(Fd,{children:"Select Run To Compare"}),p.jsxs(Ng,{children:["Choose another run to compare against"," ",p.jsx("span",{className:"font-sans text-foreground",children:d}),"."]})]}),e&&p.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-xs",children:[p.jsxs("span",{className:"text-muted-foreground",children:["Currently comparing with"," ",p.jsx("span",{className:"font-medium text-foreground",children:g||e})]}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{n(null),s(!1)},children:"Stop comparing"})]}),p.jsx(yv,{className:"h-[480px] pr-4",children:o?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(ll,{className:"h-5 w-5"})}):p.jsx(Ofe,{runs:l,currentRunId:t,selectedCompareRunId:e,onSelect:v=>{n(v),s(!1)}})})]})]})}const Lfe={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"]},zfe=new Set(["python","bash","yaml","toml"]),jfe=new Set(["sql"]);function Ffe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ufe(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 Bfe(t){return zfe.has(t)?"#.*$":jfe.has(t)?"--.*$":t==="json"?null:"//.*$"}function M0(t,e){if(t.length===0)return[{text:" "}];const n=Lfe[e]??[],r=new Set(n),i="\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`",s=Bfe(e),a=n.length>0?`\\b(?:${n.map(g=>Ffe(g)).join("|")})\\b`:null,o="\\b\\d+(?:\\.\\d+)?\\b",l=[i];s&&l.push(s),a&&l.push(a),l.push(o);const c=new RegExp(l.join("|"),"g"),d=[];let h=0;for(const g of t.matchAll(c)){const v=g[0]??"",b=g.index;if(b===void 0||v.length===0)continue;b>h&&d.push({text:t.slice(h,b)});let _;v.startsWith('"')||v.startsWith("'")||v.startsWith("`")?_="text-emerald-600 dark:text-emerald-400":v.startsWith("#")||v.startsWith("//")||v.startsWith("--")?_="text-muted-foreground":r.has(v)?_="text-violet-600 dark:text-violet-400":/^\d/.test(v)&&(_="text-amber-600 dark:text-amber-400"),d.push({text:v,className:_}),h=b+v.length}return h<t.length&&d.push({text:t.slice(h)}),d}function Hfe(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 qC(t,e){const n=t.split(/\r?\n/);if(e!=="python")return n.map(s=>M0(s,e));let r=null;const i=[];for(const s of n){if(s.length===0){i.push([{text:" "}]);continue}if(r){const g=s.indexOf(r);if(g===-1){i.push([{text:s,className:"text-muted-foreground"}]);continue}const v=s.slice(0,g+3),b=s.slice(g+3),_=[{text:v,className:"text-muted-foreground"}];r=null,b.length>0&&_.push(...M0(b,e)),i.push(_);continue}const a=Hfe(s);if(!a){i.push(M0(s,e));continue}const o=s.indexOf(a.quote,a.index+3),l=s.slice(0,a.index);if(o===-1){const g=[];l.length>0&&g.push(...M0(l,e)),g.push({text:s.slice(a.index),className:"text-muted-foreground"}),i.push(g),r=a.quote;continue}const c=[],d=s.slice(a.index,o+3),h=s.slice(o+3);l.length>0&&c.push(...M0(l,e)),c.push({text:d,className:"text-muted-foreground"}),h.length>0&&c.push(...M0(h,e)),i.push(c)}return i}function MI(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 Vfe(t,e){const n=MI(t),r=MI(e),i=Ife(n,r),s=[];let a=1,o=1;for(const l of i)for(const c of l.value)l.added?(s.push({kind:"add",text:c,leftLine:null,rightLine:o}),o+=1):l.removed?(s.push({kind:"remove",text:c,leftLine:a,rightLine:null}),a+=1):(s.push({kind:"context",text:c,leftLine:a,rightLine:o}),a+=1,o+=1);return s}function pW(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)?pW(e.children):void 0}})}function mW(t,e){const n=new Map(t.map(a=>[a.name,a])),r=new Map(e.map(a=>[a.name,a])),i=Array.from(new Set([...n.keys(),...r.keys()]));i.sort((a,o)=>{const l=n.get(a)??r.get(a),c=n.get(o)??r.get(o);return!l||!c?a.localeCompare(o):l.type!==c.type?l.type==="directory"?-1:1:l.name.localeCompare(c.name)});const s=[];for(const a of i){const o=n.get(a),l=r.get(a);if(!o&&!l)continue;const c=o??l;if(!c)continue;const d=o?l?"common":"removed":"added";if(c.type==="directory"){const h=mW((o==null?void 0:o.children)??[],(l==null?void 0:l.children)??[]),g=d==="common"&&h.some(v=>v.status!=="common")?"modified":d;s.push({name:c.name,path:c.path,type:"directory",status:g,children:h})}else{const h=d==="common"&&(o==null?void 0:o.hash)!=null&&(l==null?void 0:l.hash)!=null&&o.hash!==l.hash?"modified":d;s.push({name:c.name,path:c.path,type:"file",status:h})}}return s}function Gfe(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 XC(t){const e=t.split("/"),n=[];for(let r=1;r<e.length;r++)n.push(e.slice(0,r).join("/"));return n}function Wfe(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 gW(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=gW(n.children);if(r)return r}}return null}function eR(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)&&eR(r.children,e))return!0;return!1}function vW(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)&&vW(r.children,e))return!0;return!1}function TI(t){const e=new Set;for(const n of t)n.type==="directory"&&e.add(n.path);return e}function $fe({runPath:t,onBack:e}){const[n,r]=T.useState(null),[i,s]=T.useState(null),[a,o]=T.useState(null),[l,c]=T.useState(null),[d,h]=T.useState(0),[g,v]=T.useState(null),b=T.useRef({}),_=T.useRef({}),w=T.useRef(!1),S=T.useRef(null),E=T.useRef(null),{data:A}=fm(),N=(A==null?void 0:A.runs.find(Vt=>Vt.run_id===t))??null,I=(N==null?void 0:N.name)||t.split("/").pop()||t,P=(A==null?void 0:A.runs.find(Vt=>Vt.run_id===a))??null,L=(P==null?void 0:P.name)||(a==null?void 0:a.split("/").pop())||a,{data:R,isLoading:O,error:W}=eI(t,!!t),{data:U,isLoading:V,error:G}=eI(a||"",!!a),{data:Z,isFetching:B}=uue(a||"",t,!!a&&!!(R!=null&&R.available)&&!!(U!=null&&U.available)&&!V),q=T.useMemo(()=>R!=null&&R.available?R.tree:[],[R]),Y=T.useMemo(()=>U!=null&&U.available?U.tree:[],[U]),K=a!==null,J=K&&!V&&(U==null?void 0:U.available)===!0,F=T.useMemo(()=>J?mW(Y,q):pW(q),[J,q,Y]),j=TI(F),X=n??j,H=F.length===0?null:i&&vW(F,i)?i:gW(F),se=Ufe(H),re=!!H&&eR(q,H),ie=!!H&&eR(Y,H),{data:ue,isLoading:le,isFetching:fe,error:xe}=tI(t,H??"",!!t&&!!H&&!!(R!=null&&R.available)&&re),{data:he,isLoading:Te,isFetching:We,error:Se}=tI(a??"",H??"",!!a&&!!H&&!!(U!=null&&U.available)&&ie),Le=re?ue:null,pe=ie?he:null,Re=H&&(Le==null?void 0:Le.file_path)===H?Le:null,ne=H&&(pe==null?void 0:pe.file_path)===H?pe:null,Xe=(Le==null?void 0:Le.content)??null,Ae=(Re==null?void 0:Re.content)??null,Pe=(ne==null?void 0:ne.content)??null,Ke=re?Ae:"",oe=ie?Pe:"",te=H&&(g==null?void 0:g.targetPath)===H?g:null,ve=K&&!(Ke!==null&&oe!==null)&&te!==null,ye=ve?te.rightContent:Ke,ke=ve?te.leftContent:oe,Be=Vt=>{r(pn=>{const Bt=new Set(pn??j);return Bt.has(Vt)?Bt.delete(Vt):Bt.add(Vt),Bt})},ge=(Vt,pn)=>Vt.map(Bt=>{var On;const Cn=Bt.status==="added"?"text-emerald-700 dark:text-emerald-400":Bt.status==="removed"?"text-[#f27c7e] line-through":Bt.status==="modified"?"text-[#ab6100]":"",Bn=Bt.status==="added"?"text-emerald-700 dark:text-emerald-400":Bt.status==="removed"?"text-[#f27c7e]":Bt.status==="modified"?"text-[#ab6100]":"text-muted-foreground";if(Bt.type==="directory"){const jn=X.has(Bt.path);return p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>Be(Bt.path),className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",style:{paddingLeft:`${pn*14+6}px`},children:[p.jsx("span",{className:Rt("inline-flex h-4 w-4 items-center justify-center",Bn),children:jn?p.jsx(Vr,{className:"h-3 w-3"}):p.jsx(u1,{className:"h-3 w-3"})}),jn?p.jsx(Lle,{className:Rt("h-3.5 w-3.5",Bn)}):p.jsx(jle,{className:Rt("h-3.5 w-3.5",Bn)}),p.jsx("span",{className:Rt("truncate",Cn),children:Bt.name})]}),jn&&((On=Bt.children)!=null&&On.length)?ge(Bt.children,pn+1):null]},Bt.path)}const wn=H===Bt.path;return p.jsxs("button",{type:"button",ref:jn=>{_.current[Bt.path]=jn},onClick:()=>{zt(Bt.path),s(Bt.path),K&&(h(0),w.current=!0,S.current=Bt.path)},className:Rt("flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",wn&&"bg-muted font-medium"),style:{paddingLeft:`${pn*14+26}px`},children:[p.jsx(Ile,{className:Rt("h-3.5 w-3.5",Bn)}),p.jsx("span",{className:Rt("truncate",Cn),children:Bt.name})]},Bt.path)}),Ye=T.useMemo(()=>qC(Xe??"",se),[Xe,se]),Qe=T.useMemo(()=>qC(ke??"",se),[ke,se]),Ie=T.useMemo(()=>qC(ye??"",se),[ye,se]),Fe=T.useMemo(()=>!K||!H?[]:Vfe(ke??"",ye??""),[K,H,ke,ye]),Ge=!!H&&K&&!ve&&(re&&Ke===null&&!xe||ie&&oe===null&&!Se),Me=!!H&&K&&(re&&fe||ie&&We),$e=!re||Re!==null&&!le&&!fe,dt=!ie||ne!==null&&!Te&&!We,Oe=!!(ne!=null&&ne.is_binary),st=!!(Le!=null&&Le.is_binary),ft=!!(Re!=null&&Re.is_binary),pt=K?re?ye:ie?ke:null:Xe,Ze=!!H&&pt!==null&&!(K?re?ft:ie?Oe:!1:st),me=T.useMemo(()=>Wfe(Fe),[Fe]),je=T.useMemo(()=>Gfe(F),[F]),He=H?je.indexOf(H):-1,nt=me.length>0?(d%me.length+me.length)%me.length:0,yt=me.length>0?nt+1:0,lt=je.length>0&&He>=0?He+1:0,bt=T.useMemo(()=>Fe.reduce((Vt,pn)=>Vt+(pn.kind==="add"?1:0),0),[Fe]),Nt=T.useMemo(()=>Fe.reduce((Vt,pn)=>Vt+(pn.kind==="remove"?1:0),0),[Fe]),Pt=(Z==null?void 0:Z.added_lines)??0,Ve=(Z==null?void 0:Z.removed_lines)??0,wt=l!==null&&l===H,Et=async()=>{!Ze||pt===null||(await navigator.clipboard.writeText(pt),c(H),setTimeout(()=>c(null),2e3))},zt=Vt=>{K&&v({targetPath:Vt,leftContent:ke??"",rightContent:ye??""})},Ht=Vt=>{var Cn;if(me.length===0)return;const pn=(nt+Vt+me.length)%me.length;h(pn);const Bt=me[pn].startRowIndex;(Cn=b.current[Bt])==null||Cn.scrollIntoView({behavior:"smooth",block:"center"})},an=Vt=>{if(je.length===0)return;const pn=He<0?Vt===1?0:je.length-1:(He+Vt+je.length)%je.length;if(pn===He)return;const Bt=je[pn];zt(Bt),s(Bt),r(Cn=>{const Bn=new Set(Cn??j);for(const wn of XC(Bt))Bn.add(wn);return Bn}),h(0),w.current=!0,S.current=Bt,setTimeout(()=>{var Cn;(Cn=_.current[Bt])==null||Cn.scrollIntoView({behavior:"smooth",block:"center"})},0)},Dn=()=>{if(je.length===0)return;const Vt=je[0];zt(Vt),s(Vt),r(pn=>{const Bt=new Set(pn??j);for(const Cn of XC(Vt))Bt.add(Cn);return Bt}),h(0),w.current=!0,S.current=Vt,setTimeout(()=>{var pn;(pn=_.current[Vt])==null||pn.scrollIntoView({behavior:"smooth",block:"center"})},0)};return T.useEffect(()=>{E.current=a,a===null&&(w.current=!1,S.current=null)},[a]),T.useEffect(()=>{if(!K||!a||!J||E.current!==a||(E.current=null,je.length===0))return;const Vt=je[0];w.current=!0,S.current=Vt;const pn=window.setTimeout(()=>{var Bt;H!==Vt&&(v({targetPath:Vt,leftContent:ke??"",rightContent:ye??""}),s(Vt),r(Cn=>{const Bn=new Set(Cn??TI(F));for(const wn of XC(Vt))Bn.add(wn);return Bn})),h(0),(Bt=_.current[Vt])==null||Bt.scrollIntoView({behavior:"smooth",block:"center"})},0);return()=>window.clearTimeout(pn)},[K,a,J,je,H,ke,ye,F]),T.useEffect(()=>{if(!K||!H||!w.current||S.current!==null&&S.current!==H||!$e||!dt)return;const Vt=me.length>0?me[0].startRowIndex:null,pn=requestAnimationFrame(()=>{var Bt;Vt!==null&&((Bt=b.current[Vt])==null||Bt.scrollIntoView({behavior:"smooth",block:"center"})),w.current=!1,S.current=null});return()=>cancelAnimationFrame(pn)},[K,H,me,$e,dt]),p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[K&&L&&p.jsxs("div",{className:"flex h-9 items-center gap-2 border-b px-3 text-xs",children:[p.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[p.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[p.jsx("span",{className:"truncate font-medium",children:L}),(P==null?void 0:P.created_at)&&p.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:V1(P.created_at)})]}),p.jsx(ple,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[p.jsx("span",{className:"truncate font-medium",children:I}),(N==null?void 0:N.created_at)&&p.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:V1(N.created_at)})]})]}),p.jsxs("div",{className:"ml-2 flex shrink-0 items-center gap-2 tabular-nums",children:[p.jsxs("span",{className:Rt("text-emerald-700 transition-opacity dark:text-emerald-400",B&&"opacity-70"),children:["+",Pt]}),p.jsxs("span",{className:Rt("text-red-500 transition-opacity dark:text-red-300",B&&"opacity-70"),children:["-",Ve]})]}),p.jsx(Tn,{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:()=>{o(null),v(null),h(0),w.current=!1,S.current=null},children:p.jsx(Ju,{className:"h-3.5 w-3.5"})})]}),p.jsx("div",{className:"min-h-0 flex-1",children:O&&!R?p.jsx("div",{className:"h-full min-h-0"}):W?p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[p.jsx("div",{className:"flex h-10 items-center border-b px-2",children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[p.jsx(OC,{className:"mr-1 h-3.5 w-3.5"}),"Back"]})}),p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load code tree."})]}):R!=null&&R.available?p.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden grid-cols-1 lg:grid-cols-[320px_minmax(0,1fr)]",children:[p.jsxs("div",{className:"flex min-h-0 flex-col border-b lg:border-b-0 lg:border-r",children:[p.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[p.jsx(OC,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),p.jsx(wI,{currentRunId:t,selectedCompareRunId:a,onSelectCompareRun:o,disabled:!H})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2",children:ge(F,0)})]}),p.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col",children:[p.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-3",children:[p.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:H??"Select a file"}),H&&p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",onClick:Et,disabled:!Ze,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:wt?"Copied!":"Copy code",children:wt?p.jsx(xv,{className:"h-3.5 w-3.5"}):p.jsx(iT,{className:"h-3.5 w-3.5"})}),p.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:se})]}),K&&H&&p.jsxs("div",{className:"ml-1 flex shrink-0 items-center gap-2 text-[11px] tabular-nums",children:[p.jsxs("span",{className:"text-emerald-700 dark:text-emerald-400",children:["+",bt]}),p.jsxs("span",{className:"text-red-500 dark:text-red-300",children:["-",Nt]})]})]}),p.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[p.jsx("div",{className:Rt("h-full overflow-auto",K&&"pb-14"),children:H?K?V&&!U?p.jsx("div",{className:"h-full"}):G?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load compared run code."}):a&&!V&&U&&!U.available?p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Compared run has no downloaded code snapshot."}):Ge?p.jsx("div",{className:"h-full"}):re&&xe&&!Re||ie&&Se&&!ne?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load one side of the comparison."}):ft||Oe?p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Binary file comparison is not supported."}):p.jsx("div",{className:Rt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",Me&&"opacity-50"),children:Fe.map((Vt,pn)=>{const Bt=Vt.kind==="add"?Ie[(Vt.rightLine??1)-1]??M0(Vt.text.length>0?Vt.text:" ",se):Qe[(Vt.leftLine??1)-1]??M0(Vt.text.length>0?Vt.text:" ",se);return p.jsxs("div",{ref:Cn=>{Vt.kind!=="context"&&(b.current[pn]=Cn)},className:Rt("flex",Vt.kind==="add"&&"bg-emerald-500/18",Vt.kind==="remove"&&"bg-red-400/10"),children:[p.jsxs("div",{className:Rt("sticky left-0 z-10 flex shrink-0 bg-background",Vt.kind==="add"&&"border-l-2 border-emerald-500/60",Vt.kind==="remove"&&"border-l-2 border-red-400/35"),children:[p.jsx("span",{className:Rt("select-none w-6 px-1.5 py-0.5 text-right text-[11px]",Vt.kind==="add"&&"bg-emerald-500/18 text-emerald-700 dark:text-emerald-400",Vt.kind==="remove"&&"bg-red-400/10 text-red-500 dark:text-red-300",Vt.kind==="context"&&"text-muted-foreground"),children:Vt.kind==="add"?"+":Vt.kind==="remove"?"-":" "}),p.jsx("span",{className:Rt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",Vt.kind==="add"&&"bg-emerald-500/18",Vt.kind==="remove"&&"bg-red-400/10"),children:Vt.leftLine??""}),p.jsx("span",{className:Rt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",Vt.kind==="add"&&"bg-emerald-500/18",Vt.kind==="remove"&&"bg-red-400/10"),children:Vt.rightLine??""})]}),p.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Bt.map((Cn,Bn)=>p.jsx("span",{className:Rt(Cn.className),children:Cn.text},`diff-line-${pn}-token-${Bn}`))})]},`diff-line-${pn}`)})}):le&&!Le?p.jsx("div",{className:"h-full"}):xe&&!Le?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load file content."}):st?p.jsx("div",{className:Rt("p-4 text-sm text-muted-foreground transition-opacity",fe&&"opacity-50"),children:"Binary file preview is not supported."}):p.jsxs("div",{className:Rt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",fe&&"opacity-50"),children:[(Le==null?void 0:Le.truncated)&&p.jsx("div",{className:"border-b px-3 py-1 text-[11px] text-muted-foreground",children:"Showing first 2MB of this file."}),Ye.map((Vt,pn)=>p.jsxs("div",{className:"flex",children:[p.jsx("div",{className:"sticky left-0 z-10 flex shrink-0 bg-background",children:p.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:pn+1})}),p.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Vt.map((Bt,Cn)=>p.jsx("span",{className:Rt(Bt.className),children:Bt.text},`line-${pn}-token-${Cn}`))})]},`line-${pn}`))]}):p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Select a file on the left to view its source."})}),K&&H&&p.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:me.length===0?p.jsx("div",{className:"pointer-events-auto rounded-full border border-border/75 bg-background/90 px-2 py-1 backdrop-blur-sm",children:p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:Dn,disabled:je.length===0,children:p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx("span",{children:"See Changes"}),p.jsx(u1,{className:"h-3.5 w-3.5"})]})})}):p.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:[p.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Ht(-1),disabled:me.length===0,children:p.jsx(h8,{className:"h-3.5 w-3.5"})}),p.jsxs("span",{className:"min-w-[4rem] text-center tabular-nums",children:[yt," / ",me.length]}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Ht(1),disabled:me.length===0,children:p.jsx(Vr,{className:"h-3.5 w-3.5"})})]}),p.jsx("div",{className:"h-4 w-px bg-border"}),p.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>an(-1),disabled:je.length===0,children:p.jsx(f8,{className:"h-3.5 w-3.5"})}),p.jsxs("span",{className:"min-w-[6rem] text-center tabular-nums",children:[lt," / ",je.length," files"]}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>an(1),disabled:je.length===0,children:p.jsx(u1,{className:"h-3.5 w-3.5"})})]})]})})]})]})]}):p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[p.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[p.jsx(OC,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),p.jsx(wI,{currentRunId:t,selectedCompareRunId:a,onSelectCompareRun:o,disabled:!H})]}),p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"This run does not have a local `code/source.zip` extracted yet."})]})})]})}function hm({description:t}){const e=ki(fG),n=zd(hG),r=zd(pG),{data:i,isLoading:s}=fm(),a=(i==null?void 0:i.runs)??[],o=i==null?void 0:i.discovery,l=(i==null?void 0:i.has_wandb_key)??e,c=a.length>0,d=(i==null?void 0:i.has_known_projects)??!1,h=(o==null?void 0:o.status)==="discovering",g=!s&&!h&&!l&&!c,v=!s&&!h&&!g&&l&&!c&&!d,b=!g&&!v&&!c;return h?p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsx($u,{className:"max-w-md w-full border-dashed",children:p.jsxs(xI,{className:"items-center text-center",children:[p.jsx(n4,{children:"Fetching runs from W&B…"}),p.jsxs(r4,{className:"flex items-center gap-1.5 font-medium",children:[p.jsx(ll,{className:"h-3 w-3 shrink-0"}),(o==null?void 0:o.runs_found)??0," found"]})]})})}):b?p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"})}):p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsx($u,{className:"max-w-md w-full border-dashed",children:p.jsx(xI,{className:"text-center items-center",children:g?p.jsxs(p.Fragment,{children:[p.jsx(n4,{children:"No wandb key added yet"}),p.jsx(r4,{children:"Add your W&B API key to discover and sync runs."}),p.jsx(Tn,{className:"mt-4 bg-green-600 hover:bg-green-700",onClick:()=>n(!0),children:"Add wandb key"})]}):v?p.jsxs(p.Fragment,{children:[p.jsx(n4,{children:"Add a project"}),p.jsx(r4,{children:"Add a W&B project to start discovering telescope-tagged runs."}),p.jsx(Tn,{className:"mt-4",onClick:()=>r(!0),children:"Add project"})]}):p.jsxs(p.Fragment,{children:[p.jsx(n4,{children:"No Run Selected"}),p.jsx(r4,{children:t})]})})})})}const qfe=!0,lo="u-",Xfe="uplot",Yfe=lo+"hz",Kfe=lo+"vt",Zfe=lo+"title",Qfe=lo+"wrap",Jfe=lo+"under",ehe=lo+"over",the=lo+"axis",Eg=lo+"off",nhe=lo+"select",rhe=lo+"cursor-x",ihe=lo+"cursor-y",she=lo+"cursor-pt",ahe=lo+"legend",ohe=lo+"live",lhe=lo+"inline",che=lo+"series",uhe=lo+"marker",EI=lo+"label",dhe=lo+"value",h_="width",p_="height",Hb="top",CI="bottom",wx="left",YC="right",I8="#000",AI=I8+"0",KC="mousemove",NI="mousedown",ZC="mouseup",RI="mouseenter",kI="mouseleave",PI="dblclick",fhe="resize",hhe="scroll",DI="change",g2="dppxchange",O8="--",Sy=typeof window<"u",tR=Sy?document:null,m1=Sy?window:null,phe=Sy?navigator:null;let Ni,i4;function nR(){let t=devicePixelRatio;Ni!=t&&(Ni=t,i4&&iR(DI,i4,nR),i4=matchMedia(`(min-resolution: ${Ni-.001}dppx) and (max-resolution: ${Ni+.001}dppx)`),Gg(DI,i4,nR),m1.dispatchEvent(new CustomEvent(g2)))}function Gc(t,e){if(e!=null){let n=t.classList;!n.contains(e)&&n.add(e)}}function rR(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function As(t,e,n){t.style[e]=n+"px"}function Nd(t,e,n,r){let i=tR.createElement(t);return e!=null&&Gc(i,e),n!=null&&n.insertBefore(i,r),i}function Iu(t,e){return Nd("div",t,e)}const II=new WeakMap;function Ef(t,e,n,r,i){let s="translate("+e+"px,"+n+"px)",a=II.get(t);s!=a&&(t.style.transform=s,II.set(t,s),e<0||n<0||e>r||n>i?Gc(t,Eg):rR(t,Eg))}const OI=new WeakMap;function LI(t,e,n){let r=e+n,i=OI.get(t);r!=i&&(OI.set(t,r),t.style.background=e,t.style.borderColor=n)}const zI=new WeakMap;function jI(t,e,n,r){let i=e+""+n,s=zI.get(t);i!=s&&(zI.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 L8={passive:!0},mhe={...L8,capture:!0};function Gg(t,e,n,r){e.addEventListener(t,n,r?mhe:L8)}function iR(t,e,n,r){e.removeEventListener(t,n,L8)}Sy&&nR();function Dd(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:eu((n+r)/2),e[i]<t?n=i:r=i;return t-e[n]<=e[r]-t?n:r}function xW(t){return(n,r,i)=>{let s=-1,a=-1;for(let o=r;o<=i;o++)if(t(n[o])){s=o;break}for(let o=i;o>=r;o--)if(t(n[o])){a=o;break}return[s,a]}}const yW=t=>t!=null,bW=t=>t!=null&&t>0,_T=xW(yW),ghe=xW(bW);function vhe(t,e,n,r=0,i=!1){let s=i?ghe:_T,a=i?bW:yW;[e,n]=s(t,e,n);let o=t[e],l=t[e];if(e>-1)if(r==1)o=t[e],l=t[n];else if(r==-1)o=t[n],l=t[e];else for(let c=e;c<=n;c++){let d=t[c];a(d)&&(d<o?o=d:d>l&&(l=d))}return[o??ts,l??-ts]}function ST(t,e,n,r){let i=BI(t),s=BI(e);t==e&&(i==-1?(t*=n,e/=n):(t/=n,e*=n));let a=n==10?ap:_W,o=i==1?eu:Fu,l=s==1?Fu:eu,c=o(a(no(t))),d=l(a(no(e))),h=$1(n,c),g=$1(n,d);return n==10&&(c<0&&(h=ns(h,-c)),d<0&&(g=ns(g,-d))),r||n==2?(t=h*i,e=g*s):(t=TW(t,h),e=wT(e,g)),[t,e]}function z8(t,e,n,r){let i=ST(t,e,n,r);return t==0&&(i[0]=0),e==0&&(i[1]=0),i}const j8=.1,FI={mode:3,pad:j8},E_={pad:0,soft:null,mode:0},xhe={min:E_,max:E_};function v2(t,e,n,r){return MT(n)?UI(t,e,n):(E_.pad=n,E_.soft=r?0:null,E_.mode=r?3:0,UI(t,e,xhe))}function wi(t,e){return t??e}function yhe(t,e,n){for(e=wi(e,0),n=wi(n,t.length-1);e<=n;){if(t[e]!=null)return!0;e++}return!1}function UI(t,e,n){let r=n.min,i=n.max,s=wi(r.pad,0),a=wi(i.pad,0),o=wi(r.hard,-ts),l=wi(i.hard,ts),c=wi(r.soft,ts),d=wi(i.soft,-ts),h=wi(r.mode,0),g=wi(i.mode,0),v=e-t,b=ap(v),_=Fl(no(t),no(e)),w=ap(_),S=no(w-b);(v<1e-24||S>10)&&(v=0,(t==0||e==0)&&(v=1e-24,h==2&&c!=ts&&(s=0),g==2&&d!=-ts&&(a=0)));let E=v||_||1e3,A=ap(E),N=$1(10,eu(A)),I=E*(v==0?t==0?.1:1:s),P=ns(TW(t-I,N/10),24),L=t>=c&&(h==1||h==3&&P<=c||h==2&&P>=c)?c:ts,R=Fl(o,P<L&&t>=L?L:Od(L,P)),O=E*(v==0?e==0?.1:1:a),W=ns(wT(e+O,N/10),24),U=e<=d&&(g==1||g==3&&W>=d||g==2&&W<=d)?d:-ts,V=Od(l,W>U&&e<=U?U:Fl(U,W));return R==V&&R==0&&(V=100),[R,V]}const bhe=new Intl.NumberFormat(Sy?phe.language:"en-US"),F8=t=>bhe.format(t),lu=Math,LM=lu.PI,no=lu.abs,eu=lu.floor,to=lu.round,Fu=lu.ceil,Od=lu.min,Fl=lu.max,$1=lu.pow,BI=lu.sign,ap=lu.log10,_W=lu.log2,_he=(t,e=1)=>lu.sinh(t)*e,QC=(t,e=1)=>lu.asinh(t/e),ts=1/0;function HI(t){return(ap((t^t>>31)-(t>>31))|0)+1}function sR(t,e,n){return Od(Fl(t,e),n)}function SW(t){return typeof t=="function"}function ri(t){return SW(t)?t:()=>t}const She=()=>{},wW=t=>t,MW=(t,e)=>e,whe=t=>null,VI=t=>!0,GI=(t,e)=>t==e,Mhe=/\.\d*?(?=9{6,}|0{6,})/gm,iv=t=>{if(CW(t)||K0.has(t))return t;const e=`${t}`,n=e.match(Mhe);if(n==null)return t;let r=n[0].length-1;if(e.indexOf("e-")!=-1){let[i,s]=e.split("e");return+`${iv(i)}e${s}`}return ns(t,r)};function _g(t,e){return iv(ns(iv(t/e))*e)}function wT(t,e){return iv(Fu(iv(t/e))*e)}function TW(t,e){return iv(eu(iv(t/e))*e)}function ns(t,e=0){if(CW(t))return t;let n=10**e,r=t*n*(1+Number.EPSILON);return to(r)/n}const K0=new Map;function EW(t){return((""+t).split(".")[1]||"").length}function uS(t,e,n,r){let i=[],s=r.map(EW);for(let a=e;a<n;a++){let o=no(a),l=ns($1(t,a),o);for(let c=0;c<r.length;c++){let d=t==10?+`${r[c]}e${a}`:r[c]*l,h=(a>=0?0:o)+(a>=s[c]?0:s[c]),g=t==10?d:ns(d,h);i.push(g),K0.set(g,h)}}return i}const C_={},U8=[],q1=[null,null],T0=Array.isArray,CW=Number.isInteger,The=t=>t===void 0;function WI(t){return typeof t=="string"}function MT(t){let e=!1;if(t!=null){let n=t.constructor;e=n==null||n==Object}return e}function Ehe(t){return t!=null&&typeof t=="object"}const Che=Object.getPrototypeOf(Uint8Array),AW="__proto__";function X1(t,e=MT){let n;if(T0(t)){let r=t.find(i=>i!=null);if(T0(r)||e(r)){n=Array(t.length);for(let i=0;i<t.length;i++)n[i]=X1(t[i],e)}else n=t.slice()}else if(t instanceof Che)n=t.slice();else if(e(t)){n={};for(let r in t)r!=AW&&(n[r]=X1(t[r],e))}else n=t;return n}function Ba(t){let e=arguments;for(let n=1;n<e.length;n++){let r=e[n];for(let i in r)i!=AW&&(MT(t[i])?Ba(t[i],X1(r[i])):t[i]=X1(r[i]))}return t}const Ahe=0,Nhe=1,Rhe=2;function khe(t,e,n){for(let r=0,i,s=-1;r<e.length;r++){let a=e[r];if(a>s){for(i=a-1;i>=0&&t[i]==null;)t[i--]=null;for(i=a+1;i<n&&t[i]==null;)t[s=i++]=null}}}function Phe(t,e){if(Ohe(t)){let a=t[0].slice();for(let o=1;o<t.length;o++)a.push(...t[o].slice(1));return Lhe(a[0])||(a=Ihe(a)),a}let n=new Set;for(let a=0;a<t.length;a++){let l=t[a][0],c=l.length;for(let d=0;d<c;d++)n.add(l[d])}let r=[Array.from(n).sort((a,o)=>a-o)],i=r[0].length,s=new Map;for(let a=0;a<i;a++)s.set(r[0][a],a);for(let a=0;a<t.length;a++){let o=t[a],l=o[0];for(let c=1;c<o.length;c++){let d=o[c],h=Array(i).fill(void 0),g=e?e[a][c]:Nhe,v=[];for(let b=0;b<d.length;b++){let _=d[b],w=s.get(l[b]);_===null?g!=Ahe&&(h[w]=_,g==Rhe&&v.push(w)):h[w]=_}khe(h,v,i),r.push(h)}}return r}const Dhe=typeof queueMicrotask>"u"?t=>Promise.resolve().then(t):queueMicrotask;function Ihe(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,a)=>e[s]-e[a]);let i=[];for(let s=0;s<t.length;s++){let a=t[s],o=Array(n);for(let l=0;l<n;l++)o[l]=a[r[l]];i.push(o)}return i}function Ohe(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 Lhe(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=Fl(1,eu((i-r+1)/e));for(let a=t[r],o=r+s;o<=i;o+=s){const l=t[o];if(l!=null){if(l<=a)return!1;a=l}}return!0}const NW=["January","February","March","April","May","June","July","August","September","October","November","December"],RW=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function kW(t){return t.slice(0,3)}const zhe=RW.map(kW),jhe=NW.map(kW),Fhe={MMMM:NW,MMM:jhe,WWWW:RW,WWW:zhe};function Vb(t){return(t<10?"0":"")+t}function Uhe(t){return(t<10?"00":t<100?"0":"")+t}const Bhe={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=>Vb(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>Vb(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>Vb(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=>Vb(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>Vb(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>Uhe(t.getMilliseconds())};function B8(t,e){e=e||Fhe;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(t);)n.push(i[0][0]=="{"?Bhe[i[1]]:i[0]);return s=>{let a="";for(let o=0;o<n.length;o++)a+=typeof n[o]=="string"?n[o]:n[o](s,e);return a}}const Hhe=new Intl.DateTimeFormat().resolvedOptions().timeZone;function Vhe(t,e){let n;return e=="UTC"||e=="Etc/UTC"?n=new Date(+t+t.getTimezoneOffset()*6e4):e==Hhe?n=t:(n=new Date(t.toLocaleString("en-US",{timeZone:e})),n.setMilliseconds(t.getMilliseconds())),n}const PW=t=>t%1==0,x2=[1,2,2.5,5],Ghe=uS(10,-32,0,x2),DW=uS(10,0,32,x2),Whe=DW.filter(PW),Sg=Ghe.concat(DW),H8=`
`,IW="{YYYY}",$I=H8+IW,OW="{M}/{D}",m_=H8+OW,s4=m_+"/{YY}",LW="{aa}",$he="{h}:{mm}",Qx=$he+LW,qI=H8+Qx,XI=":{ss}",zi=null;function zW(t){let e=t*1e3,n=e*60,r=n*60,i=r*24,s=i*30,a=i*365,l=(t==1?uS(10,0,3,x2).filter(PW):uS(10,-3,0,x2)).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,a,a*2,a*5,a*10,a*25,a*50,a*100]);const c=[[a,IW,zi,zi,zi,zi,zi,zi,1],[i*28,"{MMM}",$I,zi,zi,zi,zi,zi,1],[i,OW,$I,zi,zi,zi,zi,zi,1],[r,"{h}"+LW,s4,zi,m_,zi,zi,zi,1],[n,Qx,s4,zi,m_,zi,zi,zi,1],[e,XI,s4+" "+Qx,zi,m_+" "+Qx,zi,qI,zi,1],[t,XI+".{fff}",s4+" "+Qx,zi,m_+" "+Qx,zi,qI,zi,1]];function d(h){return(g,v,b,_,w,S)=>{let E=[],A=w>=a,N=w>=s&&w<a,I=h(b),P=ns(I*t,3),L=JC(I.getFullYear(),A?0:I.getMonth(),N||A?1:I.getDate()),R=ns(L*t,3);if(N||A){let O=N?w/s:0,W=A?w/a:0,U=P==R?P:ns(JC(L.getFullYear()+W,L.getMonth()+O,1)*t,3),V=new Date(to(U/t)),G=V.getFullYear(),Z=V.getMonth();for(let B=0;U<=_;B++){let q=JC(G+W*B,Z+O*B,1),Y=q-h(ns(q*t,3));U=ns((+q+Y)*t,3),U<=_&&E.push(U)}}else{let O=w>=i?i:w,W=eu(b)-eu(P),U=R+W+wT(P-R,O);E.push(U);let V=h(U),G=V.getHours()+V.getMinutes()/n+V.getSeconds()/r,Z=w/r,B=g.axes[v]._space,q=S/B;for(;U=ns(U+w,t==1?0:3),!(U>_);)if(Z>1){let Y=eu(ns(G+Z,6))%24,F=h(U).getHours()-Y;F>1&&(F=-1),U-=F*r,G=(G+Z)%24;let j=E[E.length-1];ns((U-j)/w,3)*q>=.7&&E.push(U)}else E.push(U)}return E}}return[l,c,d]}const[qhe,Xhe,Yhe]=zW(1),[Khe,Zhe,Qhe]=zW(.001);uS(2,-53,53,[1]);function YI(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 KI(t,e){return(n,r,i,s,a)=>{let o=e.find(b=>a>=b[0])||e[e.length-1],l,c,d,h,g,v;return r.map(b=>{let _=t(b),w=_.getFullYear(),S=_.getMonth(),E=_.getDate(),A=_.getHours(),N=_.getMinutes(),I=_.getSeconds(),P=w!=l&&o[2]||S!=c&&o[3]||E!=d&&o[4]||A!=h&&o[5]||N!=g&&o[6]||I!=v&&o[7]||o[1];return l=w,c=S,d=E,h=A,g=N,v=I,P(_)})}}function Jhe(t,e){let n=B8(e);return(r,i,s,a,o)=>i.map(l=>n(t(l)))}function JC(t,e,n){return new Date(t,e,n)}function ZI(t,e){return e(t)}const epe="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function QI(t,e){return(n,r,i,s)=>s==null?O8:e(t(r))}function tpe(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null}function npe(t,e){return t.series[e].fill(t,e)}const rpe={show:!0,live:!0,isolate:!1,mount:She,markers:{show:!0,width:2,stroke:tpe,fill:npe,dash:"solid"},idx:null,idxs:null,values:[]};function ipe(t,e){let n=t.cursor.points,r=Iu(),i=n.size(t,e);As(r,h_,i),As(r,p_,i);let s=i/-2;As(r,"marginLeft",s),As(r,"marginTop",s);let a=n.width(t,e,i);return a&&As(r,"borderWidth",a),r}function spe(t,e){let n=t.series[e].points;return n._fill||n._stroke}function ape(t,e){let n=t.series[e].points;return n._stroke||n._fill}function ope(t,e){return t.series[e].points.size}const eA=[0,0];function lpe(t,e,n){return eA[0]=e,eA[1]=n,eA}function a4(t,e,n,r=!0){return i=>{i.button==0&&(!r||i.target==e)&&n(i)}}function tA(t,e,n,r=!0){return i=>{(!r||i.target==e)&&n(i)}}const cpe={show:!0,x:!0,y:!0,lock:!1,move:lpe,points:{one:!1,show:ipe,size:ope,width:0,stroke:ape,fill:spe},bind:{mousedown:a4,mouseup:a4,click:a4,dblclick:a4,mousemove:tA,mouseleave:tA,mouseenter:tA},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(t,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(t,e,n,r,i)=>r-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},jW={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},V8=Ba({},jW,{filter:MW}),FW=Ba({},V8,{size:10}),UW=Ba({},jW,{show:!1}),G8='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"',BW="bold "+G8,HW=1.5,JI={show:!0,scale:"x",stroke:I8,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:BW,side:2,grid:V8,ticks:FW,border:UW,font:G8,lineGap:HW,rotate:0},upe="Value",dpe="Time",eO={show:!0,scale:"x",auto:!1,sorted:1,min:ts,max:-ts,idxs:[]};function fpe(t,e,n,r,i){return e.map(s=>s==null?"":F8(s))}function hpe(t,e,n,r,i,s,a){let o=[],l=K0.get(i)||0;n=a?n:ns(wT(n,i),l);for(let c=n;c<=r;c=ns(c+i,l))o.push(Object.is(c,-0)?0:c);return o}function aR(t,e,n,r,i,s,a){const o=[],l=t.scales[t.axes[e].scale].log,c=l==10?ap:_W,d=eu(c(n));i=$1(l,d),l==10&&(i=Sg[Dd(i,Sg)]);let h=n,g=i*l;l==10&&(g=Sg[Dd(g,Sg)]);do o.push(h),h=h+i,l==10&&!K0.has(h)&&(h=ns(h,K0.get(i))),h>=g&&(i=h,g=i*l,l==10&&(g=Sg[Dd(g,Sg)]));while(h<=r);return o}function ppe(t,e,n,r,i,s,a){let l=t.scales[t.axes[e].scale].asinh,c=r>l?aR(t,e,Fl(l,n),r,i):[l],d=r>=0&&n<=0?[0]:[];return(n<-l?aR(t,e,Fl(l,-r),-n,i):[l]).reverse().map(g=>-g).concat(d,c)}const VW=/./,mpe=/[12357]/,gpe=/[125]/,tO=/1/,oR=(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 vpe(t,e,n,r,i){let s=t.axes[n],a=s.scale,o=t.scales[a],l=t.valToPos,c=s._space,d=l(10,a),h=l(9,a)-d>=c?VW:l(7,a)-d>=c?mpe:l(5,a)-d>=c?gpe:tO;if(h==tO){let g=no(l(1,a)-d);if(g<c)return oR(e.slice().reverse(),o.distr,h,Fu(c/g)).reverse()}return oR(e,o.distr,h,1)}function xpe(t,e,n,r,i){let s=t.axes[n],a=s.scale,o=s._space,l=t.valToPos,c=no(l(1,a)-l(2,a));return c<o?oR(e.slice().reverse(),3,VW,Fu(o/c)).reverse():e}function ype(t,e,n,r){return r==null?O8:e==null?"":F8(e)}const nO={show:!0,scale:"y",stroke:I8,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:BW,side:3,grid:V8,ticks:FW,border:UW,font:G8,lineGap:HW,rotate:0};function bpe(t,e){let n=3+(t||1)*2;return ns(n*e,3)}function _pe(t,e){let{scale:n,idxs:r}=t.series[0],i=t._data[0],s=t.valToPos(i[r[0]],n,!0),a=t.valToPos(i[r[1]],n,!0),o=no(a-s),l=t.series[e],c=o/(l.points.space*Ni);return r[1]-r[0]<=c}const rO={scale:null,auto:!0,sorted:0,min:ts,max:-ts},GW=(t,e,n,r,i)=>i,iO={show:!0,auto:!0,sorted:0,gaps:GW,alpha:1,facets:[Ba({},rO,{scale:"x"}),Ba({},rO,{scale:"y"})]},sO={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:GW,alpha:1,points:{show:_pe,filter:null},values:null,min:ts,max:-ts,idxs:[],path:null,clip:null};function Spe(t,e,n,r,i){return n/10}const WW={time:qfe,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},wpe=Ba({},WW,{time:!1,ori:1}),aO={};function $W(t,e){let n=aO[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,a,o,l,c){for(let d=0;d<n.plots.length;d++)n.plots[d]!=i&&n.plots[d].pub(r,i,s,a,o,l,c)}},t!=null&&(aO[t]=n)),n}const Y1=1,lR=2;function bv(t,e,n){const r=t.mode,i=t.series[e],s=r==2?t._data[e]:t._data,a=t.scales,o=t.bbox;let l=s[0],c=r==2?s[1]:s[e],d=r==2?a[i.facets[0].scale]:a[t.series[0].scale],h=r==2?a[i.facets[1].scale]:a[i.scale],g=o.left,v=o.top,b=o.width,_=o.height,w=t.valToPosH,S=t.valToPosV;return d.ori==0?n(i,l,c,d,h,w,S,g,v,b,_,ET,wy,AT,XW,KW):n(i,l,c,d,h,S,w,v,g,_,b,CT,My,q8,YW,ZW)}function W8(t,e){let n=0,r=0,i=wi(t.bands,U8);for(let s=0;s<i.length;s++){let a=i[s];a.series[0]==e?n=a.dir:a.series[1]==e&&(a.dir==1?r|=1:r|=2)}return[n,r==1?-1:r==2?1:r==3?2:0]}function Mpe(t,e,n,r,i){let s=t.mode,a=t.series[e],o=s==2?a.facets[1].scale:a.scale,l=t.scales[o];return i==-1?l.min:i==1?l.max:l.distr==3?l.dir==1?l.min:l.max:0}function op(t,e,n,r,i,s){return bv(t,e,(a,o,l,c,d,h,g,v,b,_,w)=>{let S=a.pxRound;const E=c.dir*(c.ori==0?1:-1),A=c.ori==0?wy:My;let N,I;E==1?(N=n,I=r):(N=r,I=n);let P=S(h(o[N],c,_,v)),L=S(g(l[N],d,w,b)),R=S(h(o[I],c,_,v)),O=S(g(s==1?d.max:d.min,d,w,b)),W=new Path2D(i);return A(W,R,O),A(W,P,O),A(W,P,L),W})}function TT(t,e,n,r,i,s){let a=null;if(t.length>0){a=new Path2D;const o=e==0?AT:q8;let l=n;for(let h=0;h<t.length;h++){let g=t[h];if(g[1]>g[0]){let v=g[0]-l;v>0&&o(a,l,r,v,r+s),l=g[1]}}let c=n+i-l,d=10;c>0&&o(a,l,r-d/2,c,r+s+d)}return a}function Tpe(t,e,n){let r=t[t.length-1];r&&r[0]==e?r[1]=n:t.push([e,n])}function $8(t,e,n,r,i,s,a){let o=[],l=t.length;for(let c=i==1?n:r;c>=n&&c<=r;c+=i)if(e[c]===null){let h=c,g=c;if(i==1)for(;++c<=r&&e[c]===null;)g=c;else for(;--c>=n&&e[c]===null;)g=c;let v=s(t[h]),b=g==h?v:s(t[g]),_=h-i;v=a<=0&&_>=0&&_<l?s(t[_]):v;let S=g+i;b=a>=0&&S>=0&&S<l?s(t[S]):b,b>=v&&o.push([v,b])}return o}function oO(t){return t==0?wW:t==1?to:e=>_g(e,t)}function qW(t){let e=t==0?ET:CT,n=t==0?(i,s,a,o,l,c)=>{i.arcTo(s,a,o,l,c)}:(i,s,a,o,l,c)=>{i.arcTo(a,s,l,o,c)},r=t==0?(i,s,a,o,l)=>{i.rect(s,a,o,l)}:(i,s,a,o,l)=>{i.rect(a,s,l,o)};return(i,s,a,o,l,c=0,d=0)=>{c==0&&d==0?r(i,s,a,o,l):(c=Od(c,o/2,l/2),d=Od(d,o/2,l/2),e(i,s+c,a),n(i,s+o,a,s+o,a+l,c),n(i,s+o,a+l,s,a+l,d),n(i,s,a+l,s,a,d),n(i,s,a,s+o,a,c),i.closePath())}}const ET=(t,e,n)=>{t.moveTo(e,n)},CT=(t,e,n)=>{t.moveTo(n,e)},wy=(t,e,n)=>{t.lineTo(e,n)},My=(t,e,n)=>{t.lineTo(n,e)},AT=qW(0),q8=qW(1),XW=(t,e,n,r,i,s)=>{t.arc(e,n,r,i,s)},YW=(t,e,n,r,i,s)=>{t.arc(n,e,r,i,s)},KW=(t,e,n,r,i,s,a)=>{t.bezierCurveTo(e,n,r,i,s,a)},ZW=(t,e,n,r,i,s,a)=>{t.bezierCurveTo(n,e,i,r,a,s)};function QW(t){return(e,n,r,i,s)=>bv(e,n,(a,o,l,c,d,h,g,v,b,_,w)=>{let{pxRound:S,points:E}=a,A,N;c.ori==0?(A=ET,N=XW):(A=CT,N=YW);const I=ns(E.width*Ni,3);let P=(E.size-E.width)/2*Ni,L=ns(P*2,3),R=new Path2D,O=new Path2D,{left:W,top:U,width:V,height:G}=e.bbox;AT(O,W-L,U-L,V+L*2,G+L*2);const Z=B=>{if(l[B]!=null){let q=S(h(o[B],c,_,v)),Y=S(g(l[B],d,w,b));A(R,q+P,Y),N(R,q,Y,P,0,LM*2)}};if(s)s.forEach(Z);else for(let B=r;B<=i;B++)Z(B);return{stroke:I>0?R:null,fill:R,clip:O,flags:Y1|lR}})}function JW(t){return(e,n,r,i,s,a)=>{r!=i&&(s!=r&&a!=r&&t(e,n,r),s!=i&&a!=i&&t(e,n,i),t(e,n,a))}}const Epe=JW(wy),Cpe=JW(My);function e$(t){const e=wi(t==null?void 0:t.alignGaps,0);return(n,r,i,s)=>bv(n,r,(a,o,l,c,d,h,g,v,b,_,w)=>{[i,s]=_T(l,i,s);let S=a.pxRound,E=G=>S(h(G,c,_,v)),A=G=>S(g(G,d,w,b)),N,I;c.ori==0?(N=wy,I=Epe):(N=My,I=Cpe);const P=c.dir*(c.ori==0?1:-1),L={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Y1},R=L.stroke;let O=!1;if(s-i>=_*4){let G=H=>n.posToVal(H,c.key,!0),Z=null,B=null,q,Y,K,J=E(o[P==1?i:s]),F=E(o[i]),j=E(o[s]),X=G(P==1?F+1:j-1);for(let H=P==1?i:s;H>=i&&H<=s;H+=P){let se=o[H],ie=(P==1?se<X:se>X)?J:E(se),ue=l[H];ie==J?ue!=null?(Y=ue,Z==null?(N(R,ie,A(Y)),q=Z=B=Y):Y<Z?Z=Y:Y>B&&(B=Y)):ue===null&&(O=!0):(Z!=null&&I(R,J,A(Z),A(B),A(q),A(Y)),ue!=null?(Y=ue,N(R,ie,A(Y)),Z=B=q=Y):(Z=B=null,ue===null&&(O=!0)),J=ie,X=G(J+P))}Z!=null&&Z!=B&&K!=J&&I(R,J,A(Z),A(B),A(q),A(Y))}else for(let G=P==1?i:s;G>=i&&G<=s;G+=P){let Z=l[G];Z===null?O=!0:Z!=null&&N(R,E(o[G]),A(Z))}let[U,V]=W8(n,r);if(a.fill!=null||U!=0){let G=L.fill=new Path2D(R),Z=a.fillTo(n,r,a.min,a.max,U),B=A(Z),q=E(o[i]),Y=E(o[s]);P==-1&&([Y,q]=[q,Y]),N(G,Y,B),N(G,q,B)}if(!a.spanGaps){let G=[];O&&G.push(...$8(o,l,i,s,P,E,e)),L.gaps=G=a.gaps(n,r,i,s,G),L.clip=TT(G,c.ori,v,b,_,w)}return V!=0&&(L.band=V==2?[op(n,r,i,s,R,-1),op(n,r,i,s,R,1)]:op(n,r,i,s,R,V)),L})}function Ape(t){const e=wi(t.align,1),n=wi(t.ascDesc,!1),r=wi(t.alignGaps,0),i=wi(t.extend,!1);return(s,a,o,l)=>bv(s,a,(c,d,h,g,v,b,_,w,S,E,A)=>{[o,l]=_T(h,o,l);let N=c.pxRound,{left:I,width:P}=s.bbox,L=F=>N(b(F,g,E,w)),R=F=>N(_(F,v,A,S)),O=g.ori==0?wy:My;const W={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Y1},U=W.stroke,V=g.dir*(g.ori==0?1:-1);let G=R(h[V==1?o:l]),Z=L(d[V==1?o:l]),B=Z,q=Z;i&&e==-1&&(q=I,O(U,q,G)),O(U,Z,G);for(let F=V==1?o:l;F>=o&&F<=l;F+=V){let j=h[F];if(j==null)continue;let X=L(d[F]),H=R(j);e==1?O(U,X,G):O(U,B,H),O(U,X,H),G=H,B=X}let Y=B;i&&e==1&&(Y=I+P,O(U,Y,G));let[K,J]=W8(s,a);if(c.fill!=null||K!=0){let F=W.fill=new Path2D(U),j=c.fillTo(s,a,c.min,c.max,K),X=R(j);O(F,Y,X),O(F,q,X)}if(!c.spanGaps){let F=[];F.push(...$8(d,h,o,l,V,L,r));let j=c.width*Ni/2,X=n||e==1?j:-j,H=n||e==-1?-j:j;F.forEach(se=>{se[0]+=X,se[1]+=H}),W.gaps=F=c.gaps(s,a,o,l,F),W.clip=TT(F,g.ori,w,S,E,A)}return J!=0&&(W.band=J==2?[op(s,a,o,l,U,-1),op(s,a,o,l,U,1)]:op(s,a,o,l,U,J)),W})}function lO(t,e,n,r,i,s,a=ts){if(t.length>1){let o=null;for(let l=0,c=1/0;l<t.length;l++)if(e[l]!==void 0){if(o!=null){let d=no(t[l]-t[o]);d<c&&(c=d,a=no(n(t[l],r,i,s)-n(t[o],r,i,s)))}o=l}}return a}function Npe(t){t=t||C_;const e=wi(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=ri(i),a=1-e[0],o=wi(e[1],ts),l=wi(e[2],1),c=wi(t.disp,C_),d=wi(t.each,v=>{}),{fill:h,stroke:g}=c;return(v,b,_,w)=>bv(v,b,(S,E,A,N,I,P,L,R,O,W,U)=>{let V=S.pxRound,G=n,Z=r*Ni,B=o*Ni,q=l*Ni,Y,K;N.ori==0?[Y,K]=s(v,b):[K,Y]=s(v,b);const J=N.dir*(N.ori==0?1:-1);let F=N.ori==0?AT:q8,j=N.ori==0?d:(_e,ve,ye,ke,Be,ge,Ye)=>{d(_e,ve,ye,Be,ke,Ye,ge)},X=wi(v.bands,U8).find(_e=>_e.series[0]==b),H=X!=null?X.dir:0,se=S.fillTo(v,b,S.min,S.max,H),re=V(L(se,I,U,O)),ie,ue,le,fe=W,xe=V(S.width*Ni),he=!1,Te=null,We=null,Se=null,Le=null;h!=null&&(xe==0||g!=null)&&(he=!0,Te=h.values(v,b,_,w),We=new Map,new Set(Te).forEach(_e=>{_e!=null&&We.set(_e,new Path2D)}),xe>0&&(Se=g.values(v,b,_,w),Le=new Map,new Set(Se).forEach(_e=>{_e!=null&&Le.set(_e,new Path2D)})));let{x0:pe,size:Re}=c;if(pe!=null&&Re!=null){G=1,E=pe.values(v,b,_,w),pe.unit==2&&(E=E.map(ye=>v.posToVal(R+ye*W,N.key,!0)));let _e=Re.values(v,b,_,w);Re.unit==2?ue=_e[0]*W:ue=P(_e[0],N,W,R)-P(0,N,W,R),fe=lO(E,A,P,N,W,R,fe),le=fe-ue+Z}else fe=lO(E,A,P,N,W,R,fe),le=fe*a+Z,ue=fe-le;le<1&&(le=0),xe>=ue/2&&(xe=0),le<5&&(V=wW);let ne=le>0,Xe=fe-le-(ne?xe:0);ue=V(sR(Xe,q,B)),ie=(G==0?ue/2:G==J?0:ue)-G*J*((G==0?Z/2:0)+(ne?xe/2:0));const Ae={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Pe=he?null:new Path2D;let Ke=null;if(X!=null)Ke=v.data[X.series[1]];else{let{y0:_e,y1:ve}=c;_e!=null&&ve!=null&&(A=ve.values(v,b,_,w),Ke=_e.values(v,b,_,w))}let oe=Y*ue,te=K*ue;for(let _e=J==1?_:w;_e>=_&&_e<=w;_e+=J){let ve=A[_e];if(ve==null)continue;if(Ke!=null){let Fe=Ke[_e]??0;if(ve-Fe==0)continue;re=L(Fe,I,U,O)}let ye=N.distr!=2||c!=null?E[_e]:_e,ke=P(ye,N,W,R),Be=L(wi(ve,se),I,U,O),ge=V(ke-ie),Ye=V(Fl(Be,re)),Qe=V(Od(Be,re)),Ie=Ye-Qe;if(ve!=null){let Fe=ve<0?te:oe,Ge=ve<0?oe:te;he?(xe>0&&Se[_e]!=null&&F(Le.get(Se[_e]),ge,Qe+eu(xe/2),ue,Fl(0,Ie-xe),Fe,Ge),Te[_e]!=null&&F(We.get(Te[_e]),ge,Qe+eu(xe/2),ue,Fl(0,Ie-xe),Fe,Ge)):F(Pe,ge,Qe+eu(xe/2),ue,Fl(0,Ie-xe),Fe,Ge),j(v,b,_e,ge-xe/2,Qe,ue+xe,Ie)}}return xe>0?Ae.stroke=he?Le:Pe:he||(Ae._fill=S.width==0?S._fill:S._stroke??S._fill,Ae.width=0),Ae.fill=he?We:Pe,Ae})}function Rpe(t,e){const n=wi(e==null?void 0:e.alignGaps,0);return(r,i,s,a)=>bv(r,i,(o,l,c,d,h,g,v,b,_,w,S)=>{[s,a]=_T(c,s,a);let E=o.pxRound,A=Y=>E(g(Y,d,w,b)),N=Y=>E(v(Y,h,S,_)),I,P,L;d.ori==0?(I=ET,L=wy,P=KW):(I=CT,L=My,P=ZW);const R=d.dir*(d.ori==0?1:-1);let O=A(l[R==1?s:a]),W=O,U=[],V=[];for(let Y=R==1?s:a;Y>=s&&Y<=a;Y+=R)if(c[Y]!=null){let J=l[Y],F=A(J);U.push(W=F),V.push(N(c[Y]))}const G={stroke:t(U,V,I,L,P,E),fill:null,clip:null,band:null,gaps:null,flags:Y1},Z=G.stroke;let[B,q]=W8(r,i);if(o.fill!=null||B!=0){let Y=G.fill=new Path2D(Z),K=o.fillTo(r,i,o.min,o.max,B),J=N(K);L(Y,W,J),L(Y,O,J)}if(!o.spanGaps){let Y=[];Y.push(...$8(l,c,s,a,R,A,n)),G.gaps=Y=o.gaps(r,i,s,a,Y),G.clip=TT(Y,d.ori,b,_,w,S)}return q!=0&&(G.band=q==2?[op(r,i,s,a,Z,-1),op(r,i,s,a,Z,1)]:op(r,i,s,a,Z,q)),G})}function kpe(t){return Rpe(Ppe,t)}function Ppe(t,e,n,r,i,s){const a=t.length;if(a<2)return null;const o=new Path2D;if(n(o,t[0],e[0]),a==2)r(o,t[1],e[1]);else{let l=Array(a),c=Array(a-1),d=Array(a-1),h=Array(a-1);for(let g=0;g<a-1;g++)d[g]=e[g+1]-e[g],h[g]=t[g+1]-t[g],c[g]=d[g]/h[g];l[0]=c[0];for(let g=1;g<a-1;g++)c[g]===0||c[g-1]===0||c[g-1]>0!=c[g]>0?l[g]=0:(l[g]=3*(h[g-1]+h[g])/((2*h[g]+h[g-1])/c[g-1]+(h[g]+2*h[g-1])/c[g]),isFinite(l[g])||(l[g]=0));l[a-1]=c[a-2];for(let g=0;g<a-1;g++)i(o,t[g]+h[g]/3,e[g]+l[g]*h[g]/3,t[g+1]-h[g]/3,e[g+1]-l[g+1]*h[g]/3,t[g+1],e[g+1])}return o}const cR=new Set;function cO(){for(let t of cR)t.syncRect(!0)}Sy&&(Gg(fhe,m1,cO),Gg(hhe,m1,cO,!0),Gg(g2,m1,()=>{ma.pxRatio=Ni}));const Dpe=e$(),Ipe=QW();function uO(t,e,n,r){return(r?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map((s,a)=>uR(s,a,e,n))}function Ope(t,e){return t.map((n,r)=>r==0?{}:Ba({},e,n))}function uR(t,e,n,r){return Ba({},e==0?n:r,t)}function t$(t,e,n){return e==null?q1:[e,n]}const Lpe=t$;function zpe(t,e,n){return e==null?q1:v2(e,n,j8,!0)}function n$(t,e,n,r){return e==null?q1:ST(e,n,t.scales[r].log,!1)}const jpe=n$;function r$(t,e,n,r){return e==null?q1:z8(e,n,t.scales[r].log,!1)}const Fpe=r$;function Upe(t,e,n,r,i){let s=Fl(HI(t),HI(e)),a=e-t,o=Dd(i/r*a,n);do{let l=n[o],c=r*l/a;if(c>=i&&s+(l<5?K0.get(l):0)<=17)return[l,c]}while(++o<n.length);return[0,0]}function dO(t){let e,n;return t=t.replace(/(\d+)px/,(r,i)=>(e=to((n=+i)*Ni))+"px"),[t,e,n]}function Bpe(t){t.show&&[t.font,t.labelFont].forEach(e=>{let n=ns(e[2]*Ni,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function ma(t,e,n){const r={mode:wi(t.mode,1)},i=r.mode;function s(de,Ee,Ue,qe){let ct=Ee.valToPct(de);return qe+Ue*(Ee.dir==-1?1-ct:ct)}function a(de,Ee,Ue,qe){let ct=Ee.valToPct(de);return qe+Ue*(Ee.dir==-1?ct:1-ct)}function o(de,Ee,Ue,qe){return Ee.ori==0?s(de,Ee,Ue,qe):a(de,Ee,Ue,qe)}r.valToPosH=s,r.valToPosV=a;let l=!1;r.status=0;const c=r.root=Iu(Xfe);if(t.id!=null&&(c.id=t.id),Gc(c,t.class),t.title){let de=Iu(Zfe,c);de.textContent=t.title}const d=Nd("canvas"),h=r.ctx=d.getContext("2d"),g=Iu(Qfe,c);Gg("click",g,de=>{de.target===b&&(ei!=xs||zr!=Wo)&&mr.click(r,de)},!0);const v=r.under=Iu(Jfe,g);g.appendChild(d);const b=r.over=Iu(ehe,g);t=X1(t);const _=+wi(t.pxAlign,1),w=oO(_);(t.plugins||[]).forEach(de=>{de.opts&&(t=de.opts(r,t)||t)});const S=t.ms||.001,E=r.series=i==1?uO(t.series||[],eO,sO,!1):Ope(t.series||[null],iO),A=r.axes=uO(t.axes||[],JI,nO,!0),N=r.scales={},I=r.bands=t.bands||[];I.forEach(de=>{de.fill=ri(de.fill||null),de.dir=wi(de.dir,-1)});const P=i==2?E[1].facets[0].scale:E[0].scale,L={axes:So,series:ss},R=(t.drawOrder||["axes","series"]).map(de=>L[de]);function O(de){const Ee=de.distr==3?Ue=>ap(Ue>0?Ue:de.clamp(r,Ue,de.min,de.max,de.key)):de.distr==4?Ue=>QC(Ue,de.asinh):de.distr==100?Ue=>de.fwd(Ue):Ue=>Ue;return Ue=>{let qe=Ee(Ue),{_min:ct,_max:St}=de,jt=St-ct;return(qe-ct)/jt}}function W(de){let Ee=N[de];if(Ee==null){let Ue=(t.scales||C_)[de]||C_;if(Ue.from!=null){W(Ue.from);let qe=Ba({},N[Ue.from],Ue,{key:de});qe.valToPct=O(qe),N[de]=qe}else{Ee=N[de]=Ba({},de==P?WW:wpe,Ue),Ee.key=de;let qe=Ee.time,ct=Ee.range,St=T0(ct);if((de!=P||i==2&&!qe)&&(St&&(ct[0]==null||ct[1]==null)&&(ct={min:ct[0]==null?FI:{mode:1,hard:ct[0],soft:ct[0]},max:ct[1]==null?FI:{mode:1,hard:ct[1],soft:ct[1]}},St=!1),!St&&MT(ct))){let jt=ct;ct=(Gt,Kt,mn)=>Kt==null?q1:v2(Kt,mn,jt)}Ee.range=ri(ct||(qe?Lpe:de==P?Ee.distr==3?jpe:Ee.distr==4?Fpe:t$:Ee.distr==3?n$:Ee.distr==4?r$:zpe)),Ee.auto=ri(St?!1:Ee.auto),Ee.clamp=ri(Ee.clamp||Spe),Ee._min=Ee._max=null,Ee.valToPct=O(Ee)}}}W("x"),W("y"),i==1&&E.forEach(de=>{W(de.scale)}),A.forEach(de=>{W(de.scale)});for(let de in t.scales)W(de);const U=N[P],V=U.distr;let G,Z;U.ori==0?(Gc(c,Yfe),G=s,Z=a):(Gc(c,Kfe),G=a,Z=s);const B={};for(let de in N){let Ee=N[de];(Ee.min!=null||Ee.max!=null)&&(B[de]={min:Ee.min,max:Ee.max},Ee.min=Ee.max=null)}const q=t.tzDate||(de=>new Date(to(de/S))),Y=t.fmtDate||B8,K=S==1?Yhe(q):Qhe(q),J=KI(q,YI(S==1?Xhe:Zhe,Y)),F=QI(q,ZI(epe,Y)),j=[],X=r.legend=Ba({},rpe,t.legend),H=r.cursor=Ba({},cpe,{drag:{y:i==2}},t.cursor),se=X.show,re=H.show,ie=X.markers;X.idxs=j,ie.width=ri(ie.width),ie.dash=ri(ie.dash),ie.stroke=ri(ie.stroke),ie.fill=ri(ie.fill);let ue,le,fe,xe=[],he=[],Te,We=!1,Se={};if(X.live){const de=E[1]?E[1].values:null;We=de!=null,Te=We?de(r,1,0):{_:0};for(let Ee in Te)Se[Ee]=O8}if(se)if(ue=Nd("table",ahe,c),fe=Nd("tbody",null,ue),X.mount(r,ue),We){le=Nd("thead",null,ue,fe);let de=Nd("tr",null,le);Nd("th",null,de);for(var Le in Te)Nd("th",EI,de).textContent=Le}else Gc(ue,lhe),X.live&&Gc(ue,ohe);const pe={show:!0},Re={show:!1};function ne(de,Ee){if(Ee==0&&(We||!X.live||i==2))return q1;let Ue=[],qe=Nd("tr",che,fe,fe.childNodes[Ee]);Gc(qe,de.class),de.show||Gc(qe,Eg);let ct=Nd("th",null,qe);if(ie.show){let Gt=Iu(uhe,ct);if(Ee>0){let Kt=ie.width(r,Ee);Kt&&(Gt.style.border=Kt+"px "+ie.dash(r,Ee)+" "+ie.stroke(r,Ee)),Gt.style.background=ie.fill(r,Ee)}}let St=Iu(EI,ct);de.label instanceof HTMLElement?St.appendChild(de.label):St.textContent=de.label,Ee>0&&(ie.show||(St.style.color=de.width>0?ie.stroke(r,Ee):ie.fill(r,Ee)),Ae("click",ct,Gt=>{if(H._lock)return;yt(Gt);let Kt=E.indexOf(de);if((Gt.ctrlKey||Gt.metaKey)!=X.isolate){let mn=E.some((vn,_n)=>_n>0&&_n!=Kt&&vn.show);E.forEach((vn,_n)=>{_n>0&&hi(_n,mn?_n==Kt?pe:Re:pe,!0,bs.setSeries)})}else hi(Kt,{show:!de.show},!0,bs.setSeries)},!1),Nt&&Ae(RI,ct,Gt=>{H._lock||(yt(Gt),hi(E.indexOf(de),ys,!0,bs.setSeries))},!1));for(var jt in Te){let Gt=Nd("td",dhe,qe);Gt.textContent="--",Ue.push(Gt)}return[qe,Ue]}const Xe=new Map;function Ae(de,Ee,Ue,qe=!0){const ct=Xe.get(Ee)||{},St=H.bind[de](r,Ee,Ue,qe);St&&(Gg(de,Ee,ct[de]=St),Xe.set(Ee,ct))}function Pe(de,Ee,Ue){const qe=Xe.get(Ee)||{};for(let ct in qe)(de==null||ct==de)&&(iR(ct,Ee,qe[ct]),delete qe[ct]);de==null&&Xe.delete(Ee)}let Ke=0,oe=0,te=0,_e=0,ve=0,ye=0,ke=ve,Be=ye,ge=te,Ye=_e,Qe=0,Ie=0,Fe=0,Ge=0;r.bbox={};let Me=!1,$e=!1,dt=!1,Oe=!1,st=!1,ft=!1;function pt(de,Ee,Ue){(Ue||de!=r.width||Ee!=r.height)&&et(de,Ee),ql(!1),dt=!0,$e=!0,Go()}function et(de,Ee){r.width=Ke=te=de,r.height=oe=_e=Ee,ve=ye=0,He(),nt();let Ue=r.bbox;Qe=Ue.left=_g(ve*Ni,.5),Ie=Ue.top=_g(ye*Ni,.5),Fe=Ue.width=_g(te*Ni,.5),Ge=Ue.height=_g(_e*Ni,.5)}const Ze=3;function me(){let de=!1,Ee=0;for(;!de;){Ee++;let Ue=$a(Ee),qe=co(Ee);de=Ee==Ze||Ue&&qe,de||(et(r.width,r.height),$e=!0)}}function je({width:de,height:Ee}){pt(de,Ee)}r.setSize=je;function He(){let de=!1,Ee=!1,Ue=!1,qe=!1;A.forEach((ct,St)=>{if(ct.show&&ct._show){let{side:jt,_size:Gt}=ct,Kt=jt%2,mn=ct.label!=null?ct.labelSize:0,vn=Gt+mn;vn>0&&(Kt?(te-=vn,jt==3?(ve+=vn,qe=!0):Ue=!0):(_e-=vn,jt==0?(ye+=vn,de=!0):Ee=!0))}}),Vt[0]=de,Vt[1]=Ue,Vt[2]=Ee,Vt[3]=qe,te-=Bn[1]+Bn[3],ve+=Bn[3],_e-=Bn[2]+Bn[0],ye+=Bn[0]}function nt(){let de=ve+te,Ee=ye+_e,Ue=ve,qe=ye;function ct(St,jt){switch(St){case 1:return de+=jt,de-jt;case 2:return Ee+=jt,Ee-jt;case 3:return Ue-=jt,Ue+jt;case 0:return qe-=jt,qe+jt}}A.forEach((St,jt)=>{if(St.show&&St._show){let Gt=St.side;St._pos=ct(Gt,St._size),St.label!=null&&(St._lpos=ct(Gt,St.labelSize))}})}if(H.dataIdx==null){let de=H.hover,Ee=de.skip=new Set(de.skip??[]);Ee.add(void 0);let Ue=de.prox=ri(de.prox),qe=de.bias??(de.bias=0);H.dataIdx=(ct,St,jt,Gt)=>{if(St==0)return jt;let Kt=jt,mn=Ue(ct,St,jt,Gt)??ts,vn=mn>=0&&mn<ts,_n=U.ori==0?te:_e,er=H.left,Xr=e[0],tr=e[St];if(Ee.has(tr[jt])){Kt=null;let ur=null,Vn=null,Nn;if(qe==0||qe==-1)for(Nn=jt;ur==null&&Nn-- >0;)Ee.has(tr[Nn])||(ur=Nn);if(qe==0||qe==1)for(Nn=jt;Vn==null&&Nn++<tr.length;)Ee.has(tr[Nn])||(Vn=Nn);if(ur!=null||Vn!=null)if(vn){let qn=ur==null?-1/0:G(Xr[ur],U,_n,0),Ji=Vn==null?1/0:G(Xr[Vn],U,_n,0),Is=er-qn,pi=Ji-er;Is<=pi?Is<=mn&&(Kt=ur):pi<=mn&&(Kt=Vn)}else Kt=Vn==null?ur:ur==null?Vn:jt-ur<=Vn-jt?ur:Vn}else vn&&no(er-G(Xr[jt],U,_n,0))>mn&&(Kt=null);return Kt}}const yt=de=>{H.event=de};H.idxs=j,H._lock=!1;let lt=H.points;lt.show=ri(lt.show),lt.size=ri(lt.size),lt.stroke=ri(lt.stroke),lt.width=ri(lt.width),lt.fill=ri(lt.fill);const bt=r.focus=Ba({},t.focus||{alpha:.3},H.focus),Nt=bt.prox>=0,Pt=Nt&&lt.one;let Ve=[],wt=[],Et=[];function zt(de,Ee){let Ue=lt.show(r,Ee);if(Ue instanceof HTMLElement)return Gc(Ue,she),Gc(Ue,de.class),Ef(Ue,-10,-10,te,_e),b.insertBefore(Ue,Ve[Ee]),Ue}function Ht(de,Ee){if(i==1||Ee>0){let Ue=i==1&&N[de.scale].time,qe=de.value;de.value=Ue?WI(qe)?QI(q,ZI(qe,Y)):qe||F:qe||ype,de.label=de.label||(Ue?dpe:upe)}if(Pt||Ee>0){de.width=de.width==null?1:de.width,de.paths=de.paths||Dpe||whe,de.fillTo=ri(de.fillTo||Mpe),de.pxAlign=+wi(de.pxAlign,_),de.pxRound=oO(de.pxAlign),de.stroke=ri(de.stroke||null),de.fill=ri(de.fill||null),de._stroke=de._fill=de._paths=de._focus=null;let Ue=bpe(Fl(1,de.width),1),qe=de.points=Ba({},{size:Ue,width:Fl(1,Ue*.2),stroke:de.stroke,space:Ue*2,paths:Ipe,_stroke:null,_fill:null},de.points);qe.show=ri(qe.show),qe.filter=ri(qe.filter),qe.fill=ri(qe.fill),qe.stroke=ri(qe.stroke),qe.paths=ri(qe.paths),qe.pxAlign=de.pxAlign}if(se){let Ue=ne(de,Ee);xe.splice(Ee,0,Ue[0]),he.splice(Ee,0,Ue[1]),X.values.push(null)}if(re){j.splice(Ee,0,null);let Ue=null;Pt?Ee==0&&(Ue=zt(de,Ee)):Ee>0&&(Ue=zt(de,Ee)),Ve.splice(Ee,0,Ue),wt.splice(Ee,0,0),Et.splice(Ee,0,0)}Ds("addSeries",Ee)}function an(de,Ee){Ee=Ee??E.length,de=i==1?uR(de,Ee,eO,sO):uR(de,Ee,{},iO),E.splice(Ee,0,de),Ht(E[Ee],Ee)}r.addSeries=an;function Dn(de){if(E.splice(de,1),se){X.values.splice(de,1),he.splice(de,1);let Ee=xe.splice(de,1)[0];Pe(null,Ee.firstChild),Ee.remove()}re&&(j.splice(de,1),Ve.splice(de,1)[0].remove(),wt.splice(de,1),Et.splice(de,1)),Ds("delSeries",de)}r.delSeries=Dn;const Vt=[!1,!1,!1,!1];function pn(de,Ee){if(de._show=de.show,de.show){let Ue=de.side%2,qe=N[de.scale];qe==null&&(de.scale=Ue?E[1].scale:P,qe=N[de.scale]);let ct=qe.time;de.size=ri(de.size),de.space=ri(de.space),de.rotate=ri(de.rotate),T0(de.incrs)&&de.incrs.forEach(jt=>{!K0.has(jt)&&K0.set(jt,EW(jt))}),de.incrs=ri(de.incrs||(qe.distr==2?Whe:ct?S==1?qhe:Khe:Sg)),de.splits=ri(de.splits||(ct&&qe.distr==1?K:qe.distr==3?aR:qe.distr==4?ppe:hpe)),de.stroke=ri(de.stroke),de.grid.stroke=ri(de.grid.stroke),de.ticks.stroke=ri(de.ticks.stroke),de.border.stroke=ri(de.border.stroke);let St=de.values;de.values=T0(St)&&!T0(St[0])?ri(St):ct?T0(St)?KI(q,YI(St,Y)):WI(St)?Jhe(q,St):St||J:St||fpe,de.filter=ri(de.filter||(qe.distr>=3&&qe.log==10?vpe:qe.distr==3&&qe.log==2?xpe:MW)),de.font=dO(de.font),de.labelFont=dO(de.labelFont),de._size=de.size(r,null,Ee,0),de._space=de._rotate=de._incrs=de._found=de._splits=de._values=null,de._size>0&&(Vt[Ee]=!0,de._el=Iu(the,g))}}function Bt(de,Ee,Ue,qe){let[ct,St,jt,Gt]=Ue,Kt=Ee%2,mn=0;return Kt==0&&(Gt||St)&&(mn=Ee==0&&!ct||Ee==2&&!jt?to(JI.size/3):0),Kt==1&&(ct||jt)&&(mn=Ee==1&&!St||Ee==3&&!Gt?to(nO.size/2):0),mn}const Cn=r.padding=(t.padding||[Bt,Bt,Bt,Bt]).map(de=>ri(wi(de,Bt))),Bn=r._padding=Cn.map((de,Ee)=>de(r,Ee,Vt,0));let wn,On=null,jn=null;const Bi=i==1?E[0].idxs:null;let ui=null,be=!1;function ot(de,Ee){if(e=de??[],r.data=r._data=e,i==2){wn=0;for(let Ue=1;Ue<E.length;Ue++)wn+=e[Ue][0].length}else{e.length==0&&(r.data=r._data=e=[[]]),ui=e[0],wn=ui.length;let Ue=e;if(V==2){Ue=e.slice();let qe=Ue[0]=Array(wn);for(let ct=0;ct<wn;ct++)qe[ct]=ct}r._data=e=Ue}if(ql(!0),Ds("setData"),V==2&&(dt=!0),Ee!==!1){let Ue=U;Ue.auto(r,be)?_t():ga(P,Ue.min,Ue.max),Oe=Oe||H.left>=0,ft=!0,Go()}}r.setData=ot;function _t(){be=!0;let de,Ee;i==1&&(wn>0?(On=Bi[0]=0,jn=Bi[1]=wn-1,de=e[0][On],Ee=e[0][jn],V==2?(de=On,Ee=jn):de==Ee&&(V==3?[de,Ee]=ST(de,de,U.log,!1):V==4?[de,Ee]=z8(de,de,U.log,!1):U.time?Ee=de+to(86400/S):[de,Ee]=v2(de,Ee,j8,!0))):(On=Bi[0]=de=null,jn=Bi[1]=Ee=null)),ga(P,de,Ee)}let xt,gt,Yt,rn,sn,Zt,Mn,Fn,$n,on;function ir(de,Ee,Ue,qe,ct,St){de??(de=AI),Ue??(Ue=U8),qe??(qe="butt"),ct??(ct=AI),St??(St="round"),de!=xt&&(h.strokeStyle=xt=de),ct!=gt&&(h.fillStyle=gt=ct),Ee!=Yt&&(h.lineWidth=Yt=Ee),St!=sn&&(h.lineJoin=sn=St),qe!=Zt&&(h.lineCap=Zt=qe),Ue!=rn&&h.setLineDash(rn=Ue)}function qr(de,Ee,Ue,qe){Ee!=gt&&(h.fillStyle=gt=Ee),de!=Mn&&(h.font=Mn=de),Ue!=Fn&&(h.textAlign=Fn=Ue),qe!=$n&&(h.textBaseline=$n=qe)}function Jr(de,Ee,Ue,qe,ct=0){if(qe.length>0&&de.auto(r,be)&&(Ee==null||Ee.min==null)){let St=wi(On,0),jt=wi(jn,qe.length-1),Gt=Ue.min==null?vhe(qe,St,jt,ct,de.distr==3):[Ue.min,Ue.max];de.min=Od(de.min,Ue.min=Gt[0]),de.max=Fl(de.max,Ue.max=Gt[1])}}const cr={min:null,max:null};function Nr(){for(let qe in N){let ct=N[qe];B[qe]==null&&(ct.min==null||B[P]!=null&&ct.auto(r,be))&&(B[qe]=cr)}for(let qe in N){let ct=N[qe];B[qe]==null&&ct.from!=null&&B[ct.from]!=null&&(B[qe]=cr)}B[P]!=null&&ql(!0);let de={};for(let qe in B){let ct=B[qe];if(ct!=null){let St=de[qe]=X1(N[qe],Ehe);if(ct.min!=null)Ba(St,ct);else if(qe!=P||i==2)if(wn==0&&St.from==null){let jt=St.range(r,null,null,qe);St.min=jt[0],St.max=jt[1]}else St.min=ts,St.max=-ts}}if(wn>0){E.forEach((qe,ct)=>{if(i==1){let St=qe.scale,jt=B[St];if(jt==null)return;let Gt=de[St];if(ct==0){let Kt=Gt.range(r,Gt.min,Gt.max,St);Gt.min=Kt[0],Gt.max=Kt[1],On=Dd(Gt.min,e[0]),jn=Dd(Gt.max,e[0]),jn-On>1&&(e[0][On]<Gt.min&&On++,e[0][jn]>Gt.max&&jn--),qe.min=ui[On],qe.max=ui[jn]}else qe.show&&qe.auto&&Jr(Gt,jt,qe,e[ct],qe.sorted);qe.idxs[0]=On,qe.idxs[1]=jn}else if(ct>0&&qe.show&&qe.auto){let[St,jt]=qe.facets,Gt=St.scale,Kt=jt.scale,[mn,vn]=e[ct],_n=de[Gt],er=de[Kt];_n!=null&&Jr(_n,B[Gt],St,mn,St.sorted),er!=null&&Jr(er,B[Kt],jt,vn,jt.sorted),qe.min=jt.min,qe.max=jt.max}});for(let qe in de){let ct=de[qe],St=B[qe];if(ct.from==null&&(St==null||St.min==null)){let jt=ct.range(r,ct.min==ts?null:ct.min,ct.max==-ts?null:ct.max,qe);ct.min=jt[0],ct.max=jt[1]}}}for(let qe in de){let ct=de[qe];if(ct.from!=null){let St=de[ct.from];if(St.min==null)ct.min=ct.max=null;else{let jt=ct.range(r,St.min,St.max,qe);ct.min=jt[0],ct.max=jt[1]}}}let Ee={},Ue=!1;for(let qe in de){let ct=de[qe],St=N[qe];if(St.min!=ct.min||St.max!=ct.max){St.min=ct.min,St.max=ct.max;let jt=St.distr;St._min=jt==3?ap(St.min):jt==4?QC(St.min,St.asinh):jt==100?St.fwd(St.min):St.min,St._max=jt==3?ap(St.max):jt==4?QC(St.max,St.asinh):jt==100?St.fwd(St.max):St.max,Ee[qe]=Ue=!0}}if(Ue){E.forEach((qe,ct)=>{i==2?ct>0&&Ee.y&&(qe._paths=null):Ee[qe.scale]&&(qe._paths=null)});for(let qe in Ee)dt=!0,Ds("setScale",qe);re&&H.left>=0&&(Oe=ft=!0)}for(let qe in B)B[qe]=null}function en(de){let Ee=sR(On-1,0,wn-1),Ue=sR(jn+1,0,wn-1);for(;de[Ee]==null&&Ee>0;)Ee--;for(;de[Ue]==null&&Ue<wn-1;)Ue++;return[Ee,Ue]}function ss(){if(wn>0){let de=E.some(Ee=>Ee._focus)&&on!=bt.alpha;de&&(h.globalAlpha=on=bt.alpha),E.forEach((Ee,Ue)=>{if(Ue>0&&Ee.show&&(Rn(Ue,!1),Rn(Ue,!0),Ee._paths==null)){let qe=on;on!=Ee.alpha&&(h.globalAlpha=on=Ee.alpha);let ct=i==2?[0,e[Ue][0].length-1]:en(e[Ue]);Ee._paths=Ee.paths(r,Ue,ct[0],ct[1]),on!=qe&&(h.globalAlpha=on=qe)}}),E.forEach((Ee,Ue)=>{if(Ue>0&&Ee.show){let qe=on;on!=Ee.alpha&&(h.globalAlpha=on=Ee.alpha),Ee._paths!=null&&gs(Ue,!1);{let ct=Ee._paths!=null?Ee._paths.gaps:null,St=Ee.points.show(r,Ue,On,jn,ct),jt=Ee.points.filter(r,Ue,St,ct);(St||jt)&&(Ee.points._paths=Ee.points.paths(r,Ue,On,jn,jt),gs(Ue,!0))}on!=qe&&(h.globalAlpha=on=qe),Ds("drawSeries",Ue)}}),de&&(h.globalAlpha=on=1)}}function Rn(de,Ee){let Ue=Ee?E[de].points:E[de];Ue._stroke=Ue.stroke(r,de),Ue._fill=Ue.fill(r,de)}function gs(de,Ee){let Ue=Ee?E[de].points:E[de],{stroke:qe,fill:ct,clip:St,flags:jt,_stroke:Gt=Ue._stroke,_fill:Kt=Ue._fill,_width:mn=Ue.width}=Ue._paths;mn=ns(mn*Ni,3);let vn=null,_n=mn%2/2;Ee&&Kt==null&&(Kt=mn>0?"#fff":Gt);let er=Ue.pxAlign==1&&_n>0;if(er&&h.translate(_n,_n),!Ee){let Xr=Qe-mn/2,tr=Ie-mn/2,ur=Fe+mn,Vn=Ge+mn;vn=new Path2D,vn.rect(Xr,tr,ur,Vn)}Ee?vs(Gt,mn,Ue.dash,Ue.cap,Kt,qe,ct,jt,St):Rs(de,Gt,mn,Ue.dash,Ue.cap,Kt,qe,ct,jt,vn,St),er&&h.translate(-_n,-_n)}function Rs(de,Ee,Ue,qe,ct,St,jt,Gt,Kt,mn,vn){let _n=!1;Kt!=0&&I.forEach((er,Xr)=>{if(er.series[0]==de){let tr=E[er.series[1]],ur=e[er.series[1]],Vn=(tr._paths||C_).band;T0(Vn)&&(Vn=er.dir==1?Vn[0]:Vn[1]);let Nn,qn=null;tr.show&&Vn&&yhe(ur,On,jn)?(qn=er.fill(r,Xr)||St,Nn=tr._paths.clip):Vn=null,vs(Ee,Ue,qe,ct,qn,jt,Gt,Kt,mn,vn,Nn,Vn),_n=!0}}),_n||vs(Ee,Ue,qe,ct,St,jt,Gt,Kt,mn,vn)}const Pi=Y1|lR;function vs(de,Ee,Ue,qe,ct,St,jt,Gt,Kt,mn,vn,_n){ir(de,Ee,Ue,qe,ct),(Kt||mn||_n)&&(h.save(),Kt&&h.clip(Kt),mn&&h.clip(mn)),_n?(Gt&Pi)==Pi?(h.clip(_n),vn&&h.clip(vn),di(ct,jt),pr(de,St,Ee)):Gt&lR?(di(ct,jt),h.clip(_n),pr(de,St,Ee)):Gt&Y1&&(h.save(),h.clip(_n),vn&&h.clip(vn),di(ct,jt),h.restore(),pr(de,St,Ee)):(di(ct,jt),pr(de,St,Ee)),(Kt||mn||_n)&&h.restore()}function pr(de,Ee,Ue){Ue>0&&(Ee instanceof Map?Ee.forEach((qe,ct)=>{h.strokeStyle=xt=ct,h.stroke(qe)}):Ee!=null&&de&&h.stroke(Ee))}function di(de,Ee){Ee instanceof Map?Ee.forEach((Ue,qe)=>{h.fillStyle=gt=qe,h.fill(Ue)}):Ee!=null&&de&&h.fill(Ee)}function ks(de,Ee,Ue,qe){let ct=A[de],St;if(qe<=0)St=[0,0];else{let jt=ct._space=ct.space(r,de,Ee,Ue,qe),Gt=ct._incrs=ct.incrs(r,de,Ee,Ue,qe,jt);St=Upe(Ee,Ue,Gt,qe,jt)}return ct._found=St}function Di(de,Ee,Ue,qe,ct,St,jt,Gt,Kt,mn){let vn=jt%2/2;_==1&&h.translate(vn,vn),ir(Gt,jt,Kt,mn,Gt),h.beginPath();let _n,er,Xr,tr,ur=ct+(qe==0||qe==3?-St:St);Ue==0?(er=ct,tr=ur):(_n=ct,Xr=ur);for(let Vn=0;Vn<de.length;Vn++)Ee[Vn]!=null&&(Ue==0?_n=Xr=de[Vn]:er=tr=de[Vn],h.moveTo(_n,er),h.lineTo(Xr,tr));h.stroke(),_==1&&h.translate(-vn,-vn)}function $a(de){let Ee=!0;return A.forEach((Ue,qe)=>{if(!Ue.show)return;let ct=N[Ue.scale];if(ct.min==null){Ue._show&&(Ee=!1,Ue._show=!1,ql(!1));return}else Ue._show||(Ee=!1,Ue._show=!0,ql(!1));let St=Ue.side,jt=St%2,{min:Gt,max:Kt}=ct,[mn,vn]=ks(qe,Gt,Kt,jt==0?te:_e);if(vn==0)return;let _n=ct.distr==2,er=Ue._splits=Ue.splits(r,qe,Gt,Kt,mn,vn,_n),Xr=ct.distr==2?er.map(Nn=>ui[Nn]):er,tr=ct.distr==2?ui[er[1]]-ui[er[0]]:mn,ur=Ue._values=Ue.values(r,Ue.filter(r,Xr,qe,vn,tr),qe,vn,tr);Ue._rotate=St==2?Ue.rotate(r,ur,qe,vn):0;let Vn=Ue._size;Ue._size=Fu(Ue.size(r,ur,qe,de)),Vn!=null&&Ue._size!=Vn&&(Ee=!1)}),Ee}function co(de){let Ee=!0;return Cn.forEach((Ue,qe)=>{let ct=Ue(r,qe,Vt,de);ct!=Bn[qe]&&(Ee=!1),Bn[qe]=ct}),Ee}function So(){for(let de=0;de<A.length;de++){let Ee=A[de];if(!Ee.show||!Ee._show)continue;let Ue=Ee.side,qe=Ue%2,ct,St,jt=Ee.stroke(r,de),Gt=Ue==0||Ue==3?-1:1,[Kt,mn]=Ee._found;if(Ee.label!=null){let aa=Ee.labelGap*Gt,xa=to((Ee._lpos+aa)*Ni);qr(Ee.labelFont[0],jt,"center",Ue==2?Hb:CI),h.save(),qe==1?(ct=St=0,h.translate(xa,to(Ie+Ge/2)),h.rotate((Ue==3?-LM:LM)/2)):(ct=to(Qe+Fe/2),St=xa);let Oc=SW(Ee.label)?Ee.label(r,de,Kt,mn):Ee.label;h.fillText(Oc,ct,St),h.restore()}if(mn==0)continue;let vn=N[Ee.scale],_n=qe==0?Fe:Ge,er=qe==0?Qe:Ie,Xr=Ee._splits,tr=vn.distr==2?Xr.map(aa=>ui[aa]):Xr,ur=vn.distr==2?ui[Xr[1]]-ui[Xr[0]]:Kt,Vn=Ee.ticks,Nn=Ee.border,qn=Vn.show?Vn.size:0,Ji=to(qn*Ni),Is=to((Ee.alignTo==2?Ee._size-qn-Ee.gap:Ee.gap)*Ni),pi=Ee._rotate*-LM/180,si=w(Ee._pos*Ni),as=(Ji+Is)*Gt,Os=si+as;St=qe==0?Os:0,ct=qe==1?Os:0;let Ya=Ee.font[0],Ra=Ee.align==1?wx:Ee.align==2?YC:pi>0?wx:pi<0?YC:qe==0?"center":Ue==3?YC:wx,Hi=pi||qe==1?"middle":Ue==2?Hb:CI;qr(Ya,jt,Ra,Hi);let Gs=Ee.font[1]*Ee.lineGap,ka=Xr.map(aa=>w(o(aa,vn,_n,er))),Eo=Ee._values;for(let aa=0;aa<Eo.length;aa++){let xa=Eo[aa];if(xa!=null){qe==0?ct=ka[aa]:St=ka[aa],xa=""+xa;let Oc=xa.indexOf(`
`)==-1?[xa]:xa.split(/\n/gm);for(let Pa=0;Pa<Oc.length;Pa++){let Av=Oc[Pa];pi?(h.save(),h.translate(ct,St+Pa*Gs),h.rotate(pi),h.fillText(Av,0,0),h.restore()):h.fillText(Av,ct,St+Pa*Gs)}}}Vn.show&&Di(ka,Vn.filter(r,tr,de,mn,ur),qe,Ue,si,Ji,ns(Vn.width*Ni,3),Vn.stroke(r,de),Vn.dash,Vn.cap);let sa=Ee.grid;sa.show&&Di(ka,sa.filter(r,tr,de,mn,ur),qe,qe==0?2:1,qe==0?Ie:Qe,qe==0?Ge:Fe,ns(sa.width*Ni,3),sa.stroke(r,de),sa.dash,sa.cap),Nn.show&&Di([si],[1],qe==0?1:0,qe==0?1:2,qe==1?Ie:Qe,qe==1?Ge:Fe,ns(Nn.width*Ni,3),Nn.stroke(r,de),Nn.dash,Nn.cap)}Ds("drawAxes")}function ql(de){E.forEach((Ee,Ue)=>{Ue>0&&(Ee._paths=null,de&&(i==1?(Ee.min=null,Ee.max=null):Ee.facets.forEach(qe=>{qe.min=null,qe.max=null})))})}let xl=!1,uo=!1,Ps=[];function Xl(){uo=!1;for(let de=0;de<Ps.length;de++)Ds(...Ps[de]);Ps.length=0}function Go(){xl||(Dhe(Mo),xl=!0)}function wo(de,Ee=!1){xl=!0,uo=Ee,de(r),Mo(),Ee&&Ps.length>0&&queueMicrotask(Xl)}r.batch=wo;function Mo(){if(Me&&(Nr(),Me=!1),dt&&(me(),dt=!1),$e){if(As(v,wx,ve),As(v,Hb,ye),As(v,h_,te),As(v,p_,_e),As(b,wx,ve),As(b,Hb,ye),As(b,h_,te),As(b,p_,_e),As(g,h_,Ke),As(g,p_,oe),d.width=to(Ke*Ni),d.height=to(oe*Ni),A.forEach(({_el:de,_show:Ee,_size:Ue,_pos:qe,side:ct})=>{if(de!=null)if(Ee){let St=ct===3||ct===0?Ue:0,jt=ct%2==1;As(de,jt?"left":"top",qe-St),As(de,jt?"width":"height",Ue),As(de,jt?"top":"left",jt?ye:ve),As(de,jt?"height":"width",jt?_e:te),rR(de,Eg)}else Gc(de,Eg)}),xt=gt=Yt=sn=Zt=Mn=Fn=$n=rn=null,on=1,ad(!0),ve!=ke||ye!=Be||te!=ge||_e!=Ye){ql(!1);let de=te/ge,Ee=_e/Ye;if(re&&!Oe&&H.left>=0){H.left*=de,H.top*=Ee,qa&&Ef(qa,to(H.left),0,te,_e),ia&&Ef(ia,0,to(H.top),te,_e);for(let Ue=0;Ue<Ve.length;Ue++){let qe=Ve[Ue];qe!=null&&(wt[Ue]*=de,Et[Ue]*=Ee,Ef(qe,Fu(wt[Ue]),Fu(Et[Ue]),te,_e))}}if(Gr.show&&!st&&Gr.left>=0&&Gr.width>0){Gr.left*=de,Gr.width*=de,Gr.top*=Ee,Gr.height*=Ee;for(let Ue in _m)As(To,Ue,Gr[Ue])}ke=ve,Be=ye,ge=te,Ye=_e}Ds("setSize"),$e=!1}Ke>0&&oe>0&&(h.clearRect(0,0,d.width,d.height),Ds("drawClear"),R.forEach(de=>de()),Ds("draw")),Gr.show&&st&&(bl(Gr),st=!1),re&&Oe&&(Zl(null,!0,!1),Oe=!1),X.show&&X.live&&ft&&(Tp(),ft=!1),l||(l=!0,r.status=1,Ds("ready")),be=!1,xl=!1}r.redraw=(de,Ee)=>{dt=Ee||!1,de!==!1?ga(P,U.min,U.max):Go()};function kc(de,Ee){let Ue=N[de];if(Ue.from==null){if(wn==0){let qe=Ue.range(r,Ee.min,Ee.max,de);Ee.min=qe[0],Ee.max=qe[1]}if(Ee.min>Ee.max){let qe=Ee.min;Ee.min=Ee.max,Ee.max=qe}if(wn>1&&Ee.min!=null&&Ee.max!=null&&Ee.max-Ee.min<1e-16)return;de==P&&Ue.distr==2&&wn>0&&(Ee.min=Dd(Ee.min,e[0]),Ee.max=Dd(Ee.max,e[0]),Ee.min==Ee.max&&Ee.max++),B[de]=Ee,Me=!0,Go()}}r.setScale=kc;let Pc,Yl,qa,ia,Na,yl,xs,Wo,$o,Dc,ei,zr,Xa=!1;const mr=H.drag;let bi=mr.x,Ii=mr.y;re&&(H.x&&(Pc=Iu(rhe,b)),H.y&&(Yl=Iu(ihe,b)),U.ori==0?(qa=Pc,ia=Yl):(qa=Yl,ia=Pc),ei=H.left,zr=H.top);const Gr=r.select=Ba({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),To=Gr.show?Iu(nhe,Gr.over?b:v):null;function bl(de,Ee){if(Gr.show){for(let Ue in de)Gr[Ue]=de[Ue],Ue in _m&&As(To,Ue,de[Ue]);Ee!==!1&&Ds("setSelect")}}r.setSelect=bl;function Kl(de){if(E[de].show)se&&rR(xe[de],Eg);else if(se&&Gc(xe[de],Eg),re){let Ue=Pt?Ve[0]:Ve[de];Ue!=null&&Ef(Ue,-10,-10,te,_e)}}function ga(de,Ee,Ue){kc(de,{min:Ee,max:Ue})}function hi(de,Ee,Ue,qe){Ee.focus!=null&&_l(de),Ee.show!=null&&E.forEach((ct,St)=>{St>0&&(de==St||de==null)&&(ct.show=Ee.show,Kl(St),i==2?(ga(ct.facets[0].scale,null,null),ga(ct.facets[1].scale,null,null)):ga(ct.scale,null,null),Go())}),Ue!==!1&&Ds("setSeries",de,Ee),qe&&cd("setSeries",r,de,Ee)}r.setSeries=hi;function vh(de,Ee){Ba(I[de],Ee)}function nd(de,Ee){de.fill=ri(de.fill||null),de.dir=wi(de.dir,-1),Ee=Ee??I.length,I.splice(Ee,0,de)}function rd(de){de==null?I.length=0:I.splice(de,1)}r.addBand=nd,r.setBand=vh,r.delBand=rd;function Qd(de,Ee){E[de].alpha=Ee,re&&Ve[de]!=null&&(Ve[de].style.opacity=Ee),se&&xe[de]&&(xe[de].style.opacity=Ee)}let fo,Gi,Hs;const ys={focus:!0};function _l(de){if(de!=Hs){let Ee=de==null,Ue=bt.alpha!=1;E.forEach((qe,ct)=>{if(i==1||ct>0){let St=Ee||ct==0||ct==de;qe._focus=Ee?null:St,Ue&&Qd(ct,St?1:bt.alpha)}}),Hs=de,Ue&&Go()}}se&&Nt&&Ae(kI,ue,de=>{H._lock||(yt(de),Hs!=null&&hi(null,ys,!0,bs.setSeries))});function va(de,Ee,Ue){let qe=N[Ee];Ue&&(de=de/Ni-(qe.ori==1?ye:ve));let ct=te;qe.ori==1&&(ct=_e,de=ct-de),qe.dir==-1&&(de=ct-de);let St=qe._min,jt=qe._max,Gt=de/ct,Kt=St+(jt-St)*Gt,mn=qe.distr;return mn==3?$1(10,Kt):mn==4?_he(Kt,qe.asinh):mn==100?qe.bwd(Kt):Kt}function wp(de,Ee){let Ue=va(de,P,Ee);return Dd(Ue,e[0],On,jn)}r.valToIdx=de=>Dd(de,e[0]),r.posToIdx=wp,r.posToVal=va,r.valToPos=(de,Ee,Ue)=>N[Ee].ori==0?s(de,N[Ee],Ue?Fe:te,Ue?Qe:0):a(de,N[Ee],Ue?Ge:_e,Ue?Ie:0),r.setCursor=(de,Ee,Ue)=>{ei=de.left,zr=de.top,Zl(null,Ee,Ue)};function xh(de,Ee){As(To,wx,Gr.left=de),As(To,h_,Gr.width=Ee)}function ym(de,Ee){As(To,Hb,Gr.top=de),As(To,p_,Gr.height=Ee)}let Jd=U.ori==0?xh:ym,id=U.ori==1?xh:ym;function Mp(){if(se&&X.live)for(let de=i==2?1:0;de<E.length;de++){if(de==0&&We)continue;let Ee=X.values[de],Ue=0;for(let qe in Ee)he[de][Ue++].firstChild.nodeValue=Ee[qe]}}function Tp(de,Ee){if(de!=null&&(de.idxs?de.idxs.forEach((Ue,qe)=>{j[qe]=Ue}):The(de.idx)||j.fill(de.idx),X.idx=j[0]),se&&X.live){for(let Ue=0;Ue<E.length;Ue++)(Ue>0||i==1&&!We)&&sd(Ue,j[Ue]);Mp()}ft=!1,Ee!==!1&&Ds("setLegend")}r.setLegend=Tp;function sd(de,Ee){let Ue=E[de],qe=de==0&&V==2?ui:e[de],ct;We?ct=Ue.values(r,de,Ee)??Se:(ct=Ue.value(r,Ee==null?null:qe[Ee],de,Ee),ct=ct==null?Se:{_:ct}),X.values[de]=ct}function Zl(de,Ee,Ue){$o=ei,Dc=zr,[ei,zr]=H.move(r,ei,zr),H.left=ei,H.top=zr,re&&(qa&&Ef(qa,to(ei),0,te,_e),ia&&Ef(ia,0,to(zr),te,_e));let qe,ct=On>jn;fo=ts,Gi=null;let St=U.ori==0?te:_e,jt=U.ori==1?te:_e;if(ei<0||wn==0||ct){qe=H.idx=null;for(let Gt=0;Gt<E.length;Gt++){let Kt=Ve[Gt];Kt!=null&&Ef(Kt,-10,-10,te,_e)}Nt&&hi(null,ys,!0,de==null&&bs.setSeries),X.live&&(j.fill(qe),ft=!0)}else{let Gt,Kt,mn;i==1&&(Gt=U.ori==0?ei:zr,Kt=va(Gt,P),qe=H.idx=Dd(Kt,e[0],On,jn),mn=G(e[0][qe],U,St,0));let vn=-10,_n=-10,er=0,Xr=0,tr=!0,ur="",Vn="";for(let Nn=i==2?1:0;Nn<E.length;Nn++){let qn=E[Nn],Ji=j[Nn],Is=Ji==null?null:i==1?e[Nn][Ji]:e[Nn][1][Ji],pi=H.dataIdx(r,Nn,qe,Kt),si=pi==null?null:i==1?e[Nn][pi]:e[Nn][1][pi];if(ft=ft||si!=Is||pi!=Ji,j[Nn]=pi,Nn>0&&qn.show){let as=pi==null?-10:pi==qe?mn:G(i==1?e[0][pi]:e[Nn][0][pi],U,St,0),Os=si==null?-10:Z(si,i==1?N[qn.scale]:N[qn.facets[1].scale],jt,0);if(Nt&&si!=null){let Ya=U.ori==1?ei:zr,Ra=no(bt.dist(r,Nn,pi,Os,Ya));if(Ra<fo){let Hi=bt.bias;if(Hi!=0){let Gs=va(Ya,qn.scale),ka=si>=0?1:-1,Eo=Gs>=0?1:-1;Eo==ka&&(Eo==1?Hi==1?si>=Gs:si<=Gs:Hi==1?si<=Gs:si>=Gs)&&(fo=Ra,Gi=Nn)}else fo=Ra,Gi=Nn}}if(ft||Pt){let Ya,Ra;U.ori==0?(Ya=as,Ra=Os):(Ya=Os,Ra=as);let Hi,Gs,ka,Eo,sa,aa,xa=!0,Oc=lt.bbox;if(Oc!=null){xa=!1;let Pa=Oc(r,Nn);ka=Pa.left,Eo=Pa.top,Hi=Pa.width,Gs=Pa.height}else ka=Ya,Eo=Ra,Hi=Gs=lt.size(r,Nn);if(aa=lt.fill(r,Nn),sa=lt.stroke(r,Nn),Pt)Nn==Gi&&fo<=bt.prox&&(vn=ka,_n=Eo,er=Hi,Xr=Gs,tr=xa,ur=aa,Vn=sa);else{let Pa=Ve[Nn];Pa!=null&&(wt[Nn]=ka,Et[Nn]=Eo,jI(Pa,Hi,Gs,xa),LI(Pa,aa,sa),Ef(Pa,Fu(ka),Fu(Eo),te,_e))}}}}if(Pt){let Nn=bt.prox,qn=Hs==null?fo<=Nn:fo>Nn||Gi!=Hs;if(ft||qn){let Ji=Ve[0];Ji!=null&&(wt[0]=vn,Et[0]=_n,jI(Ji,er,Xr,tr),LI(Ji,ur,Vn),Ef(Ji,Fu(vn),Fu(_n),te,_e))}}}if(Gr.show&&Xa)if(de!=null){let[Gt,Kt]=bs.scales,[mn,vn]=bs.match,[_n,er]=de.cursor.sync.scales,Xr=de.cursor.drag;if(bi=Xr._x,Ii=Xr._y,bi||Ii){let{left:tr,top:ur,width:Vn,height:Nn}=de.select,qn=de.scales[_n].ori,Ji=de.posToVal,Is,pi,si,as,Os,Ya=Gt!=null&&mn(Gt,_n),Ra=Kt!=null&&vn(Kt,er);Ya&&bi?(qn==0?(Is=tr,pi=Vn):(Is=ur,pi=Nn),si=N[Gt],as=G(Ji(Is,_n),si,St,0),Os=G(Ji(Is+pi,_n),si,St,0),Jd(Od(as,Os),no(Os-as))):Jd(0,St),Ra&&Ii?(qn==1?(Is=tr,pi=Vn):(Is=ur,pi=Nn),si=N[Kt],as=Z(Ji(Is,er),si,jt,0),Os=Z(Ji(Is+pi,er),si,jt,0),id(Od(as,Os),no(Os-as))):id(0,jt)}else Vs()}else{let Gt=no($o-Na),Kt=no(Dc-yl);if(U.ori==1){let er=Gt;Gt=Kt,Kt=er}bi=mr.x&&Gt>=mr.dist,Ii=mr.y&&Kt>=mr.dist;let mn=mr.uni;mn!=null?bi&&Ii&&(bi=Gt>=mn,Ii=Kt>=mn,!bi&&!Ii&&(Kt>Gt?Ii=!0:bi=!0)):mr.x&&mr.y&&(bi||Ii)&&(bi=Ii=!0);let vn,_n;bi&&(U.ori==0?(vn=xs,_n=ei):(vn=Wo,_n=zr),Jd(Od(vn,_n),no(_n-vn)),Ii||id(0,jt)),Ii&&(U.ori==1?(vn=xs,_n=ei):(vn=Wo,_n=zr),id(Od(vn,_n),no(_n-vn)),bi||Jd(0,St)),!bi&&!Ii&&(Jd(0,0),id(0,0))}if(mr._x=bi,mr._y=Ii,de==null){if(Ue){if(Np!=null){let[Gt,Kt]=bs.scales;bs.values[0]=Gt!=null?va(U.ori==0?ei:zr,Gt):null,bs.values[1]=Kt!=null?va(U.ori==1?ei:zr,Kt):null}cd(KC,r,ei,zr,te,_e,qe)}if(Nt){let Gt=Ue&&bs.setSeries,Kt=bt.prox;Hs==null?fo<=Kt&&hi(Gi,ys,!0,Gt):fo>Kt?hi(null,ys,!0,Gt):Gi!=Hs&&hi(Gi,ys,!0,Gt)}}ft&&(X.idx=qe,Tp()),Ee!==!1&&Ds("setCursor")}let Ql=null;Object.defineProperty(r,"rect",{get(){return Ql==null&&ad(!1),Ql}});function ad(de=!1){de?Ql=null:(Ql=b.getBoundingClientRect(),Ds("syncRect",Ql))}function bm(de,Ee,Ue,qe,ct,St,jt){H._lock||Xa&&de!=null&&de.movementX==0&&de.movementY==0||(Ep(de,Ee,Ue,qe,ct,St,jt,!1,de!=null),de!=null?Zl(null,!0,!0):Zl(Ee,!0,!1))}function Ep(de,Ee,Ue,qe,ct,St,jt,Gt,Kt){if(Ql==null&&ad(!1),yt(de),de!=null)Ue=de.clientX-Ql.left,qe=de.clientY-Ql.top;else{if(Ue<0||qe<0){ei=-10,zr=-10;return}let[mn,vn]=bs.scales,_n=Ee.cursor.sync,[er,Xr]=_n.values,[tr,ur]=_n.scales,[Vn,Nn]=bs.match,qn=Ee.axes[0].side%2==1,Ji=U.ori==0?te:_e,Is=U.ori==1?te:_e,pi=qn?St:ct,si=qn?ct:St,as=qn?qe:Ue,Os=qn?Ue:qe;if(tr!=null?Ue=Vn(mn,tr)?o(er,N[mn],Ji,0):-10:Ue=Ji*(as/pi),ur!=null?qe=Nn(vn,ur)?o(Xr,N[vn],Is,0):-10:qe=Is*(Os/si),U.ori==1){let Ya=Ue;Ue=qe,qe=Ya}}Kt&&(Ee==null||Ee.cursor.event.type==KC)&&((Ue<=1||Ue>=te-1)&&(Ue=_g(Ue,te)),(qe<=1||qe>=_e-1)&&(qe=_g(qe,_e))),Gt?(Na=Ue,yl=qe,[xs,Wo]=H.move(r,Ue,qe)):(ei=Ue,zr=qe)}const _m={width:0,height:0,left:0,top:0};function Vs(){bl(_m,!1)}let Sm,wm,Mm,Tm;function uu(de,Ee,Ue,qe,ct,St,jt){Xa=!0,bi=Ii=mr._x=mr._y=!1,Ep(de,Ee,Ue,qe,ct,St,jt,!0,!1),de!=null&&(Ae(ZC,tR,od,!1),cd(NI,r,xs,Wo,te,_e,null));let{left:Gt,top:Kt,width:mn,height:vn}=Gr;Sm=Gt,wm=Kt,Mm=mn,Tm=vn}function od(de,Ee,Ue,qe,ct,St,jt){Xa=mr._x=mr._y=!1,Ep(de,Ee,Ue,qe,ct,St,jt,!1,!0);let{left:Gt,top:Kt,width:mn,height:vn}=Gr,_n=mn>0||vn>0,er=Sm!=Gt||wm!=Kt||Mm!=mn||Tm!=vn;if(_n&&er&&bl(Gr),mr.setScale&&_n&&er){let Xr=Gt,tr=mn,ur=Kt,Vn=vn;if(U.ori==1&&(Xr=Kt,tr=vn,ur=Gt,Vn=mn),bi&&ga(P,va(Xr,P),va(Xr+tr,P)),Ii)for(let Nn in N){let qn=N[Nn];Nn!=P&&qn.from==null&&qn.min!=ts&&ga(Nn,va(ur+Vn,Nn),va(ur,Nn))}Vs()}else H.lock&&(H._lock=!H._lock,Zl(Ee,!0,de!=null));de!=null&&(Pe(ZC,tR),cd(ZC,r,ei,zr,te,_e,null))}function Cp(de,Ee,Ue,qe,ct,St,jt){if(H._lock)return;yt(de);let Gt=Xa;if(Xa){let Kt=!0,mn=!0,vn=10,_n,er;U.ori==0?(_n=bi,er=Ii):(_n=Ii,er=bi),_n&&er&&(Kt=ei<=vn||ei>=te-vn,mn=zr<=vn||zr>=_e-vn),_n&&Kt&&(ei=ei<xs?0:te),er&&mn&&(zr=zr<Wo?0:_e),Zl(null,!0,!0),Xa=!1}ei=-10,zr=-10,j.fill(null),Zl(null,!0,!0),Gt&&(Xa=Gt)}function Ap(de,Ee,Ue,qe,ct,St,jt){H._lock||(yt(de),_t(),Vs(),de!=null&&cd(PI,r,ei,zr,te,_e,null))}function Em(){A.forEach(Bpe),pt(r.width,r.height,!0)}Gg(g2,m1,Em);const Jl={};Jl.mousedown=uu,Jl.mousemove=bm,Jl.mouseup=od,Jl.dblclick=Ap,Jl.setSeries=(de,Ee,Ue,qe)=>{let ct=bs.match[2];Ue=ct(r,Ee,Ue),Ue!=-1&&hi(Ue,qe,!0,!1)},re&&(Ae(NI,b,uu),Ae(KC,b,bm),Ae(RI,b,de=>{yt(de),ad(!1)}),Ae(kI,b,Cp),Ae(PI,b,Ap),cR.add(r),r.syncRect=ad);const ld=r.hooks=t.hooks||{};function Ds(de,Ee,Ue){uo?Ps.push([de,Ee,Ue]):de in ld&&ld[de].forEach(qe=>{qe.call(null,r,Ee,Ue)})}(t.plugins||[]).forEach(de=>{for(let Ee in de.hooks)ld[Ee]=(ld[Ee]||[]).concat(de.hooks[Ee])});const du=(de,Ee,Ue)=>Ue,bs=Ba({key:null,setSeries:!1,filters:{pub:VI,sub:VI},scales:[P,E[1]?E[1].scale:null],match:[GI,GI,du],values:[null,null]},H.sync);bs.match.length==2&&bs.match.push(du),H.sync=bs;const Np=bs.key,yh=$W(Np);function cd(de,Ee,Ue,qe,ct,St,jt){bs.filters.pub(de,Ee,Ue,qe,ct,St,jt)&&yh.pub(de,Ee,Ue,qe,ct,St,jt)}yh.sub(r);function Rp(de,Ee,Ue,qe,ct,St,jt){bs.filters.sub(de,Ee,Ue,qe,ct,St,jt)&&Jl[de](null,Ee,Ue,qe,ct,St,jt)}r.pub=Rp;function fu(){yh.unsub(r),cR.delete(r),Xe.clear(),iR(g2,m1,Em),c.remove(),ue==null||ue.remove(),Ds("destroy")}r.destroy=fu;function Ic(){Ds("init",t,e),ot(e||t.data,!1),B[P]?kc(P,B[P]):_t(),st=Gr.show&&(Gr.width>0||Gr.height>0),Oe=ft=!0,pt(t.width,t.height)}return E.forEach(Ht),A.forEach(pn),n?n instanceof HTMLElement?(n.appendChild(c),Ic()):n(r,Ic):Ic(),r}ma.assign=Ba;ma.fmtNum=F8;ma.rangeNum=v2;ma.rangeLog=ST;ma.rangeAsinh=z8;ma.orient=bv;ma.pxRatio=Ni;ma.join=Phe;ma.fmtDate=B8,ma.tzDate=Vhe;ma.sync=$W;{ma.addGap=Tpe,ma.clipGaps=TT;let t=ma.paths={points:QW};t.linear=e$,t.stepped=Ape,t.bars=Npe,t.spline=kpe}const i$=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_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 z0({label:t,onRemove:e}){return p.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[9px] bg-white border border-gray-300 text-gray-400 rounded-full cursor-pointer hover:bg-gray-50 transition-colors whitespace-nowrap shrink-0",onClick:n=>{n.stopPropagation(),e()},children:[t,p.jsx(Ju,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function s$(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),a=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),o=a-s,l=6;return{lower:s-l*o,upper:a+l*o}}function a$(t){return t.split("/").pop()||t}function sv(t){var n;return((n=t.runName)==null?void 0:n.trim())||a$(t.runPath)}const Hpe=d1-1,fO="max-w-[190px]";function g_(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Vpe(t){const e=g_(t),{isTruncated:n,prefix:r,suffix:i}=OG(t,Hpe);return n?`<span class="inline-flex ${fO} min-w-0 items-center align-bottom" title="${e}"><span class="shrink-0">${g_(r)}</span><span class="shrink-0 px-0.5 text-muted-foreground/70">...</span><span class="shrink-0">${g_(i)}</span></span>`:`<span class="inline-block ${fO} truncate align-bottom" title="${e}">${g_(r)}</span>`}function X8(t){const e=Vpe(sv(t)),n=g_(a$(t.runPath));return`${e} <span class="text-muted-foreground/70">(${n})</span>`}function o$(t){const e=Math.abs(t);if(e>=60)return mT(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 ev(t)}const Gpe=28;function Wpe(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,a=t[n];if(a!=null)return s(n)?n:null;let o=n-1,l=n+1;for(;o>=0||l<t.length;){const c=o>=0?t[o]:void 0,d=l<t.length?t[l]:void 0,h=c!=null,g=d!=null;if(h&&g){const v=Math.abs(Number(e[o])-i),_=Math.abs(Number(e[l])-i)<v?l:o;return s(_)?_:null}if(h)return s(o)?o:null;if(g)return s(l)?l:null;o-=1,l+=1}return null}function o4(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const $pe={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 qpe(t){const e={...$pe};if(t.length>0){const n=t.map(r=>({prefix:`reward_${r}`,label:Xpe(r)}));e.samples_metrics={title:"Samples Metrics",prefixes:n}}return e}function Xpe(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const l$=["mean","std","min","max"],c$={mean:"Mean",std:"Std",min:"Min",max:"Max"};function Y8(t,e){const n=typeof IntersectionObserver>"u",[r,i]=T.useState(n),[s,a]=T.useState(n),o=T.useRef(null),l=(e==null?void 0:e.root)??null,c=(e==null?void 0:e.rootMargin)??"0px",d=(e==null?void 0:e.threshold)??0;return T.useEffect(()=>{const h=t.current;if(!h||typeof IntersectionObserver>"u")return;const g=new IntersectionObserver(([v])=>{const b=v.isIntersecting;i(b),b?(o.current&&(clearTimeout(o.current),o.current=null),a(!0)):(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(!1),o.current=null},2e3))},{root:l,rootMargin:c,threshold:d});return g.observe(h),()=>{g.disconnect(),o.current&&clearTimeout(o.current)}},[t,l,c,d]),r||s}function Ype({runs:t,shouldPoll:e,maxStep:n,maxTime:r,showEma:i=!1,emaSpan:s=10,hoveredRunId:a=null,availableRewardNames:o=[],customMetricSections:l={},xAxisMode:c="step",scrollRoot:d=null,evalsList:h=[]}){var _e,ve,ye,ke,Be,ge,Ye,Qe,Ie,Fe,Ge,Me,$e,dt,Oe,st,ft,pt,et,Ze;const[g,v]=T.useState({}),[b,_]=T.useState(!0),[w,S]=T.useState(!0),[E,A]=T.useState(!0),[N,I]=T.useState(!0),[P,L]=T.useState({}),[R,O]=T.useState(!0),[W,U]=T.useState(!0),[V,G]=T.useState(!0),Z=T.useMemo(()=>qpe(o),[o]),B=c==="time",q=Or(((_e=t[0])==null?void 0:_e.runPath)||"",B&&!!t[0],e),Y=Or(((ve=t[1])==null?void 0:ve.runPath)||"",B&&!!t[1],e),K=Or(((ye=t[2])==null?void 0:ye.runPath)||"",B&&!!t[2],e),J=Or(((ke=t[3])==null?void 0:ke.runPath)||"",B&&!!t[3],e),F=Or(((Be=t[4])==null?void 0:Be.runPath)||"",B&&!!t[4],e),j=Or(((ge=t[5])==null?void 0:ge.runPath)||"",B&&!!t[5],e),X=Or(((Ye=t[6])==null?void 0:Ye.runPath)||"",B&&!!t[6],e),H=Or(((Qe=t[7])==null?void 0:Qe.runPath)||"",B&&!!t[7],e),se=Or(((Ie=t[8])==null?void 0:Ie.runPath)||"",B&&!!t[8],e),re=Or(((Fe=t[9])==null?void 0:Fe.runPath)||"",B&&!!t[9],e),ie=Or(((Ge=t[10])==null?void 0:Ge.runPath)||"",B&&!!t[10],e),ue=Or(((Me=t[11])==null?void 0:Me.runPath)||"",B&&!!t[11],e),le=Or((($e=t[12])==null?void 0:$e.runPath)||"",B&&!!t[12],e),fe=Or(((dt=t[13])==null?void 0:dt.runPath)||"",B&&!!t[13],e),xe=Or(((Oe=t[14])==null?void 0:Oe.runPath)||"",B&&!!t[14],e),he=Or(((st=t[15])==null?void 0:st.runPath)||"",B&&!!t[15],e),Te=Or(((ft=t[16])==null?void 0:ft.runPath)||"",B&&!!t[16],e),We=Or(((pt=t[17])==null?void 0:pt.runPath)||"",B&&!!t[17],e),Se=Or(((et=t[18])==null?void 0:et.runPath)||"",B&&!!t[18],e),Le=Or(((Ze=t[19])==null?void 0:Ze.runPath)||"",B&&!!t[19],e),{isStepTimesFetching:pe,isStepTimesRefetching:Re}=T.useMemo(()=>{if(!B)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const me=[q,Y,K,J,F,j,X,H,se,re,ie,ue,le,fe,xe,he,Te,We,Se,Le],je=me.some(yt=>yt.isFetching),He=me.filter(yt=>yt.isFetching),nt=je&&He.length>0&&He.every(yt=>!!yt.data);return{isStepTimesFetching:je,isStepTimesRefetching:nt}},[B,q,Y,K,J,F,j,X,H,se,re,ie,ue,le,fe,xe,he,Te,We,Se,Le]),{stepTimesByRun:ne,firstStepTimesByRun:Xe}=T.useMemo(()=>{if(!B)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const me=[q,Y,K,J,F,j,X,H,se,re,ie,ue,le,fe,xe,he,Te,We,Se,Le],je=new Map,He=new Map;return t.forEach((nt,yt)=>{if(yt>=20)return;const bt=me[yt].data;if(!bt||bt.first_step_time===null||bt.first_step_time===void 0||!bt.step_times||bt.step_times.length===0)return;const Nt=new Map;bt.step_times.forEach(Pt=>{typeof Pt.time=="number"&&Nt.set(Pt.step,Pt.time)}),Nt.size>0&&(je.set(nt.runPath,Nt),He.set(nt.runPath,bt.first_step_time))}),{stepTimesByRun:je,firstStepTimesByRun:He}},[t,B,q,Y,K,J,F,j,X,H,se,re,ie,ue,le,fe,xe,he,Te,We,Se,Le]),Ae={xAxisMode:c,stepTimesByRun:ne,firstStepTimesByRun:Xe,isStepTimesFetching:pe,isStepTimesRefetching:Re,scrollRoot:d,maxStepLimit:n,maxTimeLimit:r},Pe=T.useMemo(()=>Object.keys(l),[l]),Ke=T.useCallback(me=>{v(je=>({...je,[me]:!(je[me]??!0)}))},[]),oe=T.useCallback(me=>{L(je=>({...je,[me]:!(je[me]??!0)}))},[]),te=h.length>0;return p.jsxs("div",{className:"-mt-3",children:[Pe.map((me,je)=>{const He=g[me]??!0,nt=l[me]??{},yt=Object.entries(nt);return p.jsxs("div",{children:[je>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:He,onOpenChange:()=>Ke(me),children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!He&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:o4(me)})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-4 mt-3 mb-4",children:yt.map(([lt,bt])=>p.jsxs("div",{children:[lt&&p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:o4(lt)}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:bt.map(Nt=>p.jsx(Hr,{runs:t,shouldPoll:e,metricName:Nt,label:o4(Nt),showEma:i,emaSpan:s,hoveredRunId:a,...Ae},Nt))})]},lt))})})]})]},me)}),Pe.length>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:b,onOpenChange:_,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!b&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:Z.reward.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Z.reward.prefixes.map(me=>p.jsx(tg,{runs:t,shouldPoll:e,prefix:me.prefix,label:me.label,hideGroupLabel:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ae,extraCharts:me.prefix==="reward_sum"?p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"reward_gini_mean",label:`${me.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:a,...Ae}):void 0},me.prefix))})})]}),Z.samples_metrics&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:w,onOpenChange:S,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!w&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:Z.samples_metrics.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Z.samples_metrics.prefixes.map(me=>p.jsx(tg,{runs:t,shouldPoll:e,prefix:me.prefix,label:me.label,showEma:i,emaSpan:s,hoveredRunId:a,...Ae,extraCharts:p.jsx(Hr,{runs:t,shouldPoll:e,metricName:`${me.prefix}_gini_mean`,label:`${me.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:a,...Ae})},me.prefix))})})]})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:E,onOpenChange:A,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!E&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:Z.advantage.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Z.advantage.prefixes.map(me=>p.jsx(tg,{runs:t,shouldPoll:e,prefix:me.prefix,label:me.label,hideGroupLabel:!0,showZeroLine:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ae},me.prefix))})})]}),te&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:N,onOpenChange:I,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!N&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"Evals"})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"mt-3 mb-4 space-y-4",children:h.map((me,je)=>{const He=me.eval_name,nt=me.available_rollout_metric_names,yt=P[He]??!0;return p.jsxs("div",{children:[je>0&&p.jsx("div",{className:"border-t border-gray-100 my-3"}),p.jsxs(Ki,{open:yt,onOpenChange:()=>oe(He),children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-3.5 w-3.5 text-muted-foreground transition-transform",!yt&&"-rotate-90")}),p.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:He})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3",children:[nt.map(lt=>p.jsx(l4,{runs:t,shouldPoll:e,evalName:He,prefix:`reward_${lt}`,label:o4(lt),showEma:i,emaSpan:s,hoveredRunId:a,scrollRoot:d,xAxisMode:c,stepTimesByRun:Ae.stepTimesByRun,firstStepTimesByRun:Ae.firstStepTimesByRun,isStepTimesFetching:Ae.isStepTimesFetching,isStepTimesRefetching:Ae.isStepTimesRefetching,maxStepLimit:Ae.maxStepLimit,maxTimeLimit:Ae.maxTimeLimit},`${He}-reward_${lt}`)),p.jsx(l4,{runs:t,shouldPoll:e,evalName:He,prefix:"length_completion",label:"Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,scrollRoot:d,xAxisMode:c,stepTimesByRun:Ae.stepTimesByRun,firstStepTimesByRun:Ae.firstStepTimesByRun,isStepTimesFetching:Ae.isStepTimesFetching,isStepTimesRefetching:Ae.isStepTimesRefetching,maxStepLimit:Ae.maxStepLimit,maxTimeLimit:Ae.maxTimeLimit}),p.jsx(l4,{runs:t,shouldPoll:e,evalName:He,prefix:"length_prompt",label:"Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,scrollRoot:d,xAxisMode:c,stepTimesByRun:Ae.stepTimesByRun,firstStepTimesByRun:Ae.firstStepTimesByRun,isStepTimesFetching:Ae.isStepTimesFetching,isStepTimesRefetching:Ae.isStepTimesRefetching,maxStepLimit:Ae.maxStepLimit,maxTimeLimit:Ae.maxTimeLimit}),p.jsx(l4,{runs:t,shouldPoll:e,evalName:He,prefix:"length_sum",label:"Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,scrollRoot:d,xAxisMode:c,stepTimesByRun:Ae.stepTimesByRun,firstStepTimesByRun:Ae.firstStepTimesByRun,isStepTimesFetching:Ae.isStepTimesFetching,isStepTimesRefetching:Ae.isStepTimesRefetching,maxStepLimit:Ae.maxStepLimit,maxTimeLimit:Ae.maxTimeLimit})]})})]})]},He)})})})]})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:R,onOpenChange:O,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!R&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:Z.rollouts.title})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[Z.rollouts.prefixes.map(me=>p.jsx(tg,{runs:t,shouldPoll:e,prefix:me.prefix,label:me.label,unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ae},me.prefix)),p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"General"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:a,...Ae})]})]})]})})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:W,onOpenChange:U,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!W&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"Discarded Rollouts"})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Discarded Rollouts General"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_count",label:"Discarded Count",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_pct",label:"Zero Advantage %",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_max_async_pct",label:"Max Async %",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:a,...Ae})]})]}),p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Zero Advantage Breakdown"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_zero_pct",label:"Zero Advantage (All Reward = 0) %",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_positive_pct",label:"Zero Advantage (All Reward > 0) %",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_mean_reward",label:"Zero Advantage Mean Reward",showEma:i,emaSpan:s,hoveredRunId:a,...Ae})]})]}),p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Canceled"}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"canceled_count",label:"Canceled Count",showEma:i,emaSpan:s,hoveredRunId:a,...Ae})})]}),p.jsx(tg,{runs:t,shouldPoll:e,prefix:"discarded_length_prompt",label:"Discarded Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(tg,{runs:t,shouldPoll:e,prefix:"discarded_length_completion",label:"Discarded Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(tg,{runs:t,shouldPoll:e,prefix:"discarded_length_sum",label:"Discarded Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ae})]})})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:V,onOpenChange:G,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!V&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"Timeline"})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Full Step (Total Time)"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_step_total",label:"Time per Step",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_step_active",label:"Time per Step Active (Excl. Wait)",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_save_batch_total",label:"Batch Completion (Save Batch)",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_microbatch_count",label:"Microbatches per Step",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_forward_total",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_backward_total",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_total",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_total",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_total",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_total",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_total",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_waiting_for_data",label:"Waiting for Data",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_trainer_total",label:"Weight Broadcast (Trainer)",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_inference_total",label:"Weight Broadcast (Inference)",showEma:i,emaSpan:s,hoveredRunId:a,...Ae})]})]}),p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Microbatch (Mean Time per Microbatch)"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_forward_microbatch_mean",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_backward_microbatch_mean",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_microbatch_mean",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_microbatch_mean",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_microbatch_mean",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_microbatch_mean",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:a,...Ae}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_microbatch_mean",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:a,...Ae})]})]})]})})]})]})}const y2=100;function Kpe(t,e,n){const r=t.length;if(r<=y2)return{steps:t,counts:e};const i=Math.ceil(r/y2),s=[],a=[],o=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),d=Math.floor((l+c-1)/2);s.push(t[d]);const h=new Array(o).fill(0);for(let g=l;g<c;g++){const v=e[g];for(let b=0;b<o;b++)h[b]+=v[b]||0}a.push(h)}return{steps:s,counts:a}}function u$({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,shouldPoll:s,scrollRoot:a=null,headerPrefix:o,headerSuffix:l}){const c=T.useRef(null),d=T.useRef(null),h=T.useRef(null),g=T.useRef(null),v=T.useRef(null),b=Y8(c,{root:a,threshold:0}),{data:_,isFetching:w,isRefetching:S}=PG(t,e,b&&!!t&&!!e,s),E=_&&_.steps.length>0&&_.bin_edges.length>0,A=E&&_.steps.length>y2,N=T.useMemo(()=>!E||!_?null:A?Kpe(_.steps,_.counts,_.bin_edges):{steps:_.steps,counts:_.counts},[E,_,A]),I=T.useCallback(U=>U==null?"N/A":i?Math.round(U).toLocaleString():qu(U),[i]),P=T.useCallback(U=>Math.abs(U)>=1e3?`${parseFloat((U/1e3).toFixed(1))}k`:i?Math.round(U).toString():Number.isInteger(U)?U.toLocaleString():Math.abs(U)<.01&&U!==0?U.toExponential(1):String(parseFloat(U.toFixed(2))),[i]),L=T.useCallback(()=>{const U={top:8,right:8,bottom:24,left:40};if(!h.current||!_)return U;const V=h.current.getContext("2d");if(!V)return U;const G="10px system-ui, sans-serif",Z=5;let B=0;V.save(),V.setTransform(1,0,0,1,0,0),V.font=G;for(let q=0;q<Z;q++){const Y=(_.global_min??0)+q/(Z-1)*((_.global_max??0)-(_.global_min??0)),K=P(Y);B=Math.max(B,V.measureText(K).width)}return V.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(B)+12)}},[_,P]);T.useEffect(()=>{if(!d.current||!h.current||!E||!_||!N)return;const U=d.current,V=h.current,G=V.getContext("2d");if(!G)return;const Z=U.clientWidth,B=200,q="rgba(100, 100, 100, 0.9)",Y="rgba(128, 128, 128, 0.15)",K="10px system-ui, sans-serif",J=window.devicePixelRatio||1;V.width=Z*J,V.height=B*J,V.style.width=`${Z}px`,V.style.height=`${B}px`,G.scale(J,J),G.font=K,G.clearRect(0,0,Z,B);const F=L(),j=Z-F.left-F.right,X=B-F.top-F.bottom,H=N.steps,se=_.bin_edges,re=N.counts,ie=H.length,ue=se.length-1;if(ie===0||ue===0)return;let le=0;for(const pe of re)for(const Re of pe)Re>le&&(le=Re);const fe=Math.min(5,ie),xe=5,he=j/Math.max(ie,1),Te=pe=>F.left+(pe+.5)*he,We=pe=>{const Re=(_.global_max??1)-(_.global_min??0),ne=(pe-(_.global_min??0))/(Re||1);return F.top+X-ne*X},Se=pe=>pe===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(pe/le)*.75})`;G.strokeStyle=Y,G.lineWidth=1;for(let pe=0;pe<fe;pe++){const Re=Math.floor(pe/Math.max(fe-1,1)*(ie-1)),ne=Te(Re);G.beginPath(),G.moveTo(ne,F.top),G.lineTo(ne,B-F.bottom),G.stroke()}for(let pe=0;pe<xe;pe++){const Re=(_.global_min??0)+pe/(xe-1)*((_.global_max??0)-(_.global_min??0)),ne=We(Re);G.beginPath(),G.moveTo(F.left,ne),G.lineTo(Z-F.right,ne),G.stroke()}const Le=he;for(let pe=0;pe<ie;pe++){const Re=F.left+pe*he,ne=re[pe];for(let Xe=0;Xe<ue;Xe++){const Ae=ne[Xe];if(Ae===0)continue;const Pe=se[Xe+1],Ke=se[Xe],oe=We(Pe),te=We(Ke),_e=Math.max(1,te-oe);G.fillStyle=Se(Ae),G.fillRect(Re,oe,Le,_e)}}if(r&&(_.global_min??0)<0&&(_.global_max??0)>0){const pe=We(0);G.strokeStyle="rgba(128, 128, 128, 0.5)",G.lineWidth=1,G.setLineDash([5,5]),G.beginPath(),G.moveTo(F.left,pe),G.lineTo(Z-F.right,pe),G.stroke(),G.setLineDash([])}G.strokeStyle=q,G.lineWidth=1,G.beginPath(),G.moveTo(F.left,B-F.bottom),G.lineTo(Z-F.right,B-F.bottom),G.stroke(),G.beginPath(),G.moveTo(F.left,F.top),G.lineTo(F.left,B-F.bottom),G.stroke(),G.fillStyle=q,G.font=K,G.textAlign="center";for(let pe=0;pe<fe;pe++){const Re=Math.floor(pe/Math.max(fe-1,1)*(ie-1)),ne=H[Re],Xe=Te(Re),Ae=ne>=1e3?`${(ne/1e3).toFixed(0)}k`:ne.toString();G.fillText(Ae,Xe,B-6)}G.textAlign="right",G.textBaseline="middle";for(let pe=0;pe<xe;pe++){const Re=(_.global_min??0)+pe/(xe-1)*((_.global_max??0)-(_.global_min??0)),ne=We(Re);G.fillText(P(Re),F.left-4,ne)}},[_,N,E,r,P,L]),T.useEffect(()=>{if(!d.current)return;const U=d.current,V=new ResizeObserver(()=>{if(h.current&&d.current){const G=d.current.clientWidth;h.current.style.width=`${G}px`}});return V.observe(U),()=>{V.disconnect()}},[]);const R=T.useCallback(U=>{var Ae;if(!_||!N||!g.current||!h.current||!d.current)return;const V=h.current.getBoundingClientRect(),G=U.clientX-V.left,Z=U.clientY-V.top,B=d.current.clientWidth,q=200,Y=L(),K=B-Y.left-Y.right,J=q-Y.top-Y.bottom;if(K<=0||J<=0){v.current&&(v.current.style.display="none");return}if(G<Y.left||G>B-Y.right||Z<Y.top||Z>q-Y.bottom){g.current.style.display="none",v.current&&(v.current.style.display="none");return}const F=(G-Y.left)/K,j=Math.min(N.steps.length-1,Math.max(0,Math.round(F*(N.steps.length-1)))),X=N.steps[j];if(v.current){const Pe=K/Math.max(N.steps.length,1),Ke=Y.left+(j+.5)*Pe;v.current.style.display="block",v.current.style.left=`${Ke}px`,v.current.style.top=`${Y.top}px`,v.current.style.bottom=`${Y.bottom}px`}const H=1-(Z-Y.top)/J,se=_.bin_edges.length-1,re=Math.min(se-1,Math.max(0,Math.floor(H*se))),ie=_.bin_edges[re],ue=_.bin_edges[re+1],le=((Ae=N.counts[j])==null?void 0:Ae[re])??0,xe=(N.counts[j]??[]).reduce((Pe,Ke)=>Pe+Ke,0),he=xe>0?(le/xe*100).toFixed(1):"0.0",We=A&&_.steps.length>y2?" (aggregated)":"";g.current.innerHTML=`
        <div class="font-medium mb-1">Step ${X.toLocaleString()}${We}</div>
        <div class="text-muted-foreground">Range: ${I(ie)} to ${I(ue)}</div>
        <div class="text-muted-foreground">Count: ${le.toLocaleString()} (${he}%)</div>
      `,g.current.style.display="block",g.current.style.left="0px",g.current.style.top="0px";const Se=g.current.getBoundingClientRect(),Le=U.clientX;let pe=Le;pe+Se.width+20>window.innerWidth&&(pe=Le-Se.width);const Re=Math.max(4,window.innerWidth-Se.width-4);pe=Math.min(Math.max(4,pe),Re);const ne=d.current.getBoundingClientRect();let Xe=ne.top-Se.height+20;Xe<4&&(Xe=ne.bottom-20),g.current.style.left=`${pe-Se.left}px`,g.current.style.top=`${Xe-Se.top}px`},[_,N,I,L,A]),O=T.useCallback(()=>{g.current&&(g.current.style.display="none"),v.current&&(v.current.style.display="none")},[]),W=w&&!S;return p.jsxs("div",{ref:c,className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white",W&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o,p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:n})}),l&&p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:l})]}),E?p.jsxs("div",{className:"h-[200px] relative bg-white rounded",ref:d,children:[p.jsx("canvas",{className:"block w-full h-full max-w-full",ref:h,onMouseMove:R,onMouseLeave:O}),p.jsx("div",{ref:v,className:"absolute z-[2] border-l border-dashed border-gray-500/70 pointer-events-none",style:{display:"none"}}),p.jsx("div",{ref:g,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),S&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted-foreground text-xs rounded",children:w?"Loading...":"No data"})]})}function Zpe(t,e,n,r,i){const s=T.useMemo(()=>t.slice(0,20).map(l=>l.runPath).filter(Boolean),[t]),a=bue(s,e,n?[n]:[],i&&s.length>0&&!!n,r);return{metricsByRunPath:T.useMemo(()=>{var c,d;const l=new Map;return(d=(c=a.data)==null?void 0:c.runs)==null||d.forEach(h=>{l.set(h.run_path,h.metrics??[])}),l},[a.data]),isFetching:a.isFetching,isRefetching:a.isFetching&&!!a.data}}function d$({runs:t,shouldPoll:e,evalName:n,metricName:r,label:i,unit:s,showZeroLine:a,statType:o,isTokenMetric:l,showEma:c=!1,emaSpan:d=10,hoveredRunId:h=null,xAxisMode:g="step",stepTimesByRun:v,firstStepTimesByRun:b,isStepTimesFetching:_=!1,isStepTimesRefetching:w=!1,scrollRoot:S=null,maxStepLimit:E,maxTimeLimit:A,headerPrefix:N,headerSuffix:I}){const P=T.useRef(null),L=T.useRef(null),R=T.useRef(null),O=T.useRef(null),[W,U]=cn(EG),V=T.useMemo(()=>`eval-metric-${n}-${r}`,[n,r]),G=T.useRef(!1),Z=T.useRef(!1);T.useEffect(()=>{const Qe=Fe=>{(Fe.key==="Control"||Fe.key==="Meta")&&(Z.current=!0)},Ie=Fe=>{(Fe.key==="Control"||Fe.key==="Meta")&&(Z.current=!1,U(null))};return window.addEventListener("keydown",Qe),window.addEventListener("keyup",Ie),()=>{window.removeEventListener("keydown",Qe),window.removeEventListener("keyup",Ie)}},[U]);const B=`eval/${n}/${r}`,[q,Y]=cn(xG),J=i$.has(r),F=q[B],j=(F==null?void 0:F.ignoreOutliers)??!1,X=(F==null?void 0:F.ignoreFirstStep)??J,H=(F==null?void 0:F.minY)??null,se=(F==null?void 0:F.maxY)??null,re=T.useCallback(Qe=>{Y(Ie=>{const Fe={ignoreOutliers:!1,ignoreFirstStep:J,minY:null,maxY:null},Ge=Ie[B]??Fe,Me=Qe(Ge);if(Me.ignoreOutliers===Fe.ignoreOutliers&&Me.ignoreFirstStep===Fe.ignoreFirstStep&&Me.minY===Fe.minY&&Me.maxY===Fe.maxY){if(!Object.prototype.hasOwnProperty.call(Ie,B))return Ie;const dt={...Ie};return delete dt[B],dt}return{...Ie,[B]:Me}})},[B,Y,J]),ie=T.useCallback(Qe=>{re(Ie=>({...Ie,ignoreOutliers:Qe}))},[re]),ue=T.useCallback(Qe=>{re(Ie=>({...Ie,ignoreFirstStep:Qe}))},[re]),le=T.useCallback(Qe=>{re(Ie=>({...Ie,minY:Qe}))},[re]),fe=T.useCallback(Qe=>{re(Ie=>({...Ie,maxY:Qe}))},[re]),xe=Y8(P,{root:S,threshold:0}),he=T.useMemo(()=>{const Qe=t.filter(Fe=>!Fe.isSelected),Ie=t.filter(Fe=>Fe.isSelected);return[...Qe,...Ie]},[t]),Te=T.useMemo(()=>he.slice(0,20),[he]),We=T.useMemo(()=>{const Qe=new Map;return Te.forEach((Ie,Fe)=>{Qe.set(Ie.runPath,Fe)}),Qe},[Te]),{metricsByRunPath:Se,isFetching:Le,isRefetching:pe}=Zpe(t,n,r,e,xe),{uplotData:Re,seriesConfig:ne,isFetching:Xe,isRefetching:Ae,hasData:Pe,timeToStepByRun:Ke,outlierBounds:oe}=T.useMemo(()=>{const Qe=new Set,Ie=new Map,Fe=new Map,Ge=new Map,Me=g==="time"&&!!v&&!!b,$e=Le;he.forEach((me,je)=>{if(je>=20)return;const He=Se.get(me.runPath)??[],nt=new Map;if(He.forEach(yt=>{Qe.add(yt.step),nt.set(yt.step,yt.value)}),Ie.set(je,nt),Me){const yt=v==null?void 0:v.get(me.runPath),lt=b==null?void 0:b.get(me.runPath);if(yt&&lt!==void 0){const bt=new Map,Nt=new Map;yt.forEach((Pt,Ve)=>{const wt=Pt-lt;bt.set(Ve,wt),Nt.set(wt,Ve)}),Fe.set(je,bt),Ge.set(je,Nt)}}});const dt=()=>!(!$e&&!_||$e&&!pe||_&&!w);if(Qe.size===0)return{uplotData:null,seriesConfig:[],isFetching:$e||_,isRefetching:dt(),hasData:!1,timeToStepByRun:Ge,outlierBounds:null};let Oe=Array.from(Qe).sort((me,je)=>me-je);E!=null&&!Me&&(Oe=Oe.filter(me=>me<=E));let st=Oe;if(Me){const me=new Set;if(Ie.forEach((He,nt)=>{const yt=Fe.get(nt);yt&&He.forEach((lt,bt)=>{const Nt=yt.get(bt);Nt!==void 0&&me.add(Nt)})}),me.size===0)return{uplotData:null,seriesConfig:[],isFetching:$e||_,isRefetching:dt(),hasData:!1,timeToStepByRun:Ge,outlierBounds:null};let je=Array.from(me).sort((He,nt)=>He-nt);A!=null&&(je=je.filter(He=>He<=A)),st=je}let ft=null;if(j){const me=[];Ie.forEach(je=>{je.forEach(He=>{me.push(He)})}),ft=s$(me)}const pt=new Float64Array(st),et=[{label:Me?"Time (s)":"Step"}],Ze=[pt];return he.forEach((me,je)=>{if(je>=20)return;const He=Ie.get(je)||new Map;let nt;if(Me){const Nt=Fe.get(je),Pt=new Map;Nt&&He.forEach((Ve,wt)=>{const Et=Nt.get(wt);Et!==void 0&&Pt.set(Et,Ve)}),nt=st.map(Ve=>Pt.get(Ve)??null)}else nt=Oe.map(Nt=>He.get(Nt)??null);const yt=h===me.runPath,bt=h!==null&&!yt?.1:c?.3:1;Ze.push(nt),et.push({label:sv(me),stroke:me.color,width:1,alpha:bt,spanGaps:!0,points:{show:!1}})}),c&&he.forEach((me,je)=>{if(je>=20)return;const He=Ie.get(je)||new Map,nt=2/(d+1);let yt=null,lt;if(Me){const Ve=Fe.get(je),wt=new Map;Oe.forEach(Et=>{const zt=He.get(Et);if(zt!==void 0){yt=yt===null?zt:nt*zt+(1-nt)*yt;const Ht=Ve==null?void 0:Ve.get(Et);Ht!==void 0&&yt!==null&&wt.set(Ht,yt)}}),lt=st.map(Et=>wt.get(Et)??null)}else{const Ve=[];Oe.forEach(wt=>{const Et=He.get(wt);Et!==void 0?(yt=yt===null?Et:nt*Et+(1-nt)*yt,Ve.push(yt)):Ve.push(null)}),lt=Ve}const bt=h===me.runPath,Pt=h!==null&&!bt?.1:1;Ze.push(lt),et.push({label:`${sv(me)} (EMA)`,stroke:me.color,width:1.5,alpha:Pt,spanGaps:!0,points:{show:!1}})}),{uplotData:Ze,seriesConfig:et,isFetching:$e||_,isRefetching:dt(),hasData:!0,timeToStepByRun:Ge,outlierBounds:ft}},[he,Se,Le,pe,c,d,h,g,v,b,_,w,E,A,j]),te=o||r.split("_").pop()||"",_e=g==="time",ve=T.useCallback(Qe=>Qe==null?"N/A":l&&(te==="min"||te==="max")?Math.round(Qe).toLocaleString():qu(Qe),[l,te]),ye=T.useCallback(Qe=>Math.abs(Qe)>=1e3?`${parseFloat((Qe/1e3).toFixed(1))}k`:l?te==="min"||te==="max"?Math.round(Qe).toString():String(parseFloat(Qe.toFixed(1))):Number.isInteger(Qe)?Qe.toLocaleString():Math.abs(Qe)<.01&&Qe!==0?Qe.toExponential(1):String(parseFloat(Qe.toFixed(2))),[l,te]),ke=T.useCallback(Qe=>_e?ev(Qe):Qe>=1e3?`${(Qe/1e3).toFixed(0)}k`:Qe.toString(),[_e]);T.useEffect(()=>{if(!L.current||!Re||!Pe)return;const Qe=L.current,Ie=Qe.clientWidth,Fe=Qe.clientHeight||192;let Ge=1/0,Me=-1/0;for(let yt=1;yt<Re.length;yt++){const lt=Re[yt];for(let bt=0;bt<lt.length;bt++){if(X&&bt===0)continue;const Nt=lt[bt];Nt!=null&&(j&&oe?Nt>=oe.lower&&Nt<=oe.upper&&(Nt<Ge&&(Ge=Nt),Nt>Me&&(Me=Nt)):(Nt<Ge&&(Ge=Nt),Nt>Me&&(Me=Nt)))}}Ge===1/0&&oe&&(Ge=oe.lower,Me=oe.upper);const $e=Me-Ge,dt=Math.max(Math.abs(Me),Math.abs(Ge)),Oe=Math.max(dt*.05,1e-10),st=Math.max($e*.1,Oe);let ft,pt;a?(ft=Math.min(Ge-st,0),pt=Math.max(Me+st,0)):(ft=Ge-st,pt=Me+st),H!==null&&(ft=H),se!==null&&(pt=se);const et="rgba(128, 128, 128, 0.15)",Ze="rgba(100, 100, 100, 0.9)",je={width:Ie,height:Fe,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,pt]}},axes:[{stroke:Ze,grid:{stroke:et,width:1},ticks:{stroke:et,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(yt,lt)=>lt.map(ke)},{stroke:Ze,grid:{stroke:et,width:1},ticks:{stroke:et,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(yt,lt)=>{if(!lt||lt.length===0)return 40;const bt=Math.max(...lt.map(Nt=>Nt.length));return Math.max(40,bt*7+14)},values:(yt,lt)=>lt.map(ye)}],series:ne,hooks:{draw:[yt=>{var Ve,wt;if(!Re)return;const lt=Re[0],bt=Math.min(he.length,20),Nt=yt.series.length,Pt=yt.ctx;Pt.save();for(let Et=1;Et<Nt;Et++){const zt=Re[Et];if(!zt)continue;let Ht=-1;for(let wn=zt.length-1;wn>=0;wn--)if(zt[wn]!==null&&zt[wn]!==void 0){Ht=wn;break}if(Ht===-1)continue;const an=lt[Ht],Dn=zt[Ht];if(an===void 0||Dn===void 0||Dn===null)continue;const Vt=yt.valToPos(Number(an),"x",!0),pn=yt.valToPos(Number(Dn),"y",!0);if(!Number.isFinite(Vt)||!Number.isFinite(pn))continue;const Bt=yt.series[Et],Cn=typeof(Bt==null?void 0:Bt.alpha)=="number"?Bt.alpha:1;let Bn=typeof(Bt==null?void 0:Bt.stroke)=="string"?Bt.stroke:void 0;if(!Bn){const wn=Et-1;if(wn<bt)Bn=(Ve=he[wn])==null?void 0:Ve.color;else if(c){const On=wn-bt;On>=0&&On<bt&&(Bn=(wt=he[On])==null?void 0:wt.color)}}Bn&&(Pt.globalAlpha=Cn,Pt.fillStyle=Bn,Pt.beginPath(),Pt.arc(Vt,pn,4,0,Math.PI*2),Pt.fill())}Pt.restore()}],setCursor:[yt=>{if(!O.current)return;const{left:lt,top:bt,idx:Nt}=yt.cursor;if(Nt==null||lt===void 0||bt===void 0||lt<0){O.current.style.display="none";return}const Pt=Re[0][Nt];if(Pt===void 0){O.current.style.display="none";return}Z.current&&!G.current&&U({xValue:Number(Pt),sourceChartId:V});let wt=`<div class="font-medium mb-1">${_e?`Time ${o$(Number(Pt))}`:`Step ${Number(Pt).toLocaleString()}`}</div>`;const Et=Te.length;t.forEach(Vt=>{var On;const pn=We.get(Vt.runPath);if(pn===void 0)return;const Bt=pn+1,Cn=Re[Bt];if(!Cn)return;const Bn=Cn[Nt];let wn;if(c){const jn=Et+pn+1;wn=(On=Re[jn])==null?void 0:On[Nt]}Bn!=null&&(wt+=`
                <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>${X8(Vt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${c?.7:1}">${ve(Bn)}${s?` ${s}`:""}</span>
                    ${c&&wn!==void 0&&wn!==null?`<span class="text-muted-foreground">(EMA: ${ve(wn)})</span>`:""}
                  </div>
                </div>
              `)}),O.current.innerHTML=wt,O.current.style.display="block";const zt=L.current.getBoundingClientRect(),Ht=O.current.getBoundingClientRect();let an=zt.left+lt+15;an+Ht.width+20>window.innerWidth&&(an=zt.left+lt-Ht.width-15+yt.bbox.left),an=Math.max(4,an);let Dn=zt.top-Ht.height+20;Dn<4&&(Dn=zt.bottom-20),O.current.style.left=`${an}px`,O.current.style.top=`${Dn}px`}]}};R.current&&R.current.destroy();const He=new ma(je,Re,Qe);R.current=He;const nt=new ResizeObserver(yt=>{for(const lt of yt){const{width:bt,height:Nt}=lt.contentRect;He&&bt>0&&Nt>0&&He.setSize({width:bt,height:Nt})}});return nt.observe(Qe),()=>{nt.disconnect(),He.destroy(),R.current=null}},[Re,ne,Pe,ke,ye,ve,_e,Ke,he,h,c,a,s,t,Te,We,V,U,j,X,oe,H,se]),T.useEffect(()=>{if(!W){O.current&&(O.current.style.display="none");return}if(W.sourceChartId===V||!R.current||!Re)return;const Qe=R.current,Ie=Re[0];if(!Ie||Ie.length===0)return;const Fe=W.xValue;let Ge=0,Me=1/0;for(let dt=0;dt<Ie.length;dt++){const Oe=Math.abs(Number(Ie[dt])-Fe);Oe<Me&&(Me=Oe,Ge=dt)}const $e=Qe.valToPos(Number(Ie[Ge]),"x");$e>=0&&$e<=Qe.width&&(G.current=!0,Qe.setCursor({left:$e,top:0}),G.current=!1)},[W,V,Re]);const Be=T.useCallback(()=>{O.current&&(O.current.style.display="none"),(W==null?void 0:W.sourceChartId)===V&&U(null)},[W,V,U]),ge=Xe&&!Ae,Ye=i||(te?`${te.charAt(0).toUpperCase()}${te.slice(1)}`:r);return p.jsxs("div",{ref:P,className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white h-[246px] flex flex-col",ge&&"opacity-50"),children:[p.jsxs("div",{className:"shrink-0 mb-2",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[N,p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:Ye})]}),p.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.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:p.jsx(iw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:j,onCheckedChange:ie,children:"Ignore Outliers"}),p.jsx(vi,{checked:X,onCheckedChange:ue,children:"Ignore First Step"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.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:H??"",onChange:Qe=>{const Ie=Qe.target.value;le(Ie===""?null:Number(Ie))},onClick:Qe=>Qe.stopPropagation(),onKeyDown:Qe=>Qe.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.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:Qe=>{const Ie=Qe.target.value;fe(Ie===""?null:Number(Ie))},onClick:Qe=>Qe.stopPropagation(),onKeyDown:Qe=>Qe.stopPropagation()})]})]})]}),I]})]}),(j||X||H!==null||se!==null)&&p.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[j&&p.jsx(z0,{label:"Ignore Outliers",onRemove:()=>ie(!1)}),X&&p.jsx(z0,{label:"Ignore First Step",onRemove:()=>ue(!1)}),H!==null&&p.jsx(z0,{label:`Min Y: ${H}`,onRemove:()=>le(null)}),se!==null&&p.jsx(z0,{label:`Max Y: ${se}`,onRemove:()=>fe(null)})]})]}),Pe?p.jsxs("div",{className:"flex-1 min-h-0 relative bg-white rounded",ref:L,onMouseLeave:Be,children:[p.jsx("div",{ref:O,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),Ae&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:Xe?"Loading...":"No data"})]})}function l4({runs:t,shouldPoll:e,evalName:n,prefix:r,label:i,unit:s,showZeroLine:a,isTokenMetric:o,showEma:l,emaSpan:c,hoveredRunId:d,xAxisMode:h,stepTimesByRun:g,firstStepTimesByRun:v,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:w,maxStepLimit:S,maxTimeLimit:E}){return p.jsxs("div",{children:[p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:i}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:l$.map(A=>p.jsx(d$,{runs:t,shouldPoll:e,evalName:n,metricName:`${r}_${A}`,label:`${i} ${c$[A]}`,unit:s,showZeroLine:a,statType:A,isTokenMetric:o,showEma:l,emaSpan:c,hoveredRunId:d,xAxisMode:h,stepTimesByRun:g,firstStepTimesByRun:v,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:w,maxStepLimit:S,maxTimeLimit:E},`${n}-${r}_${A}`))})]})}function tg({runs:t,shouldPoll:e,prefix:n,label:r,unit:i,showZeroLine:s,isTokenMetric:a,showEma:o,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:h,firstStepTimesByRun:g,isStepTimesFetching:v,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:w,maxTimeLimit:S,extraCharts:E,hideGroupLabel:A}){const N=t.find(I=>I.isSelected)??t[0];return p.jsxs("div",{children:[!A&&p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:r}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[l$.map(I=>p.jsx(Hr,{runs:t,shouldPoll:e,metricName:`${n}_${I}`,label:`${r} ${c$[I]}`,unit:i,showZeroLine:s,statType:I,isTokenMetric:a,showEma:o,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:h,firstStepTimesByRun:g,isStepTimesFetching:v,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:w,maxTimeLimit:S},`${n}_${I}`)),E,N&&p.jsx(u$,{runPath:N.runPath,metricType:n,label:`${r} (Dist. Over Time)`,showZeroLine:s,isTokenMetric:a,shouldPoll:e,scrollRoot:_})]})]})}function Qpe(t,e,n,r){const i=T.useMemo(()=>t.slice(0,20).map(l=>l.runPath).filter(Boolean),[t]),s=T.useMemo(()=>e?[e]:[],[e]),a=xue(i,s,r&&i.length>0&&s.length>0,n);return{metricsByRunPath:T.useMemo(()=>{var c,d;const l=new Map;return(d=(c=a.data)==null?void 0:c.runs)==null||d.forEach(h=>{l.set(h.run_path,h.metrics??[])}),l},[a.data]),isFetching:a.isFetching,isRefetching:a.isFetching&&!!a.data}}function Hr({runs:t,shouldPoll:e,metricName:n,label:r,unit:i,showZeroLine:s,statType:a,isTokenMetric:o,showEma:l=!1,emaSpan:c=10,hoveredRunId:d=null,xAxisMode:h="step",stepTimesByRun:g,firstStepTimesByRun:v,isStepTimesFetching:b=!1,isStepTimesRefetching:_=!1,scrollRoot:w=null,defaultIgnoreOutliers:S,maxStepLimit:E,maxTimeLimit:A,headerPrefix:N,headerSuffix:I}){const P=T.useRef(null),L=T.useRef(null),R=T.useRef(null),O=T.useRef(null),[W,U]=cn(EG),[V,G]=cn(xG),Z=T.useMemo(()=>`metric-${n}`,[n]),B=T.useRef(!1),q=T.useRef(!1);T.useEffect(()=>{const Ie=Ge=>{(Ge.key==="Control"||Ge.key==="Meta")&&(q.current=!0)},Fe=Ge=>{(Ge.key==="Control"||Ge.key==="Meta")&&(q.current=!1,U(null))};return window.addEventListener("keydown",Ie),window.addEventListener("keyup",Fe),()=>{window.removeEventListener("keydown",Ie),window.removeEventListener("keyup",Fe)}},[U]);const Y=S??!1,J=i$.has(n),F=V[n],j=(F==null?void 0:F.ignoreOutliers)??Y,X=(F==null?void 0:F.ignoreFirstStep)??J,H=(F==null?void 0:F.minY)??null,se=(F==null?void 0:F.maxY)??null,re=T.useCallback(Ie=>{G(Fe=>{const Ge={ignoreOutliers:Y,ignoreFirstStep:J,minY:null,maxY:null},Me=Fe[n]??Ge,$e=Ie(Me);if($e.ignoreOutliers===Ge.ignoreOutliers&&$e.ignoreFirstStep===Ge.ignoreFirstStep&&$e.minY===Ge.minY&&$e.maxY===Ge.maxY){if(!Object.prototype.hasOwnProperty.call(Fe,n))return Fe;const Oe={...Fe};return delete Oe[n],Oe}return{...Fe,[n]:$e}})},[n,G,Y,J]),ie=T.useCallback(Ie=>{re(Fe=>({...Fe,ignoreOutliers:Ie}))},[re]),ue=T.useCallback(Ie=>{re(Fe=>({...Fe,ignoreFirstStep:Ie}))},[re]),le=T.useCallback(Ie=>{re(Fe=>({...Fe,minY:Ie}))},[re]),fe=T.useCallback(Ie=>{re(Fe=>({...Fe,maxY:Ie}))},[re]),xe=Y8(P,{root:w,threshold:0}),he=T.useMemo(()=>{const Ie=t.filter(Ge=>!Ge.isSelected),Fe=t.filter(Ge=>Ge.isSelected);return[...Ie,...Fe]},[t]),Te=T.useMemo(()=>he.slice(0,20),[he]),We=T.useMemo(()=>{const Ie=new Map;return Te.forEach((Fe,Ge)=>{Ie.set(Fe.runPath,Ge)}),Ie},[Te]),{metricsByRunPath:Se,isFetching:Le,isRefetching:pe}=Qpe(t,n,e,xe),{uplotData:Re,seriesConfig:ne,isFetching:Xe,isRefetching:Ae,hasData:Pe,timeToStepByRun:Ke,outlierBounds:oe}=T.useMemo(()=>{const Ie=new Set,Fe=new Map,Ge=new Map,Me=new Map,$e=h==="time"&&!!g&&!!v,dt=Le;he.forEach((He,nt)=>{if(nt>=20)return;const yt=Se.get(He.runPath)??[],lt=new Map;if(yt.forEach(bt=>{Ie.add(bt.step),lt.set(bt.step,bt.value)}),Fe.set(nt,lt),$e){const bt=g==null?void 0:g.get(He.runPath),Nt=v==null?void 0:v.get(He.runPath);if(bt&&Nt!==void 0){const Pt=new Map,Ve=new Map;bt.forEach((wt,Et)=>{const zt=wt-Nt;Pt.set(Et,zt),Ve.set(zt,Et)}),Ge.set(nt,Pt),Me.set(nt,Ve)}}});const Oe=()=>!(!dt&&!b||dt&&!pe||b&&!_);if(Ie.size===0)return{uplotData:null,seriesConfig:[],isFetching:dt||b,isRefetching:Oe(),hasData:!1,timeToStepByRun:Me,outlierBounds:null,minStep:null};const st=Math.min(...Array.from(Ie));let ft=Array.from(Ie).sort((He,nt)=>He-nt);E!=null&&!$e&&(ft=ft.filter(He=>He<=E));let pt=ft;if($e){const He=new Set;if(Fe.forEach((yt,lt)=>{const bt=Ge.get(lt);bt&&yt.forEach((Nt,Pt)=>{const Ve=bt.get(Pt);Ve!==void 0&&He.add(Ve)})}),He.size===0)return{uplotData:null,seriesConfig:[],isFetching:dt||b,isRefetching:Oe(),hasData:!1,timeToStepByRun:Me,outlierBounds:null,minStep:null};let nt=Array.from(He).sort((yt,lt)=>yt-lt);A!=null&&(nt=nt.filter(yt=>yt<=A)),pt=nt}let et=null;if(j){const He=[];Fe.forEach(nt=>{nt.forEach(yt=>{He.push(yt)})}),et=s$(He)}const Ze=new Float64Array(pt),me=[{label:$e?"Time (s)":"Step"}],je=[Ze];return he.forEach((He,nt)=>{if(nt>=20)return;const yt=Fe.get(nt)||new Map;let lt;if($e){const Ve=Ge.get(nt),wt=new Map;Ve&&yt.forEach((Et,zt)=>{const Ht=Ve.get(zt);Ht!==void 0&&wt.set(Ht,Et)}),lt=pt.map(Et=>wt.get(Et)??null)}else lt=ft.map(Ve=>yt.get(Ve)??null);const bt=d===He.runPath,Nt=d!==null;let Pt;Nt&&!bt?Pt=.1:Pt=l?.3:1,je.push(lt),me.push({label:sv(He),stroke:He.color,width:1,alpha:Pt,spanGaps:!0,points:{show:!1}})}),l&&he.forEach((He,nt)=>{if(nt>=20)return;const yt=Fe.get(nt)||new Map,lt=2/(c+1);let bt=null,Nt;if($e){const Et=Ge.get(nt),zt=new Map;ft.forEach(Ht=>{const an=yt.get(Ht);if(an!==void 0){!(et&&(an<et.lower||an>et.upper))&&!(X&&Ht===st)&&(bt=bt===null?an:lt*an+(1-lt)*bt);const pn=Et==null?void 0:Et.get(Ht);pn!==void 0&&bt!==null&&zt.set(pn,bt)}}),Nt=pt.map(Ht=>zt.get(Ht)??null)}else{const Et=[];ft.forEach(zt=>{const Ht=yt.get(zt);Ht!==void 0?(!(et&&(Ht<et.lower||Ht>et.upper))&&!(X&&zt===st)&&(bt===null?bt=Ht:bt=lt*Ht+(1-lt)*bt),Et.push(bt)):Et.push(null)}),Nt=Et}const Pt=d===He.runPath,Ve=d!==null;let wt;Ve&&!Pt?wt=.1:wt=1,je.push(Nt),me.push({label:`${sv(He)} (EMA)`,stroke:He.color,width:1.5,alpha:wt,spanGaps:!0,points:{show:!1}})}),{uplotData:je,seriesConfig:me,isFetching:dt||b,isRefetching:Oe(),hasData:!0,timeToStepByRun:Me,outlierBounds:et,minStep:st}},[he,Se,Le,pe,l,c,d,h,g,v,b,_,j,X,E,A]),te=a||n.split("_").pop()||"",_e=h==="time",ve=n.startsWith("timing_")&&n!=="timing_microbatch_count",ye=T.useCallback(Ie=>Ie==null?"N/A":o&&(te==="min"||te==="max")?Math.round(Ie).toLocaleString():qu(Ie),[o,te]),ke=T.useCallback(Ie=>ve?ev(Ie):Math.abs(Ie)>=1e3?`${parseFloat((Ie/1e3).toFixed(1))}k`:o?te==="min"||te==="max"?Math.round(Ie).toString():String(parseFloat(Ie.toFixed(1))):Number.isInteger(Ie)?Ie.toLocaleString():Math.abs(Ie)<.01&&Ie!==0?Ie.toExponential(1):String(parseFloat(Ie.toFixed(2))),[o,ve,te]),Be=T.useCallback(Ie=>_e?ev(Ie):Ie>=1e3?`${(Ie/1e3).toFixed(0)}k`:Ie.toString(),[_e]);T.useEffect(()=>{if(!L.current||!Re||!Pe)return;const Ie=L.current,Fe=Ie.clientWidth,Ge=Ie.clientHeight||192;let Me=1/0,$e=-1/0;for(let lt=1;lt<Re.length;lt++){const bt=Re[lt];for(let Nt=0;Nt<bt.length;Nt++){if(X&&Nt===0)continue;const Pt=bt[Nt];Pt!=null&&(j&&oe?Pt>=oe.lower&&Pt<=oe.upper&&(Pt<Me&&(Me=Pt),Pt>$e&&($e=Pt)):(Pt<Me&&(Me=Pt),Pt>$e&&($e=Pt)))}}Me===1/0&&oe&&(Me=oe.lower,$e=oe.upper);const dt=$e-Me,Oe=Math.max(Math.abs($e),Math.abs(Me)),st=Math.max(Oe*.05,1e-10),ft=Math.max(dt*.1,st);let pt,et;s?(pt=Math.min(Me-ft,0),et=Math.max($e+ft,0)):(pt=Me-ft,et=$e+ft),H!==null&&(pt=H),se!==null&&(et=se);const Ze="rgba(128, 128, 128, 0.15)",me="rgba(100, 100, 100, 0.9)",He={width:Fe,height:Ge,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[pt,et]}},axes:[{stroke:me,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:(lt,bt)=>bt.map(Be)},{stroke:me,grid:{stroke:Ze,width:1},ticks:{stroke:Ze,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(lt,bt)=>{if(!bt||bt.length===0)return 40;const Nt=Math.max(...bt.map(Pt=>Pt.length));return Math.max(40,Nt*7+14)},values:(lt,bt)=>bt.map(ke)}],series:ne,hooks:{draw:[lt=>{var wt,Et;if(!Re)return;const bt=Re[0],Nt=Math.min(he.length,20),Pt=lt.series.length,Ve=lt.ctx;Ve.save();for(let zt=1;zt<Pt;zt++){const Ht=Re[zt];if(!Ht)continue;let an=-1;for(let On=Ht.length-1;On>=0;On--){const jn=Ht[On];if(jn!=null){an=On;break}}if(an===-1)continue;const Dn=bt[an],Vt=Ht[an];if(Dn===void 0||Vt===void 0||Vt===null)continue;const pn=lt.valToPos(Number(Dn),"x",!0),Bt=lt.valToPos(Number(Vt),"y",!0);if(!Number.isFinite(pn)||!Number.isFinite(Bt))continue;const Cn=lt.series[zt],Bn=typeof(Cn==null?void 0:Cn.alpha)=="number"?Cn.alpha:1;let wn=typeof(Cn==null?void 0:Cn.stroke)=="string"?Cn.stroke:void 0;if(!wn){const On=zt-1;if(On<Nt)wn=(wt=he[On])==null?void 0:wt.color;else if(l){const jn=On-Nt;jn>=0&&jn<Nt&&(wn=(Et=he[jn])==null?void 0:Et.color)}}wn&&(Ve.globalAlpha=Bn,Ve.fillStyle=wn,Ve.beginPath(),Ve.arc(pn,Bt,4,0,Math.PI*2),Ve.fill())}Ve.restore()}],setCursor:[lt=>{if(!O.current)return;const{left:bt,top:Nt,idx:Pt}=lt.cursor;if(Pt==null||bt===void 0||Nt===void 0||bt<0){O.current.style.display="none";return}const Ve=Re[0][Pt];if(Ve===void 0){O.current.style.display="none";return}q.current&&!B.current&&U({xValue:Number(Ve),sourceChartId:Z});const wt=(()=>{var Bi,ui;if(!_e||!Ke)return null;const Bn=Number(Ve);if(d){const be=he.findIndex(ot=>ot.runPath===d);if(be>=0){const ot=(Bi=Ke.get(be))==null?void 0:Bi.get(Bn);if(ot!==void 0)return ot}}const wn=he.findIndex(be=>be.isSelected);if(wn>=0){const be=(ui=Ke.get(wn))==null?void 0:ui.get(Bn);if(be!==void 0)return be}let On=null;const jn=new Set;return he.forEach((be,ot)=>{var xt;const _t=(xt=Ke.get(ot))==null?void 0:xt.get(Bn);_t!==void 0&&(jn.add(_t),On===null&&(On=_t))}),jn.size===1,On})();let zt=`<div class="font-medium mb-1">${_e?`Time ${o$(Number(Ve))}${wt!==null?` <span class="text-muted-foreground">(Step ${Number(wt).toLocaleString()})</span>`:""}`:`Step ${Number(Ve).toLocaleString()}`}</div>`;const Ht=Te.length,an=Re[0],Dn=(()=>{if(!_e)return null;const Bn=lt.scales.x,wn=Number(Bn.min),On=Number(Bn.max);if(!Number.isFinite(wn)||!Number.isFinite(On))return null;const jn=Math.abs(On-wn);if(jn<=0)return null;const Bi=Math.max(1,lt.bbox.width);return jn*Gpe/Bi})();t.forEach(Bn=>{const wn=We.get(Bn.runPath);if(wn===void 0)return;const On=wn+1,jn=Re[On];if(!jn)return;const Bi=_e?Wpe(jn,an,Pt,Dn):Pt;if(Bi===null)return;const ui=jn[Bi];let be;if(l){const ot=Ht+wn+1,_t=Re[ot];be=_t==null?void 0:_t[Bi]}ui!=null&&(zt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Bn.color}"></div>
                    <span>${X8(Bn)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${l?.7:1}">${ve?nI(ui):`${ye(ui)}${i?` ${i}`:""}`}</span>
                    ${l&&be!==void 0&&be!==null?`<span class="text-muted-foreground">(EMA: ${ve?nI(be):ye(be)})</span>`:""}
                  </div>
                </div>
              `)}),O.current.innerHTML=zt,O.current.style.display="block";const Vt=L.current.getBoundingClientRect(),pn=O.current.getBoundingClientRect();let Bt=Vt.left+bt+15;Bt+pn.width+20>window.innerWidth&&(Bt=Vt.left+bt-pn.width-15+lt.bbox.left),Bt=Math.max(4,Bt);let Cn=Vt.top-pn.height+20;Cn<4&&(Cn=Vt.bottom-20),O.current.style.left=`${Bt}px`,O.current.style.top=`${Cn}px`}]}};R.current&&R.current.destroy();const nt=new ma(He,Re,Ie);R.current=nt;const yt=new ResizeObserver(lt=>{for(const bt of lt){const{width:Nt,height:Pt}=bt.contentRect;nt&&Nt>0&&Pt>0&&nt.setSize({width:Nt,height:Pt})}});return yt.observe(Ie),()=>{yt.disconnect(),nt.destroy(),R.current=null}},[Re,ne,Pe,Be,ke,ye,_e,Ke,he,d,l,s,i,j,oe,X,H,se,t,Te,We,Z,ve,U]),T.useEffect(()=>{if(!W){O.current&&(O.current.style.display="none");return}if(W.sourceChartId===Z||!R.current||!Re)return;const Ie=R.current,Fe=Re[0];if(!Fe||Fe.length===0)return;const Ge=W.xValue;let Me=0,$e=1/0;for(let Oe=0;Oe<Fe.length;Oe++){const st=Math.abs(Number(Fe[Oe])-Ge);st<$e&&($e=st,Me=Oe)}const dt=Ie.valToPos(Number(Fe[Me]),"x");dt>=0&&dt<=Ie.width&&(B.current=!0,Ie.setCursor({left:dt,top:0}),B.current=!1)},[W,Z,Re]);const ge=T.useCallback(()=>{O.current&&(O.current.style.display="none"),(W==null?void 0:W.sourceChartId)===Z&&U(null)},[W,Z,U]),Ye=Xe&&!Ae,Qe=r||(te?`${te.charAt(0).toUpperCase()}${te.slice(1)}`:n);return p.jsxs("div",{ref:P,className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white h-[246px] flex flex-col",Ye&&"opacity-50"),children:[p.jsxs("div",{className:"shrink-0 mb-2",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[N,p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:Qe})]}),p.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.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:p.jsx(iw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:j,onCheckedChange:ie,children:"Ignore Outliers"}),p.jsx(vi,{checked:X,onCheckedChange:ue,children:"Ignore First Step"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.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:H??"",onChange:Ie=>{const Fe=Ie.target.value;le(Fe===""?null:Number(Fe))},onClick:Ie=>Ie.stopPropagation(),onKeyDown:Ie=>Ie.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.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:Ie=>{const Fe=Ie.target.value;fe(Fe===""?null:Number(Fe))},onClick:Ie=>Ie.stopPropagation(),onKeyDown:Ie=>Ie.stopPropagation()})]})]})]}),I]})]}),(j||X||H!==null||se!==null)&&p.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[j&&p.jsx(z0,{label:"Ignore Outliers",onRemove:()=>ie(!1)}),X&&p.jsx(z0,{label:"Ignore First Step",onRemove:()=>ue(!1)}),H!==null&&p.jsx(z0,{label:`Min Y: ${H}`,onRemove:()=>le(null)}),se!==null&&p.jsx(z0,{label:`Max Y: ${se}`,onRemove:()=>fe(null)})]})]}),Pe?p.jsxs("div",{className:"flex-1 min-h-0 relative bg-white rounded",ref:L,onMouseLeave:ge,children:[p.jsx("div",{ref:O,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),Ae&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:Xe?"Loading...":"No data"})]})}const ng=["mean","std","min","max"],rg={mean:"Mean",std:"Std",min:"Min",max:"Max"};function b2(){return Math.random().toString(36).slice(2,10)}function Jx(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function f$(t,e,n){const r=[];for(const[i,s]of Object.entries(t)){const a=Jx(i);for(const[o,l]of Object.entries(s)){const c=o?Jx(o):void 0;for(const d of l)r.push({section:a,group:c,metricKey:d,label:Jx(d),plotType:"step_metric",simple:!0})}}for(const i of ng)r.push({section:"Reward",metricKey:`reward_sum_${i}`,label:`Reward ${rg[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=Jx(i);for(const a of ng)r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_${a}`,label:`${s} ${rg[a]}`,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 ng)r.push({section:"Advantage",metricKey:`advantage_${i}`,label:`Advantage ${rg[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 a of i.available_rollout_metric_names){const o=Jx(a);for(const l of ng)r.push({section:"Evals",group:`${s} / ${o}`,metricKey:`reward_${a}_${l}`,label:`${s} ${o} ${rg[l]}`,plotType:"eval_metric",evalName:s})}for(const a of["length_completion","length_prompt","length_sum"]){const o=a==="length_completion"?"Tokens Completion":a==="length_prompt"?"Tokens Prompt":"Tokens Total";for(const l of ng)r.push({section:"Evals",group:`${s} / ${o}`,metricKey:`${a}_${l}`,label:`${s} ${o} ${rg[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 a of ng)r.push({section:"Rollouts",group:s,metricKey:`${i}_${a}`,label:`${s} ${rg[a]}`,plotType:"step_metric"});r.push({section:"Rollouts",group:s,metricKey:`${i}_distribution_over_time`,label:`${s} Dist. Over Time`,plotType:"distribution_over_time",distMetricType:i})}for(const i of[{key:"stop_reason_length_pct",label:"% Stop Reason = Length"},{key:"group_length_gini_mean",label:"Group Completion Length Gini"},{key:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median"}])r.push({section:"Rollouts",group:"General",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"discarded_count",label:"Discarded Count"},{key:"discarded_zero_advantage_pct",label:"Zero Advantage %"},{key:"discarded_max_async_pct",label:"Max Async %"},{key:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length"},{key:"discarded_group_length_gini_mean",label:"Group Completion Length Gini"},{key:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median"},{key:"discarded_zero_advantage_all_zero_pct",label:"Zero Adv (All Reward = 0) %"},{key:"discarded_zero_advantage_all_positive_pct",label:"Zero Adv (All Reward > 0) %"},{key:"discarded_zero_advantage_mean_reward",label:"Zero Adv Mean Reward"}])r.push({section:"Discarded Rollouts",group:"General",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});r.push({section:"Discarded Rollouts",group:"Canceled",metricKey:"canceled_count",label:"Canceled Count",plotType:"step_metric",simple:!0});for(const i of["discarded_length_prompt","discarded_length_completion","discarded_length_sum"]){const s=i.includes("prompt")?"Discarded Tokens Prompt":i.includes("completion")?"Discarded Tokens Completion":"Discarded Tokens Total";for(const a of ng)r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_${a}`,label:`${s} ${rg[a]}`,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_save_batch_total",label:"Batch Completion (Save Batch)"},{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",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",group:"Microbatch (Mean Time)",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});return r}async function hO(t){await fetch(`${Ar}/custom-metrics-layout`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:t})})}function _2({open:t,onOpenChange:e,title:n,existingNames:r,initialValue:i="",onSubmit:s}){const[a,o]=T.useState(i),[l,c]=T.useState(""),d=T.useRef(null),h=v=>{v&&(o(i),c(""),setTimeout(()=>{var b;return(b=d.current)==null?void 0:b.focus()},50)),e(v)},g=()=>{const v=a.trim();if(!v){c("Name cannot be empty");return}if(r.some(b=>b.toLowerCase()===v.toLowerCase())&&v.toLowerCase()!==i.toLowerCase()){c("Name already exists");return}s(v),e(!1)};return p.jsx($f,{open:t,onOpenChange:h,children:p.jsxs(qf,{className:"sm:max-w-[340px]",children:[p.jsx(jd,{children:p.jsx(Fd,{children:n})}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(V0,{ref:d,value:a,onChange:v=>{o(v.target.value),c("")},onKeyDown:v=>{v.key==="Enter"&&g()},placeholder:"Name..."}),l&&p.jsx("p",{className:"text-xs text-destructive",children:l})]}),p.jsx(m8,{children:p.jsx(Tn,{size:"sm",onClick:g,children:i?"Rename":"Create"})})]})})}function pO(t){return`${t.plotType}|${t.evalName||""}|${t.metricKey}`}function K1({catalog:t,onSelect:e,existingPlots:n,children:r}){const i=T.useMemo(()=>new Set((n??[]).map(pO)),[n]),[s,a]=T.useState(!1),[o,l]=T.useState(""),c=T.useMemo(()=>{const d=o.toLowerCase(),h=d?t.filter(v=>{var b;return v.label.toLowerCase().includes(d)||v.metricKey.toLowerCase().includes(d)||v.section.toLowerCase().includes(d)||(((b=v.group)==null?void 0:b.toLowerCase().includes(d))??!1)}):t,g=[];for(const v of h){let b=g.find(S=>S.section===v.section);b||(b={section:v.section,groups:[]},g.push(b));const _=v.group||"";let w=b.groups.find(S=>S.group===_);w||(w={group:_,items:[]},b.groups.push(w)),w.items.push(v)}return g},[t,o]);return p.jsxs(aT,{open:s,onOpenChange:a,children:[p.jsx(oT,{asChild:!0,children:r}),p.jsxs(lT,{align:"start",className:"w-[320px] p-0",onClick:d=>d.stopPropagation(),children:[p.jsx("div",{className:"p-2 border-b",children:p.jsx(V0,{value:o,onChange:d=>l(d.target.value),placeholder:"Search metrics...",className:"h-7 text-xs"})}),p.jsxs("div",{className:"max-h-[50vh] overflow-y-auto p-1.5",children:[c.length===0&&p.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No metrics found"}),c.map(d=>p.jsxs("div",{className:"mb-2",children:[p.jsx("div",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider px-1.5 py-1",children:d.section}),d.groups.map(h=>p.jsxs("div",{children:[h.group&&p.jsx("div",{className:"text-[10px] font-medium text-muted-foreground/70 px-3 py-0.5",children:h.group}),h.items.map(g=>{const v=i.has(pO(g));return p.jsx("button",{type:"button",disabled:v,className:Rt("flex w-full items-center gap-1.5 rounded px-3 py-0.5 text-xs text-left transition-colors",v?"text-muted-foreground/50 cursor-default":"hover:bg-accent hover:text-accent-foreground"),onClick:()=>{v||(e(g),a(!1),l(""))},children:g.label},`${g.plotType}-${g.evalName||""}-${g.metricKey}`)})]},`${d.section}-${h.group}`))]},d.section))]})]})]})}function h$({open:t,onOpenChange:e,title:n,description:r,onConfirm:i}){return p.jsx(FN,{open:t,onOpenChange:e,children:p.jsxs(UN,{children:[p.jsxs(BN,{children:[p.jsx(VN,{children:n}),p.jsx(GN,{children:r})]}),p.jsxs(HN,{children:[p.jsx($N,{children:"Cancel"}),p.jsx(WN,{variant:"destructive",onClick:i,children:"Delete"})]})]})})}function K8({plot:t,onRemove:e,chartProps:n}){const{attributes:r,listeners:i,setNodeRef:s,transform:a,transition:o,isDragging:l}=k8({id:t.id}),c={transform:a?`translate3d(${Math.round(a.x)}px, ${Math.round(a.y)}px, 0)`:void 0,transition:o,opacity:l?.4:1,position:"relative",zIndex:l?50:void 0},d=t.label||Jx(t.metricKey),h=p.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:p.jsx(p8,{className:"h-3 w-3 text-muted-foreground"})}),g=p.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:p.jsx(Ju,{className:"h-3 w-3"})});return p.jsx("div",{ref:s,style:c,children:t.plotType==="distribution_over_time"&&t.distMetricType?(()=>{const v=n.runs.find(b=>b.isSelected)??n.runs[0];return v?p.jsx(u$,{runPath:v.runPath,metricType:t.distMetricType,label:d,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,headerPrefix:h,headerSuffix:g}):null})():t.plotType==="eval_metric"&&t.evalName?p.jsx(d$,{runs:n.runs,shouldPoll:n.shouldPoll,evalName:t.evalName,metricName:t.metricKey,label:d,showEma:n.showEma,emaSpan:n.emaSpan,hoveredRunId:n.hoveredRunId,xAxisMode:n.xAxisMode,stepTimesByRun:n.stepTimesByRun,firstStepTimesByRun:n.firstStepTimesByRun,isStepTimesFetching:n.isStepTimesFetching,isStepTimesRefetching:n.isStepTimesRefetching,scrollRoot:n.scrollRoot,maxStepLimit:n.maxStep,maxTimeLimit:n.maxTime,headerPrefix:h,headerSuffix:g}):p.jsx(Hr,{runs:n.runs,shouldPoll:n.shouldPoll,metricName:t.metricKey,label:d,showEma:n.showEma,emaSpan:n.emaSpan,hoveredRunId:n.hoveredRunId,xAxisMode:n.xAxisMode,stepTimesByRun:n.stepTimesByRun,firstStepTimesByRun:n.firstStepTimesByRun,isStepTimesFetching:n.isStepTimesFetching,isStepTimesRefetching:n.isStepTimesRefetching,scrollRoot:n.scrollRoot,maxStepLimit:n.maxStep,maxTimeLimit:n.maxTime,headerPrefix:h,headerSuffix:g})})}function Jpe({group:t,catalog:e,groupNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[a,o]=T.useState(!0),[l,c]=T.useState(!1),[d,h]=T.useState(!1),[g,v]=T.useState(!1),{attributes:b,listeners:_,setNodeRef:w,transform:S,transition:E,isDragging:A}=k8({id:t.id}),N={transform:G1.Transform.toString(S),transition:E,opacity:A?.4:1},I=W=>{const U={id:b2(),metricKey:W.metricKey,label:W.label,plotType:W.plotType,evalName:W.evalName,distMetricType:W.distMetricType};r({...t,plots:[...t.plots,U]})},P=W=>{r({...t,plots:t.plots.filter(U=>U.id!==W)})},L=W=>{r({...t,name:W})},R=rS(Xf(nv,{activationConstraint:{distance:5}}),Xf(tv,{coordinateGetter:lS})),O=W=>{const{active:U,over:V}=W;if(!V||U.id===V.id)return;const G=t.plots.findIndex(B=>B.id===U.id),Z=t.plots.findIndex(B=>B.id===V.id);G===-1||Z===-1||r({...t,plots:rv(t.plots,G,Z)})};return p.jsxs("div",{ref:w,style:N,children:[p.jsxs(Ki,{open:a,onOpenChange:o,children:[p.jsxs("div",{className:"flex items-center gap-1 h-8",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors shrink-0",children:[p.jsx(Vr,{className:Rt("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",!a&&"-rotate-90")}),p.jsx("h4",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:t.name})]})}),p.jsx("button",{...b,..._,className:Rt("cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0",l?"opacity-100":"opacity-0 pointer-events-none"),children:p.jsx(p8,{className:"h-3.5 w-3.5 text-muted-foreground"})}),p.jsxs("div",{className:Rt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[p.jsx(K1,{catalog:e,onSelect:I,existingPlots:t.plots,children:p.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:[p.jsx(ip,{className:"h-3 w-3"}),"New Plot"]})}),p.jsx("button",{onClick:()=>h(!0),className:"h-6 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",title:"Rename group",children:p.jsx(cG,{className:"h-3 w-3 text-muted-foreground"})}),p.jsx("button",{onClick:()=>v(!0),className:"h-6 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:p.jsx(Ju,{className:"h-3 w-3 text-muted-foreground"})})]})]}),p.jsx(Qi,{children:p.jsx(aS,{sensors:R,collisionDetection:iS,onDragEnd:O,children:p.jsx(oS,{items:t.plots.map(W=>W.id),strategy:lw,children:p.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(W=>p.jsx(K8,{plot:W,onRemove:()=>P(W.id),chartProps:s},W.id)),t.plots.length===0&&p.jsx(K1,{catalog:e,onSelect:I,existingPlots:t.plots,children:p.jsxs("button",{className:"h-32 rounded-lg border-2 border-dashed border-gray-200 hover:border-gray-300 hover:bg-gray-50/50 transition-colors flex items-center justify-center text-xs text-muted-foreground gap-1",children:[p.jsx(ip,{className:"h-3.5 w-3.5"}),"Add a plot"]})})]})})})})]}),p.jsx(_2,{open:d,onOpenChange:h,title:"Rename Group",existingNames:n.filter(W=>W!==t.name),onSubmit:L,initialValue:t.name}),p.jsx(h$,{open:g,onOpenChange:v,title:"Delete Group",description:`Delete "${t.name}" and all its plots?`,onConfirm:i})]})}function e0e({section:t,catalog:e,allSectionNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[a,o]=T.useState(!0),[l,c]=T.useState(!1),[d,h]=T.useState(!1),[g,v]=T.useState(!1),[b,_]=T.useState(!1),{attributes:w,listeners:S,setNodeRef:E,transform:A,transition:N,isDragging:I}=k8({id:t.id}),P={transform:G1.Transform.toString(A),transition:N,opacity:I?.4:1},L=t.groups.map(K=>K.name),R=K=>{const J={id:b2(),name:K,plots:[]};r({...t,groups:[...t.groups,J]})},O=(K,J)=>{r({...t,groups:t.groups.map(F=>F.id===K?J:F)})},W=K=>{r({...t,groups:t.groups.filter(J=>J.id!==K)})},U=K=>{const J={id:b2(),metricKey:K.metricKey,label:K.label,plotType:K.plotType,evalName:K.evalName,distMetricType:K.distMetricType};r({...t,plots:[...t.plots,J]})},V=K=>{r({...t,plots:t.plots.filter(J=>J.id!==K)})},G=K=>{r({...t,name:K})},Z=rS(Xf(nv,{activationConstraint:{distance:5}}),Xf(tv,{coordinateGetter:lS})),B=K=>{const{active:J,over:F}=K;if(!F||J.id===F.id)return;const j=t.groups.findIndex(H=>H.id===J.id),X=t.groups.findIndex(H=>H.id===F.id);j===-1||X===-1||r({...t,groups:rv(t.groups,j,X)})},q=rS(Xf(nv,{activationConstraint:{distance:5}}),Xf(tv,{coordinateGetter:lS})),Y=K=>{const{active:J,over:F}=K;if(!F||J.id===F.id)return;const j=t.plots.findIndex(H=>H.id===J.id),X=t.plots.findIndex(H=>H.id===F.id);j===-1||X===-1||r({...t,plots:rv(t.plots,j,X)})};return p.jsxs("div",{ref:E,style:P,children:[p.jsxs(Ki,{open:a,onOpenChange:o,children:[p.jsxs("div",{className:"flex items-center gap-1.5 h-9",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform shrink-0",!a&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:t.name})]})}),p.jsx("button",{...w,...S,className:Rt("cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0",l?"opacity-100":"opacity-0 pointer-events-none"),children:p.jsx(p8,{className:"h-4 w-4 text-muted-foreground"})}),p.jsxs("div",{className:Rt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[p.jsxs("button",{onClick:()=>h(!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:[p.jsx(ip,{className:"h-3 w-3"}),"New Group"]}),p.jsx(K1,{catalog:e,onSelect:U,existingPlots:t.plots,children:p.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:[p.jsx(ip,{className:"h-3 w-3"}),"New Plot"]})}),p.jsx("button",{onClick:()=>v(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",title:"Rename section",children:p.jsx(cG,{className:"h-3.5 w-3.5 text-muted-foreground"})}),p.jsx("button",{onClick:()=>_(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:p.jsx(Ju,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),p.jsxs(Qi,{children:[t.plots.length>0&&p.jsx(aS,{sensors:q,collisionDetection:iS,onDragEnd:Y,children:p.jsx(oS,{items:t.plots.map(K=>K.id),strategy:lw,children:p.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=>p.jsx(K8,{plot:K,onRemove:()=>V(K.id),chartProps:s},K.id))})})}),p.jsx(aS,{sensors:Z,collisionDetection:iS,onDragEnd:B,children:p.jsx(oS,{items:t.groups.map(K=>K.id),strategy:iW,children:p.jsx("div",{className:"space-y-2",children:t.groups.map(K=>p.jsx(Jpe,{group:K,catalog:e,groupNames:L,onUpdate:J=>O(K.id,J),onRemove:()=>W(K.id),chartProps:s},K.id))})})}),t.plots.length===0&&t.groups.length===0&&p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[p.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"No plots yet. Add a group or a plot."}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(Tn,{size:"sm",variant:"outline",onClick:()=>h(!0),children:[p.jsx(ip,{className:"h-3.5 w-3.5 mr-1"}),"New Group"]}),p.jsx(K1,{catalog:e,onSelect:U,existingPlots:t.plots,children:p.jsxs(Tn,{size:"sm",variant:"outline",children:[p.jsx(ip,{className:"h-3.5 w-3.5 mr-1"}),"New Plot"]})})]})]})]})]}),p.jsx(_2,{open:d,onOpenChange:h,title:"New Group",existingNames:L,onSubmit:R}),p.jsx(_2,{open:g,onOpenChange:v,title:"Rename Section",existingNames:n.filter(K=>K!==t.name),onSubmit:G,initialValue:t.name}),p.jsx(h$,{open:b,onOpenChange:_,title:"Delete Section",description:`Delete "${t.name}" and all its groups and plots?`,onConfirm:i})]})}function t0e({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,availableRewardNames:s,customMetricSections:a,xAxisMode:o,scrollRoot:l,maxStep:c,maxTime:d,evalsList:h,newSectionTrigger:g}){var _e,ve,ye,ke,Be,ge,Ye,Qe,Ie,Fe,Ge,Me,$e,dt,Oe,st,ft,pt,et,Ze;const v=hy(),{data:b,isLoading:_}=DG(),[w,S]=T.useState({sections:[]}),[E,A]=T.useState(!1),[N,I]=T.useState(!1);!N&&b&&(I(!0),b.layout&&S(b.layout));const[P,L]=T.useState(g);g!==P&&(L(g),A(!0));const R=T.useRef(null),O=T.useRef(null),W=T.useCallback(me=>{S(me),v.setQueryData(["custom-metrics-layout"],{layout:me}),O.current=me,R.current&&clearTimeout(R.current),R.current=setTimeout(async()=>{O.current&&(await hO(O.current),O.current=null)},500)},[v]);T.useEffect(()=>()=>{R.current&&clearTimeout(R.current),O.current&&(hO(O.current),O.current=null)},[]);const U=T.useMemo(()=>f$(a,s,h),[a,s,h]),V=o==="time",G=Or(((_e=t[0])==null?void 0:_e.runPath)||"",V&&!!t[0],e),Z=Or(((ve=t[1])==null?void 0:ve.runPath)||"",V&&!!t[1],e),B=Or(((ye=t[2])==null?void 0:ye.runPath)||"",V&&!!t[2],e),q=Or(((ke=t[3])==null?void 0:ke.runPath)||"",V&&!!t[3],e),Y=Or(((Be=t[4])==null?void 0:Be.runPath)||"",V&&!!t[4],e),K=Or(((ge=t[5])==null?void 0:ge.runPath)||"",V&&!!t[5],e),J=Or(((Ye=t[6])==null?void 0:Ye.runPath)||"",V&&!!t[6],e),F=Or(((Qe=t[7])==null?void 0:Qe.runPath)||"",V&&!!t[7],e),j=Or(((Ie=t[8])==null?void 0:Ie.runPath)||"",V&&!!t[8],e),X=Or(((Fe=t[9])==null?void 0:Fe.runPath)||"",V&&!!t[9],e),H=Or(((Ge=t[10])==null?void 0:Ge.runPath)||"",V&&!!t[10],e),se=Or(((Me=t[11])==null?void 0:Me.runPath)||"",V&&!!t[11],e),re=Or((($e=t[12])==null?void 0:$e.runPath)||"",V&&!!t[12],e),ie=Or(((dt=t[13])==null?void 0:dt.runPath)||"",V&&!!t[13],e),ue=Or(((Oe=t[14])==null?void 0:Oe.runPath)||"",V&&!!t[14],e),le=Or(((st=t[15])==null?void 0:st.runPath)||"",V&&!!t[15],e),fe=Or(((ft=t[16])==null?void 0:ft.runPath)||"",V&&!!t[16],e),xe=Or(((pt=t[17])==null?void 0:pt.runPath)||"",V&&!!t[17],e),he=Or(((et=t[18])==null?void 0:et.runPath)||"",V&&!!t[18],e),Te=Or(((Ze=t[19])==null?void 0:Ze.runPath)||"",V&&!!t[19],e),We=T.useMemo(()=>[G,Z,B,q,Y,K,J,F,j,X,H,se,re,ie,ue,le,fe,xe,he,Te],[G,Z,B,q,Y,K,J,F,j,X,H,se,re,ie,ue,le,fe,xe,he,Te]),{isStepTimesFetching:Se,isStepTimesRefetching:Le}=T.useMemo(()=>{if(!V)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const me=We.some(nt=>nt.isFetching),je=We.filter(nt=>nt.isFetching),He=me&&je.length>0&&je.every(nt=>!!nt.data);return{isStepTimesFetching:me,isStepTimesRefetching:He}},[V,We]),{stepTimesByRun:pe,firstStepTimesByRun:Re}=T.useMemo(()=>{if(!V)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const me=new Map,je=new Map;return t.forEach((He,nt)=>{if(nt>=20)return;const lt=We[nt].data;if(!lt||lt.first_step_time===null||lt.first_step_time===void 0||!lt.step_times||lt.step_times.length===0)return;const bt=new Map;lt.step_times.forEach(Nt=>{typeof Nt.time=="number"&&bt.set(Nt.step,Nt.time)}),bt.size>0&&(me.set(He.runPath,bt),je.set(He.runPath,lt.first_step_time))}),{stepTimesByRun:me,firstStepTimesByRun:je}},[t,V,We]),ne=T.useMemo(()=>({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,xAxisMode:o,scrollRoot:l,maxStep:c,maxTime:d,stepTimesByRun:pe,firstStepTimesByRun:Re,isStepTimesFetching:Se,isStepTimesRefetching:Le}),[t,e,n,r,i,o,l,c,d,pe,Re,Se,Le]),Xe=w.sections.map(me=>me.name),Ae=me=>{const je={id:b2(),name:me,groups:[],plots:[]};W({sections:[...w.sections,je]})},Pe=(me,je)=>{W({sections:w.sections.map(He=>He.id===me?je:He)})},Ke=me=>{W({sections:w.sections.filter(je=>je.id!==me)})},oe=rS(Xf(nv,{activationConstraint:{distance:8}}),Xf(tv,{coordinateGetter:lS})),te=me=>{const{active:je,over:He}=me;if(!He||je.id===He.id)return;const nt=w.sections.findIndex(lt=>lt.id===je.id),yt=w.sections.findIndex(lt=>lt.id===He.id);nt===-1||yt===-1||W({sections:rv(w.sections,nt,yt)})};return p.jsxs("div",{className:"-mt-3",children:[p.jsx(aS,{sensors:oe,collisionDetection:iS,onDragEnd:te,children:p.jsx(oS,{items:w.sections.map(me=>me.id),strategy:iW,children:w.sections.map((me,je)=>p.jsxs("div",{children:[je>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsx(e0e,{section:me,catalog:U,allSectionNames:Xe,onUpdate:He=>Pe(me.id,He),onRemove:()=>Ke(me.id),chartProps:ne})]},me.id))})}),w.sections.length===0&&_&&p.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:[p.jsx(Kd,{className:"h-4 w-4 animate-spin mr-2"}),p.jsx("span",{className:"text-sm",children:"Loading..."})]}),w.sections.length===0&&!_&&p.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[p.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No custom sections yet. Create one to start building your dashboard."}),p.jsxs(Tn,{size:"sm",variant:"outline",onClick:()=>A(!0),children:[p.jsx(ip,{className:"h-3.5 w-3.5 mr-1"}),"New Section"]})]}),p.jsx(_2,{open:E,onOpenChange:A,title:"New Section",existingNames:Xe,onSubmit:Ae})]})}const mO=100;function p$({current:t,total:e,fillClassName:n,activeBorderClassName:r}){const i=e/mO;return p.jsx("div",{className:"flex gap-[2px]",children:Array.from({length:mO}).map((s,a)=>{const o=a*i,l=(a+1)*i;let c=0;t>=l?c=1:t>o&&(c=(t-o)/i);const d=c>0&&r?r:"border-muted-foreground/50";return p.jsx("div",{className:`relative flex-1 h-8 border ${d} rounded-[2px] overflow-hidden bg-background`,children:c>0&&p.jsx("div",{className:`absolute top-0 left-0 bottom-0 transition-all duration-200 ${n}`,style:{width:`${c*100}%`}})},a)})})}function gO(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 n0e(t,e){const[n,r]=T.useState(null);if(T.useEffect(()=>{if(!t||!e)return;const a=setTimeout(()=>r(Date.now()),0),o=setInterval(()=>{r(Date.now())},1e3);return()=>{clearTimeout(a),clearInterval(o)}},[t,e]),!t||!e||n===null)return null;const i=new Date(t).getTime();return isNaN(i)?null:(n-i)/1e3}function r0e(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"),a=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${i} ${s}:${a}:${o}`}function i0e(t){const e=o=>o&&typeof o=="object"&&"value"in o?o.value:o,n=e(t.model),r=typeof n=="string"?n:null,i=e(t.environments);let s=[],a=i;if(typeof a=="string")try{a=JSON.parse(a)}catch{}return a&&typeof a=="object"&&!Array.isArray(a)?s=Object.keys(a):Array.isArray(a)&&(s=a.map(o=>typeof o=="string"?o:o&&typeof o=="object"&&"name"in o?String(o.name):String(o))),{model:r,envNames:s}}function Gb(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 s0e(t,e,n){if(t.length===0||e>=n)return null;const i=[...t].sort((g,v)=>g.step-v.step).slice(-50);if(i.length===0)return null;const a=Math.pow(.5,1/10),o=i.length;let l=0,c=0;for(let g=0;g<o;g++){const v=Math.pow(a,o-1-g);l+=i[g].value*v,c+=v}const d=l/c,h=n-e;return d*h}function a0e({currentStep:t,totalSteps:e,runtimeSeconds:n,estimatedSecondsToFinish:r}){const i=t>=0?t+1:0,s=e>0?i/e*100:0,a=Math.min(s,100);return p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),p.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[p.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[a.toFixed(2),"%"]}),p.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[i," / ",e," Steps"]}),n!==null&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),p.jsx("span",{className:"text-sm text-muted-foreground tabular-nums",children:gO(n)})]}),r!==null&&r>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),p.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:["ETA: ",gO(r)]})]})]}),p.jsx(p$,{current:i,total:e,fillClassName:"bg-foreground",activeBorderClassName:"border-foreground"})]})}function o0e({groupsDone:t,totalGroups:e,step:n,waitingBuckets:r}){const i=e>0?t/e*100:0,s=Math.min(i,100),a=(r==null?void 0:r.length)??0;return p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["Trainer Bucket",n!==null?` (Step ${n})`:"",a>0&&p.jsxs("span",{className:"ml-2 font-normal",children:["· ",a," batch",a!==1?"es":""," waiting for trainer"," · ",p.jsxs("span",{className:"tabular-nums",children:["steps ",r.join(", ")]})]})]}),p.jsxs("div",{className:"flex items-baseline gap-1.5",children:[p.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[s.toFixed(2),"%"]}),p.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[t," / ",e," Groups"]})]}),p.jsx(p$,{current:t,total:e,fillClassName:"bg-muted-foreground/40"})]})}function l0e(){var ne,Xe,Ae,Pe,Ke,oe,te,_e,ve,ye,ke;const t=ki(ml),e=ki(cT),n=ki(fT),r=zd(mG),i=zd(gG),[s,a]=T.useState(!0),[o,l]=T.useState(!0),[c,d]=T.useState("custom"),[h,g]=T.useState(0),[v,b]=T.useState(0),[_,w]=cn(gce),[S,E]=cn(vce),[A,N]=T.useState(String(S)),[I,P]=cn(xce),[L,R]=cn(vG),[O,W]=cn(bce),U=I?n:null,{data:V,isLoading:G,error:Z}=ed(t||"",!!t,!0),{data:B}=fm(),q=T.useMemo(()=>{const Be=(B==null?void 0:B.runs)||[],ge=new Set(e);return t&&ge.add(t),Be.filter(Ye=>ge.has(Ye.run_id)).map(Ye=>({runPath:Ye.run_id,runName:Ye.name,color:Ye.color,isSelected:Ye.run_id===t}))},[t,e,B==null?void 0:B.runs]);T.useEffect(()=>{V&&(r(V.is_tracking),i(V.is_syncing))},[V,r,i]);const Y=typeof((ne=V==null?void 0:V.config)==null?void 0:ne.number_of_steps)=="number"?V.config.number_of_steps:null,K=typeof((Xe=V==null?void 0:V.config)==null?void 0:Xe.prompts_batch_size_for_trainer)=="number"?V.config.prompts_batch_size_for_trainer:typeof((Ae=V==null?void 0:V.config)==null?void 0:Ae.batch_size_for_trainer)=="number"?V.config.batch_size_for_trainer:null,J=(Pe=V==null?void 0:V.summary)!=null&&Pe.steps&&typeof V.summary.steps=="object"?V.summary.steps:null,F=Gb((Ke=V==null?void 0:V.summary)==null?void 0:Ke["steps/last_training_step"])??Gb(J==null?void 0:J.last_training_step)??Gb((oe=V==null?void 0:V.trainer_info)==null?void 0:oe.last_training_step)??Gb((te=V==null?void 0:V.rollout_info)==null?void 0:te.last_training_step)??Gb(V==null?void 0:V.last_rollout_step)??-1,j=V==null?void 0:V.trainer_bucket_info,X=((_e=V==null?void 0:V.step_metrics_info)==null?void 0:_e.local_steps)??0,H=((ve=V==null?void 0:V.step_metrics_info)==null?void 0:ve.custom_metric_sections)??{},se=(V==null?void 0:V.available_rollout_metric_names)??[],re=((ye=V==null?void 0:V.eval_info)==null?void 0:ye.evals)??[],ie=T.useMemo(()=>f$(H,se,re),[H,se,re]),ue=T.useMemo(()=>{if(I)return q;const Be=q.find(ge=>ge.isSelected);return Be?[Be]:q.slice(0,1)},[I,q]),le=rS(Xf(nv,{activationConstraint:{distance:5}}),Xf(tv,{coordinateGetter:lS})),fe=T.useCallback(Be=>{const{active:ge,over:Ye}=Be;!Ye||ge.id===Ye.id||W(Qe=>{const Ie=Qe.findIndex(Ge=>Ge.id===ge.id),Fe=Qe.findIndex(Ge=>Ge.id===Ye.id);return Ie===-1||Fe===-1?Qe:rv(Qe,Ie,Fe)})},[W]),xe=T.useMemo(()=>({runs:ue,shouldPoll:!0,showEma:_,emaSpan:S,hoveredRunId:U,xAxisMode:"step",scrollRoot:null}),[ue,_,S,U]),he=T.useMemo(()=>!t||!(B!=null&&B.runs)?null:B.runs.find(Be=>Be.run_id===t)??null,[t,B]),Te=((ke=he==null?void 0:he.state)==null?void 0:ke.toLowerCase())==="running",We=n0e((he==null?void 0:he.created_at)??null,Te),Se=T.useMemo(()=>{var Ye,Qe,Ie;if(Te)return null;const Be=(Ye=V==null?void 0:V.summary)==null?void 0:Ye._runtime;if(typeof Be=="number")return Be;const ge=(Ie=(Qe=V==null?void 0:V.summary)==null?void 0:Qe._wandb)==null?void 0:Ie.runtime;return typeof ge=="number"?ge:null},[Te,V==null?void 0:V.summary]),Le=Te?We:Se,{data:pe}=kG(t||"","timing_step_total",!!t&&!!Y&&F>0,!0),Re=T.useMemo(()=>{if(!(pe!=null&&pe.metrics)||!Y||F<=0)return null;const Be=pe.metrics.filter(Qe=>Qe.metric_name==="timing_step_total").map(Qe=>({step:Qe.step,value:Qe.value}));if(Be.length===0)return null;const ge=Math.min(...Be.map(Qe=>Qe.step)),Ye=Be.filter(Qe=>Qe.step!==ge);return s0e(Ye,F,Y)},[pe,Y,F]);return t?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:p.jsx("div",{className:"py-2.5 px-6",children:p.jsx("div",{className:"max-w-7xl mx-auto flex items-center gap-2.5 h-7",children:he&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:he.color}}),p.jsx("span",{className:"text-sm font-semibold truncate",children:he.name||he.run_id.split("/").pop()}),p.jsx("span",{className:"text-sm text-muted-foreground truncate",children:he.run_id}),he.created_at&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),p.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums whitespace-nowrap",children:["Created at ",r0e(he.created_at)]})]})]})})})}),p.jsx("div",{className:L?"flex-1 min-h-0 overflow-hidden":"flex-1 overflow-auto p-6",children:L?p.jsx($fe,{runPath:t,onBack:()=>R(!1)},t):p.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[G?p.jsxs("div",{className:"space-y-3",children:[p.jsx(Zh,{className:"h-4 w-32"}),p.jsx(Zh,{className:"h-8 w-64"}),p.jsx(Zh,{className:"h-8 w-full"})]}):Z?p.jsx($u,{className:"border-destructive",children:p.jsx(eh,{className:"pt-6",children:p.jsx("p",{className:"text-destructive",children:"Failed to load run summary. Make sure the run has been synced."})})}):p.jsxs("div",{className:"space-y-5",children:[Y!==null?p.jsx(a0e,{currentStep:F,totalSteps:Y,runtimeSeconds:Le??null,estimatedSecondsToFinish:Re}):p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),p.jsx("div",{className:"flex items-baseline gap-1.5",children:p.jsx("span",{className:"text-sm text-muted-foreground",children:"Waiting for data…"})})]}),K!==null&&j&&p.jsx(o0e,{groupsDone:j.groups_done,totalGroups:K,step:j.step,waitingBuckets:V==null?void 0:V.waiting_buckets})]}),X>0&&q.length>0&&p.jsx("div",{children:s?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(!1),children:"Hide Plots"}),p.jsx(cS,{label:"EMA",variant:"selecting",size:"sm",enabled:_,onEnabledChange:w,value:A,onValueChange:N,onValueCommit:Be=>{const ge=parseInt(Be,10);!isNaN(ge)&&ge>=2&&ge<=100?(E(ge),N(ge.toString())):N(S.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),p.jsx(p1,{variant:"selecting",size:"sm",pressed:I,onPressedChange:P,className:"text-xs px-2",children:"All selected runs"}),p.jsx(K1,{catalog:ie,existingPlots:O,onSelect:Be=>{const ge=Math.random().toString(36).slice(2,10);W(Ye=>[...Ye,{id:ge,metricKey:Be.metricKey,label:Be.label,plotType:Be.plotType,evalName:Be.evalName}])},children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Plots"})})]}),p.jsx(aS,{sensors:le,collisionDetection:iS,onDragEnd:fe,children:p.jsx(oS,{items:O.map(Be=>Be.id),strategy:lw,children:p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:O.map(Be=>p.jsx(K8,{plot:Be,onRemove:()=>W(ge=>ge.filter(Ye=>Ye.id!==Be.id)),chartProps:xe},Be.id))})})})]}):p.jsxs("button",{onClick:()=>a(!0),className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors flex items-center gap-1.5",children:[p.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:p.jsx("path",{d:"m6 9 6 6 6-6"})}),p.jsx("span",{className:"text-sm font-semibold",children:"Plots"})]})}),(V==null?void 0:V.config)&&(()=>{const{model:Be,envNames:ge}=i0e(V.config);return!Be&&ge.length===0?null:p.jsxs("div",{className:"flex items-center gap-3 text-sm mb-4",children:[Be&&p.jsx("span",{className:"font-semibold",children:Be}),ge.map(Ye=>p.jsx("span",{className:"text-muted-foreground",children:Ye},Ye))]})})(),(V==null?void 0:V.config)&&Object.keys(V.config).length>0&&p.jsx("div",{children:o?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"}),V.custom_config&&p.jsxs(Y0,{type:"single",value:c,onValueChange:Be=>{Be&&d(Be)},variant:"outline",size:"sm",children:[p.jsx(Uo,{value:"custom",className:"text-xs px-3 h-7",children:"Custom"}),p.jsx(Uo,{value:"all",className:"text-xs px-3 h-7",children:"All"})]}),p.jsx(Rfe,{currentRunId:t,currentConfig:V.config}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{g(Be=>Be+1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{b(Be=>Be+1)},children:"Expand All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>R(!0),children:"Code"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>l(!1),children:"Hide Configs"})]}),p.jsx(zG,{config:c==="custom"&&V.custom_config?V.custom_config:V.config,collapseAllSignal:h,expandAllSignal:v})]}):p.jsxs("button",{onClick:()=>l(!0),className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors flex items-center gap-1.5",children:[p.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:p.jsx("path",{d:"m6 9 6 6 6-6"})}),p.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"})]})})]})})]}):p.jsx(hm,{description:"Select a run from the sidebar or add a new one to get started."})}const c4=gT;function c0e(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),a=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10),l=s*3600+a*60+o;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function u0e(){var se;const[t,e]=T.useState(null),n=T.useRef(0),[r,i]=cn(Cce),s=ki(ml),a=ki(cT),o=ki(fT),[l,c]=cn(Ace),[d,h]=T.useState(0),[g,v]=cn(_ce),[b,_]=cn(Sce),[w,S]=T.useState(b.toString()),[E,A]=cn(wce),[N,I]=cn(Mce),[P,L]=cn(Tce),[R,O]=cn(Ece),[W,U]=T.useState(P.toString()),[V,G]=T.useState(c4(R));T.useEffect(()=>{U(P.toString())},[P]),T.useEffect(()=>{G(c4(R))},[R]),DG();const Z=!0;T.useEffect(()=>{t&&(t.scrollTop=r,n.current=r)},[t]),T.useEffect(()=>{if(!t)return;const re=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",re,{passive:!0}),()=>{t.removeEventListener("scroll",re),i(n.current)}},[t]);const{data:B}=fm(),q=T.useMemo(()=>{const re=(B==null?void 0:B.runs)||[],ie=new Set(a);return s&&ie.add(s),re.filter(ue=>ie.has(ue.run_id)).map(ue=>({runPath:ue.run_id,runName:ue.name,color:ue.color,isSelected:ue.run_id===s}))},[s,a,B==null?void 0:B.runs]),{data:Y,error:K}=ed(s||"",!!s,Z),J=Y==null?void 0:Y.step_metrics_info,F=(J==null?void 0:J.local_steps)??0,j=(Y==null?void 0:Y.available_rollout_metric_names)??[],X=(J==null?void 0:J.custom_metric_sections)??{},H=((se=Y==null?void 0:Y.eval_info)==null?void 0:se.evals)??[];return s?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center justify-start gap-2 h-7",children:[p.jsxs(Y0,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:re=>{re&&c(re)},children:[p.jsx(Uo,{value:"all",className:"text-xs px-2 py-1 h-7",children:"All"}),p.jsx(Uo,{value:"custom",className:"text-xs px-2 py-1 h-7",children:"Custom"})]}),l==="custom"&&p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>h(re=>re+1),children:[p.jsx(ip,{className:"h-3 w-3 mr-1"}),"New Section"]}),p.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),p.jsxs(Y0,{type:"single",variant:"outline",size:"sm",value:E,onValueChange:re=>{re&&A(re)},children:[p.jsx(Uo,{value:"step",className:"text-xs px-2 py-1 h-7",children:"Step"}),p.jsx(Uo,{value:"time",className:"text-xs px-2 py-1 h-7",children:"Time"})]}),p.jsx(cS,{label:"EMA",variant:"selecting",size:"sm",enabled:g,onEnabledChange:v,value:w,onValueChange:S,onValueCommit:re=>{const ie=parseInt(re,10);!isNaN(ie)&&ie>=2&&ie<=100?(_(ie),S(ie.toString())):S(b.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),p.jsx(cS,{label:E==="step"?"Max Step":"Max Time",variant:"selecting",size:"sm",enabled:N,onEnabledChange:I,value:E==="step"?W:V,inputType:E==="step"?"number":"text",onValueChange:re=>{E==="step"?U(re):G(re)},onValueCommit:re=>{if(E==="step"){const ie=parseInt(re,10);!isNaN(ie)&&ie>=1?(L(ie),U(ie.toString())):U(P.toString())}else{const ie=c0e(re);ie!==null?(O(ie),G(c4(ie))):G(c4(R))}},inputMin:1,inputWidth:"w-16"})]})})}),p.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:p.jsxs("div",{className:"max-w-7xl mx-auto",children:[K&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",K instanceof Error?K.message:"Unknown error"]})})}),l==="all"?p.jsx(Ype,{runs:q,shouldPoll:Z,totalSteps:F,showEma:g,emaSpan:b,hoveredRunId:o,availableRewardNames:j,customMetricSections:X,xAxisMode:E,scrollRoot:t,maxStep:N&&E==="step"?P:void 0,maxTime:N&&E==="time"?R:void 0,evalsList:H}):p.jsx(t0e,{runs:q,shouldPoll:Z,showEma:g,emaSpan:b,hoveredRunId:o,availableRewardNames:j,customMetricSections:X,xAxisMode:E,scrollRoot:t,maxStep:N&&E==="step"?P:void 0,maxTime:N&&E==="time"?R:void 0,evalsList:H,newSectionTrigger:d})]})})]}):p.jsx(hm,{description:"Select a run from the sidebar to view training metrics."})}function Z8({...t}){return p.jsx(Nae,{"data-slot":"select",...t})}function Q8({...t}){return p.jsx(kae,{"data-slot":"select-value",...t})}function J8({className:t,size:e="default",children:n,...r}){return p.jsxs(Rae,{"data-slot":"select-trigger","data-size":e,className:Rt("border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-[3px] aria-invalid:ring-[3px] data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,p.jsx(Pae,{asChild:!0,children:p.jsx(Vr,{className:"text-muted-foreground size-4 pointer-events-none"})})]})}function ek({className:t,children:e,position:n="item-aligned",align:r="center",...i}){return p.jsx(Dae,{children:p.jsxs(Iae,{"data-slot":"select-content",className:Rt("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,align:r,...i,children:[p.jsx(d0e,{}),p.jsx(Oae,{"data-position":n,className:Rt("data-[position=popper]:h-[var(--radix-select-trigger-height)] data-[position=popper]:w-full data-[position=popper]:min-w-[var(--radix-select-trigger-width)]",n==="popper"&&""),children:e}),p.jsx(f0e,{})]})})}function tk({className:t,children:e,...n}){return p.jsxs(Lae,{"data-slot":"select-item",className:Rt("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...n,children:[p.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:p.jsx(jae,{children:p.jsx(xv,{className:"pointer-events-none"})})}),p.jsx(zae,{children:e})]})}function d0e({className:t,...e}){return p.jsx(Fae,{"data-slot":"select-scroll-up-button",className:Rt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:p.jsx(h8,{})})}function f0e({className:t,...e}){return p.jsx(Uae,{"data-slot":"select-scroll-down-button",className:Rt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:p.jsx(Vr,{})})}const u4=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],NT={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 mT(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 ev(t)}const p0e=28;function m0e(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,a=t[n];if(a!=null)return s(n)?n:null;let o=n-1,l=n+1;for(;o>=0||l<t.length;){const c=o>=0?t[o]:void 0,d=l<t.length?t[l]:void 0,h=c!=null,g=d!=null;if(h&&g){const v=Math.abs(Number(e[o])-i),_=Math.abs(Number(e[l])-i)<v?l:o;return s(_)?_:null}if(h)return s(o)?o:null;if(g)return s(l)?l:null;o-=1,l+=1}return null}function g0e(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),a=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),o=a-s,l=6;return{lower:s-l*o,upper:a+l*o}}function nA({label:t,onRemove:e}){return p.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] bg-white border border-gray-400 text-gray-600 rounded-full cursor-pointer hover:bg-gray-50 transition-colors",onClick:n=>{n.stopPropagation(),e()},children:[t,p.jsx(Ju,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function d4(t){return typeof t=="number"&&Number.isFinite(t)}function v0e(t,e){if(t.startsWith("#")){const i=t.slice(1),s=i.length===3?i.split("").map(a=>a+a).join(""):i;if(s.length===6){const a=Number.parseInt(s.slice(0,2),16),o=Number.parseInt(s.slice(2,4),16),l=Number.parseInt(s.slice(4,6),16);return`rgba(${a}, ${o}, ${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 m$({metricName:t,data:e,gpuIndices:n,intervalStart:r,intervalEnd:i,variant:s="default",strokeColor:a,gpuDisplayNames:o,isLoading:l,seriesMode:c="gpu",showLegend:d,seriesRoles:h,activeSeriesKeys:g=null,xOffset:v=0,xAxisMode:b="elapsed",xAxisTicks:_="auto",isRefetching:w=!1}){const S=T.useRef(null),E=T.useRef(null),A=T.useRef(null),[N,I]=T.useState(!1),[P,L]=T.useState(null),[R,O]=T.useState(null),W=NT[t]||{label:t.replace(/_/g," "),unit:""},U=s==="timeline",V=b==="clock"&&_==="bounds",G=T.useMemo(()=>{if(c==="node_gpu"){const H=new Map,se=[...e].sort((re,ie)=>{const ue=d4(re.node_id)?re.node_id:Number.MAX_SAFE_INTEGER,le=d4(ie.node_id)?ie.node_id:Number.MAX_SAFE_INTEGER;return ue!==le?ue-le:re.gpu_index-ie.gpu_index});for(const re of se){const ie=d4(re.node_id)?re.node_id:null,ue=`${ie??"?"}:${re.gpu_index}`;if(H.has(ue))continue;const le=ie===null?"Node ?":`Node ${ie}`,fe=H.size;H.set(ue,{key:ue,label:`${le} GPU ${re.gpu_index}`,stroke:a||u4[fe%u4.length],gpuIndex:re.gpu_index,nodeId:ie})}return Array.from(H.values())}return(n.length>0?Array.from(new Set(n)).sort((H,se)=>H-se):Array.from(new Set(e.map(H=>H.gpu_index))).sort((H,se)=>H-se)).map(H=>({key:`gpu:${H}`,label:(o==null?void 0:o[H])??`GPU ${H}`,stroke:a||u4[H%u4.length],gpuIndex:H,nodeId:null}))},[c,e,n,o,a]),Z=T.useMemo(()=>new Set(G.map(X=>X.key)),[G]),{uplotData:B,seriesConfig:q,hasData:Y,outlierBounds:K}=T.useMemo(()=>{if(e.length===0||G.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const X={},H=new Set,se=[];for(const fe of e){const xe=c==="node_gpu"?`${d4(fe.node_id)?fe.node_id:"?"}:${fe.gpu_index}`:`gpu:${fe.gpu_index}`;Z.has(xe)&&(H.add(fe.timestamp),X[fe.timestamp]||(X[fe.timestamp]={}),X[fe.timestamp][xe]=fe.value,se.push(fe.value))}const re=Array.from(H).sort((fe,xe)=>fe-xe);if(re.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const ie=re.map(fe=>fe-r),ue=[{label:"Time"}],le=[ie];for(const fe of G){const xe=re.map(Te=>{var We;return((We=X[Te])==null?void 0:We[fe.key])??null}),he=g!==null&&g.size>0&&!g.has(fe.key);le.push(xe),ue.push({label:fe.label,stroke:he?v0e(fe.stroke,.25):fe.stroke,width:he?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:le,seriesConfig:ue,hasData:!0,outlierBounds:g0e(se)}},[e,r,G,c,Z,g]),J=d??(!U&&G.length>1),F=T.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))),[]);T.useEffect(()=>{if(!S.current||!B||!Y)return;const X=S.current,H=X.clientWidth,se=192;let re=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY;for(let ne=1;ne<B.length;ne+=1){const Xe=B[ne];for(let Ae=0;Ae<Xe.length;Ae+=1){const Pe=Xe[Ae];Pe!=null&&(N&&K?Pe>=K.lower&&Pe<=K.upper&&(Pe<re&&(re=Pe),Pe>ie&&(ie=Pe)):(Pe<re&&(re=Pe),Pe>ie&&(ie=Pe)))}}re===Number.POSITIVE_INFINITY&&K&&(re=K.lower,ie=K.upper);const ue=ie-re,le=Math.max(Math.abs(ie),Math.abs(re)),fe=Math.max(le*.05,1e-10),xe=Math.max(ue*.1,fe),he=[P!==null?P:Math.max(0,re-xe),R!==null?R:ie+xe],Te="rgba(128, 128, 128, 0.15)",We="rgba(100, 100, 100, 0.9)",Le={width:H,height:se,padding:U?[0,0,0,0]:V?[4,24,0,4]:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!U,y:!1}},legend:{show:J},...U?{}:{select:{show:!0,left:0,top:0,width:0,height:0}},scales:{x:{time:!1,range:(ne,Xe,Ae)=>{const Pe=i-r;return Pe>0?[0,Pe]:[Xe,Ae]}},y:{range:he}},axes:U?[{show:!1,size:0},{show:!1,size:0}]:[{stroke:We,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"?(ne,Xe,Ae,Pe)=>[Ae,Pe]:void 0,values:(ne,Xe)=>Xe.map(Ae=>b==="clock"?X0(r+Number(Ae),i-r):ev(Number(Ae)+v))},{stroke:We,grid:{stroke:Te,width:1},ticks:{stroke:Te,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ne,Xe)=>{if(!Xe||Xe.length===0)return 40;const Ae=Math.max(...Xe.map(Pe=>Pe.length));return Math.max(40,Ae*7+14)},values:(ne,Xe)=>Xe.map(F)}],series:q,hooks:{setCursor:[ne=>{if(!A.current||!S.current)return;const{left:Xe,idx:Ae}=ne.cursor;if(Ae==null||Xe===void 0||Xe<0){A.current.style.display="none";return}const Pe=B[0][Ae];if(Pe===void 0){A.current.style.display="none";return}const Ke=B[0],oe=(()=>{const Ge=ne.scales.x,Me=Number(Ge.min),$e=Number(Ge.max);if(!Number.isFinite(Me)||!Number.isFinite($e))return null;const dt=Math.abs($e-Me);if(dt<=0)return null;const Oe=Math.max(1,ne.bbox.width);return dt*p0e/Oe})(),te=h0e(Number(Pe)+v),_e=r+Number(Pe),ve=X0(_e,i-r);let ye="";U||(ye+=`<div class="font-medium mb-1">${ve}</div>`,ye+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${te}</div>`,ye+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${_e.toFixed(3)}</div>`);const ke=[];for(let Ge=0;Ge<G.length;Ge+=1){const Me=G[Ge],$e=B[Ge+1],dt=m0e($e,Ke,Ae,oe);if(dt===null)continue;const Oe=$e==null?void 0:$e[dt];Oe!=null&&ke.push({entry:Me,formatted:qu(Oe),role:(h==null?void 0:h[Me.key])??null})}const Be=ke.length>0;if(ke.some(Ge=>Ge.role!==null)&&!U){const Ge={Trainer:0,Inference:1},Me=[];for(const $e of ke){const dt=$e.role??"Other";Me.includes(dt)||Me.push(dt)}Me.sort(($e,dt)=>(Ge[$e]??99)-(Ge[dt]??99));for(const $e of Me){ye+=`<div class="text-[10px] font-medium text-muted-foreground mt-1 mb-0.5">${$e}</div>`;for(const dt of ke)(dt.role??"Other")===$e&&(ye+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${dt.entry.stroke}"></div>
                      <span class="text-muted-foreground">${dt.entry.label}:</span>
                      <span class="font-medium">${dt.formatted} ${W.unit}</span>
                    </div>
                  `)}}else for(const Ge of ke)U?ye+=`
                    <div class="flex items-center gap-2">
                      <span class="text-muted-foreground">${Ge.entry.label}:</span>
                      <span class="font-medium">${Ge.formatted} ${W.unit}</span>
                    </div>
                  `:ye+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Ge.entry.stroke}"></div>
                      <span class="text-muted-foreground">${Ge.entry.label}:</span>
                      <span class="font-medium">${Ge.formatted} ${W.unit}</span>
                    </div>
                  `;if(!Be){A.current.style.display="none";return}U&&(ye+=`<div class="text-muted-foreground mt-1">Time: ${te}</div>`),A.current.innerHTML=ye,A.current.style.display="block";const Ye=S.current.getBoundingClientRect(),Qe=A.current.getBoundingClientRect();let Ie=Ye.left+Xe+15;Ie+Qe.width+20>window.innerWidth&&(Ie=Ye.left+Xe-Qe.width-15+ne.bbox.left),Ie=Math.max(4,Ie);let Fe=Ye.top-Qe.height+20;Fe<4&&(Fe=Ye.bottom-20),A.current.style.left=`${Ie}px`,A.current.style.top=`${Fe}px`}]}};E.current&&E.current.destroy();const pe=new ma(Le,B,X);E.current=pe;const Re=new ResizeObserver(ne=>{for(const Xe of ne){const{width:Ae}=Xe.contentRect;pe&&Ae>0&&pe.setSize({width:Ae,height:se})}});return Re.observe(X),()=>{Re.disconnect(),pe.destroy(),E.current=null}},[B,Y,q,t,r,i,v,b,_,V,U,W.unit,J,G,h,F,N,K,P,R]);const j=T.useCallback(()=>{A.current&&(A.current.style.display="none")},[]);return!Y&&U?p.jsx("div",{className:"h-48 bg-muted/30 rounded-lg border border-border/50 opacity-50 transition-opacity duration-200"}):p.jsxs("div",{className:Rt("rounded-lg border transition-opacity",U?"overflow-hidden":"group/chart border-gray-200 p-3 bg-white",l&&"opacity-60"),children:[!U&&p.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:W.label}),N&&p.jsx(nA,{label:"Ignore Outliers",onRemove:()=>I(!1)}),P!==null&&p.jsx(nA,{label:`Min Y: ${P}`,onRemove:()=>L(null)}),R!==null&&p.jsx(nA,{label:`Max Y: ${R}`,onRemove:()=>O(null)})]}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.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:p.jsx(iw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:N,onCheckedChange:I,children:"Ignore Outliers"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.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:P??"",onChange:X=>{const H=X.target.value;L(H===""?null:Number(H))},onClick:X=>X.stopPropagation(),onKeyDown:X=>X.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.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:R??"",onChange:X=>{const H=X.target.value;O(H===""?null:Number(H))},onClick:X=>X.stopPropagation(),onKeyDown:X=>X.stopPropagation()})]})]})]})})]}),Y?p.jsxs("div",{className:"h-48 relative bg-white rounded",ref:S,onMouseLeave:j,children:[!U&&w&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"}),p.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"}})]}):p.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:l?"Loading...":`No data for ${W.label}`})]})}function vO(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&e.push(a),i=r+1,r=n.indexOf(",",i)}return e}function x0e(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const y0e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,b0e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_0e={};function xO(t,e){return(_0e.jsx?b0e:y0e).test(t)}const S0e=/[ \t\n\f\r]/g;function w0e(t){return typeof t=="object"?t.type==="text"?yO(t.value):!1:yO(t)}function yO(t){return t.replace(S0e,"")===""}class cw{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}cw.prototype.normal={};cw.prototype.property={};cw.prototype.space=void 0;function g$(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new cw(n,r,e)}function dS(t){return t.toLowerCase()}class Ac{constructor(e,n){this.attribute=n,this.property=e}}Ac.prototype.attribute="";Ac.prototype.booleanish=!1;Ac.prototype.boolean=!1;Ac.prototype.commaOrSpaceSeparated=!1;Ac.prototype.commaSeparated=!1;Ac.prototype.defined=!1;Ac.prototype.mustUseProperty=!1;Ac.prototype.number=!1;Ac.prototype.overloadedBoolean=!1;Ac.prototype.property="";Ac.prototype.spaceSeparated=!1;Ac.prototype.space=void 0;let M0e=0;const kr=_v(),Ua=_v(),dR=_v(),nn=_v(),ds=_v(),g1=_v(),Vc=_v();function _v(){return 2**++M0e}const fR=Object.freeze(Object.defineProperty({__proto__:null,boolean:kr,booleanish:Ua,commaOrSpaceSeparated:Vc,commaSeparated:g1,number:nn,overloadedBoolean:dR,spaceSeparated:ds},Symbol.toStringTag,{value:"Module"})),rA=Object.keys(fR);class nk extends Ac{constructor(e,n,r,i){let s=-1;if(super(e,n),bO(this,"space",i),typeof r=="number")for(;++s<rA.length;){const a=rA[s];bO(this,rA[s],(r&fR[a])===fR[a])}}}nk.prototype.defined=!0;function bO(t,e,n){n&&(t[e]=n)}function Ty(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new nk(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[dS(r)]=r,n[dS(s.attribute)]=r}return new cw(e,n,t.space)}const v$=Ty({properties:{ariaActiveDescendant:null,ariaAtomic:Ua,ariaAutoComplete:null,ariaBusy:Ua,ariaChecked:Ua,ariaColCount:nn,ariaColIndex:nn,ariaColSpan:nn,ariaControls:ds,ariaCurrent:null,ariaDescribedBy:ds,ariaDetails:null,ariaDisabled:Ua,ariaDropEffect:ds,ariaErrorMessage:null,ariaExpanded:Ua,ariaFlowTo:ds,ariaGrabbed:Ua,ariaHasPopup:null,ariaHidden:Ua,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ds,ariaLevel:nn,ariaLive:null,ariaModal:Ua,ariaMultiLine:Ua,ariaMultiSelectable:Ua,ariaOrientation:null,ariaOwns:ds,ariaPlaceholder:null,ariaPosInSet:nn,ariaPressed:Ua,ariaReadOnly:Ua,ariaRelevant:null,ariaRequired:Ua,ariaRoleDescription:ds,ariaRowCount:nn,ariaRowIndex:nn,ariaRowSpan:nn,ariaSelected:Ua,ariaSetSize:nn,ariaSort:null,ariaValueMax:nn,ariaValueMin:nn,ariaValueNow:nn,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function x$(t,e){return e in t?t[e]:e}function y$(t,e){return x$(t,e.toLowerCase())}const T0e=Ty({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:g1,acceptCharset:ds,accessKey:ds,action:null,allow:null,allowFullScreen:kr,allowPaymentRequest:kr,allowUserMedia:kr,alt:null,as:null,async:kr,autoCapitalize:null,autoComplete:ds,autoFocus:kr,autoPlay:kr,blocking:ds,capture:null,charSet:null,checked:kr,cite:null,className:ds,cols:nn,colSpan:null,content:null,contentEditable:Ua,controls:kr,controlsList:ds,coords:nn|g1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kr,defer:kr,dir:null,dirName:null,disabled:kr,download:dR,draggable:Ua,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kr,formTarget:null,headers:ds,height:nn,hidden:dR,high:nn,href:null,hrefLang:null,htmlFor:ds,httpEquiv:ds,id:null,imageSizes:null,imageSrcSet:null,inert:kr,inputMode:null,integrity:null,is:null,isMap:kr,itemId:null,itemProp:ds,itemRef:ds,itemScope:kr,itemType:ds,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kr,low:nn,manifest:null,max:null,maxLength:nn,media:null,method:null,min:null,minLength:nn,multiple:kr,muted:kr,name:null,nonce:null,noModule:kr,noValidate:kr,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:kr,optimum:nn,pattern:null,ping:ds,placeholder:null,playsInline:kr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kr,referrerPolicy:null,rel:ds,required:kr,reversed:kr,rows:nn,rowSpan:nn,sandbox:ds,scope:null,scoped:kr,seamless:kr,selected:kr,shadowRootClonable:kr,shadowRootDelegatesFocus:kr,shadowRootMode:null,shape:null,size:nn,sizes:null,slot:null,span:nn,spellCheck:Ua,src:null,srcDoc:null,srcLang:null,srcSet:null,start:nn,step:null,style:null,tabIndex:nn,target:null,title:null,translate:null,type:null,typeMustMatch:kr,useMap:null,value:Ua,width:nn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ds,axis:null,background:null,bgColor:null,border:nn,borderColor:null,bottomMargin:nn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kr,declare:kr,event:null,face:null,frame:null,frameBorder:null,hSpace:nn,leftMargin:nn,link:null,longDesc:null,lowSrc:null,marginHeight:nn,marginWidth:nn,noResize:kr,noHref:kr,noShade:kr,noWrap:kr,object:null,profile:null,prompt:null,rev:null,rightMargin:nn,rules:null,scheme:null,scrolling:Ua,standby:null,summary:null,text:null,topMargin:nn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:nn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kr,disableRemotePlayback:kr,prefix:null,property:null,results:nn,security:null,unselectable:null},space:"html",transform:y$}),E0e=Ty({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:Vc,accentHeight:nn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:nn,amplitude:nn,arabicForm:null,ascent:nn,attributeName:null,attributeType:null,azimuth:nn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:nn,by:null,calcMode:null,capHeight:nn,className:ds,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:nn,diffuseConstant:nn,direction:null,display:null,dur:null,divisor:nn,dominantBaseline:null,download:kr,dx:null,dy:null,edgeMode:null,editable:null,elevation:nn,enableBackground:null,end:null,event:null,exponent:nn,externalResourcesRequired:null,fill:null,fillOpacity:nn,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,g2:g1,glyphName:g1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:nn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:nn,horizOriginX:nn,horizOriginY:nn,id:null,ideographic:nn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:nn,k:nn,k1:nn,k2:nn,k3:nn,k4:nn,kernelMatrix:Vc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:nn,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:nn,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:nn,overlineThickness:nn,paintOrder:null,panose1:null,path:null,pathLength:nn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ds,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:nn,pointsAtY:nn,pointsAtZ:nn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vc,rev:Vc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vc,requiredFeatures:Vc,requiredFonts:Vc,requiredFormats:Vc,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:nn,specularExponent:nn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:nn,strikethroughThickness:nn,string:null,stroke:null,strokeDashArray:Vc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:nn,strokeOpacity:nn,strokeWidth:null,style:null,surfaceScale:nn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vc,tabIndex:nn,tableValues:null,target:null,targetX:nn,targetY:nn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:nn,underlineThickness:nn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:nn,values:null,vAlphabetic:nn,vMathematical:nn,vectorEffect:null,vHanging:nn,vIdeographic:nn,version:null,vertAdvY:nn,vertOriginX:nn,vertOriginY:nn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:nn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:x$}),b$=Ty({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()}}),_$=Ty({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:y$}),S$=Ty({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),C0e={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"},A0e=/[A-Z]/g,_O=/-[a-z]/g,N0e=/^data[-\w.:]+$/i;function w$(t,e){const n=dS(e);let r=e,i=Ac;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&N0e.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(_O,k0e);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!_O.test(s)){let a=s.replace(A0e,R0e);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=nk}return new i(r,e)}function R0e(t){return"-"+t.toLowerCase()}function k0e(t){return t.charAt(1).toUpperCase()}const M$=g$([v$,T0e,b$,_$,S$],"html"),RT=g$([v$,E0e,b$,_$,S$],"svg");function SO(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function P0e(t){return t.join(" ").trim()}var Mx={},iA,wO;function D0e(){if(wO)return iA;wO=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
`,c="/",d="*",h="",g="comment",v="declaration";function b(w,S){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];S=S||{};var E=1,A=1;function N(Z){var B=Z.match(e);B&&(E+=B.length);var q=Z.lastIndexOf(l);A=~q?Z.length-q:A+Z.length}function I(){var Z={line:E,column:A};return function(B){return B.position=new P(Z),O(),B}}function P(Z){this.start=Z,this.end={line:E,column:A},this.source=S.source}P.prototype.content=w;function L(Z){var B=new Error(S.source+":"+E+":"+A+": "+Z);if(B.reason=Z,B.filename=S.source,B.line=E,B.column=A,B.source=w,!S.silent)throw B}function R(Z){var B=Z.exec(w);if(B){var q=B[0];return N(q),w=w.slice(q.length),B}}function O(){R(n)}function W(Z){var B;for(Z=Z||[];B=U();)B!==!1&&Z.push(B);return Z}function U(){var Z=I();if(!(c!=w.charAt(0)||d!=w.charAt(1))){for(var B=2;h!=w.charAt(B)&&(d!=w.charAt(B)||c!=w.charAt(B+1));)++B;if(B+=2,h===w.charAt(B-1))return L("End of comment missing");var q=w.slice(2,B-2);return A+=2,N(q),w=w.slice(B),A+=2,Z({type:g,comment:q})}}function V(){var Z=I(),B=R(r);if(B){if(U(),!R(i))return L("property missing ':'");var q=R(s),Y=Z({type:v,property:_(B[0].replace(t,h)),value:q?_(q[0].replace(t,h)):h});return R(a),Y}}function G(){var Z=[];W(Z);for(var B;B=V();)B!==!1&&(Z.push(B),W(Z));return Z}return O(),G()}function _(w){return w?w.replace(o,h):h}return iA=b,iA}var MO;function I0e(){if(MO)return Mx;MO=1;var t=Mx&&Mx.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Mx,"__esModule",{value:!0}),Mx.default=n;const e=t(D0e());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const a=(0,e.default)(r),o=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:d}=l;o?i(c,d,l):d&&(s=s||{},s[c]=d)}),s}return Mx}var Wb={},TO;function O0e(){if(TO)return Wb;TO=1,Object.defineProperty(Wb,"__esModule",{value:!0}),Wb.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)},a=function(c,d){return d.toUpperCase()},o=function(c,d){return"".concat(d,"-")},l=function(c,d){return d===void 0&&(d={}),s(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,o):c=c.replace(r,o),c.replace(e,a))};return Wb.camelCase=l,Wb}var $b,EO;function L0e(){if(EO)return $b;EO=1;var t=$b&&$b.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(I0e()),n=O0e();function r(i,s){var a={};return!i||typeof i!="string"||(0,e.default)(i,function(o,l){o&&l&&(a[(0,n.camelCase)(o,s)]=l)}),a}return r.default=r,$b=r,$b}var z0e=L0e();const j0e=cy(z0e),T$=E$("end"),rk=E$("start");function E$(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 F0e(t){const e=rk(t),n=T$(t);if(e&&n)return{start:e,end:n}}function A_(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?CO(t.position):"start"in t||"end"in t?CO(t):"line"in t||"column"in t?hR(t):""}function hR(t){return AO(t&&t.line)+":"+AO(t&&t.column)}function CO(t){return hR(t&&t.start)+"-"+hR(t&&t.end)}function AO(t){return t&&typeof t=="number"?t:1}class gl extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!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&&(a=!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 o=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=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=A_(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=a&&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}}gl.prototype.file="";gl.prototype.name="";gl.prototype.reason="";gl.prototype.message="";gl.prototype.stack="";gl.prototype.column=void 0;gl.prototype.line=void 0;gl.prototype.ancestors=void 0;gl.prototype.cause=void 0;gl.prototype.fatal=void 0;gl.prototype.place=void 0;gl.prototype.ruleId=void 0;gl.prototype.source=void 0;const ik={}.hasOwnProperty,U0e=new Map,B0e=/[A-Z]/g,H0e=new Set(["table","tbody","thead","tfoot","tr"]),V0e=new Set(["td","th"]),C$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function G0e(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=Q0e(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=Z0e(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"?RT:M$,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=A$(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function A$(t,e,n){if(e.type==="element")return W0e(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return $0e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return X0e(t,e,n);if(e.type==="mdxjsEsm")return q0e(t,e);if(e.type==="root")return Y0e(t,e,n);if(e.type==="text")return K0e(t,e)}function W0e(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=RT,t.schema=i),t.ancestors.push(e);const s=R$(t,e.tagName,!1),a=J0e(t,e);let o=ak(t,e);return H0e.has(e.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!w0e(l):!0})),N$(t,a,s,e),sk(a,o),t.ancestors.pop(),t.schema=r,t.create(e,s,a,n)}function $0e(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)}fS(t,e.position)}function q0e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);fS(t,e.position)}function X0e(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=RT,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:R$(t,e.name,!0),a=eme(t,e),o=ak(t,e);return N$(t,a,s,e),sk(a,o),t.ancestors.pop(),t.schema=r,t.create(e,s,a,n)}function Y0e(t,e,n){const r={};return sk(r,ak(t,e)),t.create(e,t.Fragment,r,n)}function K0e(t,e){return e.value}function N$(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function sk(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Z0e(t,e,n){return r;function r(i,s,a,o){const c=Array.isArray(a.children)?n:e;return o?c(s,a,o):c(s,a)}}function Q0e(t,e){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=rk(r);return e(i,s,a,o,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function J0e(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&ik.call(e.properties,i)){const s=tme(t,i,e.properties[i]);if(s){const[a,o]=s;t.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&V0e.has(e.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function eme(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 a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,t.evaluater.evaluateExpression(o.argument))}else fS(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 o=r.value.data.estree.body[0];o.type,s=t.evaluater.evaluateExpression(o.expression)}else fS(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function ak(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:U0e;for(;++r<e.children.length;){const s=e.children[r];let a;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;a=l+"-"+c,i.set(l,c+1)}}const o=A$(t,s,a);o!==void 0&&n.push(o)}return n}function tme(t,e,n){const r=w$(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?x0e(n):P0e(n)),r.property==="style"){let i=typeof n=="object"?n:nme(t,String(n));return t.stylePropertyNameCase==="css"&&(i=rme(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?C0e[r.property]||r.property:r.attribute,n]}}function nme(t,e){try{return j0e(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new gl("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=C$+"#cannot-parse-style-attribute",i}}function R$(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,a;for(;++s<i.length;){const o=xO(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=a}else r=xO(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return ik.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);fS(t)}function fS(t,e){const n=new gl("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=C$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function rme(t){const e={};let n;for(n in t)ik.call(t,n)&&(e[ime(n)]=t[n]);return e}function ime(t){let e=t.replace(B0e,sme);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function sme(t){return"-"+t.toLowerCase()}const sA={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"]},ame={};function ome(t,e){const n=ame,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return k$(t,r,i)}function k$(t,e,n){if(lme(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 NO(t.children,e,n)}return Array.isArray(t)?NO(t,e,n):""}function NO(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=k$(t[i],e,n);return r.join("")}function lme(t){return!!(t&&typeof t=="object")}const RO=document.createElement("i");function ok(t){const e="&"+t+";";RO.innerHTML=e;const n=RO.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function ih(t,e,n,r){const i=t.length;let s=0,a;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(e,0),t.splice(...a),s+=1e4,e+=1e4}function Uu(t,e){return t.length>0?(ih(t,t.length,0,e),t):e}const kO={}.hasOwnProperty;function cme(t){const e={};let n=-1;for(;++n<t.length;)ume(e,t[n]);return e}function ume(t,e){let n;for(n in e){const i=(kO.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let a;if(s)for(a in s){kO.call(i,a)||(i[a]=[]);const o=s[a];dme(i[a],Array.isArray(o)?o:o?[o]:[])}}}function dme(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);ih(t,0,0,r)}function P$(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 v1(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Vf=pm(/[A-Za-z]/),Yc=pm(/[\dA-Za-z]/),fme=pm(/[#-'*+\--9=?A-Z^-~]/);function pR(t){return t!==null&&(t<32||t===127)}const mR=pm(/\d/),hme=pm(/[\dA-Fa-f]/),pme=pm(/[!-/:-@[-`{-~]/);function Yn(t){return t!==null&&t<-2}function Ec(t){return t!==null&&(t<0||t===32)}function Ri(t){return t===-2||t===-1||t===32}const mme=pm(new RegExp("\\p{P}|\\p{S}","u")),gme=pm(/\s/);function pm(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ey(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let a="";if(s===37&&Yc(t.charCodeAt(n+1))&&Yc(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const o=t.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Fi(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return Ri(l)?(t.enter(n),o(l)):e(l)}function o(l){return Ri(l)&&s++<i?(t.consume(l),o):(t.exit(n),e(l))}}const vme={tokenize:xme};function xme(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Fi(t,e,"linePrefix")}function i(o){return t.enter("paragraph"),s(o)}function s(o){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(o);return}return Yn(o)?(t.consume(o),t.exit("chunkText"),s):(t.consume(o),a)}}const yme={tokenize:bme},PO={tokenize:_me};function bme(t){const e=this,n=[];let r=0,i,s,a;return o;function o(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&&E();const N=e.events.length;let I=N,P;for(;I--;)if(e.events[I][0]==="exit"&&e.events[I][1].type==="chunkFlow"){P=e.events[I][1].end;break}S(r);let L=N;for(;L<e.events.length;)e.events[L][1].end={...P},L++;return ih(e.events,I+1,0,e.events.slice(N)),e.events.length=L,c(A)}return o(A)}function c(A){if(r===n.length){if(!i)return g(A);if(i.currentConstruct&&i.currentConstruct.concrete)return b(A);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(PO,d,h)(A)}function d(A){return i&&E(),S(r),g(A)}function h(A){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,b(A)}function g(A){return e.containerState={},t.attempt(PO,v,b)(A)}function v(A){return r++,n.push([e.currentConstruct,e.containerState]),g(A)}function b(A){if(A===null){i&&E(),S(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){w(t.exit("chunkFlow"),!0),S(0),t.consume(A);return}return Yn(A)?(t.consume(A),w(t.exit("chunkFlow")),r=0,e.interrupt=void 0,o):(t.consume(A),_)}function w(A,N){const I=e.sliceStream(A);if(N&&I.push(null),A.previous=s,s&&(s.next=A),s=A,i.defineSkip(A.start),i.write(I),e.parser.lazy[A.start.line]){let P=i.events.length;for(;P--;)if(i.events[P][1].start.offset<a&&(!i.events[P][1].end||i.events[P][1].end.offset>a))return;const L=e.events.length;let R=L,O,W;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){if(O){W=e.events[R][1].end;break}O=!0}for(S(r),P=L;P<e.events.length;)e.events[P][1].end={...W},P++;ih(e.events,R+1,0,e.events.slice(L)),e.events.length=P}}function S(A){let N=n.length;for(;N-- >A;){const I=n[N];e.containerState=I[1],I[0].exit.call(e,t)}n.length=A}function E(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function _me(t,e,n){return Fi(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function DO(t){if(t===null||Ec(t)||gme(t))return 1;if(mme(t))return 2}function lk(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 gR={name:"attention",resolveAll:Sme,tokenize:wme};function Sme(t,e){let n=-1,r,i,s,a,o,l,c,d;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},g={...t[n][1].start};IO(h,-l),IO(g,l),a={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},t[r][1].end={...a.start},t[n][1].start={...o.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Uu(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Uu(c,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",s,e]]),c=Uu(c,lk(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Uu(c,[["exit",s,e],["enter",o,e],["exit",o,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,c=Uu(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,ih(t,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function wme(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=DO(r);let s;return a;function a(l){return s=l,t.enter("attentionSequence"),o(l)}function o(l){if(l===s)return t.consume(l),o;const c=t.exit("attentionSequence"),d=DO(l),h=!d||d===2&&i||n.includes(l),g=!i||i===2&&d||n.includes(r);return c._open=!!(s===42?h:h&&(i||!g)),c._close=!!(s===42?g:g&&(d||!h)),e(l)}}function IO(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Mme={name:"autolink",tokenize:Tme};function Tme(t,e,n){let r=0;return i;function i(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(v){return Vf(v)?(t.consume(v),a):v===64?n(v):c(v)}function a(v){return v===43||v===45||v===46||Yc(v)?(r=1,o(v)):c(v)}function o(v){return v===58?(t.consume(v),r=0,l):(v===43||v===45||v===46||Yc(v))&&r++<32?(t.consume(v),o):(r=0,c(v))}function l(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),e):v===null||v===32||v===60||pR(v)?n(v):(t.consume(v),l)}function c(v){return v===64?(t.consume(v),d):fme(v)?(t.consume(v),c):n(v)}function d(v){return Yc(v)?h(v):n(v)}function h(v){return v===46?(t.consume(v),r=0,d):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),e):g(v)}function g(v){if((v===45||Yc(v))&&r++<63){const b=v===45?g:h;return t.consume(v),b}return n(v)}}const kT={partial:!0,tokenize:Eme};function Eme(t,e,n){return r;function r(s){return Ri(s)?Fi(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Yn(s)?e(s):n(s)}}const D$={continuation:{tokenize:Ame},exit:Nme,name:"blockQuote",tokenize:Cme};function Cme(t,e,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(t.enter("blockQuote",{_container:!0}),o.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),s}return n(a)}function s(a){return Ri(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function Ame(t,e,n){const r=this;return i;function i(a){return Ri(a)?Fi(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return t.attempt(D$,e,n)(a)}}function Nme(t){t.exit("blockQuote")}const I$={name:"characterEscape",tokenize:Rme};function Rme(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 pme(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const O$={name:"characterReference",tokenize:kme};function kme(t,e,n){const r=this;let i=0,s,a;return o;function o(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),l}function l(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,a=Yc,d(h))}function c(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,a=hme,d):(t.enter("characterReferenceValue"),s=7,a=mR,d(h))}function d(h){if(h===59&&i){const g=t.exit("characterReferenceValue");return a===Yc&&!ok(r.sliceSerialize(g))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(h)&&i++<s?(t.consume(h),d):n(h)}}const OO={partial:!0,tokenize:Dme},LO={concrete:!0,name:"codeFenced",tokenize:Pme};function Pme(t,e,n){const r=this,i={partial:!0,tokenize:I};let s=0,a=0,o;return l;function l(P){return c(P)}function c(P){const L=r.events[r.events.length-1];return s=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,o=P,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(P)}function d(P){return P===o?(a++,t.consume(P),d):a<3?n(P):(t.exit("codeFencedFenceSequence"),Ri(P)?Fi(t,h,"whitespace")(P):h(P))}function h(P){return P===null||Yn(P)?(t.exit("codeFencedFence"),r.interrupt?e(P):t.check(OO,_,N)(P)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(P))}function g(P){return P===null||Yn(P)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(P)):Ri(P)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Fi(t,v,"whitespace")(P)):P===96&&P===o?n(P):(t.consume(P),g)}function v(P){return P===null||Yn(P)?h(P):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(P))}function b(P){return P===null||Yn(P)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(P)):P===96&&P===o?n(P):(t.consume(P),b)}function _(P){return t.attempt(i,N,w)(P)}function w(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),S}function S(P){return s>0&&Ri(P)?Fi(t,E,"linePrefix",s+1)(P):E(P)}function E(P){return P===null||Yn(P)?t.check(OO,_,N)(P):(t.enter("codeFlowValue"),A(P))}function A(P){return P===null||Yn(P)?(t.exit("codeFlowValue"),E(P)):(t.consume(P),A)}function N(P){return t.exit("codeFenced"),e(P)}function I(P,L,R){let O=0;return W;function W(B){return P.enter("lineEnding"),P.consume(B),P.exit("lineEnding"),U}function U(B){return P.enter("codeFencedFence"),Ri(B)?Fi(P,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):V(B)}function V(B){return B===o?(P.enter("codeFencedFenceSequence"),G(B)):R(B)}function G(B){return B===o?(O++,P.consume(B),G):O>=a?(P.exit("codeFencedFenceSequence"),Ri(B)?Fi(P,Z,"whitespace")(B):Z(B)):R(B)}function Z(B){return B===null||Yn(B)?(P.exit("codeFencedFence"),L(B)):R(B)}}}function Dme(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const aA={name:"codeIndented",tokenize:Ome},Ime={partial:!0,tokenize:Lme};function Ome(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Fi(t,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):Yn(c)?t.attempt(Ime,a,l)(c):(t.enter("codeFlowValue"),o(c))}function o(c){return c===null||Yn(c)?(t.exit("codeFlowValue"),a(c)):(t.consume(c),o)}function l(c){return t.exit("codeIndented"),e(c)}}function Lme(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Yn(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Fi(t,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):Yn(a)?i(a):n(a)}}const zme={name:"codeText",previous:Fme,resolve:jme,tokenize:Ume};function jme(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 Fme(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ume(t,e,n){let r=0,i,s;return a;function a(h){return t.enter("codeText"),t.enter("codeTextSequence"),o(h)}function o(h){return h===96?(t.consume(h),r++,o):(t.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),l):h===96?(s=t.enter("codeTextSequence"),i=0,d(h)):Yn(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||Yn(h)?(t.exit("codeTextData"),l(h)):(t.consume(h),c)}function d(h){return h===96?(t.consume(h),i++,d):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(s.type="codeTextData",c(h))}}class Bme{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&&qb(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),qb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),qb(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);qb(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);qb(this.left,n.reverse())}}}function qb(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 L$(t){const e={};let n=-1,r,i,s,a,o,l,c;const d=new Bme(t);for(;++n<d.length;){for(;n in e;)n=e[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Hme(d,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=d.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return ih(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Hme(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],c={};let d,h,g=-1,v=n,b=0,_=0;const w=[_];for(;v;){for(;t.get(++i)[1]!==v;);s.push(i),v._tokenizer||(d=r.sliceStream(v),v.next||d.push(null),h&&a.defineSkip(v.start),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=v,v=v.next}for(v=n;++g<o.length;)o[g][0]==="exit"&&o[g-1][0]==="enter"&&o[g][1].type===o[g-1][1].type&&o[g][1].start.line!==o[g][1].end.line&&(_=g+1,w.push(_),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(a.events=[],v?(v._tokenizer=void 0,v.previous=void 0):w.pop(),g=w.length;g--;){const S=o.slice(w[g],w[g+1]),E=s.pop();l.push([E,E+S.length-1]),t.splice(E,2,S)}for(l.reverse(),g=-1;++g<l.length;)c[b+l[g][0]]=b+l[g][1],b+=l[g][1]-l[g][0]-1;return c}const Vme={resolve:Wme,tokenize:$me},Gme={partial:!0,tokenize:qme};function Wme(t){return L$(t),t}function $me(t,e){let n;return r;function r(o){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?s(o):Yn(o)?t.check(Gme,a,s)(o):(t.consume(o),i)}function s(o){return t.exit("chunkContent"),t.exit("content"),e(o)}function a(o){return t.consume(o),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function qme(t,e,n){const r=this;return i;function i(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Fi(t,s,"linePrefix")}function s(a){if(a===null||Yn(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function z$(t,e,n,r,i,s,a,o,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(S){return S===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(S),t.exit(s),g):S===null||S===32||S===41||pR(S)?n(S):(t.enter(r),t.enter(a),t.enter(o),t.enter("chunkString",{contentType:"string"}),_(S))}function g(S){return S===62?(t.enter(s),t.consume(S),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(o),t.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(t.exit("chunkString"),t.exit(o),g(S)):S===null||S===60||Yn(S)?n(S):(t.consume(S),S===92?b:v)}function b(S){return S===60||S===62||S===92?(t.consume(S),v):v(S)}function _(S){return!d&&(S===null||S===41||Ec(S))?(t.exit("chunkString"),t.exit(o),t.exit(a),t.exit(r),e(S)):d<c&&S===40?(t.consume(S),d++,_):S===41?(t.consume(S),d--,_):S===null||S===32||S===40||pR(S)?n(S):(t.consume(S),S===92?w:_)}function w(S){return S===40||S===41||S===92?(t.consume(S),_):_(S)}}function j$(t,e,n,r,i,s){const a=this;let o=0,l;return c;function c(v){return t.enter(r),t.enter(i),t.consume(v),t.exit(i),t.enter(s),d}function d(v){return o>999||v===null||v===91||v===93&&!l||v===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(v):v===93?(t.exit(s),t.enter(i),t.consume(v),t.exit(i),t.exit(r),e):Yn(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===null||v===91||v===93||Yn(v)||o++>999?(t.exit("chunkString"),d(v)):(t.consume(v),l||(l=!Ri(v)),v===92?g:h)}function g(v){return v===91||v===92||v===93?(t.consume(v),o++,h):h(v)}}function F$(t,e,n,r,i,s){let a;return o;function o(g){return g===34||g===39||g===40?(t.enter(r),t.enter(i),t.consume(g),t.exit(i),a=g===40?41:g,l):n(g)}function l(g){return g===a?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),c(g))}function c(g){return g===a?(t.exit(s),l(a)):g===null?n(g):Yn(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Fi(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===a||g===null||Yn(g)?(t.exit("chunkString"),c(g)):(t.consume(g),g===92?h:d)}function h(g){return g===a||g===92?(t.consume(g),d):d(g)}}function N_(t,e){let n;return r;function r(i){return Yn(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ri(i)?Fi(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Xme={name:"definition",tokenize:Kme},Yme={partial:!0,tokenize:Zme};function Kme(t,e,n){const r=this;let i;return s;function s(v){return t.enter("definition"),a(v)}function a(v){return j$.call(r,t,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function o(v){return i=v1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),l):n(v)}function l(v){return Ec(v)?N_(t,c)(v):c(v)}function c(v){return z$(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function d(v){return t.attempt(Yme,h,h)(v)}function h(v){return Ri(v)?Fi(t,g,"whitespace")(v):g(v)}function g(v){return v===null||Yn(v)?(t.exit("definition"),r.parser.defined.push(i),e(v)):n(v)}}function Zme(t,e,n){return r;function r(o){return Ec(o)?N_(t,i)(o):n(o)}function i(o){return F$(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return Ri(o)?Fi(t,a,"whitespace")(o):a(o)}function a(o){return o===null||Yn(o)?e(o):n(o)}}const Qme={name:"hardBreakEscape",tokenize:Jme};function Jme(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Yn(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const ege={name:"headingAtx",resolve:tge,tokenize:nge};function tge(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"},ih(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function nge(t,e,n){let r=0;return i;function i(d){return t.enter("atxHeading"),s(d)}function s(d){return t.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(t.consume(d),a):d===null||Ec(d)?(t.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(t.enter("atxHeadingSequence"),l(d)):d===null||Yn(d)?(t.exit("atxHeading"),e(d)):Ri(d)?Fi(t,o,"whitespace")(d):(t.enter("atxHeadingText"),c(d))}function l(d){return d===35?(t.consume(d),l):(t.exit("atxHeadingSequence"),o(d))}function c(d){return d===null||d===35||Ec(d)?(t.exit("atxHeadingText"),o(d)):(t.consume(d),c)}}const rge=["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"],zO=["pre","script","style","textarea"],ige={concrete:!0,name:"htmlFlow",resolveTo:oge,tokenize:lge},sge={partial:!0,tokenize:uge},age={partial:!0,tokenize:cge};function oge(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 lge(t,e,n){const r=this;let i,s,a,o,l;return c;function c(H){return d(H)}function d(H){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(H),h}function h(H){return H===33?(t.consume(H),g):H===47?(t.consume(H),s=!0,_):H===63?(t.consume(H),i=3,r.interrupt?e:F):Vf(H)?(t.consume(H),a=String.fromCharCode(H),w):n(H)}function g(H){return H===45?(t.consume(H),i=2,v):H===91?(t.consume(H),i=5,o=0,b):Vf(H)?(t.consume(H),i=4,r.interrupt?e:F):n(H)}function v(H){return H===45?(t.consume(H),r.interrupt?e:F):n(H)}function b(H){const se="CDATA[";return H===se.charCodeAt(o++)?(t.consume(H),o===se.length?r.interrupt?e:V:b):n(H)}function _(H){return Vf(H)?(t.consume(H),a=String.fromCharCode(H),w):n(H)}function w(H){if(H===null||H===47||H===62||Ec(H)){const se=H===47,re=a.toLowerCase();return!se&&!s&&zO.includes(re)?(i=1,r.interrupt?e(H):V(H)):rge.includes(a.toLowerCase())?(i=6,se?(t.consume(H),S):r.interrupt?e(H):V(H)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):s?E(H):A(H))}return H===45||Yc(H)?(t.consume(H),a+=String.fromCharCode(H),w):n(H)}function S(H){return H===62?(t.consume(H),r.interrupt?e:V):n(H)}function E(H){return Ri(H)?(t.consume(H),E):W(H)}function A(H){return H===47?(t.consume(H),W):H===58||H===95||Vf(H)?(t.consume(H),N):Ri(H)?(t.consume(H),A):W(H)}function N(H){return H===45||H===46||H===58||H===95||Yc(H)?(t.consume(H),N):I(H)}function I(H){return H===61?(t.consume(H),P):Ri(H)?(t.consume(H),I):A(H)}function P(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(t.consume(H),l=H,L):Ri(H)?(t.consume(H),P):R(H)}function L(H){return H===l?(t.consume(H),l=null,O):H===null||Yn(H)?n(H):(t.consume(H),L)}function R(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||Ec(H)?I(H):(t.consume(H),R)}function O(H){return H===47||H===62||Ri(H)?A(H):n(H)}function W(H){return H===62?(t.consume(H),U):n(H)}function U(H){return H===null||Yn(H)?V(H):Ri(H)?(t.consume(H),U):n(H)}function V(H){return H===45&&i===2?(t.consume(H),q):H===60&&i===1?(t.consume(H),Y):H===62&&i===4?(t.consume(H),j):H===63&&i===3?(t.consume(H),F):H===93&&i===5?(t.consume(H),J):Yn(H)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(sge,X,G)(H)):H===null||Yn(H)?(t.exit("htmlFlowData"),G(H)):(t.consume(H),V)}function G(H){return t.check(age,Z,X)(H)}function Z(H){return t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),B}function B(H){return H===null||Yn(H)?G(H):(t.enter("htmlFlowData"),V(H))}function q(H){return H===45?(t.consume(H),F):V(H)}function Y(H){return H===47?(t.consume(H),a="",K):V(H)}function K(H){if(H===62){const se=a.toLowerCase();return zO.includes(se)?(t.consume(H),j):V(H)}return Vf(H)&&a.length<8?(t.consume(H),a+=String.fromCharCode(H),K):V(H)}function J(H){return H===93?(t.consume(H),F):V(H)}function F(H){return H===62?(t.consume(H),j):H===45&&i===2?(t.consume(H),F):V(H)}function j(H){return H===null||Yn(H)?(t.exit("htmlFlowData"),X(H)):(t.consume(H),j)}function X(H){return t.exit("htmlFlow"),e(H)}}function cge(t,e,n){const r=this;return i;function i(a){return Yn(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function uge(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(kT,e,n)}}const dge={name:"htmlText",tokenize:fge};function fge(t,e,n){const r=this;let i,s,a;return o;function o(F){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(F),l}function l(F){return F===33?(t.consume(F),c):F===47?(t.consume(F),I):F===63?(t.consume(F),A):Vf(F)?(t.consume(F),R):n(F)}function c(F){return F===45?(t.consume(F),d):F===91?(t.consume(F),s=0,b):Vf(F)?(t.consume(F),E):n(F)}function d(F){return F===45?(t.consume(F),v):n(F)}function h(F){return F===null?n(F):F===45?(t.consume(F),g):Yn(F)?(a=h,Y(F)):(t.consume(F),h)}function g(F){return F===45?(t.consume(F),v):h(F)}function v(F){return F===62?q(F):F===45?g(F):h(F)}function b(F){const j="CDATA[";return F===j.charCodeAt(s++)?(t.consume(F),s===j.length?_:b):n(F)}function _(F){return F===null?n(F):F===93?(t.consume(F),w):Yn(F)?(a=_,Y(F)):(t.consume(F),_)}function w(F){return F===93?(t.consume(F),S):_(F)}function S(F){return F===62?q(F):F===93?(t.consume(F),S):_(F)}function E(F){return F===null||F===62?q(F):Yn(F)?(a=E,Y(F)):(t.consume(F),E)}function A(F){return F===null?n(F):F===63?(t.consume(F),N):Yn(F)?(a=A,Y(F)):(t.consume(F),A)}function N(F){return F===62?q(F):A(F)}function I(F){return Vf(F)?(t.consume(F),P):n(F)}function P(F){return F===45||Yc(F)?(t.consume(F),P):L(F)}function L(F){return Yn(F)?(a=L,Y(F)):Ri(F)?(t.consume(F),L):q(F)}function R(F){return F===45||Yc(F)?(t.consume(F),R):F===47||F===62||Ec(F)?O(F):n(F)}function O(F){return F===47?(t.consume(F),q):F===58||F===95||Vf(F)?(t.consume(F),W):Yn(F)?(a=O,Y(F)):Ri(F)?(t.consume(F),O):q(F)}function W(F){return F===45||F===46||F===58||F===95||Yc(F)?(t.consume(F),W):U(F)}function U(F){return F===61?(t.consume(F),V):Yn(F)?(a=U,Y(F)):Ri(F)?(t.consume(F),U):O(F)}function V(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(t.consume(F),i=F,G):Yn(F)?(a=V,Y(F)):Ri(F)?(t.consume(F),V):(t.consume(F),Z)}function G(F){return F===i?(t.consume(F),i=void 0,B):F===null?n(F):Yn(F)?(a=G,Y(F)):(t.consume(F),G)}function Z(F){return F===null||F===34||F===39||F===60||F===61||F===96?n(F):F===47||F===62||Ec(F)?O(F):(t.consume(F),Z)}function B(F){return F===47||F===62||Ec(F)?O(F):n(F)}function q(F){return F===62?(t.consume(F),t.exit("htmlTextData"),t.exit("htmlText"),e):n(F)}function Y(F){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),K}function K(F){return Ri(F)?Fi(t,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):J(F)}function J(F){return t.enter("htmlTextData"),a(F)}}const ck={name:"labelEnd",resolveAll:gge,resolveTo:vge,tokenize:xge},hge={tokenize:yge},pge={tokenize:bge},mge={tokenize:_ge};function gge(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&&ih(t,0,t.length,n),t}function vge(t,e){let n=t.length,r=0,i,s,a,o;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(a){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"&&(a=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[a][1].end}},d={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[a-2][1].start}};return o=[["enter",l,e],["enter",c,e]],o=Uu(o,t.slice(s+1,s+r+3)),o=Uu(o,[["enter",d,e]]),o=Uu(o,lk(e.parser.constructs.insideSpan.null,t.slice(s+r+4,a-3),e)),o=Uu(o,[["exit",d,e],t[a-2],t[a-1],["exit",c,e]]),o=Uu(o,t.slice(a+1)),o=Uu(o,[["exit",l,e]]),ih(t,s,t.length,o),t}function xge(t,e,n){const r=this;let i=r.events.length,s,a;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 o;function o(g){return s?s._inactive?h(g):(a=r.parser.defined.includes(v1(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),l):n(g)}function l(g){return g===40?t.attempt(hge,d,a?d:h)(g):g===91?t.attempt(pge,d,a?c:h)(g):a?d(g):h(g)}function c(g){return t.attempt(mge,d,h)(g)}function d(g){return e(g)}function h(g){return s._balanced=!0,n(g)}}function yge(t,e,n){return r;function r(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),i}function i(h){return Ec(h)?N_(t,s)(h):s(h)}function s(h){return h===41?d(h):z$(t,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return Ec(h)?N_(t,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?F$(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return Ec(h)?N_(t,d)(h):d(h)}function d(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):n(h)}}function bge(t,e,n){const r=this;return i;function i(o){return j$.call(r,t,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(v1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(o):n(o)}function a(o){return n(o)}}function _ge(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 Sge={name:"labelStartImage",resolveAll:ck.resolveAll,tokenize:wge};function wge(t,e,n){const r=this;return i;function i(o){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(o),t.exit("labelImageMarker"),s}function s(o){return o===91?(t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const Mge={name:"labelStartLink",resolveAll:ck.resolveAll,tokenize:Tge};function Tge(t,e,n){const r=this;return i;function i(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const oA={name:"lineEnding",tokenize:Ege};function Ege(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Fi(t,e,"linePrefix")}}const zM={name:"thematicBreak",tokenize:Cge};function Cge(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),a(c)}function a(c){return i=c,o(c)}function o(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Yn(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Ri(c)?Fi(t,o,"whitespace")(c):o(c))}}const xc={continuation:{tokenize:kge},exit:Dge,name:"list",tokenize:Rge},Age={partial:!0,tokenize:Ige},Nge={partial:!0,tokenize:Pge};function Rge(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,a=0;return o;function o(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:mR(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(zM,n,c)(v):c(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(v)}return n(v)}function l(v){return mR(v)&&++a<10?(t.consume(v),l):(!r.interrupt||a<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),c(v)):n(v)}function c(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(kT,r.interrupt?n:d,t.attempt(Age,g,h))}function d(v){return r.containerState.initialBlankLine=!0,s++,g(v)}function h(v){return Ri(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),g):n(v)}function g(v){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function kge(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(kT,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Fi(t,e,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!Ri(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Nge,e,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Fi(t,t.attempt(xc,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Pge(t,e,n){const r=this;return Fi(t,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(s):n(s)}}function Dge(t){t.exit(this.containerState.type)}function Ige(t,e,n){const r=this;return Fi(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!Ri(s)&&a&&a[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const jO={name:"setextUnderline",resolveTo:Oge,tokenize:Lge};function Oge(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 a={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",a,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function Lge(t,e,n){const r=this;let i;return s;function s(c){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return t.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===i?(t.consume(c),o):(t.exit("setextHeadingLineSequence"),Ri(c)?Fi(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Yn(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const zge={tokenize:jge};function jge(t){const e=this,n=t.attempt(kT,r,t.attempt(this.parser.constructs.flowInitial,i,Fi(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Vme,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 Fge={resolveAll:B$()},Uge=U$("string"),Bge=U$("text");function U$(t){return{resolveAll:B$(t==="text"?Hge:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,a,o);return a;function a(d){return c(d)?s(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const h=i[d];let g=-1;if(h)for(;++g<h.length;){const v=h[g];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function B$(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 Hge(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,a=-1,o=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(c===-2)l=!0,o++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(o=0),o){const c={type:n===t.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},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 Vge={42:xc,43:xc,45:xc,48:xc,49:xc,50:xc,51:xc,52:xc,53:xc,54:xc,55:xc,56:xc,57:xc,62:D$},Gge={91:Xme},Wge={[-2]:aA,[-1]:aA,32:aA},$ge={35:ege,42:zM,45:[jO,zM],60:ige,61:jO,95:zM,96:LO,126:LO},qge={38:O$,92:I$},Xge={[-5]:oA,[-4]:oA,[-3]:oA,33:Sge,38:O$,42:gR,60:[Mme,dge],91:Mge,92:[Qme,I$],93:ck,95:gR,96:zme},Yge={null:[gR,Fge]},Kge={null:[42,95]},Zge={null:[]},Qge=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Kge,contentInitial:Gge,disable:Zge,document:Vge,flow:$ge,flowInitial:Wge,insideSpan:Yge,string:qge,text:Xge},Symbol.toStringTag,{value:"Module"}));function Jge(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 a=[],o=[];const l={attempt:L(I),check:L(P),consume:E,enter:A,exit:N,interrupt:L(P,{interrupt:!0})},c={code:null,containerState:{},defineSkip:_,events:[],now:b,parser:t,previous:null,sliceSerialize:g,sliceStream:v,write:h};let d=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function h(U){return a=Uu(a,U),w(),a[a.length-1]!==null?[]:(R(e,0),c.events=lk(s,c.events,c),c.events)}function g(U,V){return tve(v(U),V)}function v(U){return eve(a,U)}function b(){const{_bufferIndex:U,_index:V,line:G,column:Z,offset:B}=r;return{_bufferIndex:U,_index:V,line:G,column:Z,offset:B}}function _(U){i[U.line]=U.column,W()}function w(){let U;for(;r._index<a.length;){const V=a[r._index];if(typeof V=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<V.length;)S(V.charCodeAt(r._bufferIndex));else S(V)}}function S(U){d=d(U)}function E(U){Yn(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,W()):U!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=U}function A(U,V){const G=V||{};return G.type=U,G.start=b(),c.events.push(["enter",G,c]),o.push(G),G}function N(U){const V=o.pop();return V.end=b(),c.events.push(["exit",V,c]),V}function I(U,V){R(U,V.from)}function P(U,V){V.restore()}function L(U,V){return G;function G(Z,B,q){let Y,K,J,F;return Array.isArray(Z)?X(Z):"tokenize"in Z?X([Z]):j(Z);function j(ie){return ue;function ue(le){const fe=le!==null&&ie[le],xe=le!==null&&ie.null,he=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(xe)?xe:xe?[xe]:[]];return X(he)(le)}}function X(ie){return Y=ie,K=0,ie.length===0?q:H(ie[K])}function H(ie){return ue;function ue(le){return F=O(),J=ie,ie.partial||(c.currentConstruct=ie),ie.name&&c.parser.constructs.disable.null.includes(ie.name)?re():ie.tokenize.call(V?Object.assign(Object.create(c),V):c,l,se,re)(le)}}function se(ie){return U(J,F),B}function re(ie){return F.restore(),++K<Y.length?H(Y[K]):q}}}function R(U,V){U.resolveAll&&!s.includes(U)&&s.push(U),U.resolve&&ih(c.events,V,c.events.length-V,U.resolve(c.events.slice(V),c)),U.resolveTo&&(c.events=U.resolveTo(c.events,c))}function O(){const U=b(),V=c.previous,G=c.currentConstruct,Z=c.events.length,B=Array.from(o);return{from:Z,restore:q};function q(){r=U,c.previous=V,c.currentConstruct=G,c.events.length=Z,o=B,W()}}function W(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function eve(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let a;if(n===i)a=[t[n].slice(r,s)];else{if(a=t.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(t[i].slice(0,s))}return a}function tve(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
`;break}case-3:{a=`\r
`;break}case-2:{a=e?" ":"	";break}case-1:{if(!e&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function nve(t){const r={constructs:cme([Qge,...(t||{}).extensions||[]]),content:i(vme),defined:[],document:i(yme),flow:i(zge),lazy:{},string:i(Uge),text:i(Bge)};return r;function i(s){return a;function a(o){return Jge(r,s,o)}}}function rve(t){for(;!L$(t););return t}const FO=/[\0\t\n\r]/g;function ive(){let t=1,e="",n=!0,r;return i;function i(s,a,o){const l=[];let c,d,h,g,v;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),h=0,e="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(FO.lastIndex=h,c=FO.exec(s),g=c&&c.index!==void 0?c.index:s.length,v=s.charCodeAt(g),!c){e=s.slice(h);break}if(v===10&&h===g&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<g&&(l.push(s.slice(h,g)),t+=g-h),v){case 0:{l.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,l.push(-2);t++<d;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}h=g+1}return o&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const sve=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ave(t){return t.replace(sve,ove)}function ove(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return P$(n.slice(s?2:1),s?16:10)}return ok(n)||t}const H$={}.hasOwnProperty;function lve(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),cve(n)(rve(nve(n).document().write(ive()(t,e,!0))))}function cve(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Xe),autolinkProtocol:O,autolinkEmail:O,atxHeading:s(Le),blockQuote:s(xe),characterEscape:O,characterReference:O,codeFenced:s(he),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(he,a),codeText:s(Te,a),codeTextData:O,data:O,codeFlowValue:O,definition:s(We),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(Se),hardBreakEscape:s(pe),hardBreakTrailing:s(pe),htmlFlow:s(Re,a),htmlFlowData:O,htmlText:s(Re,a),htmlTextData:O,image:s(ne),label:a,link:s(Xe),listItem:s(Pe),listItemValue:g,listOrdered:s(Ae,h),listUnordered:s(Ae),paragraph:s(Ke),reference:H,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Le),strong:s(oe),thematicBreak:s(_e)},exit:{atxHeading:l(),atxHeadingSequence:I,autolink:l(),autolinkEmail:fe,autolinkProtocol:le,blockQuote:l(),characterEscapeValue:W,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ie,characterReference:ue,codeFenced:l(w),codeFencedFence:_,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:W,codeIndented:l(S),codeText:l(B),codeTextData:W,data:W,definition:l(),definitionDestinationString:N,definitionLabelString:E,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(V),hardBreakTrailing:l(V),htmlFlow:l(G),htmlFlowData:W,htmlText:l(Z),htmlTextData:W,image:l(Y),label:J,labelText:K,lineEnding:U,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:F,resourceTitleString:j,resource:X,setextHeading:l(R),setextHeadingLineSequence:L,setextHeadingText:P,strong:l(),thematicBreak:l()}};V$(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(ve){let ye={type:"root",children:[]};const ke={stack:[ye],tokenStack:[],config:e,enter:o,exit:c,buffer:a,resume:d,data:n},Be=[];let ge=-1;for(;++ge<ve.length;)if(ve[ge][1].type==="listOrdered"||ve[ge][1].type==="listUnordered")if(ve[ge][0]==="enter")Be.push(ge);else{const Ye=Be.pop();ge=i(ve,Ye,ge)}for(ge=-1;++ge<ve.length;){const Ye=e[ve[ge][0]];H$.call(Ye,ve[ge][1].type)&&Ye[ve[ge][1].type].call(Object.assign({sliceSerialize:ve[ge][2].sliceSerialize},ke),ve[ge][1])}if(ke.tokenStack.length>0){const Ye=ke.tokenStack[ke.tokenStack.length-1];(Ye[1]||UO).call(ke,void 0,Ye[0])}for(ye.position={start:u0(ve.length>0?ve[0][1].start:{line:1,column:1,offset:0}),end:u0(ve.length>0?ve[ve.length-2][1].end:{line:1,column:1,offset:0})},ge=-1;++ge<e.transforms.length;)ye=e.transforms[ge](ye)||ye;return ye}function i(ve,ye,ke){let Be=ye-1,ge=-1,Ye=!1,Qe,Ie,Fe,Ge;for(;++Be<=ke;){const Me=ve[Be];switch(Me[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Me[0]==="enter"?ge++:ge--,Ge=void 0;break}case"lineEndingBlank":{Me[0]==="enter"&&(Qe&&!Ge&&!ge&&!Fe&&(Fe=Be),Ge=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ge=void 0}if(!ge&&Me[0]==="enter"&&Me[1].type==="listItemPrefix"||ge===-1&&Me[0]==="exit"&&(Me[1].type==="listUnordered"||Me[1].type==="listOrdered")){if(Qe){let $e=Be;for(Ie=void 0;$e--;){const dt=ve[$e];if(dt[1].type==="lineEnding"||dt[1].type==="lineEndingBlank"){if(dt[0]==="exit")continue;Ie&&(ve[Ie][1].type="lineEndingBlank",Ye=!0),dt[1].type="lineEnding",Ie=$e}else if(!(dt[1].type==="linePrefix"||dt[1].type==="blockQuotePrefix"||dt[1].type==="blockQuotePrefixWhitespace"||dt[1].type==="blockQuoteMarker"||dt[1].type==="listItemIndent"))break}Fe&&(!Ie||Fe<Ie)&&(Qe._spread=!0),Qe.end=Object.assign({},Ie?ve[Ie][1].start:Me[1].end),ve.splice(Ie||Be,0,["exit",Qe,Me[2]]),Be++,ke++}if(Me[1].type==="listItemPrefix"){const $e={type:"listItem",_spread:!1,start:Object.assign({},Me[1].start),end:void 0};Qe=$e,ve.splice(Be,0,["enter",$e,Me[2]]),Be++,ke++,Fe=void 0,Ge=!0}}}return ve[ye][1]._spread=Ye,ke}function s(ve,ye){return ke;function ke(Be){o.call(this,ve(Be),Be),ye&&ye.call(this,Be)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(ve,ye,ke){this.stack[this.stack.length-1].children.push(ve),this.stack.push(ve),this.tokenStack.push([ye,ke||void 0]),ve.position={start:u0(ye.start),end:void 0}}function l(ve){return ye;function ye(ke){ve&&ve.call(this,ke),c.call(this,ke)}}function c(ve,ye){const ke=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==ve.type&&(ye?ye.call(this,ve,Be[0]):(Be[1]||UO).call(this,ve,Be[0]));else throw new Error("Cannot close `"+ve.type+"` ("+A_({start:ve.start,end:ve.end})+"): it’s not open");ke.position.end=u0(ve.end)}function d(){return ome(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(ve){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ve),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ve}function b(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ve}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ve.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ve.replace(/(\r?\n|\r)$/g,"")}function E(ve){const ye=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ye,ke.identifier=v1(this.sliceSerialize(ve)).toLowerCase()}function A(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ve}function N(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ve}function I(ve){const ye=this.stack[this.stack.length-1];if(!ye.depth){const ke=this.sliceSerialize(ve).length;ye.depth=ke}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function L(ve){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ve).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function O(ve){const ke=this.stack[this.stack.length-1].children;let Be=ke[ke.length-1];(!Be||Be.type!=="text")&&(Be=te(),Be.position={start:u0(ve.start),end:void 0},ke.push(Be)),this.stack.push(Be)}function W(ve){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ve),ye.position.end=u0(ve.end)}function U(ve){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ke=ye.children[ye.children.length-1];ke.position.end=u0(ve.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ye.type)&&(O.call(this,ve),W.call(this,ve))}function V(){this.data.atHardBreak=!0}function G(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ve}function Z(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ve}function B(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ve}function q(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=ye,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function Y(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=ye,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function K(ve){const ye=this.sliceSerialize(ve),ke=this.stack[this.stack.length-2];ke.label=ave(ye),ke.identifier=v1(ye).toLowerCase()}function J(){const ve=this.stack[this.stack.length-1],ye=this.resume(),ke=this.stack[this.stack.length-1];if(this.data.inReference=!0,ke.type==="link"){const Be=ve.children;ke.children=Be}else ke.alt=ye}function F(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ve}function j(){const ve=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ve}function X(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function se(ve){const ye=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ye,ke.identifier=v1(this.sliceSerialize(ve)).toLowerCase(),this.data.referenceType="full"}function re(ve){this.data.characterReferenceType=ve.type}function ie(ve){const ye=this.sliceSerialize(ve),ke=this.data.characterReferenceType;let Be;ke?(Be=P$(ye,ke==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=ok(ye);const ge=this.stack[this.stack.length-1];ge.value+=Be}function ue(ve){const ye=this.stack.pop();ye.position.end=u0(ve.end)}function le(ve){W.call(this,ve);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ve)}function fe(ve){W.call(this,ve);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ve)}function xe(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function Te(){return{type:"inlineCode",value:""}}function We(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Se(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function pe(){return{type:"break"}}function Re(){return{type:"html",value:""}}function ne(){return{type:"image",title:null,url:"",alt:null}}function Xe(){return{type:"link",title:null,url:"",children:[]}}function Ae(ve){return{type:"list",ordered:ve.type==="listOrdered",start:null,spread:ve._spread,children:[]}}function Pe(ve){return{type:"listItem",spread:ve._spread,checked:null,children:[]}}function Ke(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function te(){return{type:"text",value:""}}function _e(){return{type:"thematicBreak"}}}function u0(t){return{line:t.line,column:t.column,offset:t.offset}}function V$(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?V$(t,r):uve(t,r)}}function uve(t,e){let n;for(n in e)if(H$.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 UO(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+A_({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+A_({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+A_({start:e.start,end:e.end})+") is still open")}function dve(t){const e=this;e.parser=n;function n(r){return lve(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function fve(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 hve(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function pve(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 mve(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function gve(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function vve(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Ey(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let a,o=t.footnoteCounts.get(r);o===void 0?(o=0,t.footnoteOrder.push(r),a=t.footnoteOrder.length):a=s+1,o+=1,t.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function xve(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 yve(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function G$(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 a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function bve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return G$(t,e);const i={src:Ey(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function _ve(t,e){const n={src:Ey(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 Sve(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 wve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return G$(t,e);const i={href:Ey(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 Mve(t,e){const n={href:Ey(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 Tve(t,e,n){const r=t.all(e),i=n?Eve(n):W$(e),s={},a=[];if(typeof e.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const d=r[o];(i||o!==0||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!i?a.push(...d.children):a.push(d)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:s,children:a};return t.patch(e,c),t.applyData(e,c)}function Eve(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=W$(n[r])}return e}function W$(t){const e=t.spread;return e??t.children.length>1}function Cve(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 a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.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 Ave(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Nve(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function Rve(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function kve(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},o=rk(e.children[1]),l=T$(e.children[e.children.length-1]);o&&l&&(a.position={start:o,end:l}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function Pve(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:e.children.length;let l=-1;const c=[];for(;++l<o;){const h=e.children[l],g={},v=a?a[l]:void 0;v&&(g.align=v);let b={type:"element",tagName:s,properties:g,children:[]};h&&(b.children=t.all(h),t.patch(h,b),b=t.applyData(h,b)),c.push(b)}const d={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,d),t.applyData(e,d)}function Dve(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const BO=9,HO=32;function Ive(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(VO(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(VO(e.slice(i),i>0,!1)),s.join("")}function VO(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===BO||s===HO;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===BO||s===HO;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function Ove(t,e){const n={type:"text",value:Ive(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Lve(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const zve={blockquote:fve,break:hve,code:pve,delete:mve,emphasis:gve,footnoteReference:vve,heading:xve,html:yve,imageReference:bve,image:_ve,inlineCode:Sve,linkReference:wve,link:Mve,listItem:Tve,list:Cve,paragraph:Ave,root:Nve,strong:Rve,table:kve,tableCell:Dve,tableRow:Pve,text:Ove,thematicBreak:Lve,toml:f4,yaml:f4,definition:f4,footnoteDefinition:f4};function f4(){}const $$=-1,PT=0,R_=1,S2=2,uk=3,dk=4,fk=5,hk=6,q$=7,X$=8,GO=typeof self=="object"?self:globalThis,jve=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,a]=e[i];switch(s){case PT:case $$:return n(a,i);case R_:{const o=n([],i);for(const l of a)o.push(r(l));return o}case S2:{const o=n({},i);for(const[l,c]of a)o[r(l)]=r(c);return o}case uk:return n(new Date(a),i);case dk:{const{source:o,flags:l}=a;return n(new RegExp(o,l),i)}case fk:{const o=n(new Map,i);for(const[l,c]of a)o.set(r(l),r(c));return o}case hk:{const o=n(new Set,i);for(const l of a)o.add(r(l));return o}case q$:{const{name:o,message:l}=a;return n(new GO[o](l),i)}case X$:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new GO[s](a),i)};return r},WO=t=>jve(new Map,t)(0),Tx="",{toString:Fve}={},{keys:Uve}=Object,Xb=t=>{const e=typeof t;if(e!=="object"||!t)return[PT,e];const n=Fve.call(t).slice(8,-1);switch(n){case"Array":return[R_,Tx];case"Object":return[S2,Tx];case"Date":return[uk,Tx];case"RegExp":return[dk,Tx];case"Map":return[fk,Tx];case"Set":return[hk,Tx];case"DataView":return[R_,n]}return n.includes("Array")?[R_,n]:n.includes("Error")?[q$,n]:[S2,n]},h4=([t,e])=>t===PT&&(e==="function"||e==="symbol"),Bve=(t,e,n,r)=>{const i=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},s=a=>{if(n.has(a))return n.get(a);let[o,l]=Xb(a);switch(o){case PT:{let d=a;switch(l){case"bigint":o=X$,d=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([$$],a)}return i([o,d],a)}case R_:{if(l){let g=a;return l==="DataView"?g=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(g=new Uint8Array(a)),i([l,[...g]],a)}const d=[],h=i([o,d],a);for(const g of a)d.push(s(g));return h}case S2:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(e&&"toJSON"in a)return s(a.toJSON());const d=[],h=i([o,d],a);for(const g of Uve(a))(t||!h4(Xb(a[g])))&&d.push([s(g),s(a[g])]);return h}case uk:return i([o,a.toISOString()],a);case dk:{const{source:d,flags:h}=a;return i([o,{source:d,flags:h}],a)}case fk:{const d=[],h=i([o,d],a);for(const[g,v]of a)(t||!(h4(Xb(g))||h4(Xb(v))))&&d.push([s(g),s(v)]);return h}case hk:{const d=[],h=i([o,d],a);for(const g of a)(t||!h4(Xb(g)))&&d.push(s(g));return h}}const{message:c}=a;return i([o,{name:l,message:c}],a)};return s},$O=(t,{json:e,lossy:n}={})=>{const r=[];return Bve(!(e||n),!!e,new Map,r)(t),r},w2=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?WO($O(t,e)):structuredClone(t):(t,e)=>WO($O(t,e));function Hve(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 Vve(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Gve(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Hve,r=t.options.footnoteBackLabel||Vve,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const d=t.all(c),h=String(c.identifier).toUpperCase(),g=Ey(h.toLowerCase());let v=0;const b=[],_=t.footnoteCounts.get(h);for(;_!==void 0&&++v<=_;){b.length>0&&b.push({type:"text",value:" "});let E=typeof n=="string"?n:n(l,v);typeof E=="string"&&(E={type:"text",value:E}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,v),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const E=w.children[w.children.length-1];E&&E.type==="text"?E.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...b)}else d.push(...b);const S={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(d,!0)};t.patch(c,S),o.push(S)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...w2(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(o,!0)},{type:"text",value:`
`}]}}const pk=(function(t){if(t==null)return Xve;if(typeof t=="function")return DT(t);if(typeof t=="object")return Array.isArray(t)?Wve(t):$ve(t);if(typeof t=="string")return qve(t);throw new Error("Expected function, string, or object as test")});function Wve(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=pk(t[n]);return DT(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function $ve(t){const e=t;return DT(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function qve(t){return DT(e);function e(n){return n&&n.type===t}}function DT(t){return e;function e(n,r,i){return!!(Yve(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Xve(){return!0}function Yve(t){return t!==null&&typeof t=="object"&&"type"in t}const Y$=[],Kve=!0,qO=!1,K$="skip";function Z$(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=pk(i),a=r?-1:1;o(t,void 0,[])();function o(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const v=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(l.type+(v?"<"+v+">":""))+")"})}return g;function g(){let v=Y$,b,_,w;if((!e||s(l,c,d[d.length-1]||void 0))&&(v=Zve(n(l,d)),v[0]===qO))return v;if("children"in l&&l.children){const S=l;if(S.children&&v[0]!==K$)for(_=(r?S.children.length:-1)+a,w=d.concat(S);_>-1&&_<S.children.length;){const E=S.children[_];if(b=o(E,_,w)(),b[0]===qO)return b;_=typeof b[1]=="number"?b[1]:_+a}}return v}}}function Zve(t){return Array.isArray(t)?t:typeof t=="number"?[Kve,t]:t==null?Y$:[t]}function Q$(t,e,n,r){let i,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,i=n):(s=e,a=n,i=r),Z$(t,s,o,i);function o(l,c){const d=c[c.length-1],h=d?d.children.indexOf(l):void 0;return a(l,h,d)}}const vR={}.hasOwnProperty,Qve={};function Jve(t,e){const n=e||Qve,r=new Map,i=new Map,s=new Map,a={...zve,...n.handlers},o={all:c,applyData:txe,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:l,options:n,patch:exe,wrap:rxe};return Q$(t,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:i,g=String(d.identifier).toUpperCase();h.has(g)||h.set(g,d)}}),o;function l(d,h){const g=d.type,v=o.handlers[g];if(vR.call(o.handlers,g)&&v)return v(o,d,h);if(o.options.passThrough&&o.options.passThrough.includes(g)){if("children"in d){const{children:_,...w}=d,S=w2(w);return S.children=o.all(d),S}return w2(d)}return(o.options.unknownHandler||nxe)(o,d,h)}function c(d){const h=[];if("children"in d){const g=d.children;let v=-1;for(;++v<g.length;){const b=o.one(g[v],d);if(b){if(v&&g[v-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=XO(b.value)),!Array.isArray(b)&&b.type==="element")){const _=b.children[0];_&&_.type==="text"&&(_.value=XO(_.value))}Array.isArray(b)?h.push(...b):h.push(b)}}}return h}}function exe(t,e){t.position&&(e.position=F0e(t))}function txe(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 a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&s&&Object.assign(n.properties,w2(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function nxe(t,e){const n=e.data||{},r="value"in e&&!(vR.call(n,"hProperties")||vR.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 rxe(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 XO(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function YO(t,e){const n=Jve(t,e),r=n.one(t,void 0),i=Gve(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
`},i),s}function ixe(t,e){return t&&"run"in t?async function(n,r){const i=YO(n,{file:r,...e});await t.run(i,r)}:function(n,r){return YO(n,{file:r,...t||e})}}function KO(t){if(t)throw t}var lA,ZO;function sxe(){if(ZO)return lA;ZO=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var d=t.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!h)return!1;var g;for(g in c);return typeof g>"u"||t.call(c,g)},a=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},o=function(c,d){if(d==="__proto__")if(t.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return lA=function l(){var c,d,h,g,v,b,_=arguments[0],w=1,S=arguments.length,E=!1;for(typeof _=="boolean"&&(E=_,_=arguments[1]||{},w=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});w<S;++w)if(c=arguments[w],c!=null)for(d in c)h=o(_,d),g=o(c,d),_!==g&&(E&&g&&(s(g)||(v=i(g)))?(v?(v=!1,b=h&&i(h)?h:[]):b=h&&s(h)?h:{},a(_,{name:d,newValue:l(E,b,g)})):typeof g<"u"&&a(_,{name:d,newValue:g}));return _},lA}var axe=sxe();const cA=cy(axe);function xR(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 oxe(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(l,...c){const d=t[++s];let h=-1;if(l){a(l);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,d?lxe(d,o)(...c):a(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 lxe(t,e){let n;return r;function r(...a){const o=t.length>a.length;let l;o&&a.push(i);try{l=t.apply(this,a)}catch(c){const d=c;if(o&&n)throw d;return i(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(a,...o){n||(n=!0,e(a,...o))}function s(a){i(null,a)}}const Lf={basename:cxe,dirname:uxe,extname:dxe,join:fxe,sep:"/"};function cxe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');uw(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 a=-1,o=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(t.codePointAt(i)===e.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function uxe(t){if(uw(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 dxe(t){uw(t);let e=t.length,n=-1,r=0,i=-1,s=0,a;for(;e--;){const o=t.codePointAt(e);if(o===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),o===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 fxe(...t){let e=-1,n;for(;++e<t.length;)uw(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":hxe(n)}function hxe(t){uw(t);const e=t.codePointAt(0)===47;let n=pxe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function pxe(t,e){let n="",r=0,i=-1,s=0,a=-1,o,l;for(;++a<=t.length;){if(a<t.length)o=t.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-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=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function uw(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const mxe={cwd:gxe};function gxe(){return"/"}function yR(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function vxe(t){if(typeof t=="string")t=new URL(t);else if(!yR(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 xxe(t)}function xxe(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 uA=["history","path","basename","stem","extname","dirname"];class J${constructor(e){let n;e?yR(e)?n={path:e}:typeof e=="string"||yxe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":mxe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<uA.length;){const s=uA[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)uA.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Lf.basename(this.path):void 0}set basename(e){fA(e,"basename"),dA(e,"basename"),this.path=Lf.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Lf.dirname(this.path):void 0}set dirname(e){QO(this.basename,"dirname"),this.path=Lf.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Lf.extname(this.path):void 0}set extname(e){if(dA(e,"extname"),QO(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=Lf.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){yR(e)&&(e=vxe(e)),fA(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Lf.basename(this.path,this.extname):void 0}set stem(e){fA(e,"stem"),dA(e,"stem"),this.path=Lf.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 gl(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 dA(t,e){if(t&&t.includes(Lf.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Lf.sep+"`")}function fA(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function QO(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function yxe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const bxe=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),_xe={}.hasOwnProperty;class mk extends bxe{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=oxe()}copy(){const e=new mk;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(cA(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(mA("data",this.frozen),this.namespace[e]=n,this):_xe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(mA("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=p4(e),r=this.parser||this.Parser;return hA("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),hA("process",this.parser||this.Parser),pA("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=p4(e),l=r.parse(o);r.run(l,o,function(d,h,g){if(d||!h||!g)return c(d);const v=h,b=r.stringify(v,g);Mxe(b)?g.value=b:g.result=b,c(d,g)});function c(d,h){d||!h?a(d):s?s(h):n(void 0,h)}}}processSync(e){let n=!1,r;return this.freeze(),hA("processSync",this.parser||this.Parser),pA("processSync",this.compiler||this.Compiler),this.process(e,i),eL("processSync","process",n),r;function i(s,a){n=!0,KO(s),r=a}}run(e,n,r){JO(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(a,o){const l=p4(n);i.run(e,l,c);function c(d,h,g){const v=h||e;d?o(d):a?a(v):r(void 0,v,g)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),eL("runSync","run",r),i;function s(a,o){KO(a),i=o,r=!0}}stringify(e,n){this.freeze();const r=p4(n),i=this.compiler||this.Compiler;return pA("stringify",i),JO(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(mA("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?o(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;l(d,h)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(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");o(c.plugins),c.settings&&(i.settings=cA(!0,i.settings,c.settings))}function o(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let h=-1,g=-1;for(;++h<r.length;)if(r[h][0]===c){g=h;break}if(g===-1)r.push([c,...d]);else if(d.length>0){let[v,...b]=d;const _=r[g][1];xR(_)&&xR(v)&&(v=cA(!0,_,v)),r[g]=[c,v,...b]}}}}const Sxe=new mk().freeze();function hA(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function pA(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function mA(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 JO(t){if(!xR(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function eL(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function p4(t){return wxe(t)?t:new J$(t)}function wxe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Mxe(t){return typeof t=="string"||Txe(t)}function Txe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Exe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",tL=[],nL={allowDangerousHtml:!0},Cxe=/^(https?|ircs?|mailto|xmpp)$/i,Axe=[{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 Nxe(t){const e=Rxe(t),n=kxe(t);return Pxe(e.runSync(e.parse(n),n),t)}function Rxe(t){const e=t.rehypePlugins||tL,n=t.remarkPlugins||tL,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...nL}:nL;return Sxe().use(dve).use(n).use(ixe,r).use(e)}function kxe(t){const e=t.children||"",n=new J$;return typeof e=="string"&&(n.value=e),n}function Pxe(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,a=e.skipHtml,o=e.unwrapDisallowed,l=e.urlTransform||Dxe;for(const d of Axe)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Exe+d.id,void 0);return Q$(t,c),G0e(t,{Fragment:p.Fragment,components:i,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function c(d,h,g){if(d.type==="raw"&&g&&typeof h=="number")return a?g.children.splice(h,1):g.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let v;for(v in sA)if(Object.hasOwn(sA,v)&&Object.hasOwn(d.properties,v)){const b=d.properties[v],_=sA[v];(_===null||_.includes(d.tagName))&&(d.properties[v]=l(String(b||""),v,d))}}if(d.type==="element"){let v=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!v&&r&&typeof h=="number"&&(v=!r(d,h,g)),v&&g&&typeof h=="number")return o&&d.children?g.children.splice(h,1,...d.children):g.children.splice(h,1),h}}}function Dxe(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||Cxe.test(t.slice(0,e))?t:""}function Ixe(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,a=0;for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+e.length,r=n.indexOf(e,i);return a}function Oxe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:o,mathText:a,mathTextData:o}};function t(l){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function e(){this.buffer()}function n(){const l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c;const h=d.data.hChildren[0];h.type,h.tagName,h.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 a(l){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c,d.data.hChildren.push({type:"text",value:c})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function Lxe(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,a,o,l){const c=s.value||"",d=o.createTracker(l),h="$".repeat(Math.max(Ixe(c,"$")+1,2)),g=o.enter("mathFlow");let v=d.move(h);if(s.meta){const b=o.enter("mathFlowMeta");v+=d.move(o.safe(s.meta,{after:`
`,before:v,encode:["$"],...d.current()})),b()}return v+=d.move(`
`),c&&(v+=d.move(c+`
`)),v+=d.move(h),g(),v}function r(s,a,o){let l=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const d="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let h=-1;for(;++h<o.unsafe.length;){const g=o.unsafe[h];if(!g.atBreak)continue;const v=o.compilePattern(g);let b;for(;b=v.exec(l);){let _=b.index;l.codePointAt(_)===10&&l.codePointAt(_-1)===13&&_--,l=l.slice(0,_)+" "+l.slice(b.index+1)}}return d+l+d}function i(){return"$"}}const zxe={tokenize:jxe,concrete:!0,name:"mathFlow"},rL={tokenize:Fxe,partial:!0};function jxe(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 a=0;return o;function o(E){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),l(E)}function l(E){return E===36?(t.consume(E),a++,l):a<2?n(E):(t.exit("mathFlowFenceSequence"),Fi(t,c,"whitespace")(E))}function c(E){return E===null||Yn(E)?h(E):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),d(E))}function d(E){return E===null||Yn(E)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),h(E)):E===36?n(E):(t.consume(E),d)}function h(E){return t.exit("mathFlowFence"),r.interrupt?e(E):t.attempt(rL,g,w)(E)}function g(E){return t.attempt({tokenize:S,partial:!0},w,v)(E)}function v(E){return(s?Fi(t,b,"linePrefix",s+1):b)(E)}function b(E){return E===null?w(E):Yn(E)?t.attempt(rL,g,w)(E):(t.enter("mathFlowValue"),_(E))}function _(E){return E===null||Yn(E)?(t.exit("mathFlowValue"),b(E)):(t.consume(E),_)}function w(E){return t.exit("mathFlow"),e(E)}function S(E,A,N){let I=0;return Fi(E,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function P(O){return E.enter("mathFlowFence"),E.enter("mathFlowFenceSequence"),L(O)}function L(O){return O===36?(I++,E.consume(O),L):I<a?N(O):(E.exit("mathFlowFenceSequence"),Fi(E,R,"whitespace")(O))}function R(O){return O===null||Yn(O)?(E.exit("mathFlowFence"),A(O)):N(O)}}}function Fxe(t,e,n){const r=this;return i;function i(a){return a===null?e(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Uxe(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:Bxe,previous:Hxe,name:"mathText"};function r(i,s,a){let o=0,l,c;return d;function d(_){return i.enter("mathText"),i.enter("mathTextSequence"),h(_)}function h(_){return _===36?(i.consume(_),o++,h):o<2&&!n?a(_):(i.exit("mathTextSequence"),g(_))}function g(_){return _===null?a(_):_===36?(c=i.enter("mathTextSequence"),l=0,b(_)):_===32?(i.enter("space"),i.consume(_),i.exit("space"),g):Yn(_)?(i.enter("lineEnding"),i.consume(_),i.exit("lineEnding"),g):(i.enter("mathTextData"),v(_))}function v(_){return _===null||_===32||_===36||Yn(_)?(i.exit("mathTextData"),g(_)):(i.consume(_),v)}function b(_){return _===36?(i.consume(_),l++,b):l===o?(i.exit("mathTextSequence"),i.exit("mathText"),s(_)):(c.type="mathTextData",v(_))}}}function Bxe(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 Hxe(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Vxe(t){return{flow:{36:zxe},text:{36:Uxe(t)}}}class wc{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 wc(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class tu{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 tu(n,wc.range(this,e))}}class Qt{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,a=n&&n.loc;if(a&&a.start<=a.end){var o=a.lexer.input;i=a.start,s=a.end,i===o.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var l=o.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+o.slice(i-15,i):c=o.slice(0,i);var d;s+15<o.length?d=o.slice(s,s+15)+"…":d=o.slice(s),r+=c+l+d}var h=new Error(r);return h.name="ParseError",h.__proto__=Qt.prototype,h.position=i,i!=null&&s!=null&&(h.length=s-i),h.rawMessage=e,h}}Qt.prototype.__proto__=Error.prototype;var Gxe=/([A-Z])/g,gk=t=>t.replace(Gxe,"-$1").toLowerCase(),Wxe={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},$xe=/[&><"']/g,dl=t=>String(t).replace($xe,e=>Wxe[e]),k_=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?k_(t.body[0]):t:t.type==="font"?k_(t.body):t,qxe=new Set(["mathord","textord","atom"]),xp=t=>qxe.has(k_(t).type),Xxe=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"},jM={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 Yxe(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 vk{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 jM)if(jM.hasOwnProperty(n)){var r=jM[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Yxe(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 Qt("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=Xxe(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class d0{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 Uf[Kxe[this.id]]}sub(){return Uf[Zxe[this.id]]}fracNum(){return Uf[Qxe[this.id]]}fracDen(){return Uf[Jxe[this.id]]}cramp(){return Uf[e1e[this.id]]}text(){return Uf[t1e[this.id]]}isTight(){return this.size>=2}}var xk=0,M2=1,x1=2,lp=3,hS=4,Bu=5,Z1=6,Ul=7,Uf=[new d0(xk,0,!1),new d0(M2,0,!0),new d0(x1,1,!1),new d0(lp,1,!0),new d0(hS,2,!1),new d0(Bu,2,!0),new d0(Z1,3,!1),new d0(Ul,3,!0)],Kxe=[hS,Bu,hS,Bu,Z1,Ul,Z1,Ul],Zxe=[Bu,Bu,Bu,Bu,Ul,Ul,Ul,Ul],Qxe=[x1,lp,hS,Bu,Z1,Ul,Z1,Ul],Jxe=[lp,lp,Bu,Bu,Ul,Ul,Ul,Ul],e1e=[M2,M2,lp,lp,Bu,Bu,Ul,Ul],t1e=[xk,M2,x1,lp,x1,lp,x1,lp],hr={DISPLAY:Uf[xk],TEXT:Uf[x1],SCRIPT:Uf[hS],SCRIPTSCRIPT:Uf[Z1]},bR=[{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 n1e(t){for(var e=0;e<bR.length;e++)for(var n=bR[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 FM=[];bR.forEach(t=>t.blocks.forEach(e=>FM.push(...e)));function eq(t){for(var e=0;e<FM.length;e+=2)if(t>=FM[e]&&t<=FM[e+1])return!0;return!1}var Ex=80,r1e=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"},i1e=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"},s1e=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"},a1e=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"},o1e=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"},l1e=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},c1e=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"},u1e=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=r1e(n,Ex);break;case"sqrtSize1":i=i1e(n,Ex);break;case"sqrtSize2":i=s1e(n,Ex);break;case"sqrtSize3":i=a1e(n,Ex);break;case"sqrtSize4":i=o1e(n,Ex);break;case"sqrtTall":i=c1e(n,Ex,r)}return i},d1e=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""}},iL={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`},f1e=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 dw=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 Yf={"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]}},m4={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]},sL={Å:"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 h1e(t,e){Yf[t]=e}function yk(t,e,n){if(!Yf[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=Yf[e][r];if(!i&&t[0]in sL&&(r=sL[t[0]].charCodeAt(0),i=Yf[e][r]),!i&&n==="text"&&eq(r)&&(i=Yf[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var gA={};function p1e(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!gA[e]){var n=gA[e]={cssEmPerMu:m4.quad[e]/18};for(var r in m4)m4.hasOwnProperty(r)&&(n[r]=m4[r][e])}return gA[e]}var m1e=[[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]],aL=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],oL=function(e,n){return n.size<2?e:m1e[e-1][n.size-1]};class Qh{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||Qh.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=aL[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 Qh(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:oL(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:aL[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=oL(Qh.BASESIZE,e);return this.size===n&&this.textSize===Qh.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!==Qh.BASESIZE?["sizing","reset-size"+this.size,"size"+Qh.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=p1e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Qh.BASESIZE=6;var _R={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},g1e={ex:!0,em:!0,mu:!0},tq=function(e){return typeof e!="string"&&(e=e.unit),e in _R||e in g1e||e==="ex"},Js=function(e,n){var r;if(e.unit in _R)r=_R[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 Qt("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},dn=function(e){return+e.toFixed(4)+"em"},Z0=function(e){return e.filter(n=>n).join(" ")},nq=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)}},rq=function(e){var n=document.createElement(e);n.className=Z0(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},v1e=/[\s"'>/=\x00-\x1f]/,iq=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+dl(Z0(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=gk(i)+":"+this.style[i]+";");r&&(n+=' style="'+dl(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(v1e.test(s))throw new Qt("Invalid attribute name '"+s+"'");n+=" "+s+'="'+dl(this.attributes[s])+'"'}n+=">";for(var a=0;a<this.children.length;a++)n+=this.children[a].toMarkup();return n+="</"+e+">",n};class fw{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,nq.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return rq.call(this,"span")}toMarkup(){return iq.call(this,"span")}}class bk{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,nq.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 rq.call(this,"a")}toMarkup(){return iq.call(this,"a")}}class x1e{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="'+dl(this.src)+'"'+(' alt="'+dl(this.alt)+'"'),n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=gk(r)+":"+this.style[r]+";");return n&&(e+=' style="'+dl(n)+'"'),e+="'/>",e}}var y1e={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Xu{constructor(e,n,r,i,s,a,o,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=a||0,this.classes=o||[],this.style=l||{},this.maxFontSize=0;var c=n1e(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=y1e[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=dn(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Z0(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+=dl(Z0(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+=gk(i)+":"+this.style[i]+";");r&&(e=!0,n+=' style="'+dl(r)+'"');var s=dl(this.text);return e?(n+=">",n+=s,n+="</span>",n):s}}class hp{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+'="'+dl(this.attributes[n])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class Q0{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",iL[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+dl(this.alternate)+'"/>':'<path d="'+dl(iL[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+'="'+dl(this.attributes[n])+'"');return e+="/>",e}}function lL(t){if(t instanceof Xu)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function b1e(t){if(t instanceof fw)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var _1e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},S1e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},hs={math:{},text:{}};function Q(t,e,n,r,i,s){hs[t][i]={font:e,group:n,replace:r},s&&r&&(hs[t][r]=hs[t][i])}var ae="math",$t="text",we="main",Je="ams",Bs="accent-token",En="bin",Wl="close",Cy="inner",Qn="mathord",Wa="op-token",cu="open",IT="punct",tt="rel",yp="spacing",ht="textord";Q(ae,we,tt,"≡","\\equiv",!0);Q(ae,we,tt,"≺","\\prec",!0);Q(ae,we,tt,"≻","\\succ",!0);Q(ae,we,tt,"∼","\\sim",!0);Q(ae,we,tt,"⊥","\\perp");Q(ae,we,tt,"⪯","\\preceq",!0);Q(ae,we,tt,"⪰","\\succeq",!0);Q(ae,we,tt,"≃","\\simeq",!0);Q(ae,we,tt,"∣","\\mid",!0);Q(ae,we,tt,"≪","\\ll",!0);Q(ae,we,tt,"≫","\\gg",!0);Q(ae,we,tt,"≍","\\asymp",!0);Q(ae,we,tt,"∥","\\parallel");Q(ae,we,tt,"⋈","\\bowtie",!0);Q(ae,we,tt,"⌣","\\smile",!0);Q(ae,we,tt,"⊑","\\sqsubseteq",!0);Q(ae,we,tt,"⊒","\\sqsupseteq",!0);Q(ae,we,tt,"≐","\\doteq",!0);Q(ae,we,tt,"⌢","\\frown",!0);Q(ae,we,tt,"∋","\\ni",!0);Q(ae,we,tt,"∝","\\propto",!0);Q(ae,we,tt,"⊢","\\vdash",!0);Q(ae,we,tt,"⊣","\\dashv",!0);Q(ae,we,tt,"∋","\\owns");Q(ae,we,IT,".","\\ldotp");Q(ae,we,IT,"⋅","\\cdotp");Q(ae,we,ht,"#","\\#");Q($t,we,ht,"#","\\#");Q(ae,we,ht,"&","\\&");Q($t,we,ht,"&","\\&");Q(ae,we,ht,"ℵ","\\aleph",!0);Q(ae,we,ht,"∀","\\forall",!0);Q(ae,we,ht,"ℏ","\\hbar",!0);Q(ae,we,ht,"∃","\\exists",!0);Q(ae,we,ht,"∇","\\nabla",!0);Q(ae,we,ht,"♭","\\flat",!0);Q(ae,we,ht,"ℓ","\\ell",!0);Q(ae,we,ht,"♮","\\natural",!0);Q(ae,we,ht,"♣","\\clubsuit",!0);Q(ae,we,ht,"℘","\\wp",!0);Q(ae,we,ht,"♯","\\sharp",!0);Q(ae,we,ht,"♢","\\diamondsuit",!0);Q(ae,we,ht,"ℜ","\\Re",!0);Q(ae,we,ht,"♡","\\heartsuit",!0);Q(ae,we,ht,"ℑ","\\Im",!0);Q(ae,we,ht,"♠","\\spadesuit",!0);Q(ae,we,ht,"§","\\S",!0);Q($t,we,ht,"§","\\S");Q(ae,we,ht,"¶","\\P",!0);Q($t,we,ht,"¶","\\P");Q(ae,we,ht,"†","\\dag");Q($t,we,ht,"†","\\dag");Q($t,we,ht,"†","\\textdagger");Q(ae,we,ht,"‡","\\ddag");Q($t,we,ht,"‡","\\ddag");Q($t,we,ht,"‡","\\textdaggerdbl");Q(ae,we,Wl,"⎱","\\rmoustache",!0);Q(ae,we,cu,"⎰","\\lmoustache",!0);Q(ae,we,Wl,"⟯","\\rgroup",!0);Q(ae,we,cu,"⟮","\\lgroup",!0);Q(ae,we,En,"∓","\\mp",!0);Q(ae,we,En,"⊖","\\ominus",!0);Q(ae,we,En,"⊎","\\uplus",!0);Q(ae,we,En,"⊓","\\sqcap",!0);Q(ae,we,En,"∗","\\ast");Q(ae,we,En,"⊔","\\sqcup",!0);Q(ae,we,En,"◯","\\bigcirc",!0);Q(ae,we,En,"∙","\\bullet",!0);Q(ae,we,En,"‡","\\ddagger");Q(ae,we,En,"≀","\\wr",!0);Q(ae,we,En,"⨿","\\amalg");Q(ae,we,En,"&","\\And");Q(ae,we,tt,"⟵","\\longleftarrow",!0);Q(ae,we,tt,"⇐","\\Leftarrow",!0);Q(ae,we,tt,"⟸","\\Longleftarrow",!0);Q(ae,we,tt,"⟶","\\longrightarrow",!0);Q(ae,we,tt,"⇒","\\Rightarrow",!0);Q(ae,we,tt,"⟹","\\Longrightarrow",!0);Q(ae,we,tt,"↔","\\leftrightarrow",!0);Q(ae,we,tt,"⟷","\\longleftrightarrow",!0);Q(ae,we,tt,"⇔","\\Leftrightarrow",!0);Q(ae,we,tt,"⟺","\\Longleftrightarrow",!0);Q(ae,we,tt,"↦","\\mapsto",!0);Q(ae,we,tt,"⟼","\\longmapsto",!0);Q(ae,we,tt,"↗","\\nearrow",!0);Q(ae,we,tt,"↩","\\hookleftarrow",!0);Q(ae,we,tt,"↪","\\hookrightarrow",!0);Q(ae,we,tt,"↘","\\searrow",!0);Q(ae,we,tt,"↼","\\leftharpoonup",!0);Q(ae,we,tt,"⇀","\\rightharpoonup",!0);Q(ae,we,tt,"↙","\\swarrow",!0);Q(ae,we,tt,"↽","\\leftharpoondown",!0);Q(ae,we,tt,"⇁","\\rightharpoondown",!0);Q(ae,we,tt,"↖","\\nwarrow",!0);Q(ae,we,tt,"⇌","\\rightleftharpoons",!0);Q(ae,Je,tt,"≮","\\nless",!0);Q(ae,Je,tt,"","\\@nleqslant");Q(ae,Je,tt,"","\\@nleqq");Q(ae,Je,tt,"⪇","\\lneq",!0);Q(ae,Je,tt,"≨","\\lneqq",!0);Q(ae,Je,tt,"","\\@lvertneqq");Q(ae,Je,tt,"⋦","\\lnsim",!0);Q(ae,Je,tt,"⪉","\\lnapprox",!0);Q(ae,Je,tt,"⊀","\\nprec",!0);Q(ae,Je,tt,"⋠","\\npreceq",!0);Q(ae,Je,tt,"⋨","\\precnsim",!0);Q(ae,Je,tt,"⪹","\\precnapprox",!0);Q(ae,Je,tt,"≁","\\nsim",!0);Q(ae,Je,tt,"","\\@nshortmid");Q(ae,Je,tt,"∤","\\nmid",!0);Q(ae,Je,tt,"⊬","\\nvdash",!0);Q(ae,Je,tt,"⊭","\\nvDash",!0);Q(ae,Je,tt,"⋪","\\ntriangleleft");Q(ae,Je,tt,"⋬","\\ntrianglelefteq",!0);Q(ae,Je,tt,"⊊","\\subsetneq",!0);Q(ae,Je,tt,"","\\@varsubsetneq");Q(ae,Je,tt,"⫋","\\subsetneqq",!0);Q(ae,Je,tt,"","\\@varsubsetneqq");Q(ae,Je,tt,"≯","\\ngtr",!0);Q(ae,Je,tt,"","\\@ngeqslant");Q(ae,Je,tt,"","\\@ngeqq");Q(ae,Je,tt,"⪈","\\gneq",!0);Q(ae,Je,tt,"≩","\\gneqq",!0);Q(ae,Je,tt,"","\\@gvertneqq");Q(ae,Je,tt,"⋧","\\gnsim",!0);Q(ae,Je,tt,"⪊","\\gnapprox",!0);Q(ae,Je,tt,"⊁","\\nsucc",!0);Q(ae,Je,tt,"⋡","\\nsucceq",!0);Q(ae,Je,tt,"⋩","\\succnsim",!0);Q(ae,Je,tt,"⪺","\\succnapprox",!0);Q(ae,Je,tt,"≆","\\ncong",!0);Q(ae,Je,tt,"","\\@nshortparallel");Q(ae,Je,tt,"∦","\\nparallel",!0);Q(ae,Je,tt,"⊯","\\nVDash",!0);Q(ae,Je,tt,"⋫","\\ntriangleright");Q(ae,Je,tt,"⋭","\\ntrianglerighteq",!0);Q(ae,Je,tt,"","\\@nsupseteqq");Q(ae,Je,tt,"⊋","\\supsetneq",!0);Q(ae,Je,tt,"","\\@varsupsetneq");Q(ae,Je,tt,"⫌","\\supsetneqq",!0);Q(ae,Je,tt,"","\\@varsupsetneqq");Q(ae,Je,tt,"⊮","\\nVdash",!0);Q(ae,Je,tt,"⪵","\\precneqq",!0);Q(ae,Je,tt,"⪶","\\succneqq",!0);Q(ae,Je,tt,"","\\@nsubseteqq");Q(ae,Je,En,"⊴","\\unlhd");Q(ae,Je,En,"⊵","\\unrhd");Q(ae,Je,tt,"↚","\\nleftarrow",!0);Q(ae,Je,tt,"↛","\\nrightarrow",!0);Q(ae,Je,tt,"⇍","\\nLeftarrow",!0);Q(ae,Je,tt,"⇏","\\nRightarrow",!0);Q(ae,Je,tt,"↮","\\nleftrightarrow",!0);Q(ae,Je,tt,"⇎","\\nLeftrightarrow",!0);Q(ae,Je,tt,"△","\\vartriangle");Q(ae,Je,ht,"ℏ","\\hslash");Q(ae,Je,ht,"▽","\\triangledown");Q(ae,Je,ht,"◊","\\lozenge");Q(ae,Je,ht,"Ⓢ","\\circledS");Q(ae,Je,ht,"®","\\circledR");Q($t,Je,ht,"®","\\circledR");Q(ae,Je,ht,"∡","\\measuredangle",!0);Q(ae,Je,ht,"∄","\\nexists");Q(ae,Je,ht,"℧","\\mho");Q(ae,Je,ht,"Ⅎ","\\Finv",!0);Q(ae,Je,ht,"⅁","\\Game",!0);Q(ae,Je,ht,"‵","\\backprime");Q(ae,Je,ht,"▲","\\blacktriangle");Q(ae,Je,ht,"▼","\\blacktriangledown");Q(ae,Je,ht,"■","\\blacksquare");Q(ae,Je,ht,"⧫","\\blacklozenge");Q(ae,Je,ht,"★","\\bigstar");Q(ae,Je,ht,"∢","\\sphericalangle",!0);Q(ae,Je,ht,"∁","\\complement",!0);Q(ae,Je,ht,"ð","\\eth",!0);Q($t,we,ht,"ð","ð");Q(ae,Je,ht,"╱","\\diagup");Q(ae,Je,ht,"╲","\\diagdown");Q(ae,Je,ht,"□","\\square");Q(ae,Je,ht,"□","\\Box");Q(ae,Je,ht,"◊","\\Diamond");Q(ae,Je,ht,"¥","\\yen",!0);Q($t,Je,ht,"¥","\\yen",!0);Q(ae,Je,ht,"✓","\\checkmark",!0);Q($t,Je,ht,"✓","\\checkmark");Q(ae,Je,ht,"ℶ","\\beth",!0);Q(ae,Je,ht,"ℸ","\\daleth",!0);Q(ae,Je,ht,"ℷ","\\gimel",!0);Q(ae,Je,ht,"ϝ","\\digamma",!0);Q(ae,Je,ht,"ϰ","\\varkappa");Q(ae,Je,cu,"┌","\\@ulcorner",!0);Q(ae,Je,Wl,"┐","\\@urcorner",!0);Q(ae,Je,cu,"└","\\@llcorner",!0);Q(ae,Je,Wl,"┘","\\@lrcorner",!0);Q(ae,Je,tt,"≦","\\leqq",!0);Q(ae,Je,tt,"⩽","\\leqslant",!0);Q(ae,Je,tt,"⪕","\\eqslantless",!0);Q(ae,Je,tt,"≲","\\lesssim",!0);Q(ae,Je,tt,"⪅","\\lessapprox",!0);Q(ae,Je,tt,"≊","\\approxeq",!0);Q(ae,Je,En,"⋖","\\lessdot");Q(ae,Je,tt,"⋘","\\lll",!0);Q(ae,Je,tt,"≶","\\lessgtr",!0);Q(ae,Je,tt,"⋚","\\lesseqgtr",!0);Q(ae,Je,tt,"⪋","\\lesseqqgtr",!0);Q(ae,Je,tt,"≑","\\doteqdot");Q(ae,Je,tt,"≓","\\risingdotseq",!0);Q(ae,Je,tt,"≒","\\fallingdotseq",!0);Q(ae,Je,tt,"∽","\\backsim",!0);Q(ae,Je,tt,"⋍","\\backsimeq",!0);Q(ae,Je,tt,"⫅","\\subseteqq",!0);Q(ae,Je,tt,"⋐","\\Subset",!0);Q(ae,Je,tt,"⊏","\\sqsubset",!0);Q(ae,Je,tt,"≼","\\preccurlyeq",!0);Q(ae,Je,tt,"⋞","\\curlyeqprec",!0);Q(ae,Je,tt,"≾","\\precsim",!0);Q(ae,Je,tt,"⪷","\\precapprox",!0);Q(ae,Je,tt,"⊲","\\vartriangleleft");Q(ae,Je,tt,"⊴","\\trianglelefteq");Q(ae,Je,tt,"⊨","\\vDash",!0);Q(ae,Je,tt,"⊪","\\Vvdash",!0);Q(ae,Je,tt,"⌣","\\smallsmile");Q(ae,Je,tt,"⌢","\\smallfrown");Q(ae,Je,tt,"≏","\\bumpeq",!0);Q(ae,Je,tt,"≎","\\Bumpeq",!0);Q(ae,Je,tt,"≧","\\geqq",!0);Q(ae,Je,tt,"⩾","\\geqslant",!0);Q(ae,Je,tt,"⪖","\\eqslantgtr",!0);Q(ae,Je,tt,"≳","\\gtrsim",!0);Q(ae,Je,tt,"⪆","\\gtrapprox",!0);Q(ae,Je,En,"⋗","\\gtrdot");Q(ae,Je,tt,"⋙","\\ggg",!0);Q(ae,Je,tt,"≷","\\gtrless",!0);Q(ae,Je,tt,"⋛","\\gtreqless",!0);Q(ae,Je,tt,"⪌","\\gtreqqless",!0);Q(ae,Je,tt,"≖","\\eqcirc",!0);Q(ae,Je,tt,"≗","\\circeq",!0);Q(ae,Je,tt,"≜","\\triangleq",!0);Q(ae,Je,tt,"∼","\\thicksim");Q(ae,Je,tt,"≈","\\thickapprox");Q(ae,Je,tt,"⫆","\\supseteqq",!0);Q(ae,Je,tt,"⋑","\\Supset",!0);Q(ae,Je,tt,"⊐","\\sqsupset",!0);Q(ae,Je,tt,"≽","\\succcurlyeq",!0);Q(ae,Je,tt,"⋟","\\curlyeqsucc",!0);Q(ae,Je,tt,"≿","\\succsim",!0);Q(ae,Je,tt,"⪸","\\succapprox",!0);Q(ae,Je,tt,"⊳","\\vartriangleright");Q(ae,Je,tt,"⊵","\\trianglerighteq");Q(ae,Je,tt,"⊩","\\Vdash",!0);Q(ae,Je,tt,"∣","\\shortmid");Q(ae,Je,tt,"∥","\\shortparallel");Q(ae,Je,tt,"≬","\\between",!0);Q(ae,Je,tt,"⋔","\\pitchfork",!0);Q(ae,Je,tt,"∝","\\varpropto");Q(ae,Je,tt,"◀","\\blacktriangleleft");Q(ae,Je,tt,"∴","\\therefore",!0);Q(ae,Je,tt,"∍","\\backepsilon");Q(ae,Je,tt,"▶","\\blacktriangleright");Q(ae,Je,tt,"∵","\\because",!0);Q(ae,Je,tt,"⋘","\\llless");Q(ae,Je,tt,"⋙","\\gggtr");Q(ae,Je,En,"⊲","\\lhd");Q(ae,Je,En,"⊳","\\rhd");Q(ae,Je,tt,"≂","\\eqsim",!0);Q(ae,we,tt,"⋈","\\Join");Q(ae,Je,tt,"≑","\\Doteq",!0);Q(ae,Je,En,"∔","\\dotplus",!0);Q(ae,Je,En,"∖","\\smallsetminus");Q(ae,Je,En,"⋒","\\Cap",!0);Q(ae,Je,En,"⋓","\\Cup",!0);Q(ae,Je,En,"⩞","\\doublebarwedge",!0);Q(ae,Je,En,"⊟","\\boxminus",!0);Q(ae,Je,En,"⊞","\\boxplus",!0);Q(ae,Je,En,"⋇","\\divideontimes",!0);Q(ae,Je,En,"⋉","\\ltimes",!0);Q(ae,Je,En,"⋊","\\rtimes",!0);Q(ae,Je,En,"⋋","\\leftthreetimes",!0);Q(ae,Je,En,"⋌","\\rightthreetimes",!0);Q(ae,Je,En,"⋏","\\curlywedge",!0);Q(ae,Je,En,"⋎","\\curlyvee",!0);Q(ae,Je,En,"⊝","\\circleddash",!0);Q(ae,Je,En,"⊛","\\circledast",!0);Q(ae,Je,En,"⋅","\\centerdot");Q(ae,Je,En,"⊺","\\intercal",!0);Q(ae,Je,En,"⋒","\\doublecap");Q(ae,Je,En,"⋓","\\doublecup");Q(ae,Je,En,"⊠","\\boxtimes",!0);Q(ae,Je,tt,"⇢","\\dashrightarrow",!0);Q(ae,Je,tt,"⇠","\\dashleftarrow",!0);Q(ae,Je,tt,"⇇","\\leftleftarrows",!0);Q(ae,Je,tt,"⇆","\\leftrightarrows",!0);Q(ae,Je,tt,"⇚","\\Lleftarrow",!0);Q(ae,Je,tt,"↞","\\twoheadleftarrow",!0);Q(ae,Je,tt,"↢","\\leftarrowtail",!0);Q(ae,Je,tt,"↫","\\looparrowleft",!0);Q(ae,Je,tt,"⇋","\\leftrightharpoons",!0);Q(ae,Je,tt,"↶","\\curvearrowleft",!0);Q(ae,Je,tt,"↺","\\circlearrowleft",!0);Q(ae,Je,tt,"↰","\\Lsh",!0);Q(ae,Je,tt,"⇈","\\upuparrows",!0);Q(ae,Je,tt,"↿","\\upharpoonleft",!0);Q(ae,Je,tt,"⇃","\\downharpoonleft",!0);Q(ae,we,tt,"⊶","\\origof",!0);Q(ae,we,tt,"⊷","\\imageof",!0);Q(ae,Je,tt,"⊸","\\multimap",!0);Q(ae,Je,tt,"↭","\\leftrightsquigarrow",!0);Q(ae,Je,tt,"⇉","\\rightrightarrows",!0);Q(ae,Je,tt,"⇄","\\rightleftarrows",!0);Q(ae,Je,tt,"↠","\\twoheadrightarrow",!0);Q(ae,Je,tt,"↣","\\rightarrowtail",!0);Q(ae,Je,tt,"↬","\\looparrowright",!0);Q(ae,Je,tt,"↷","\\curvearrowright",!0);Q(ae,Je,tt,"↻","\\circlearrowright",!0);Q(ae,Je,tt,"↱","\\Rsh",!0);Q(ae,Je,tt,"⇊","\\downdownarrows",!0);Q(ae,Je,tt,"↾","\\upharpoonright",!0);Q(ae,Je,tt,"⇂","\\downharpoonright",!0);Q(ae,Je,tt,"⇝","\\rightsquigarrow",!0);Q(ae,Je,tt,"⇝","\\leadsto");Q(ae,Je,tt,"⇛","\\Rrightarrow",!0);Q(ae,Je,tt,"↾","\\restriction");Q(ae,we,ht,"‘","`");Q(ae,we,ht,"$","\\$");Q($t,we,ht,"$","\\$");Q($t,we,ht,"$","\\textdollar");Q(ae,we,ht,"%","\\%");Q($t,we,ht,"%","\\%");Q(ae,we,ht,"_","\\_");Q($t,we,ht,"_","\\_");Q($t,we,ht,"_","\\textunderscore");Q(ae,we,ht,"∠","\\angle",!0);Q(ae,we,ht,"∞","\\infty",!0);Q(ae,we,ht,"′","\\prime");Q(ae,we,ht,"△","\\triangle");Q(ae,we,ht,"Γ","\\Gamma",!0);Q(ae,we,ht,"Δ","\\Delta",!0);Q(ae,we,ht,"Θ","\\Theta",!0);Q(ae,we,ht,"Λ","\\Lambda",!0);Q(ae,we,ht,"Ξ","\\Xi",!0);Q(ae,we,ht,"Π","\\Pi",!0);Q(ae,we,ht,"Σ","\\Sigma",!0);Q(ae,we,ht,"Υ","\\Upsilon",!0);Q(ae,we,ht,"Φ","\\Phi",!0);Q(ae,we,ht,"Ψ","\\Psi",!0);Q(ae,we,ht,"Ω","\\Omega",!0);Q(ae,we,ht,"A","Α");Q(ae,we,ht,"B","Β");Q(ae,we,ht,"E","Ε");Q(ae,we,ht,"Z","Ζ");Q(ae,we,ht,"H","Η");Q(ae,we,ht,"I","Ι");Q(ae,we,ht,"K","Κ");Q(ae,we,ht,"M","Μ");Q(ae,we,ht,"N","Ν");Q(ae,we,ht,"O","Ο");Q(ae,we,ht,"P","Ρ");Q(ae,we,ht,"T","Τ");Q(ae,we,ht,"X","Χ");Q(ae,we,ht,"¬","\\neg",!0);Q(ae,we,ht,"¬","\\lnot");Q(ae,we,ht,"⊤","\\top");Q(ae,we,ht,"⊥","\\bot");Q(ae,we,ht,"∅","\\emptyset");Q(ae,Je,ht,"∅","\\varnothing");Q(ae,we,Qn,"α","\\alpha",!0);Q(ae,we,Qn,"β","\\beta",!0);Q(ae,we,Qn,"γ","\\gamma",!0);Q(ae,we,Qn,"δ","\\delta",!0);Q(ae,we,Qn,"ϵ","\\epsilon",!0);Q(ae,we,Qn,"ζ","\\zeta",!0);Q(ae,we,Qn,"η","\\eta",!0);Q(ae,we,Qn,"θ","\\theta",!0);Q(ae,we,Qn,"ι","\\iota",!0);Q(ae,we,Qn,"κ","\\kappa",!0);Q(ae,we,Qn,"λ","\\lambda",!0);Q(ae,we,Qn,"μ","\\mu",!0);Q(ae,we,Qn,"ν","\\nu",!0);Q(ae,we,Qn,"ξ","\\xi",!0);Q(ae,we,Qn,"ο","\\omicron",!0);Q(ae,we,Qn,"π","\\pi",!0);Q(ae,we,Qn,"ρ","\\rho",!0);Q(ae,we,Qn,"σ","\\sigma",!0);Q(ae,we,Qn,"τ","\\tau",!0);Q(ae,we,Qn,"υ","\\upsilon",!0);Q(ae,we,Qn,"ϕ","\\phi",!0);Q(ae,we,Qn,"χ","\\chi",!0);Q(ae,we,Qn,"ψ","\\psi",!0);Q(ae,we,Qn,"ω","\\omega",!0);Q(ae,we,Qn,"ε","\\varepsilon",!0);Q(ae,we,Qn,"ϑ","\\vartheta",!0);Q(ae,we,Qn,"ϖ","\\varpi",!0);Q(ae,we,Qn,"ϱ","\\varrho",!0);Q(ae,we,Qn,"ς","\\varsigma",!0);Q(ae,we,Qn,"φ","\\varphi",!0);Q(ae,we,En,"∗","*",!0);Q(ae,we,En,"+","+");Q(ae,we,En,"−","-",!0);Q(ae,we,En,"⋅","\\cdot",!0);Q(ae,we,En,"∘","\\circ",!0);Q(ae,we,En,"÷","\\div",!0);Q(ae,we,En,"±","\\pm",!0);Q(ae,we,En,"×","\\times",!0);Q(ae,we,En,"∩","\\cap",!0);Q(ae,we,En,"∪","\\cup",!0);Q(ae,we,En,"∖","\\setminus",!0);Q(ae,we,En,"∧","\\land");Q(ae,we,En,"∨","\\lor");Q(ae,we,En,"∧","\\wedge",!0);Q(ae,we,En,"∨","\\vee",!0);Q(ae,we,ht,"√","\\surd");Q(ae,we,cu,"⟨","\\langle",!0);Q(ae,we,cu,"∣","\\lvert");Q(ae,we,cu,"∥","\\lVert");Q(ae,we,Wl,"?","?");Q(ae,we,Wl,"!","!");Q(ae,we,Wl,"⟩","\\rangle",!0);Q(ae,we,Wl,"∣","\\rvert");Q(ae,we,Wl,"∥","\\rVert");Q(ae,we,tt,"=","=");Q(ae,we,tt,":",":");Q(ae,we,tt,"≈","\\approx",!0);Q(ae,we,tt,"≅","\\cong",!0);Q(ae,we,tt,"≥","\\ge");Q(ae,we,tt,"≥","\\geq",!0);Q(ae,we,tt,"←","\\gets");Q(ae,we,tt,">","\\gt",!0);Q(ae,we,tt,"∈","\\in",!0);Q(ae,we,tt,"","\\@not");Q(ae,we,tt,"⊂","\\subset",!0);Q(ae,we,tt,"⊃","\\supset",!0);Q(ae,we,tt,"⊆","\\subseteq",!0);Q(ae,we,tt,"⊇","\\supseteq",!0);Q(ae,Je,tt,"⊈","\\nsubseteq",!0);Q(ae,Je,tt,"⊉","\\nsupseteq",!0);Q(ae,we,tt,"⊨","\\models");Q(ae,we,tt,"←","\\leftarrow",!0);Q(ae,we,tt,"≤","\\le");Q(ae,we,tt,"≤","\\leq",!0);Q(ae,we,tt,"<","\\lt",!0);Q(ae,we,tt,"→","\\rightarrow",!0);Q(ae,we,tt,"→","\\to");Q(ae,Je,tt,"≱","\\ngeq",!0);Q(ae,Je,tt,"≰","\\nleq",!0);Q(ae,we,yp," ","\\ ");Q(ae,we,yp," ","\\space");Q(ae,we,yp," ","\\nobreakspace");Q($t,we,yp," ","\\ ");Q($t,we,yp," "," ");Q($t,we,yp," ","\\space");Q($t,we,yp," ","\\nobreakspace");Q(ae,we,yp,null,"\\nobreak");Q(ae,we,yp,null,"\\allowbreak");Q(ae,we,IT,",",",");Q(ae,we,IT,";",";");Q(ae,Je,En,"⊼","\\barwedge",!0);Q(ae,Je,En,"⊻","\\veebar",!0);Q(ae,we,En,"⊙","\\odot",!0);Q(ae,we,En,"⊕","\\oplus",!0);Q(ae,we,En,"⊗","\\otimes",!0);Q(ae,we,ht,"∂","\\partial",!0);Q(ae,we,En,"⊘","\\oslash",!0);Q(ae,Je,En,"⊚","\\circledcirc",!0);Q(ae,Je,En,"⊡","\\boxdot",!0);Q(ae,we,En,"△","\\bigtriangleup");Q(ae,we,En,"▽","\\bigtriangledown");Q(ae,we,En,"†","\\dagger");Q(ae,we,En,"⋄","\\diamond");Q(ae,we,En,"⋆","\\star");Q(ae,we,En,"◃","\\triangleleft");Q(ae,we,En,"▹","\\triangleright");Q(ae,we,cu,"{","\\{");Q($t,we,ht,"{","\\{");Q($t,we,ht,"{","\\textbraceleft");Q(ae,we,Wl,"}","\\}");Q($t,we,ht,"}","\\}");Q($t,we,ht,"}","\\textbraceright");Q(ae,we,cu,"{","\\lbrace");Q(ae,we,Wl,"}","\\rbrace");Q(ae,we,cu,"[","\\lbrack",!0);Q($t,we,ht,"[","\\lbrack",!0);Q(ae,we,Wl,"]","\\rbrack",!0);Q($t,we,ht,"]","\\rbrack",!0);Q(ae,we,cu,"(","\\lparen",!0);Q(ae,we,Wl,")","\\rparen",!0);Q($t,we,ht,"<","\\textless",!0);Q($t,we,ht,">","\\textgreater",!0);Q(ae,we,cu,"⌊","\\lfloor",!0);Q(ae,we,Wl,"⌋","\\rfloor",!0);Q(ae,we,cu,"⌈","\\lceil",!0);Q(ae,we,Wl,"⌉","\\rceil",!0);Q(ae,we,ht,"\\","\\backslash");Q(ae,we,ht,"∣","|");Q(ae,we,ht,"∣","\\vert");Q($t,we,ht,"|","\\textbar",!0);Q(ae,we,ht,"∥","\\|");Q(ae,we,ht,"∥","\\Vert");Q($t,we,ht,"∥","\\textbardbl");Q($t,we,ht,"~","\\textasciitilde");Q($t,we,ht,"\\","\\textbackslash");Q($t,we,ht,"^","\\textasciicircum");Q(ae,we,tt,"↑","\\uparrow",!0);Q(ae,we,tt,"⇑","\\Uparrow",!0);Q(ae,we,tt,"↓","\\downarrow",!0);Q(ae,we,tt,"⇓","\\Downarrow",!0);Q(ae,we,tt,"↕","\\updownarrow",!0);Q(ae,we,tt,"⇕","\\Updownarrow",!0);Q(ae,we,Wa,"∐","\\coprod");Q(ae,we,Wa,"⋁","\\bigvee");Q(ae,we,Wa,"⋀","\\bigwedge");Q(ae,we,Wa,"⨄","\\biguplus");Q(ae,we,Wa,"⋂","\\bigcap");Q(ae,we,Wa,"⋃","\\bigcup");Q(ae,we,Wa,"∫","\\int");Q(ae,we,Wa,"∫","\\intop");Q(ae,we,Wa,"∬","\\iint");Q(ae,we,Wa,"∭","\\iiint");Q(ae,we,Wa,"∏","\\prod");Q(ae,we,Wa,"∑","\\sum");Q(ae,we,Wa,"⨂","\\bigotimes");Q(ae,we,Wa,"⨁","\\bigoplus");Q(ae,we,Wa,"⨀","\\bigodot");Q(ae,we,Wa,"∮","\\oint");Q(ae,we,Wa,"∯","\\oiint");Q(ae,we,Wa,"∰","\\oiiint");Q(ae,we,Wa,"⨆","\\bigsqcup");Q(ae,we,Wa,"∫","\\smallint");Q($t,we,Cy,"…","\\textellipsis");Q(ae,we,Cy,"…","\\mathellipsis");Q($t,we,Cy,"…","\\ldots",!0);Q(ae,we,Cy,"…","\\ldots",!0);Q(ae,we,Cy,"⋯","\\@cdots",!0);Q(ae,we,Cy,"⋱","\\ddots",!0);Q(ae,we,ht,"⋮","\\varvdots");Q($t,we,ht,"⋮","\\varvdots");Q(ae,we,Bs,"ˊ","\\acute");Q(ae,we,Bs,"ˋ","\\grave");Q(ae,we,Bs,"¨","\\ddot");Q(ae,we,Bs,"~","\\tilde");Q(ae,we,Bs,"ˉ","\\bar");Q(ae,we,Bs,"˘","\\breve");Q(ae,we,Bs,"ˇ","\\check");Q(ae,we,Bs,"^","\\hat");Q(ae,we,Bs,"⃗","\\vec");Q(ae,we,Bs,"˙","\\dot");Q(ae,we,Bs,"˚","\\mathring");Q(ae,we,Qn,"","\\@imath");Q(ae,we,Qn,"","\\@jmath");Q(ae,we,ht,"ı","ı");Q(ae,we,ht,"ȷ","ȷ");Q($t,we,ht,"ı","\\i",!0);Q($t,we,ht,"ȷ","\\j",!0);Q($t,we,ht,"ß","\\ss",!0);Q($t,we,ht,"æ","\\ae",!0);Q($t,we,ht,"œ","\\oe",!0);Q($t,we,ht,"ø","\\o",!0);Q($t,we,ht,"Æ","\\AE",!0);Q($t,we,ht,"Œ","\\OE",!0);Q($t,we,ht,"Ø","\\O",!0);Q($t,we,Bs,"ˊ","\\'");Q($t,we,Bs,"ˋ","\\`");Q($t,we,Bs,"ˆ","\\^");Q($t,we,Bs,"˜","\\~");Q($t,we,Bs,"ˉ","\\=");Q($t,we,Bs,"˘","\\u");Q($t,we,Bs,"˙","\\.");Q($t,we,Bs,"¸","\\c");Q($t,we,Bs,"˚","\\r");Q($t,we,Bs,"ˇ","\\v");Q($t,we,Bs,"¨",'\\"');Q($t,we,Bs,"˝","\\H");Q($t,we,Bs,"◯","\\textcircled");var sq={"--":!0,"---":!0,"``":!0,"''":!0};Q($t,we,ht,"–","--",!0);Q($t,we,ht,"–","\\textendash");Q($t,we,ht,"—","---",!0);Q($t,we,ht,"—","\\textemdash");Q($t,we,ht,"‘","`",!0);Q($t,we,ht,"‘","\\textquoteleft");Q($t,we,ht,"’","'",!0);Q($t,we,ht,"’","\\textquoteright");Q($t,we,ht,"“","``",!0);Q($t,we,ht,"“","\\textquotedblleft");Q($t,we,ht,"”","''",!0);Q($t,we,ht,"”","\\textquotedblright");Q(ae,we,ht,"°","\\degree",!0);Q($t,we,ht,"°","\\degree");Q($t,we,ht,"°","\\textdegree",!0);Q(ae,we,ht,"£","\\pounds");Q(ae,we,ht,"£","\\mathsterling",!0);Q($t,we,ht,"£","\\pounds");Q($t,we,ht,"£","\\textsterling",!0);Q(ae,Je,ht,"✠","\\maltese");Q($t,Je,ht,"✠","\\maltese");var cL='0123456789/@."';for(var vA=0;vA<cL.length;vA++){var uL=cL.charAt(vA);Q(ae,we,ht,uL,uL)}var dL='0123456789!@*()-=+";:?/.,';for(var xA=0;xA<dL.length;xA++){var fL=dL.charAt(xA);Q($t,we,ht,fL,fL)}var T2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var yA=0;yA<T2.length;yA++){var g4=T2.charAt(yA);Q(ae,we,Qn,g4,g4),Q($t,we,ht,g4,g4)}Q(ae,Je,ht,"C","ℂ");Q($t,Je,ht,"C","ℂ");Q(ae,Je,ht,"H","ℍ");Q($t,Je,ht,"H","ℍ");Q(ae,Je,ht,"N","ℕ");Q($t,Je,ht,"N","ℕ");Q(ae,Je,ht,"P","ℙ");Q($t,Je,ht,"P","ℙ");Q(ae,Je,ht,"Q","ℚ");Q($t,Je,ht,"Q","ℚ");Q(ae,Je,ht,"R","ℝ");Q($t,Je,ht,"R","ℝ");Q(ae,Je,ht,"Z","ℤ");Q($t,Je,ht,"Z","ℤ");Q(ae,we,Qn,"h","ℎ");Q($t,we,Qn,"h","ℎ");var lr="";for(var kl=0;kl<T2.length;kl++){var da=T2.charAt(kl);lr=String.fromCharCode(55349,56320+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56372+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56424+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56580+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56684+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56736+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56788+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56840+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56944+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),kl<26&&(lr=String.fromCharCode(55349,56632+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr),lr=String.fromCharCode(55349,56476+kl),Q(ae,we,Qn,da,lr),Q($t,we,ht,da,lr))}lr="𝕜";Q(ae,we,Qn,"k",lr);Q($t,we,ht,"k",lr);for(var ig=0;ig<10;ig++){var f0=ig.toString();lr=String.fromCharCode(55349,57294+ig),Q(ae,we,Qn,f0,lr),Q($t,we,ht,f0,lr),lr=String.fromCharCode(55349,57314+ig),Q(ae,we,Qn,f0,lr),Q($t,we,ht,f0,lr),lr=String.fromCharCode(55349,57324+ig),Q(ae,we,Qn,f0,lr),Q($t,we,ht,f0,lr),lr=String.fromCharCode(55349,57334+ig),Q(ae,we,Qn,f0,lr),Q($t,we,ht,f0,lr)}var wR="ÐÞþ";for(var bA=0;bA<wR.length;bA++){var v4=wR.charAt(bA);Q(ae,we,Qn,v4,v4),Q($t,we,ht,v4,v4)}var x4=[["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"]],hL=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],w1e=function(e,n){var r=e.charCodeAt(0),i=e.charCodeAt(1),s=(r-55296)*1024+(i-56320)+65536,a=n==="math"?0:1;if(119808<=s&&s<120484){var o=Math.floor((s-119808)/26);return[x4[o][2],x4[o][a]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[hL[l][2],hL[l][a]]}else{if(s===120485||s===120486)return[x4[0][2],x4[0][a]];if(120486<s&&s<120782)return["",""];throw new Qt("Unsupported character: "+e)}},OT=function(e,n,r){return hs[r][e]&&hs[r][e].replace&&(e=hs[r][e].replace),{value:e,metrics:yk(e,n,r)}},Ll=function(e,n,r,i,s){var a=OT(e,n,r),o=a.metrics;e=a.value;var l;if(o){var c=o.italic;(r==="text"||i&&i.font==="mathit")&&(c=0),l=new Xu(e,o.height,o.depth,c,o.skew,o.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+n+"' and mode '"+r+"'")),l=new Xu(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var d=i.getColor();d&&(l.style.color=d)}return l},_k=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&OT(e,"Main-Bold",n).metrics?Ll(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||hs[n][e].font==="main"?Ll(e,"Main-Regular",n,r,i):Ll(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},M1e=function(e,n,r,i,s){return s!=="textord"&&OT(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},LT=function(e,n,r){var i=e.mode,s=e.text,a=["mord"],o=i==="math"||i==="text"&&n.font,l=o?n.font:n.fontFamily,c="",d="";if(s.charCodeAt(0)===55349&&([c,d]=w1e(s,i)),c.length>0)return Ll(s,c,i,n,a.concat(d));if(l){var h,g;if(l==="boldsymbol"){var v=M1e(s,i,n,a,r);h=v.fontName,g=[v.fontClass]}else o?(h=MR[l].fontName,g=[l]):(h=y4(l,n.fontWeight,n.fontShape),g=[l,n.fontWeight,n.fontShape]);if(OT(s,h,i).metrics)return Ll(s,h,i,n,a.concat(g));if(sq.hasOwnProperty(s)&&h.slice(0,10)==="Typewriter"){for(var b=[],_=0;_<s.length;_++)b.push(Ll(s[_],h,i,n,a.concat(g)));return bp(b)}}if(r==="mathord")return Ll(s,"Math-Italic",i,n,a.concat(["mathnormal"]));if(r==="textord"){var w=hs[i][s]&&hs[i][s].font;if(w==="ams"){var S=y4("amsrm",n.fontWeight,n.fontShape);return Ll(s,S,i,n,a.concat("amsrm",n.fontWeight,n.fontShape))}else if(w==="main"||!w){var E=y4("textrm",n.fontWeight,n.fontShape);return Ll(s,E,i,n,a.concat(n.fontWeight,n.fontShape))}else{var A=y4(w,n.fontWeight,n.fontShape);return Ll(s,A,i,n,a.concat(A,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},T1e=(t,e)=>{if(Z0(t.classes)!==Z0(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},aq=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof Xu&&r instanceof Xu&&T1e(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},Sk=function(e){for(var n=0,r=0,i=0,s=0;s<e.children.length;s++){var a=e.children[s];a.height>n&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>i&&(i=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=i},Xt=function(e,n,r,i){var s=new fw(e,n,r,i);return Sk(s),s},J0=(t,e,n,r)=>new fw(t,e,n,r),Q1=function(e,n,r){var i=Xt([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=dn(i.height),i.maxFontSize=1,i},E1e=function(e,n,r,i){var s=new bk(e,n,r,i);return Sk(s),s},bp=function(e){var n=new dw(e);return Sk(n),n},J1=function(e,n){return e instanceof dw?Xt([],[e],n):e},C1e=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],i=-n[0].shift-n[0].elem.depth,s=i,a=1;a<n.length;a++){var o=-n[a].shift-s-n[a].elem.depth,l=o-(n[a-1].elem.height+n[a-1].elem.depth);s=s+o,r.push({type:"kern",size:l}),r.push(n[a])}return{children:r,depth:i}}var c;if(e.positionType==="top"){for(var d=e.positionData,h=0;h<e.children.length;h++){var g=e.children[h];d-=g.type==="kern"?g.size:g.elem.height+g.elem.depth}c=d}else if(e.positionType==="bottom")c=-e.positionData;else{var v=e.children[0];if(v.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-v.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-v.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Mi=function(e,n){for(var{children:r,depth:i}=C1e(e),s=0,a=0;a<r.length;a++){var o=r[a];if(o.type==="elem"){var l=o.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var c=Xt(["pstrut"],[]);c.style.height=dn(s);for(var d=[],h=i,g=i,v=i,b=0;b<r.length;b++){var _=r[b];if(_.type==="kern")v+=_.size;else{var w=_.elem,S=_.wrapperClasses||[],E=_.wrapperStyle||{},A=Xt(S,[c,w],void 0,E);A.style.top=dn(-s-v-w.depth),_.marginLeft&&(A.style.marginLeft=_.marginLeft),_.marginRight&&(A.style.marginRight=_.marginRight),d.push(A),v+=w.height+w.depth}h=Math.min(h,v),g=Math.max(g,v)}var N=Xt(["vlist"],d);N.style.height=dn(g);var I;if(h<0){var P=Xt([],[]),L=Xt(["vlist"],[P]);L.style.height=dn(-h);var R=Xt(["vlist-s"],[new Xu("​")]);I=[Xt(["vlist-r"],[N,R]),Xt(["vlist-r"],[L])]}else I=[Xt(["vlist-r"],[N])];var O=Xt(["vlist-t"],I);return I.length===2&&O.classes.push("vlist-t2"),O.height=g,O.depth=-h,O},oq=(t,e)=>{var n=Xt(["mspace"],[],e),r=Js(t,e);return n.style.marginRight=dn(r),n},y4=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},MR={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"}},lq={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},cq=function(e,n){var[r,i,s]=lq[e],a=new Q0(r),o=new hp([a],{width:dn(i),height:dn(s),style:"width:"+dn(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=J0(["overlay"],[o],n);return l.height=s,l.style.height=dn(s),l.style.width=dn(i),l},Zs={number:3,unit:"mu"},sg={number:4,unit:"mu"},Vh={number:5,unit:"mu"},A1e={mord:{mop:Zs,mbin:sg,mrel:Vh,minner:Zs},mop:{mord:Zs,mop:Zs,mrel:Vh,minner:Zs},mbin:{mord:sg,mop:sg,mopen:sg,minner:sg},mrel:{mord:Vh,mop:Vh,mopen:Vh,minner:Vh},mopen:{},mclose:{mop:Zs,mbin:sg,mrel:Vh,minner:Zs},mpunct:{mord:Zs,mop:Zs,mrel:Vh,mopen:Zs,mclose:Zs,mpunct:Zs,minner:Zs},minner:{mord:Zs,mop:Zs,mbin:sg,mrel:Vh,mopen:Zs,mpunct:Zs,minner:Zs}},N1e={mord:{mop:Zs},mop:{mord:Zs,mop:Zs},mbin:{},mrel:{},mopen:{},mclose:{mop:Zs},mpunct:{},minner:{mop:Zs}},uq={},E2={},C2={};function bn(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:a}=t,o={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)uq[n[l]]=o;e&&(s&&(E2[e]=s),a&&(C2[e]=a))}function Sv(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;bn({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var A2=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Ta=function(e){return e.type==="ordgroup"?e.body:[e]},R1e=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),k1e=new Set(["rightmost","mrel","mclose","mpunct"]),P1e={display:hr.DISPLAY,text:hr.TEXT,script:hr.SCRIPT,scriptscript:hr.SCRIPTSCRIPT},D1e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},so=function(e,n,r,i){i===void 0&&(i=[null,null]);for(var s=[],a=0;a<e.length;a++){var o=xi(e[a],n);if(o instanceof dw){var l=o.children;s.push(...l)}else s.push(o)}if(aq(s),!r)return s;var c=n;if(e.length===1){var d=e[0];d.type==="sizing"?c=n.havingSize(d.size):d.type==="styling"&&(c=n.havingStyle(P1e[d.style]))}var h=Xt([i[0]||"leftmost"],[],n),g=Xt([i[1]||"rightmost"],[],n),v=r==="root";return pL(s,(b,_)=>{var w=_.classes[0],S=b.classes[0];w==="mbin"&&k1e.has(S)?_.classes[0]="mord":S==="mbin"&&R1e.has(w)&&(b.classes[0]="mord")},{node:h},g,v),pL(s,(b,_)=>{var w=TR(_),S=TR(b),E=w&&S?b.hasClass("mtight")?N1e[w][S]:A1e[w][S]:null;if(E)return oq(E,c)},{node:h},g,v),s},pL=function t(e,n,r,i,s){i&&e.push(i);for(var a=0;a<e.length;a++){var o=e[a],l=dq(o);if(l){t(l.children,n,r,null,s);continue}var c=!o.hasClass("mspace");if(c){var d=n(o,r.node);d&&(r.insertAfter?r.insertAfter(d):(e.unshift(d),a++))}c?r.node=o:s&&o.hasClass("newline")&&(r.node=Xt(["leftmost"])),r.insertAfter=(h=>g=>{e.splice(h+1,0,g),a++})(a)}i&&e.pop()},dq=function(e){return e instanceof dw||e instanceof bk||e instanceof fw&&e.hasClass("enclosing")?e:null},I1e=function t(e,n){var r=dq(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},TR=function(e,n){return e?(n&&(e=I1e(e,n)),D1e[e.classes[0]]||null):null},pS=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Xt(n.concat(r))},xi=function(e,n,r){if(!e)return Xt();if(E2[e.type]){var i=E2[e.type](e,n);if(r&&n.size!==r.size){i=Xt(n.sizingClasses(r),[i],n);var s=n.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new Qt("Got group of unknown type: '"+e.type+"'")};function b4(t,e){var n=Xt(["base"],t,e),r=Xt(["strut"]);return r.style.height=dn(n.height+n.depth),n.depth&&(r.style.verticalAlign=dn(-n.depth)),n.children.unshift(r),n}function ER(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=so(t,e,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var s=[],a=[],o=0;o<r.length;o++)if(a.push(r[o]),r[o].hasClass("mbin")||r[o].hasClass("mrel")||r[o].hasClass("allowbreak")){for(var l=!1;o<r.length-1&&r[o+1].hasClass("mspace")&&!r[o+1].hasClass("newline");)o++,a.push(r[o]),r[o].hasClass("nobreak")&&(l=!0);l||(s.push(b4(a,e)),a=[])}else r[o].hasClass("newline")&&(a.pop(),a.length>0&&(s.push(b4(a,e)),a=[]),s.push(r[o]));a.length>0&&s.push(b4(a,e));var c;n?(c=b4(so(n,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var d=Xt(["katex-html"],s);if(d.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=dn(d.height+d.depth),d.depth&&(h.style.verticalAlign=dn(-d.depth))}return d}function fq(t){return new dw(t)}class Jt{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=Z0(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Va&&this.children[r+1]instanceof Va){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Va;)i+=this.children[++r].toText();e.appendChild(new Va(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+=dl(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+dl(Z0(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 Va{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return dl(this.toText())}toText(){return this.text}}class hq{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",dn(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+dn(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var O1e=new Set(["\\imath","\\jmath"]),L1e=new Set(["mrow","mtable"]),Yu=function(e,n,r){return hs[n][e]&&hs[n][e].replace&&e.charCodeAt(0)!==55349&&!(sq.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=hs[n][e].replace),new Va(e)},wk=function(e){return e.length===1?e[0]:new Jt("mrow",e)},Mk=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(O1e.has(s))return null;hs[i][s]&&hs[i][s].replace&&(s=hs[i][s].replace);var a=MR[r].fontName;return yk(s,a,i)?MR[r].variant:null};function _A(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Va&&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 Va&&n.text===","}else return!1}var Nc=function(e,n,r){if(e.length===1){var i=is(e[0],n);return r&&i instanceof Jt&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],a,o=0;o<e.length;o++){var l=is(e[o],n);if(l instanceof Jt&&a instanceof Jt){if(l.type==="mtext"&&a.type==="mtext"&&l.getAttribute("mathvariant")===a.getAttribute("mathvariant")){a.children.push(...l.children);continue}else if(l.type==="mn"&&a.type==="mn"){a.children.push(...l.children);continue}else if(_A(l)&&a.type==="mn"){a.children.push(...l.children);continue}else if(l.type==="mn"&&_A(a))l.children=[...a.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(a.type==="mn"||_A(a))){var c=l.children[0];c instanceof Jt&&c.type==="mn"&&(c.children=[...a.children,...c.children],s.pop())}else if(a.type==="mi"&&a.children.length===1){var d=a.children[0];if(d instanceof Va&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof Va&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),s.pop())}}}s.push(l),a=l}return s},em=function(e,n,r){return wk(Nc(e,n,r))},is=function(e,n){if(!e)return new Jt("mrow");if(C2[e.type]){var r=C2[e.type](e,n);return r}else throw new Qt("Got group of unknown type: '"+e.type+"'")};function mL(t,e,n,r,i){var s=Nc(t,n),a;s.length===1&&s[0]instanceof Jt&&L1e.has(s[0].type)?a=s[0]:a=new Jt("mrow",s);var o=new Jt("annotation",[new Va(e)]);o.setAttribute("encoding","application/x-tex");var l=new Jt("semantics",[a,o]),c=new Jt("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var d=i?"katex":"katex-mathml";return Xt([d],[c])}var pq=function(e){return new Qh({style:e.displayMode?hr.DISPLAY:hr.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},mq=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=Xt(r,[e])}return e},z1e=function(e,n,r){var i=pq(r),s;if(r.output==="mathml")return mL(e,n,i,r.displayMode,!0);if(r.output==="html"){var a=ER(e,i);s=Xt(["katex"],[a])}else{var o=mL(e,n,i,r.displayMode,!1),l=ER(e,i);s=Xt(["katex"],[o,l])}return mq(s,r)},j1e=function(e,n,r){var i=pq(r),s=ER(e,i),a=Xt(["katex"],[s]);return mq(a,r)},F1e={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":"="},zT=function(e){var n=new Jt("mo",[new Va(F1e[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},U1e={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]},B1e=new Set(["widehat","widecheck","widetilde","utilde"]),jT=function(e,n){function r(){var o=4e5,l=e.label.slice(1);if(B1e.has(l)){var c=e,d=c.base.type==="ordgroup"?c.base.body.length:1,h,g,v;if(d>5)l==="widehat"||l==="widecheck"?(h=420,o=2364,v=.42,g=l+"4"):(h=312,o=2340,v=.34,g="tilde4");else{var b=[1,1,2,2,3,3][d];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][b],h=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],g=l+b):(o=[0,600,1033,2339,2340][b],h=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],g="tilde"+b)}var _=new Q0(g),w=new hp([_],{width:"100%",height:dn(v),viewBox:"0 0 "+o+" "+h,preserveAspectRatio:"none"});return{span:J0([],[w],n),minWidth:0,height:v}}else{var S=[],E=U1e[l],[A,N,I]=E,P=I/1e3,L=A.length,R,O;if(L===1){var W=E[3];R=["hide-tail"],O=[W]}else if(L===2)R=["halfarrow-left","halfarrow-right"],O=["xMinYMin","xMaxYMin"];else if(L===3)R=["brace-left","brace-center","brace-right"],O=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+L+" children.");for(var U=0;U<L;U++){var V=new Q0(A[U]),G=new hp([V],{width:"400em",height:dn(P),viewBox:"0 0 "+o+" "+I,preserveAspectRatio:O[U]+" slice"}),Z=J0([R[U]],[G],n);if(L===1)return{span:Z,minWidth:N,height:P};Z.style.height=dn(P),S.push(Z)}return{span:Xt(["stretchy"],S,n),minWidth:N,height:P}}}var{span:i,minWidth:s,height:a}=r();return i.height=a,i.style.height=dn(a),s>0&&(i.style.minWidth=dn(s)),i},H1e=function(e,n,r,i,s){var a,o=e.height+e.depth+r+i;if(/fbox|color|angl/.test(n)){if(a=Xt(["stretchy",n],[],s),n==="fbox"){var l=s.color&&s.getColor();l&&(a.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 d=new hp(c,{width:"100%",height:dn(o)});a=J0([],[d],s)}return a.height=o,a.style.height=dn(o),a};function Pr(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 Tk(t){var e=FT(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 FT(t){return t&&(t.type==="atom"||S1e.hasOwnProperty(t.type))?t:null}var Ek=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=Pr(t.base,"accent"),n=r.base,t.base=n,i=b1e(xi(t,e)),t.base=r):(r=Pr(t,"accent"),n=r.base);var s=xi(n,e.havingCrampedStyle()),a=r.isShifty&&xp(n),o=0;if(a){var l=k_(n),c=xi(l,e.havingCrampedStyle());o=lL(c).skew}var d=r.label==="\\c",h=d?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=jT(r,e),g=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+dn(2*o)+")",marginLeft:dn(2*o)}:void 0}]});else{var v,b;r.label==="\\vec"?(v=cq("vec",e),b=lq.vec[1]):(v=LT({mode:r.mode,text:r.label},e,"textord"),v=lL(v),v.italic=0,b=v.width,d&&(h+=v.depth)),g=Xt(["accent-body"],[v]);var _=r.label==="\\textcircled";_&&(g.classes.push("accent-full"),h=s.height);var w=o;_||(w-=b/2),g.style.left=dn(w),r.label==="\\textcircled"&&(g.style.top=".2em"),g=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-h},{type:"elem",elem:g}]})}var S=Xt(["mord","accent"],[g],e);return i?(i.children[0]=S,i.height=Math.max(S.height,i.height),i.classes[0]="mord",i):S},gq=(t,e)=>{var n=t.isStretchy?zT(t.label):new Jt("mo",[Yu(t.label,t.mode)]),r=new Jt("mover",[is(t.base,e),n]);return r.setAttribute("accent","true"),r},V1e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));bn({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=A2(e[0]),r=!V1e.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:Ek,mathmlBuilder:gq});bn({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:Ek,mathmlBuilder:gq});bn({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=xi(t.base,e),r=jT(t,e),i=t.label==="\\utilde"?.12:0,s=Mi({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]});return Xt(["mord","accentunder"],[s],e)},mathmlBuilder:(t,e)=>{var n=zT(t.label),r=new Jt("munder",[is(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var _4=t=>{var e=new Jt("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};bn({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=J1(xi(t.body,r,e),e),s=t.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=J1(xi(t.below,r,e),e),a.classes.push(s+"-arrow-pad"));var o=jT(t,e),l=-e.fontMetrics().axisHeight+.5*o.height,c=-e.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||t.label==="\\xleftequilibrium")&&(c-=i.depth);var d;if(a){var h=-e.fontMetrics().axisHeight+a.height+.5*o.height+.111;d=Mi({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:o,shift:l},{type:"elem",elem:a,shift:h}]})}else d=Mi({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:o,shift:l}]});return d.children[0].children[0].children[1].classes.push("svg-align"),Xt(["mrel","x-arrow"],[d],e)},mathmlBuilder(t,e){var n=zT(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var i=_4(is(t.body,e));if(t.below){var s=_4(is(t.below,e));r=new Jt("munderover",[n,s,i])}else r=new Jt("mover",[n,i])}else if(t.below){var a=_4(is(t.below,e));r=new Jt("munder",[n,a])}else r=_4(),r=new Jt("mover",[n,r]);return r}});function vq(t,e){var n=so(t.body,e,!0);return Xt([t.mclass],n,e)}function xq(t,e){var n,r=Nc(t.body,e);return t.mclass==="minner"?n=new Jt("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Jt("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Jt("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}bn({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:Ta(i),isCharacterBox:xp(i)}},htmlBuilder:vq,mathmlBuilder:xq});var UT=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"};bn({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:UT(e[0]),body:Ta(e[1]),isCharacterBox:xp(e[1])}}});bn({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,i=e[1],s=e[0],a;r!=="\\stackrel"?a=UT(i):a="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Ta(i)},l={type:"supsub",mode:s.mode,base:o,sup:r==="\\underset"?null:s,sub:r==="\\underset"?s:null};return{type:"mclass",mode:n.mode,mclass:a,body:[l],isCharacterBox:xp(l)}},htmlBuilder:vq,mathmlBuilder:xq});bn({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:UT(e[0]),body:Ta(e[0])}},htmlBuilder(t,e){var n=so(t.body,e,!0),r=Xt([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Nc(t.body,e),r=new Jt("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var G1e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},gL=()=>({type:"styling",body:[],mode:"math",style:"display"}),vL=t=>t.type==="textord"&&t.text==="@",W1e=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function $1e(t,e,n){var r=G1e[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"},a=n.callFunction("\\Big",[s],[]),o=n.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,a,o]};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 q1e(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 Qt("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var a=e[s],o=gL(),l=0;l<a.length;l++)if(!vL(a[l]))o.body.push(a[l]);else{r.push(o),l+=1;var c=Tk(a[l]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var h=0;h<2;h++){for(var g=!0,v=l+1;v<a.length;v++){if(W1e(a[v],c)){g=!1,l=v;break}if(vL(a[v]))throw new Qt("Missing a "+c+" character to complete a CD arrow.",a[v]);d[h].body.push(a[v])}if(g)throw new Qt("Missing a "+c+" character to complete a CD arrow.",a[l])}else throw new Qt('Expected one of "<>AV=|." after @',a[l]);var b=$1e(c,d,t),_={type:"styling",body:[b],mode:"math",style:"display"};r.push(_),o=gL()}s%2===0?r.push(o):r.shift(),r=[],i.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var w=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:w,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}bn({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=J1(xi(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=dn(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Jt("mrow",[is(t.label,e)]);return n=new Jt("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Jt("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});bn({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=J1(xi(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Jt("mrow",[is(t.fragment,e)])}});bn({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Pr(e[0],"ordgroup"),i=r.body,s="",a=0;a<i.length;a++){var o=Pr(i[a],"textord");s+=o.text}var l=parseInt(s),c;if(isNaN(l))throw new Qt("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new Qt("\\@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 yq=(t,e)=>{var n=so(t.body,e.withColor(t.color),!1);return bp(n)},bq=(t,e)=>{var n=Nc(t.body,e.withColor(t.color)),r=new Jt("mstyle",n);return r.setAttribute("mathcolor",t.color),r};bn({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Pr(e[0],"color-token").color,i=e[1];return{type:"color",mode:n.mode,color:r,body:Ta(i)}},htmlBuilder:yq,mathmlBuilder:bq});bn({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,i=Pr(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:yq,mathmlBuilder:bq});bn({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&&Pr(i,"size").value}},htmlBuilder(t,e){var n=Xt(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=dn(Js(t.size,e)))),n},mathmlBuilder(t,e){var n=new Jt("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",dn(Js(t.size,e)))),n}});var CR={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},_q=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Qt("Expected a control sequence",t);return e},X1e=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},Sq=(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)};bn({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(CR[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=CR[r.text]),Pr(e.parseFunction(),"internal");throw new Qt("Invalid token after macro prefix",r)}});bn({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 Qt("Expected a control sequence",r);for(var s=0,a,o=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),o[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Qt('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new Qt('Argument number "'+r.text+'" out of order');s++,o.push([])}else{if(r.text==="EOF")throw new Qt("Expected a macro definition");o[s].push(r.text)}var{tokens:l}=e.gullet.consumeArg();return a&&l.unshift(a),(n==="\\edef"||n==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:o},n===CR[n]),{type:"internal",mode:e.mode}}});bn({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=_q(e.gullet.popToken());e.gullet.consumeSpaces();var i=X1e(e);return Sq(e,r,i,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});bn({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=_q(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return Sq(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var v_=function(e,n,r){var i=hs.math[e]&&hs.math[e].replace,s=yk(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},Ck=function(e,n,r,i){var s=r.havingBaseStyle(n),a=Xt(i.concat(s.sizingClasses(r)),[e],r),o=s.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=s.sizeMultiplier,a},wq=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=dn(s),e.height-=s,e.depth+=s},Y1e=function(e,n,r,i,s,a){var o=Ll(e,"Main-Regular",s,i),l=Ck(o,n,i,a);return wq(l,i,n),l},K1e=function(e,n,r,i){return Ll(e,"Size"+n+"-Regular",r,i)},Mq=function(e,n,r,i,s,a){var o=K1e(e,n,s,i),l=Ck(Xt(["delimsizing","size"+n],[o],i),hr.TEXT,i,a);return r&&wq(l,i,hr.TEXT),l},SA=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=Xt(["delimsizinginner",i],[Xt([],[Ll(e,n,r)])]);return{type:"elem",elem:s}},wA=function(e,n,r){var i=Yf["Size4-Regular"][e.charCodeAt(0)]?Yf["Size4-Regular"][e.charCodeAt(0)][4]:Yf["Size1-Regular"][e.charCodeAt(0)][4],s=new Q0("inner",d1e(e,Math.round(1e3*n))),a=new hp([s],{width:dn(i),height:dn(n),style:"width:"+dn(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=J0([],[a],r);return o.height=n,o.style.height=dn(n),o.style.width=dn(i),{type:"elem",elem:o}},AR=.008,S4={type:"kern",size:-1*AR},Z1e=new Set(["|","\\lvert","\\rvert","\\vert"]),Q1e=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Tq=function(e,n,r,i,s,a){var o,l,c,d,h="",g=0;o=c=d=e,l=null;var v="Size1-Regular";e==="\\uparrow"?c=d="⏐":e==="\\Uparrow"?c=d="‖":e==="\\downarrow"?o=c="⏐":e==="\\Downarrow"?o=c="‖":e==="\\updownarrow"?(o="\\uparrow",c="⏐",d="\\downarrow"):e==="\\Updownarrow"?(o="\\Uparrow",c="‖",d="\\Downarrow"):Z1e.has(e)?(c="∣",h="vert",g=333):Q1e.has(e)?(c="∥",h="doublevert",g=556):e==="["||e==="\\lbrack"?(o="⎡",c="⎢",d="⎣",v="Size4-Regular",h="lbrack",g=667):e==="]"||e==="\\rbrack"?(o="⎤",c="⎥",d="⎦",v="Size4-Regular",h="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(c=o="⎢",d="⎣",v="Size4-Regular",h="lfloor",g=667):e==="\\lceil"||e==="⌈"?(o="⎡",c=d="⎢",v="Size4-Regular",h="lceil",g=667):e==="\\rfloor"||e==="⌋"?(c=o="⎥",d="⎦",v="Size4-Regular",h="rfloor",g=667):e==="\\rceil"||e==="⌉"?(o="⎤",c=d="⎥",v="Size4-Regular",h="rceil",g=667):e==="("||e==="\\lparen"?(o="⎛",c="⎜",d="⎝",v="Size4-Regular",h="lparen",g=875):e===")"||e==="\\rparen"?(o="⎞",c="⎟",d="⎠",v="Size4-Regular",h="rparen",g=875):e==="\\{"||e==="\\lbrace"?(o="⎧",l="⎨",d="⎩",c="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(o="⎫",l="⎬",d="⎭",c="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(o="⎧",d="⎩",c="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(o="⎫",d="⎭",c="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(o="⎧",d="⎭",c="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(o="⎫",d="⎩",c="⎪",v="Size4-Regular");var b=v_(o,v,s),_=b.height+b.depth,w=v_(c,v,s),S=w.height+w.depth,E=v_(d,v,s),A=E.height+E.depth,N=0,I=1;if(l!==null){var P=v_(l,v,s);N=P.height+P.depth,I=2}var L=_+A+N,R=Math.max(0,Math.ceil((n-L)/(I*S))),O=L+R*I*S,W=i.fontMetrics().axisHeight;r&&(W*=i.sizeMultiplier);var U=O/2-W,V=[];if(h.length>0){var G=O-_-A,Z=Math.round(O*1e3),B=f1e(h,Math.round(G*1e3)),q=new Q0(h,B),Y=(g/1e3).toFixed(3)+"em",K=(Z/1e3).toFixed(3)+"em",J=new hp([q],{width:Y,height:K,viewBox:"0 0 "+g+" "+Z}),F=J0([],[J],i);F.height=Z/1e3,F.style.width=Y,F.style.height=K,V.push({type:"elem",elem:F})}else{if(V.push(SA(d,v,s)),V.push(S4),l===null){var j=O-_-A+2*AR;V.push(wA(c,j,i))}else{var X=(O-_-A-N)/2+2*AR;V.push(wA(c,X,i)),V.push(S4),V.push(SA(l,v,s)),V.push(S4),V.push(wA(c,X,i))}V.push(S4),V.push(SA(o,v,s))}var H=i.havingBaseStyle(hr.TEXT),se=Mi({positionType:"bottom",positionData:U,children:V});return Ck(Xt(["delimsizing","mult"],[se],H),hr.TEXT,i,a)},MA=80,TA=.08,EA=function(e,n,r,i,s){var a=u1e(e,i,r),o=new Q0(e,a),l=new hp([o],{width:"400em",height:dn(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return J0(["hide-tail"],[l],s)},J1e=function(e,n){var r=n.havingBaseSizing(),i=Rq("\\surd",e*r.sizeMultiplier,Nq,r),s=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,l=0,c=0,d=0,h;return i.type==="small"?(d=1e3+1e3*a+MA,e<1?s=1:e<1.4&&(s=.7),l=(1+a+TA)/s,c=(1+a)/s,o=EA("sqrtMain",l,d,a,n),o.style.minWidth="0.853em",h=.833/s):i.type==="large"?(d=(1e3+MA)*P_[i.size],c=(P_[i.size]+a)/s,l=(P_[i.size]+a+TA)/s,o=EA("sqrtSize"+i.size,l,d,a,n),o.style.minWidth="1.02em",h=1/s):(l=e+a+TA,c=e+a,d=Math.floor(1e3*e+a)+MA,o=EA("sqrtTall",l,d,a,n),o.style.minWidth="0.742em",h=1.056),o.height=c,o.style.height=dn(l),{span:o,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*s}},Eq=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),eye=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),Cq=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),P_=[0,1.2,1.8,2.4,3],Aq=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),Eq.has(e)||Cq.has(e))return Mq(e,n,!1,r,i,s);if(eye.has(e))return Tq(e,P_[n],!1,r,i,s);throw new Qt("Illegal delimiter: '"+e+"'")},tye=[{type:"small",style:hr.SCRIPTSCRIPT},{type:"small",style:hr.SCRIPT},{type:"small",style:hr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],nye=[{type:"small",style:hr.SCRIPTSCRIPT},{type:"small",style:hr.SCRIPT},{type:"small",style:hr.TEXT},{type:"stack"}],Nq=[{type:"small",style:hr.SCRIPTSCRIPT},{type:"small",style:hr.SCRIPT},{type:"small",style:hr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],rye=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.")},Rq=function(e,n,r,i){for(var s=Math.min(2,3-i.style.size),a=s;a<r.length&&r[a].type!=="stack";a++){var o=v_(e,rye(r[a]),"math"),l=o.height+o.depth;if(r[a].type==="small"){var c=i.havingBaseStyle(r[a].style);l*=c.sizeMultiplier}if(l>n)return r[a]}return r[r.length-1]},NR=function(e,n,r,i,s,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var o;Cq.has(e)?o=tye:Eq.has(e)?o=Nq:o=nye;var l=Rq(e,n,o,i);return l.type==="small"?Y1e(e,l.style,r,i,s,a):l.type==="large"?Mq(e,l.size,r,i,s,a):Tq(e,n,r,i,s,a)},CA=function(e,n,r,i,s,a){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,d=Math.max(n-o,r+o),h=Math.max(d/500*l,2*d-c);return NR(e,h,!0,i,s,a)},xL={"\\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}},iye=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 BT(t,e){var n=FT(t);if(n&&iye.has(n.text))return n;throw n?new Qt("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new Qt("Invalid delimiter type '"+t.type+"'",t)}bn({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=BT(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:xL[t.funcName].size,mclass:xL[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?Xt([t.mclass]):Aq(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Yu(t.delim,t.mode));var n=new Jt("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=dn(P_[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function yL(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}bn({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 Qt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:BT(e[0],t).text,color:n}}});bn({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=BT(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Pr(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:s.delim,rightColor:s.color}},htmlBuilder:(t,e)=>{yL(t);for(var n=so(t.body,e,!0,["mopen","mclose"]),r=0,i=0,s=!1,a=0;a<n.length;a++)n[a].isMiddle?s=!0:(r=Math.max(n[a].height,r),i=Math.max(n[a].depth,i));r*=e.sizeMultiplier,i*=e.sizeMultiplier;var o;if(t.left==="."?o=pS(e,["mopen"]):o=CA(t.left,r,i,e,t.mode,["mopen"]),n.unshift(o),s)for(var l=1;l<n.length;l++){var c=n[l],d=c.isMiddle;d&&(n[l]=CA(d.delim,r,i,d.options,t.mode,[]))}var h;if(t.right===".")h=pS(e,["mclose"]);else{var g=t.rightColor?e.withColor(t.rightColor):e;h=CA(t.right,r,i,g,t.mode,["mclose"])}return n.push(h),Xt(["minner"],n,e)},mathmlBuilder:(t,e)=>{yL(t);var n=Nc(t.body,e);if(t.left!=="."){var r=new Jt("mo",[Yu(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new Jt("mo",[Yu(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return wk(n)}});bn({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=BT(e[0],t);if(!t.parser.leftrightDepth)throw new Qt("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=pS(e,[]);else{n=Aq(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==="|"?Yu("|","text"):Yu(t.delim,t.mode),r=new Jt("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Ak=(t,e)=>{var n=J1(xi(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,a=0,o=xp(t.body);if(r==="sout")s=Xt(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=Js({number:.6,unit:"pt"},e),c=Js({number:.35,unit:"ex"},e),d=e.havingBaseSizing();i=i/d.sizeMultiplier;var h=n.height+n.depth+l+c;n.style.paddingLeft=dn(h/2+l);var g=Math.floor(1e3*h*i),v=l1e(g),b=new hp([new Q0("phase",v)],{width:"400em",height:dn(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});s=J0(["hide-tail"],[b],e),s.style.height=dn(h),a=n.depth+l+c}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var _=0,w=0,S=0;/box/.test(r)?(S=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),_=e.fontMetrics().fboxsep+(r==="colorbox"?0:S),w=_):r==="angl"?(S=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),_=4*S,w=Math.max(0,.25-n.depth)):(_=o?.2:0,w=_),s=H1e(n,r,_,w,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=dn(S)):r==="angl"&&S!==.049&&(s.style.borderTopWidth=dn(S),s.style.borderRightWidth=dn(S)),a=n.depth+w,t.backgroundColor&&(s.style.backgroundColor=t.backgroundColor,t.borderColor&&(s.style.borderColor=t.borderColor))}var E;if(t.backgroundColor)E=Mi({positionType:"individualShift",children:[{type:"elem",elem:s,shift:a},{type:"elem",elem:n,shift:0}]});else{var A=/cancel|phase/.test(r)?["svg-align"]:[];E=Mi({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:s,shift:a,wrapperClasses:A}]})}return/cancel/.test(r)&&(E.height=n.height,E.depth=n.depth),/cancel/.test(r)&&!o?Xt(["mord","cancel-lap"],[E],e):Xt(["mord"],[E],e)},Nk=(t,e)=>{var n=0,r=new Jt(t.label.includes("colorbox")?"mpadded":"menclose",[is(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};bn({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Pr(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:a}},htmlBuilder:Ak,mathmlBuilder:Nk});bn({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Pr(e[0],"color-token").color,a=Pr(e[1],"color-token").color,o=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:a,borderColor:s,body:o}},htmlBuilder:Ak,mathmlBuilder:Nk});bn({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]}}});bn({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:Ak,mathmlBuilder:Nk});bn({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 kq={};function fh(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)kq[n[l]]=o;s&&(E2[e]=s),a&&(C2[e]=a)}var Pq={};function De(t,e){Pq[t]=e}function bL(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 HT=t=>{var e=t.parser.settings;if(!e.displayMode)throw new Qt("{"+t.envName+"} can be used only in display mode.")},sye=new Set(["gather","gather*"]);function Rk(t){if(!t.includes("ed"))return!t.includes("*")}function mm(t,e,n){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:a,colSeparationType:o,autoTag:l,singleRow:c,emptySingleRow:d,maxNumCols:h,leqno:g}=e;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)a=1;else if(a=parseFloat(v),!a||a<0)throw new Qt("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],_=[b],w=[],S=[],E=l!=null?[]:void 0;function A(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function N(){E&&(t.gullet.macros.get("\\df@tag")?(E.push(t.subparse([new tu("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):E.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),S.push(bL(t));;){var I=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),I={type:"ordgroup",mode:t.mode,body:I},n&&(I={type:"styling",mode:t.mode,style:n,body:[I]}),b.push(I);var P=t.fetch().text;if(P==="&"){if(h&&b.length===h){if(c||o)throw new Qt("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(P==="\\end"){N(),b.length===1&&I.type==="styling"&&I.body[0].body.length===0&&(_.length>1||!d)&&_.pop(),S.length<_.length+1&&S.push([]);break}else if(P==="\\\\"){t.consume();var L=void 0;t.gullet.future().text!==" "&&(L=t.parseSizeGroup(!0)),w.push(L?L.value:null),N(),S.push(bL(t)),b=[],_.push(b),A()}else throw new Qt("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:i,arraystretch:a,body:_,cols:s,rowGaps:w,hskipBeforeAndAfter:r,hLinesBeforeRow:S,colSeparationType:o,tags:E,leqno:g}}function kk(t){return t.slice(0,1)==="d"?"display":"text"}var hh=function(e,n){var r,i,s=e.body.length,a=e.hLinesBeforeRow,o=0,l=new Array(s),c=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,g=5*h;if(e.colSeparationType&&e.colSeparationType==="small"){var v=n.havingStyle(hr.SCRIPT).sizeMultiplier;g=.2778*(v/n.sizeMultiplier)}var b=e.colSeparationType==="CD"?Js({number:3,unit:"ex"},n):12*h,_=3*h,w=e.arraystretch*b,S=.7*w,E=.3*w,A=0;function N(Ae){for(var Pe=0;Pe<Ae.length;++Pe)Pe>0&&(A+=.25),c.push({pos:A,isDashed:Ae[Pe]})}for(N(a[0]),r=0;r<e.body.length;++r){var I=e.body[r],P=S,L=E;o<I.length&&(o=I.length);var R=new Array(I.length);for(i=0;i<I.length;++i){var O=xi(I[i],n);L<O.depth&&(L=O.depth),P<O.height&&(P=O.height),R[i]=O}var W=e.rowGaps[r],U=0;W&&(U=Js(W,n),U>0&&(U+=E,L<U&&(L=U),U=0)),e.addJot&&(L+=_),R.height=P,R.depth=L,A+=P,R.pos=A,A+=L+U,l[r]=R,N(a[r+1])}var V=A/2+n.fontMetrics().axisHeight,G=e.cols||[],Z=[],B,q,Y=[];if(e.tags&&e.tags.some(Ae=>Ae))for(r=0;r<s;++r){var K=l[r],J=K.pos-V,F=e.tags[r],j=void 0;F===!0?j=Xt(["eqn-num"],[],n):F===!1?j=Xt([],[],n):j=Xt([],so(F,n,!0),n),j.depth=K.depth,j.height=K.height,Y.push({type:"elem",elem:j,shift:J})}for(i=0,q=0;i<o||q<G.length;++i,++q){for(var X=G[q]||{},H=!0;X.type==="separator";){if(H||(B=Xt(["arraycolsep"],[]),B.style.width=dn(n.fontMetrics().doubleRuleSep),Z.push(B)),X.separator==="|"||X.separator===":"){var se=X.separator==="|"?"solid":"dashed",re=Xt(["vertical-separator"],[],n);re.style.height=dn(A),re.style.borderRightWidth=dn(d),re.style.borderRightStyle=se,re.style.margin="0 "+dn(-d/2);var ie=A-V;ie&&(re.style.verticalAlign=dn(-ie)),Z.push(re)}else throw new Qt("Invalid separator type: "+X.separator);q++,X=G[q]||{},H=!1}if(!(i>=o)){var ue=void 0;if(i>0||e.hskipBeforeAndAfter){var le;ue=(le=X.pregap)!=null?le:g,ue!==0&&(B=Xt(["arraycolsep"],[]),B.style.width=dn(ue),Z.push(B))}var fe=[];for(r=0;r<s;++r){var xe=l[r],he=xe[i];if(he){var Te=xe.pos-V;he.depth=xe.depth,he.height=xe.height,fe.push({type:"elem",elem:he,shift:Te})}}if(fe=Mi({positionType:"individualShift",children:fe}),fe=Xt(["col-align-"+(X.align||"c")],[fe]),Z.push(fe),i<o-1||e.hskipBeforeAndAfter){var We;ue=(We=X.postgap)!=null?We:g,ue!==0&&(B=Xt(["arraycolsep"],[]),B.style.width=dn(ue),Z.push(B))}}}if(l=Xt(["mtable"],Z),c.length>0){for(var Se=Q1("hline",n,d),Le=Q1("hdashline",n,d),pe=[{type:"elem",elem:l,shift:0}];c.length>0;){var Re=c.pop(),ne=Re.pos-V;Re.isDashed?pe.push({type:"elem",elem:Le,shift:ne}):pe.push({type:"elem",elem:Se,shift:ne})}l=Mi({positionType:"individualShift",children:pe})}if(Y.length===0)return Xt(["mord"],[l],n);var Xe=Mi({positionType:"individualShift",children:Y});return Xe=Xt(["tag"],[Xe],n),bp([l,Xe])},aye={c:"center ",l:"left ",r:"right "},ph=function(e,n){for(var r=[],i=new Jt("mtd",[],["mtr-glue"]),s=new Jt("mtd",[],["mml-eqn-num"]),a=0;a<e.body.length;a++){for(var o=e.body[a],l=[],c=0;c<o.length;c++)l.push(new Jt("mtd",[is(o[c],n)]));e.tags&&e.tags[a]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),r.push(new Jt("mtr",l))}var d=new Jt("mtable",r),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);d.setAttribute("rowspacing",dn(h));var g="",v="";if(e.cols&&e.cols.length>0){var b=e.cols,_="",w=!1,S=0,E=b.length;b[0].type==="separator"&&(g+="top ",S=1),b[b.length-1].type==="separator"&&(g+="bottom ",E-=1);for(var A=S;A<E;A++)b[A].type==="align"?(v+=aye[b[A].align],w&&(_+="none "),w=!0):b[A].type==="separator"&&w&&(_+=b[A].separator==="|"?"solid ":"dashed ",w=!1);d.setAttribute("columnalign",v.trim()),/[sd]/.test(_)&&d.setAttribute("columnlines",_.trim())}if(e.colSeparationType==="align"){for(var N=e.cols||[],I="",P=1;P<N.length;P++)I+=P%2?"0em ":"1em ";d.setAttribute("columnspacing",I.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?d.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?d.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?d.setAttribute("columnspacing","0.5em"):d.setAttribute("columnspacing","1em");var L="",R=e.hLinesBeforeRow;g+=R[0].length>0?"left ":"",g+=R[R.length-1].length>0?"right ":"";for(var O=1;O<R.length-1;O++)L+=R[O].length===0?"none ":R[O][0]?"dashed ":"solid ";return/[sd]/.test(L)&&d.setAttribute("rowlines",L.trim()),g!==""&&(d=new Jt("menclose",[d]),d.setAttribute("notation",g.trim())),e.arraystretch&&e.arraystretch<1&&(d=new Jt("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},Dq=function(e,n){e.envName.includes("ed")||HT(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",a=mm(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:Rk(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),o,l=0,c={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",h=0;h<n[0].body.length;h++){var g=Pr(n[0].body[h],"textord");d+=g.text}o=Number(d),l=o*2}var v=!l;a.body.forEach(function(S){for(var E=1;E<S.length;E+=2){var A=Pr(S[E],"styling"),N=Pr(A.body[0],"ordgroup");N.body.unshift(c)}if(v)l<S.length&&(l=S.length);else{var I=S.length/2;if(o<I)throw new Qt("Too many math in a row: "+("expected "+o+", but got "+I),S[0])}});for(var b=0;b<l;++b){var _="r",w=0;b%2===1?_="l":b>0&&v&&(w=1),r[b]={type:"align",align:_,pregap:w,postgap:0}}return a.colSeparationType=v?"align":"alignat",a};fh({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=FT(e[0]),r=n?[e[0]]:Pr(e[0],"ordgroup").body,i=r.map(function(a){var o=Tk(a),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Qt("Unknown column alignment: "+l,a)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return mm(t.parser,s,kk(t.envName))},htmlBuilder:hh,mathmlBuilder:ph});fh({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 Qt("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=mm(t.parser,r,kk(t.envName)),a=Math.max(0,...s.body.map(o=>o.length));return s.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=mm(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=FT(e[0]),r=n?[e[0]]:Pr(e[0],"ordgroup").body,i=r.map(function(a){var o=Tk(a),l=o.text;if("lc".includes(l))return{type:"align",align:l};throw new Qt("Unknown column alignment: "+l,a)});if(i.length>1)throw new Qt("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=mm(t.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new Qt("{subarray} can contain only one column");return s},htmlBuilder:hh,mathmlBuilder:ph});fh({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=mm(t.parser,e,kk(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Dq,htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){sye.has(t.envName)&&HT(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Rk(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return mm(t.parser,e,"display")},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Dq,htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){HT(t);var e={autoTag:Rk(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return mm(t.parser,e,"display")},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["CD"],props:{numArgs:0},handler(t){return HT(t),q1e(t.parser)},htmlBuilder:hh,mathmlBuilder:ph});De("\\nonumber","\\gdef\\@eqnsw{0}");De("\\notag","\\nonumber");bn({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new Qt(t.funcName+" valid only within array environment")}});var _L=kq;bn({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 Qt("Invalid environment name",i);for(var s="",a=0;a<i.body.length;++a)s+=Pr(i.body[a],"textord").text;if(r==="\\begin"){if(!_L.hasOwnProperty(s))throw new Qt("No such environment: "+s,i);var o=_L[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",o),d={mode:n.mode,envName:s,parser:n},h=o.handler(d,l,c);n.expect("\\end",!1);var g=n.nextToken,v=Pr(n.parseFunction(),"environment");if(v.name!==s)throw new Qt("Mismatch: \\begin{"+s+"} matched by \\end{"+v.name+"}",g);return h}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var Iq=(t,e)=>{var n=t.font,r=e.withFont(n);return xi(t.body,r)},Oq=(t,e)=>{var n=t.font,r=e.withFont(n);return is(t.body,r)},SL={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};bn({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=A2(e[0]),s=r;return s in SL&&(s=SL[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:Iq,mathmlBuilder:Oq});bn({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:UT(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:xp(r)}}});bn({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,a=n.parseExpression(!0,i),o="math"+r.slice(1);return{type:"font",mode:s,font:o,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:Iq,mathmlBuilder:Oq});var oye=(t,e)=>{var n=e.style,r=n.fracNum(),i=n.fracDen(),s;s=e.havingStyle(r);var a=xi(t.numer,s,e);if(t.continued){var o=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;a.height=a.height<o?o:a.height,a.depth=a.depth<l?l:a.depth}s=e.havingStyle(i);var c=xi(t.denom,s,e),d,h,g;t.hasBarLine?(t.barSize?(h=Js(t.barSize,e),d=Q1("frac-line",e,h)):d=Q1("frac-line",e),h=d.height,g=d.height):(d=null,h=0,g=e.fontMetrics().defaultRuleThickness);var v,b,_;n.size===hr.DISPLAY.size?(v=e.fontMetrics().num1,h>0?b=3*g:b=7*g,_=e.fontMetrics().denom1):(h>0?(v=e.fontMetrics().num2,b=g):(v=e.fontMetrics().num3,b=3*g),_=e.fontMetrics().denom2);var w;if(d){var E=e.fontMetrics().axisHeight;v-a.depth-(E+.5*h)<b&&(v+=b-(v-a.depth-(E+.5*h))),E-.5*h-(c.height-_)<b&&(_+=b-(E-.5*h-(c.height-_)));var A=-(E-.5*h);w=Mi({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:d,shift:A},{type:"elem",elem:a,shift:-v}]})}else{var S=v-a.depth-(c.height-_);S<b&&(v+=.5*(b-S),_+=.5*(b-S)),w=Mi({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:a,shift:-v}]})}s=e.havingStyle(n),w.height*=s.sizeMultiplier/e.sizeMultiplier,w.depth*=s.sizeMultiplier/e.sizeMultiplier;var N;n.size===hr.DISPLAY.size?N=e.fontMetrics().delim1:n.size===hr.SCRIPTSCRIPT.size?N=e.havingStyle(hr.SCRIPT).fontMetrics().delim2:N=e.fontMetrics().delim2;var I,P;return t.leftDelim==null?I=pS(e,["mopen"]):I=NR(t.leftDelim,N,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?P=Xt([]):t.rightDelim==null?P=pS(e,["mclose"]):P=NR(t.rightDelim,N,!0,e.havingStyle(n),t.mode,["mclose"]),Xt(["mord"].concat(s.sizingClasses(e)),[I,Xt(["mfrac"],[w]),P],e)},lye=(t,e)=>{var n=new Jt("mfrac",[is(t.numer,e),is(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Js(t.barSize,e);n.setAttribute("linethickness",dn(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new Jt("mo",[new Va(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var a=new Jt("mo",[new Va(t.rightDelim.replace("\\",""))]);a.setAttribute("fence","true"),i.push(a)}return wk(i)}return n},Lq=(t,e)=>{if(!e)return t;var n={type:"styling",mode:t.mode,style:e,body:[t]};return n};bn({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],a,o=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",l=")";break;case"\\\\bracefrac":a=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":a=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=r==="\\cfrac",d=null;return c||r.startsWith("\\d")?d="display":r.startsWith("\\t")&&(d="text"),Lq({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:a,leftDelim:o,rightDelim:l,barSize:null},d)},htmlBuilder:oye,mathmlBuilder:lye});bn({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 wL=["display","text","script","scriptscript"],ML=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};bn({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=A2(e[0]),a=s.type==="atom"&&s.family==="open"?ML(s.text):null,o=A2(e[1]),l=o.type==="atom"&&o.family==="close"?ML(o.text):null,c=Pr(e[2],"size"),d,h=null;c.isBlank?d=!0:(h=c.value,d=h.number>0);var g=null,v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Pr(v.body[0],"textord");g=wL[Number(b.text)]}}else v=Pr(v,"textord"),g=wL[Number(v.text)];return Lq({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:d,barSize:h,leftDelim:a,rightDelim:l},g)}});bn({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:Pr(e[0],"size").value,token:i}}});bn({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=Pr(e[1],"infix").size;if(!s)throw new Error("\\\\abovefrac expected size, but got "+String(s));var a=e[2],o=s.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:a,continued:!1,hasBarLine:o,barSize:s,leftDelim:null,rightDelim:null}}});var zq=(t,e)=>{var n=e.style,r,i;t.type==="supsub"?(r=t.sup?xi(t.sup,e.havingStyle(n.sup()),e):xi(t.sub,e.havingStyle(n.sub()),e),i=Pr(t.base,"horizBrace")):i=Pr(t,"horizBrace");var s=xi(i.base,e.havingBaseStyle(hr.DISPLAY)),a=jT(i,e),o;if(i.isOver?(o=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]}),o.children[0].children[0].children[1].classes.push("svg-align")):(o=Mi({positionType:"bottom",positionData:s.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]}),o.children[0].children[0].children[0].classes.push("svg-align")),r){var l=Xt(["mord",i.isOver?"mover":"munder"],[o],e);i.isOver?o=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):o=Mi({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Xt(["mord",i.isOver?"mover":"munder"],[o],e)},cye=(t,e)=>{var n=zT(t.label);return new Jt(t.isOver?"mover":"munder",[is(t.base,e),n])};bn({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:zq,mathmlBuilder:cye});bn({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],i=Pr(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:Ta(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=so(t.body,e,!1);return E1e(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=em(t.body,e);return n instanceof Jt||(n=new Jt("mrow",[n])),n.setAttribute("href",t.href),n}});bn({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Pr(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 a=r[s];a==="~"&&(a="\\textasciitilde"),i.push({type:"textord",mode:"text",text:a})}var o={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:Ta(o)}}});bn({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:Ta(e[0])}},htmlBuilder(t,e){var n=so(t.body,e,!1);return bp(n)},mathmlBuilder(t,e){return new Jt("mrow",Nc(t.body,e))}});bn({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=Pr(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(r){case"\\htmlClass":l.class=s,o={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,o={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,o={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),d=0;d<c.length;d++){var h=c[d],g=h.indexOf("=");if(g<0)throw new Qt("\\htmlData key/value '"+h+"' missing equals sign");var v=h.slice(0,g),b=h.slice(g+1);l["data-"+v.trim()]=b}o={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(o)?{type:"html",mode:n.mode,attributes:l,body:Ta(a)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=so(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var i=Xt(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)=>em(t.body,e)});bn({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:Ta(e[0]),mathml:Ta(e[1])}},htmlBuilder:(t,e)=>{var n=so(t.html,e,!1);return bp(n)},mathmlBuilder:(t,e)=>em(t.mathml,e)});var AA=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 Qt("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!tq(r))throw new Qt("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};bn({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"},a={number:0,unit:"em"},o="";if(n[0])for(var l=Pr(n[0],"raw").string,c=l.split(","),d=0;d<c.length;d++){var h=c[d].split("=");if(h.length===2){var g=h[1].trim();switch(h[0].trim()){case"alt":o=g;break;case"width":i=AA(g);break;case"height":s=AA(g);break;case"totalheight":a=AA(g);break;default:throw new Qt("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var v=Pr(e[0],"url").url;return o===""&&(o=v,o=o.replace(/^.*[\\/]/,""),o=o.substring(0,o.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:v})?{type:"includegraphics",mode:r.mode,alt:o,width:i,height:s,totalheight:a,src:v}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var n=Js(t.height,e),r=0;t.totalheight.number>0&&(r=Js(t.totalheight,e)-n);var i=0;t.width.number>0&&(i=Js(t.width,e));var s={height:dn(n+r)};i>0&&(s.width=dn(i)),r>0&&(s.verticalAlign=dn(-r));var a=new x1e(t.src,t.alt,s);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Jt("mglyph",[]);n.setAttribute("alt",t.alt);var r=Js(t.height,e),i=0;if(t.totalheight.number>0&&(i=Js(t.totalheight,e)-r,n.setAttribute("valign",dn(-i))),n.setAttribute("height",dn(r+i)),t.width.number>0){var s=Js(t.width,e);n.setAttribute("width",dn(s))}return n.setAttribute("src",t.src),n}});bn({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=Pr(e[0],"size");if(n.settings.strict){var s=r[1]==="m",a=i.value.unit==="mu";s?(a||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")):a&&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 oq(t.dimension,e)},mathmlBuilder(t,e){var n=Js(t.dimension,e);return new hq(n)}});bn({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=Xt([],[xi(t.body,e)]),n=Xt(["inner"],[n],e)):n=Xt(["inner"],[xi(t.body,e)]);var r=Xt(["fix"],[]),i=Xt([t.alignment],[n,r],e),s=Xt(["strut"]);return s.style.height=dn(i.height+i.depth),i.depth&&(s.style.verticalAlign=dn(-i.depth)),i.children.unshift(s),i=Xt(["thinbox"],[i],e),Xt(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new Jt("mpadded",[is(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});bn({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==="\\("?"\\)":"$",a=r.parseExpression(!1,s);return r.expect(s),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:a}}});bn({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Qt("Mismatched "+t.funcName)}});var TL=(t,e)=>{switch(e.style.size){case hr.DISPLAY.size:return t.display;case hr.TEXT.size:return t.text;case hr.SCRIPT.size:return t.script;case hr.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};bn({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Ta(e[0]),text:Ta(e[1]),script:Ta(e[2]),scriptscript:Ta(e[3])}},htmlBuilder:(t,e)=>{var n=TL(t,e),r=so(n,e,!1);return bp(r)},mathmlBuilder:(t,e)=>{var n=TL(t,e);return em(n,e)}});var jq=(t,e,n,r,i,s,a)=>{t=Xt([],[t]);var o=n&&xp(n),l,c;if(e){var d=xi(e,r.havingStyle(i.sup()),r);c={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=xi(n,r.havingStyle(i.sub()),r);l={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}var g;if(c&&l){var v=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+a;g=Mi({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:dn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:dn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var b=t.height-a;g=Mi({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:dn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var _=t.depth+a;g=Mi({positionType:"bottom",positionData:_,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:dn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var w=[g];if(l&&s!==0&&!o){var S=Xt(["mspace"],[],r);S.style.marginRight=dn(s),w.unshift(S)}return Xt(["mop","op-limits"],w,r)},Fq=new Set(["\\smallint"]),Ay=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Pr(t.base,"op"),i=!0):s=Pr(t,"op");var a=e.style,o=!1;a.size===hr.DISPLAY.size&&s.symbol&&!Fq.has(s.name)&&(o=!0);var l;if(s.symbol){var c=o?"Size2-Regular":"Size1-Regular",d="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(d=s.name.slice(1),s.name=d==="oiint"?"\\iint":"\\iiint"),l=Ll(s.name,c,"math",e,["mop","op-symbol",o?"large-op":"small-op"]),d.length>0){var h=l.italic,g=cq(d+"Size"+(o?"2":"1"),e);l=Mi({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:g,shift:o?.08:0}]}),s.name="\\"+d,l.classes.unshift("mop"),l.italic=h}}else if(s.body){var v=so(s.body,e,!0);v.length===1&&v[0]instanceof Xu?(l=v[0],l.classes[0]="mop"):l=Xt(["mop"],v,e)}else{for(var b=[],_=1;_<s.name.length;_++)b.push(_k(s.name[_],s.mode,e));l=Xt(["mop"],b,e)}var w=0,S=0;return(l instanceof Xu||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(w=(l.height-l.depth)/2-e.fontMetrics().axisHeight,S=l.italic),i?jq(l,n,r,e,a,S,w):(w&&(l.style.position="relative",l.style.top=dn(w)),l)},hw=(t,e)=>{var n;if(t.symbol)n=new Jt("mo",[Yu(t.name,t.mode)]),Fq.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Jt("mo",Nc(t.body,e));else{n=new Jt("mi",[new Va(t.name.slice(1))]);var r=new Jt("mo",[Yu("⁡","text")]);t.parentIsSupSub?n=new Jt("mrow",[n,r]):n=fq([n,r])}return n},uye={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};bn({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=uye[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Ay,mathmlBuilder:hw});bn({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:Ta(r)}},htmlBuilder:Ay,mathmlBuilder:hw});var dye={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};bn({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:Ay,mathmlBuilder:hw});bn({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:Ay,mathmlBuilder:hw});bn({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=dye[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Ay,mathmlBuilder:hw});var Uq=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Pr(t.base,"operatorname"),i=!0):s=Pr(t,"operatorname");var a;if(s.body.length>0){for(var o=s.body.map(h=>{var g=h.text;return typeof g=="string"?{type:"textord",mode:h.mode,text:g}:h}),l=so(o,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof Xu&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}a=Xt(["mop"],l,e)}else a=Xt(["mop"],[],e);return i?jq(a,n,r,e,e.style,0,0):a},fye=(t,e)=>{for(var n=Nc(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof hq))if(s instanceof Jt)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var a=s.children[0];s.children.length===1&&a instanceof Va?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var o=n.map(d=>d.toText()).join("");n=[new Va(o)]}var l=new Jt("mi",n);l.setAttribute("mathvariant","normal");var c=new Jt("mo",[Yu("⁡","text")]);return t.parentIsSupSub?new Jt("mrow",[l,c]):fq([l,c])};bn({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:Ta(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Uq,mathmlBuilder:fye});De("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Sv({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?bp(so(t.body,e,!1)):Xt(["mord"],so(t.body,e,!0),e)},mathmlBuilder(t,e){return em(t.body,e,!0)}});bn({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=xi(t.body,e.havingCrampedStyle()),r=Q1("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]});return Xt(["mord","overline"],[s],e)},mathmlBuilder(t,e){var n=new Jt("mo",[new Va("‾")]);n.setAttribute("stretchy","true");var r=new Jt("mover",[is(t.body,e),n]);return r.setAttribute("accent","true"),r}});bn({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:Ta(r)}},htmlBuilder:(t,e)=>{var n=so(t.body,e.withPhantom(),!1);return bp(n)},mathmlBuilder:(t,e)=>{var n=Nc(t.body,e);return new Jt("mphantom",n)}});bn({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=Xt([],[xi(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=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:n}]}),Xt(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=Nc(Ta(t.body),e),r=new Jt("mphantom",n),i=new Jt("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});bn({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=Xt(["inner"],[xi(t.body,e.withPhantom())]),r=Xt(["fix"],[]);return Xt(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Nc(Ta(t.body),e),r=new Jt("mphantom",n),i=new Jt("mpadded",[r]);return i.setAttribute("width","0px"),i}});bn({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Pr(e[0],"size").value,i=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(t,e){var n=xi(t.body,e),r=Js(t.dy,e);return Mi({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new Jt("mpadded",[is(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});bn({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});bn({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=Pr(e[0],"size"),a=Pr(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Pr(i,"size").value,width:s.value,height:a.value}},htmlBuilder(t,e){var n=Xt(["mord","rule"],[],e),r=Js(t.width,e),i=Js(t.height,e),s=t.shift?Js(t.shift,e):0;return n.style.borderRightWidth=dn(r),n.style.borderTopWidth=dn(i),n.style.bottom=dn(s),n.width=r,n.height=i+s,n.depth=-s,n.maxFontSize=i*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Js(t.width,e),r=Js(t.height,e),i=t.shift?Js(t.shift,e):0,s=e.color&&e.getColor()||"black",a=new Jt("mspace");a.setAttribute("mathbackground",s),a.setAttribute("width",dn(n)),a.setAttribute("height",dn(r));var o=new Jt("mpadded",[a]);return i>=0?o.setAttribute("height",dn(i)):(o.setAttribute("height",dn(i)),o.setAttribute("depth",dn(-i))),o.setAttribute("voffset",dn(i)),o}});function Bq(t,e,n){for(var r=so(t,e,!1),i=e.sizeMultiplier/n.sizeMultiplier,s=0;s<r.length;s++){var a=r[s].classes.indexOf("sizing");a<0?Array.prototype.push.apply(r[s].classes,e.sizingClasses(n)):r[s].classes[a+1]==="reset-size"+e.size&&(r[s].classes[a+1]="reset-size"+n.size),r[s].height*=i,r[s].depth*=i}return bp(r)}var EL=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],hye=(t,e)=>{var n=e.havingSize(t.size);return Bq(t.body,n,e)};bn({type:"sizing",names:EL,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:EL.indexOf(r)+1,body:s}},htmlBuilder:hye,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Nc(t.body,n),i=new Jt("mstyle",r);return i.setAttribute("mathsize",dn(n.sizeMultiplier)),i}});bn({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,i=!1,s=!1,a=n[0]&&Pr(n[0],"ordgroup");if(a)for(var o="",l=0;l<a.body.length;++l){var c=a.body[l];if(o=c.text,o==="t")i=!0;else if(o==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var d=e[0];return{type:"smash",mode:r.mode,body:d,smashHeight:i,smashDepth:s}},htmlBuilder:(t,e)=>{var n=Xt([],[xi(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=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Xt(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Jt("mpadded",[is(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});bn({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=xi(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=J1(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<hr.TEXT.id&&(s=e.fontMetrics().xHeight);var a=i+s/4,o=n.height+n.depth+a+i,{span:l,ruleWidth:c,advanceWidth:d}=J1e(o,e),h=l.height-c;h>n.height+n.depth+a&&(a=(a+h-n.height-n.depth)/2);var g=l.height-n.height-a-c;n.style.paddingLeft=dn(d);var v=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:l},{type:"kern",size:c}]});if(t.index){var b=e.havingStyle(hr.SCRIPTSCRIPT),_=xi(t.index,b,e),w=.6*(v.height-v.depth),S=Mi({positionType:"shift",positionData:-w,children:[{type:"elem",elem:_}]}),E=Xt(["root"],[S]);return Xt(["mord","sqrt"],[E,v],e)}else return Xt(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Jt("mroot",[is(n,e),is(r,e)]):new Jt("msqrt",[is(n,e)])}});var CL={display:hr.DISPLAY,text:hr.TEXT,script:hr.SCRIPT,scriptscript:hr.SCRIPTSCRIPT};bn({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),a=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:a,body:s}},htmlBuilder(t,e){var n=CL[t.style],r=e.havingStyle(n).withFont("");return Bq(t.body,r,e)},mathmlBuilder(t,e){var n=CL[t.style],r=e.havingStyle(n),i=Nc(t.body,r),s=new Jt("mstyle",i),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[t.style];return s.setAttribute("scriptlevel",o[0]),s.setAttribute("displaystyle",o[1]),s}});var pye=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===hr.DISPLAY.size||r.alwaysHandleSupSub);return i?Ay:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===hr.DISPLAY.size||r.limits);return s?Uq:null}else{if(r.type==="accent")return xp(r.base)?Ek:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?zq:null}else return null}else return null};Sv({type:"supsub",htmlBuilder(t,e){var n=pye(t,e);if(n)return n(t,e);var{base:r,sup:i,sub:s}=t,a=xi(r,e),o,l,c=e.fontMetrics(),d=0,h=0,g=r&&xp(r);if(i){var v=e.havingStyle(e.style.sup());o=xi(i,v,e),g||(d=a.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(s){var b=e.havingStyle(e.style.sub());l=xi(s,b,e),g||(h=a.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var _;e.style===hr.DISPLAY?_=c.sup1:e.style.cramped?_=c.sup3:_=c.sup2;var w=e.sizeMultiplier,S=dn(.5/c.ptPerEm/w),E=null;if(l){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof Xu||A)&&(E=dn(-a.italic))}var N;if(o&&l){d=Math.max(d,_,o.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var I=c.defaultRuleThickness,P=4*I;if(d-o.depth-(l.height-h)<P){h=P-(d-o.depth)+l.height;var L=.8*c.xHeight-(d-o.depth);L>0&&(d+=L,h-=L)}var R=[{type:"elem",elem:l,shift:h,marginRight:S,marginLeft:E},{type:"elem",elem:o,shift:-d,marginRight:S}];N=Mi({positionType:"individualShift",children:R})}else if(l){h=Math.max(h,c.sub1,l.height-.8*c.xHeight);var O=[{type:"elem",elem:l,marginLeft:E,marginRight:S}];N=Mi({positionType:"shift",positionData:h,children:O})}else if(o)d=Math.max(d,_,o.depth+.25*c.xHeight),N=Mi({positionType:"shift",positionData:-d,children:[{type:"elem",elem:o,marginRight:S}]});else throw new Error("supsub must have either sup or sub.");var W=TR(a,"right")||"mord";return Xt([W],[a,Xt(["msupsub"],[N])],e)},mathmlBuilder(t,e){var n=!1,r,i;t.base&&t.base.type==="horizBrace"&&(i=!!t.sup,i===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var s=[is(t.base,e)];t.sub&&s.push(is(t.sub,e)),t.sup&&s.push(is(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var c=t.base;c&&c.type==="op"&&c.limits&&e.style===hr.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===hr.DISPLAY||c.limits)?a="munderover":a="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===hr.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===hr.DISPLAY)?a="munder":a="msub"}else{var o=t.base;o&&o.type==="op"&&o.limits&&(e.style===hr.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||e.style===hr.DISPLAY)?a="mover":a="msup"}return new Jt(a,s)}});Sv({type:"atom",htmlBuilder(t,e){return _k(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Jt("mo",[Yu(t.text,t.mode)]);if(t.family==="bin"){var r=Mk(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 Hq={mi:"italic",mn:"normal",mtext:"normal"};Sv({type:"mathord",htmlBuilder(t,e){return LT(t,e,"mathord")},mathmlBuilder(t,e){var n=new Jt("mi",[Yu(t.text,t.mode,e)]),r=Mk(t,e)||"italic";return r!==Hq[n.type]&&n.setAttribute("mathvariant",r),n}});Sv({type:"textord",htmlBuilder(t,e){return LT(t,e,"textord")},mathmlBuilder(t,e){var n=Yu(t.text,t.mode,e),r=Mk(t,e)||"normal",i;return t.mode==="text"?i=new Jt("mtext",[n]):/[0-9]/.test(t.text)?i=new Jt("mn",[n]):t.text==="\\prime"?i=new Jt("mo",[n]):i=new Jt("mi",[n]),r!==Hq[i.type]&&i.setAttribute("mathvariant",r),i}});var NA={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},RA={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Sv({type:"spacing",htmlBuilder(t,e){if(RA.hasOwnProperty(t.text)){var n=RA[t.text].className||"";if(t.mode==="text"){var r=LT(t,e,"textord");return r.classes.push(n),r}else return Xt(["mspace",n],[_k(t.text,t.mode,e)],e)}else{if(NA.hasOwnProperty(t.text))return Xt(["mspace",NA[t.text]],[],e);throw new Qt('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(RA.hasOwnProperty(t.text))n=new Jt("mtext",[new Va(" ")]);else{if(NA.hasOwnProperty(t.text))return new Jt("mspace");throw new Qt('Unknown type of space "'+t.text+'"')}return n}});var AL=()=>{var t=new Jt("mtd",[]);return t.setAttribute("width","50%"),t};Sv({type:"tag",mathmlBuilder(t,e){var n=new Jt("mtable",[new Jt("mtr",[AL(),new Jt("mtd",[em(t.body,e)]),AL(),new Jt("mtd",[em(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var NL={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},RL={"\\textbf":"textbf","\\textmd":"textmd"},mye={"\\textit":"textit","\\textup":"textup"},kL=(t,e)=>{var n=t.font;if(n){if(NL[n])return e.withTextFontFamily(NL[n]);if(RL[n])return e.withTextFontWeight(RL[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(mye[n])};bn({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:Ta(i),font:r}},htmlBuilder(t,e){var n=kL(t,e),r=so(t.body,n,!0);return Xt(["mord","text"],r,n)},mathmlBuilder(t,e){var n=kL(t,e);return em(t.body,n)}});bn({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=xi(t.body,e),r=Q1("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Mi({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]});return Xt(["mord","underline"],[s],e)},mathmlBuilder(t,e){var n=new Jt("mo",[new Va("‾")]);n.setAttribute("stretchy","true");var r=new Jt("munder",[is(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});bn({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=xi(t.body,e),r=e.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return Mi({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){return new Jt("mpadded",[is(t.body,e)],["vcenter"])}});bn({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new Qt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=PL(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var a=n[s];a==="~"&&(a="\\textasciitilde"),r.push(Ll(a,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return Xt(["mord","text"].concat(i.sizingClasses(e)),aq(r),i)},mathmlBuilder(t,e){var n=new Va(PL(t)),r=new Jt("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var PL=t=>t.body.replace(/ /g,t.star?"␣":" "),j0=uq,Vq=`[ \r
	]`,gye="\\\\[a-zA-Z@]+",vye="\\\\[^\uD800-\uDFFF]",xye="("+gye+")"+Vq+"*",yye=`\\\\(
|[ \r	]+
?)[ \r	]*`,RR="[̀-ͯ]",bye=new RegExp(RR+"+$"),_ye="("+Vq+"+)|"+(yye+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(RR+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(RR+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+xye)+("|"+vye+")");class DL{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(_ye,"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 tu("EOF",new wc(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new Qt("Unexpected character: '"+e[n]+"'",new tu(e[n],new wc(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 tu(i,new wc(this,n,this.tokenRegex.lastIndex))}}class Sye{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 Qt("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 wye=Pq;De("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});De("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});De("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});De("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});De("\\@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}});De("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");De("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var IL={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};De("\\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 Qt("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=IL[e.text],r==null||r>=n)throw new Qt("Invalid base-"+n+" digit "+e.text);for(var i;(i=IL[t.future().text])!=null&&i<n;)r*=n,r+=i,t.popToken()}return"\\@char{"+r+"}"});var Pk=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new Qt("\\newcommand's first argument must be a macro name");var s=i[0].text,a=t.isDefined(s);if(a&&!e)throw new Qt("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!a&&!n)throw new Qt("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var o=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 Qt("Invalid number of arguments: "+l);o=parseInt(l),i=t.consumeArg().tokens}return a&&r||t.macros.set(s,{tokens:i,numArgs:o}),""};De("\\newcommand",t=>Pk(t,!1,!0,!1));De("\\renewcommand",t=>Pk(t,!0,!1,!1));De("\\providecommand",t=>Pk(t,!0,!0,!0));De("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});De("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});De("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),j0[n],hs.math[n],hs.text[n]),""});De("\\bgroup","{");De("\\egroup","}");De("~","\\nobreakspace");De("\\lq","`");De("\\rq","'");De("\\aa","\\r a");De("\\AA","\\r A");De("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");De("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");De("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");De("ℬ","\\mathscr{B}");De("ℰ","\\mathscr{E}");De("ℱ","\\mathscr{F}");De("ℋ","\\mathscr{H}");De("ℐ","\\mathscr{I}");De("ℒ","\\mathscr{L}");De("ℳ","\\mathscr{M}");De("ℛ","\\mathscr{R}");De("ℭ","\\mathfrak{C}");De("ℌ","\\mathfrak{H}");De("ℨ","\\mathfrak{Z}");De("\\Bbbk","\\Bbb{k}");De("·","\\cdotp");De("\\llap","\\mathllap{\\textrm{#1}}");De("\\rlap","\\mathrlap{\\textrm{#1}}");De("\\clap","\\mathclap{\\textrm{#1}}");De("\\mathstrut","\\vphantom{(}");De("\\underbar","\\underline{\\text{#1}}");De("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');De("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");De("\\ne","\\neq");De("≠","\\neq");De("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");De("∉","\\notin");De("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");De("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");De("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");De("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");De("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");De("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");De("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");De("⟂","\\perp");De("‼","\\mathclose{!\\mkern-0.8mu!}");De("∌","\\notni");De("⌜","\\ulcorner");De("⌝","\\urcorner");De("⌞","\\llcorner");De("⌟","\\lrcorner");De("©","\\copyright");De("®","\\textregistered");De("️","\\textregistered");De("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');De("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');De("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');De("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');De("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");De("⋮","\\vdots");De("\\varGamma","\\mathit{\\Gamma}");De("\\varDelta","\\mathit{\\Delta}");De("\\varTheta","\\mathit{\\Theta}");De("\\varLambda","\\mathit{\\Lambda}");De("\\varXi","\\mathit{\\Xi}");De("\\varPi","\\mathit{\\Pi}");De("\\varSigma","\\mathit{\\Sigma}");De("\\varUpsilon","\\mathit{\\Upsilon}");De("\\varPhi","\\mathit{\\Phi}");De("\\varPsi","\\mathit{\\Psi}");De("\\varOmega","\\mathit{\\Omega}");De("\\substack","\\begin{subarray}{c}#1\\end{subarray}");De("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");De("\\boxed","\\fbox{$\\displaystyle{#1}$}");De("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");De("\\implies","\\DOTSB\\;\\Longrightarrow\\;");De("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");De("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");De("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var OL={",":"\\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"},Mye=new Set(["bin","rel"]);De("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in OL?e=OL[n]:(n.slice(0,4)==="\\not"||n in hs.math&&Mye.has(hs.math[n].group))&&(e="\\dotsb"),e});var Dk={")":!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};De("\\dotso",function(t){var e=t.future().text;return e in Dk?"\\ldots\\,":"\\ldots"});De("\\dotsc",function(t){var e=t.future().text;return e in Dk&&e!==","?"\\ldots\\,":"\\ldots"});De("\\cdots",function(t){var e=t.future().text;return e in Dk?"\\@cdots\\,":"\\@cdots"});De("\\dotsb","\\cdots");De("\\dotsm","\\cdots");De("\\dotsi","\\!\\cdots");De("\\dotsx","\\ldots\\,");De("\\DOTSI","\\relax");De("\\DOTSB","\\relax");De("\\DOTSX","\\relax");De("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");De("\\,","\\tmspace+{3mu}{.1667em}");De("\\thinspace","\\,");De("\\>","\\mskip{4mu}");De("\\:","\\tmspace+{4mu}{.2222em}");De("\\medspace","\\:");De("\\;","\\tmspace+{5mu}{.2777em}");De("\\thickspace","\\;");De("\\!","\\tmspace-{3mu}{.1667em}");De("\\negthinspace","\\!");De("\\negmedspace","\\tmspace-{4mu}{.2222em}");De("\\negthickspace","\\tmspace-{5mu}{.277em}");De("\\enspace","\\kern.5em ");De("\\enskip","\\hskip.5em\\relax");De("\\quad","\\hskip1em\\relax");De("\\qquad","\\hskip2em\\relax");De("\\tag","\\@ifstar\\tag@literal\\tag@paren");De("\\tag@paren","\\tag@literal{({#1})}");De("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new Qt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});De("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");De("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");De("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");De("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");De("\\newline","\\\\\\relax");De("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Gq=dn(Yf["Main-Regular"][84][1]-.7*Yf["Main-Regular"][65][1]);De("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Gq+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");De("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Gq+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");De("\\hspace","\\@ifstar\\@hspacer\\@hspace");De("\\@hspace","\\hskip #1\\relax");De("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");De("\\ordinarycolon",":");De("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");De("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');De("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');De("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');De("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');De("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');De("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');De("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');De("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');De("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');De("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');De("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');De("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');De("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');De("∷","\\dblcolon");De("∹","\\eqcolon");De("≔","\\coloneqq");De("≕","\\eqqcolon");De("⩴","\\Coloneqq");De("\\ratio","\\vcentcolon");De("\\coloncolon","\\dblcolon");De("\\colonequals","\\coloneqq");De("\\coloncolonequals","\\Coloneqq");De("\\equalscolon","\\eqqcolon");De("\\equalscoloncolon","\\Eqqcolon");De("\\colonminus","\\coloneq");De("\\coloncolonminus","\\Coloneq");De("\\minuscolon","\\eqcolon");De("\\minuscoloncolon","\\Eqcolon");De("\\coloncolonapprox","\\Colonapprox");De("\\coloncolonsim","\\Colonsim");De("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");De("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");De("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");De("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");De("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");De("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");De("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");De("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");De("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");De("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");De("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");De("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");De("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");De("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");De("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");De("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");De("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");De("\\nleqq","\\html@mathml{\\@nleqq}{≰}");De("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");De("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");De("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");De("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");De("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");De("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");De("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");De("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");De("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");De("\\imath","\\html@mathml{\\@imath}{ı}");De("\\jmath","\\html@mathml{\\@jmath}{ȷ}");De("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");De("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");De("⟦","\\llbracket");De("⟧","\\rrbracket");De("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");De("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");De("⦃","\\lBrace");De("⦄","\\rBrace");De("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");De("⦵","\\minuso");De("\\darr","\\downarrow");De("\\dArr","\\Downarrow");De("\\Darr","\\Downarrow");De("\\lang","\\langle");De("\\rang","\\rangle");De("\\uarr","\\uparrow");De("\\uArr","\\Uparrow");De("\\Uarr","\\Uparrow");De("\\N","\\mathbb{N}");De("\\R","\\mathbb{R}");De("\\Z","\\mathbb{Z}");De("\\alef","\\aleph");De("\\alefsym","\\aleph");De("\\Alpha","\\mathrm{A}");De("\\Beta","\\mathrm{B}");De("\\bull","\\bullet");De("\\Chi","\\mathrm{X}");De("\\clubs","\\clubsuit");De("\\cnums","\\mathbb{C}");De("\\Complex","\\mathbb{C}");De("\\Dagger","\\ddagger");De("\\diamonds","\\diamondsuit");De("\\empty","\\emptyset");De("\\Epsilon","\\mathrm{E}");De("\\Eta","\\mathrm{H}");De("\\exist","\\exists");De("\\harr","\\leftrightarrow");De("\\hArr","\\Leftrightarrow");De("\\Harr","\\Leftrightarrow");De("\\hearts","\\heartsuit");De("\\image","\\Im");De("\\infin","\\infty");De("\\Iota","\\mathrm{I}");De("\\isin","\\in");De("\\Kappa","\\mathrm{K}");De("\\larr","\\leftarrow");De("\\lArr","\\Leftarrow");De("\\Larr","\\Leftarrow");De("\\lrarr","\\leftrightarrow");De("\\lrArr","\\Leftrightarrow");De("\\Lrarr","\\Leftrightarrow");De("\\Mu","\\mathrm{M}");De("\\natnums","\\mathbb{N}");De("\\Nu","\\mathrm{N}");De("\\Omicron","\\mathrm{O}");De("\\plusmn","\\pm");De("\\rarr","\\rightarrow");De("\\rArr","\\Rightarrow");De("\\Rarr","\\Rightarrow");De("\\real","\\Re");De("\\reals","\\mathbb{R}");De("\\Reals","\\mathbb{R}");De("\\Rho","\\mathrm{P}");De("\\sdot","\\cdot");De("\\sect","\\S");De("\\spades","\\spadesuit");De("\\sub","\\subset");De("\\sube","\\subseteq");De("\\supe","\\supseteq");De("\\Tau","\\mathrm{T}");De("\\thetasym","\\vartheta");De("\\weierp","\\wp");De("\\Zeta","\\mathrm{Z}");De("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");De("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");De("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");De("\\bra","\\mathinner{\\langle{#1}|}");De("\\ket","\\mathinner{|{#1}\\rangle}");De("\\braket","\\mathinner{\\langle{#1}\\rangle}");De("\\Bra","\\left\\langle#1\\right|");De("\\Ket","\\left|#1\\right\\rangle");var Wq=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,a=e.macros.get("|"),o=e.macros.get("\\|");e.macros.beginGroup();var l=h=>g=>{t&&(g.macros.set("|",a),i.length&&g.macros.set("\\|",o));var v=h;if(!h&&i.length){var b=g.future();b.text==="|"&&(g.popToken(),v=!0)}return{tokens:v?i:r,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,d=e.expandTokens([...s,...c,...n]);return e.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};De("\\bra@ket",Wq(!1));De("\\bra@set",Wq(!0));De("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");De("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");De("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");De("\\angln","{\\angl n}");De("\\blue","\\textcolor{##6495ed}{#1}");De("\\orange","\\textcolor{##ffa500}{#1}");De("\\pink","\\textcolor{##ff00af}{#1}");De("\\red","\\textcolor{##df0030}{#1}");De("\\green","\\textcolor{##28ae7b}{#1}");De("\\gray","\\textcolor{gray}{#1}");De("\\purple","\\textcolor{##9d38bd}{#1}");De("\\blueA","\\textcolor{##ccfaff}{#1}");De("\\blueB","\\textcolor{##80f6ff}{#1}");De("\\blueC","\\textcolor{##63d9ea}{#1}");De("\\blueD","\\textcolor{##11accd}{#1}");De("\\blueE","\\textcolor{##0c7f99}{#1}");De("\\tealA","\\textcolor{##94fff5}{#1}");De("\\tealB","\\textcolor{##26edd5}{#1}");De("\\tealC","\\textcolor{##01d1c1}{#1}");De("\\tealD","\\textcolor{##01a995}{#1}");De("\\tealE","\\textcolor{##208170}{#1}");De("\\greenA","\\textcolor{##b6ffb0}{#1}");De("\\greenB","\\textcolor{##8af281}{#1}");De("\\greenC","\\textcolor{##74cf70}{#1}");De("\\greenD","\\textcolor{##1fab54}{#1}");De("\\greenE","\\textcolor{##0d923f}{#1}");De("\\goldA","\\textcolor{##ffd0a9}{#1}");De("\\goldB","\\textcolor{##ffbb71}{#1}");De("\\goldC","\\textcolor{##ff9c39}{#1}");De("\\goldD","\\textcolor{##e07d10}{#1}");De("\\goldE","\\textcolor{##a75a05}{#1}");De("\\redA","\\textcolor{##fca9a9}{#1}");De("\\redB","\\textcolor{##ff8482}{#1}");De("\\redC","\\textcolor{##f9685d}{#1}");De("\\redD","\\textcolor{##e84d39}{#1}");De("\\redE","\\textcolor{##bc2612}{#1}");De("\\maroonA","\\textcolor{##ffbde0}{#1}");De("\\maroonB","\\textcolor{##ff92c6}{#1}");De("\\maroonC","\\textcolor{##ed5fa6}{#1}");De("\\maroonD","\\textcolor{##ca337c}{#1}");De("\\maroonE","\\textcolor{##9e034e}{#1}");De("\\purpleA","\\textcolor{##ddd7ff}{#1}");De("\\purpleB","\\textcolor{##c6b9fc}{#1}");De("\\purpleC","\\textcolor{##aa87ff}{#1}");De("\\purpleD","\\textcolor{##7854ab}{#1}");De("\\purpleE","\\textcolor{##543b78}{#1}");De("\\mintA","\\textcolor{##f5f9e8}{#1}");De("\\mintB","\\textcolor{##edf2df}{#1}");De("\\mintC","\\textcolor{##e0e5cc}{#1}");De("\\grayA","\\textcolor{##f6f7f7}{#1}");De("\\grayB","\\textcolor{##f0f1f2}{#1}");De("\\grayC","\\textcolor{##e3e5e6}{#1}");De("\\grayD","\\textcolor{##d6d8da}{#1}");De("\\grayE","\\textcolor{##babec2}{#1}");De("\\grayF","\\textcolor{##888d93}{#1}");De("\\grayG","\\textcolor{##626569}{#1}");De("\\grayH","\\textcolor{##3b3e40}{#1}");De("\\grayI","\\textcolor{##21242c}{#1}");De("\\kaBlue","\\textcolor{##314453}{#1}");De("\\kaGreen","\\textcolor{##71B307}{#1}");var $q={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Tye{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 Sye(wye,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new DL(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 tu("EOF",r.loc)),this.pushTokens(i),new tu("",wc.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,a=0,o=0;do{if(s=this.popToken(),n.push(s),s.text==="{")++a;else if(s.text==="}"){if(--a,a===-1)throw new Qt("Extra }",s)}else if(s.text==="EOF")throw new Qt("Unexpected end of input in a macro argument, expected '"+(e&&r?e[o]:"}")+"'",s);if(e&&r)if((a===0||a===1&&e[o]==="{")&&s.text===e[o]){if(++o,o===e.length){n.splice(-o,o);break}}else o=0}while(a!==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 Qt("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 Qt("Use of the macro doesn't match its definition",s)}}for(var a=[],o=0;o<e;o++)a.push(this.consumeArg(n&&n[o+1]).tokens);return a}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new Qt("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 Qt("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var s=i.tokens,a=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var o=s.length-1;o>=0;--o){var l=s[o];if(l.text==="#"){if(o===0)throw new Qt("Incomplete placeholder at end of macro body",l);if(l=s[--o],l.text==="#")s.splice(o+1,1);else if(/^[1-9]$/.test(l.text))s.splice(o,2,...a[+l.text-1]);else throw new Qt("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 tu(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 a=i.replace(/##/g,"");a.includes("#"+(s+1));)++s;for(var o=new DL(i,this.settings),l=[],c=o.lex();c.text!=="EOF";)l.push(c),c=o.lex();l.reverse();var d={tokens:l,numArgs:s};return d}return i}isDefined(e){return this.macros.has(e)||j0.hasOwnProperty(e)||hs.math.hasOwnProperty(e)||hs.text.hasOwnProperty(e)||$q.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:j0.hasOwnProperty(e)&&!j0[e].primitive}}var LL=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,w4=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),kA={"́":{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"}},zL={á:"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 VT{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 Tye(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 Qt("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 tu("}")),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(VT.endOfExpression.has(i.text)||n&&i.text===n||e&&j0[i.text]&&j0[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 Qt("only one infix operator per group",e[i].token);n=i,r=e[i].replaceWith}if(n!==-1&&r){var s,a,o=e.slice(0,n),l=e.slice(n+1);o.length===1&&o[0].type==="ordgroup"?s=o[0]:s={type:"ordgroup",mode:this.mode,body:o},l.length===1&&l[0].type==="ordgroup"?a=l[0]:a={type:"ordgroup",mode:this.mode,body:l};var c;return r==="\\\\abovefrac"?c=this.callFunction(r,[s,e[n],a],[]):c=this.callFunction(r,[s,a],[]),[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 Qt("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 a=s.text==="\\limits";n.limits=a,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=s.text==="\\limits");else throw new Qt("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new Qt("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new Qt("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new Qt("Double superscript",s);var o={type:"textord",mode:this.mode,text:"\\prime"},l=[o];for(this.consume();this.fetch().text==="'";)l.push(o),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:l}}else if(w4[s.text]){var c=LL.test(s.text),d=[];for(d.push(new tu(w4[s.text])),this.consume();;){var h=this.fetch().text;if(!w4[h]||LL.test(h)!==c)break;d.unshift(new tu(w4[h])),this.consume()}var g=this.subparse(d);c?i={type:"ordgroup",mode:"math",body:g}:r={type:"ordgroup",mode:"math",body:g}}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=j0[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new Qt("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new Qt("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new Qt("Can't use function '"+i+"' in math mode",r);var{args:a,optArgs:o}=this.parseArguments(i,s);return this.callFunction(i,a,o,r,e)}callFunction(e,n,r,i,s){var a={funcName:e,parser:this,token:i,breakOnTokenText:s},o=j0[e];if(o&&o.handler)return o.handler(a,n,r);throw new Qt("No function handler for "+e)}parseArguments(e,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var i=[],s=[],a=0;a<r;a++){var o=n.argTypes&&n.argTypes[a],l=a<n.numOptionalArgs;(n.primitive&&o==null||n.type==="sqrt"&&a===1&&s[0]==null)&&(o="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",o,l);if(l)s.push(c);else if(c!=null)i.push(c);else throw new Qt("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 Qt("A primitive argument cannot be optional");var a=this.parseGroup(e);if(a==null)throw new Qt("Expected group as "+e,this.fetch());return a}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Qt("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="",a;(a=this.fetch()).text!=="EOF"&&e.test(s+a.text);)i=a,s+=i.text,this.consume();if(s==="")throw new Qt("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 Qt("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 Qt("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!tq(s))throw new Qt("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 a={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return n&&this.switchMode(i),a}parseGroup(e,n){var r=this.fetch(),i=r.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var a=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var o=this.parseExpression(!1,a),l=this.fetch();this.expect(a),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:wc.range(r,l),body:o,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!$q.hasOwnProperty(i)){if(this.settings.throwOnError)throw new Qt("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:wc.range(i,e[r+2]),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:wc.range(i,e[r+1]),text:"--"}),n-=1)),(s==="'"||s==="`")&&e[r+1].text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:wc.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 Qt(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}zL.hasOwnProperty(n[0])&&!hs[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',e),n=zL[n[0]]+n.slice(1));var s=bye.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var a;if(hs[this.mode][n]){this.settings.strict&&this.mode==="math"&&wR.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var o=hs[this.mode][n].group,l=wc.range(e),c;if(_1e.hasOwnProperty(o)){var d=o;c={type:"atom",mode:this.mode,family:d,loc:l,text:n}}else c={type:o,mode:this.mode,loc:l,text:n};a=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(eq(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)),a={type:"textord",mode:"text",loc:wc.range(e),text:n};else return null;if(this.consume(),s)for(var h=0;h<s[0].length;h++){var g=s[0][h];if(!kA[g])throw new Qt("Unknown accent ' "+g+"'",e);var v=kA[g][this.mode]||kA[g].text;if(!v)throw new Qt("Accent "+g+" unsupported in "+this.mode+" mode",e);a={type:"accent",mode:this.mode,loc:wc.range(e),label:v,isStretchy:!1,isShifty:!0,base:a}}return a}}VT.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Ik=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new VT(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 Qt("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new tu("\\df@tag")])}]}return i},qq=function(e,n,r){n.textContent="";var i=Ok(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."),qq=function(){throw new Qt("KaTeX doesn't work in quirks mode.")});var Eye=function(e,n){var r=Ok(e,n).toMarkup();return r},Cye=function(e,n){var r=new vk(n);return Ik(e,r)},Xq=function(e,n,r){if(r.throwOnError||!(e instanceof Qt))throw e;var i=Xt(["katex-error"],[new Xu(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},Ok=function(e,n){var r=new vk(n);try{var i=Ik(e,r);return z1e(i,e,r)}catch(s){return Xq(s,e,r)}},Aye=function(e,n){var r=new vk(n);try{var i=Ik(e,r);return j1e(i,e,r)}catch(s){return Xq(s,e,r)}},Nye="0.16.33",Rye={Span:fw,Anchor:bk,SymbolNode:Xu,SvgNode:hp,PathNode:Q0,LineNode:SR},kR={version:Nye,render:qq,renderToString:Eye,ParseError:Qt,SETTINGS_SCHEMA:jM,__parse:Cye,__renderToDomTree:Ok,__renderToHTMLTree:Aye,__setFontMetrics:h1e,__defineSymbol:Q,__defineFunction:bn,__defineMacro:De,__domTree:Rye};const kye={};function Pye(t){const e=this,n=t||kye,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Vxe(n)),s.push(Oxe()),a.push(Lxe(n))}const jL=/[#.]/g;function Dye(t,e){const n=t||"",r={};let i=0,s,a;for(;i<n.length;){jL.lastIndex=i;const o=jL.exec(n),l=n.slice(i,o?o.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:a=l,i+=l.length),o&&(s=o[0],i++)}return{type:"element",tagName:a||e||"div",properties:r,children:[]}}function Yq(t,e,n){const r=n?zye(n):void 0;function i(s,a,...o){let l;if(s==null){l={type:"root",children:[]};const c=a;o.unshift(c)}else{l=Dye(s,e);const c=l.tagName.toLowerCase(),d=r?r.get(c):void 0;if(l.tagName=d||c,Iye(a))o.unshift(a);else for(const[h,g]of Object.entries(a))Oye(t,l.properties,h,g)}for(const c of o)PR(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function Iye(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 a of s)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function Oye(t,e,n,r){const i=w$(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=SO(r):i.commaSeparated?s=vO(r):i.commaOrSpaceSeparated?s=SO(vO(r).join(" ")):s=FL(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?Lye(r):String(r);if(Array.isArray(s)){const a=[];for(const o of s)a.push(FL(i,i.property,o));s=a}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function PR(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)PR(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?PR(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function FL(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||dS(n)===dS(e)))return!0}return n}function Lye(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function zye(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const jye=["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"],Fye=Yq(M$,"div"),Uye=Yq(RT,"g",jye),PA={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Bye(t,e){return Kq(t,{})||{type:"root",children:[]}}function Kq(t,e){const n=Hye(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function Hye(t,e){switch(t.nodeType){case 1:return $ye(t,e);case 3:return Gye(t);case 8:return Wye(t);case 9:return UL(t,e);case 10:return Vye();case 11:return UL(t,e);default:return}}function UL(t,e){return{type:"root",children:Zq(t,e)}}function Vye(){return{type:"doctype"}}function Gye(t){return{type:"text",value:t.nodeValue||""}}function Wye(t){return{type:"comment",value:t.nodeValue||""}}function $ye(t,e){const n=t.namespaceURI,r=n===PA.svg?Uye:Fye,i=n===PA.html?t.tagName.toLowerCase():t.tagName,s=n===PA.html&&i==="template"?t.content:t,a=t.getAttributeNames(),o={};let l=-1;for(;++l<a.length;)o[a[l]]=t.getAttribute(a[l])||"";return r(i,o,Zq(s,e))}function Zq(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=Kq(n[i],e);s!==void 0&&r.push(s)}return r}new DOMParser;function qye(t,e){const n=Xye(t);return Bye(n)}function Xye(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const BL=(function(t,e,n){const r=pk(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]}),wv=(function(t){if(t==null)return Zye;if(typeof t=="string")return Kye(t);if(typeof t=="object")return Yye(t);if(typeof t=="function")return Lk(t);throw new Error("Expected function, string, or array as `test`")});function Yye(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=wv(t[n]);return Lk(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Kye(t){return Lk(e);function e(n){return n.tagName===t}}function Lk(t){return e;function e(n,r,i){return!!(Qye(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Zye(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function Qye(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const HL=/\n/g,VL=/[\t ]+/g,DR=wv("br"),GL=wv(abe),Jye=wv("p"),WL=wv("tr"),ebe=wv(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",sbe,obe]),Qq=wv(["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 tbe(t,e){const n=e||{},r="children"in t?t.children:[],i=Qq(t),s=tX(t,{whitespace:n.whitespace||"normal"}),a=[];(t.type==="text"||t.type==="comment")&&a.push(...eX(t,{breakBefore:!0,breakAfter:!0}));let o=-1;for(;++o<r.length;)a.push(...Jq(r[o],t,{whitespace:s,breakBefore:o?void 0:i,breakAfter:o<r.length-1?DR(r[o+1]):i}));const l=[];let c;for(o=-1;++o<a.length;){const d=a[o];typeof d=="number"?c!==void 0&&d>c&&(c=d):d&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(d))}return l.join("")}function Jq(t,e,n){return t.type==="element"?nbe(t,e,n):t.type==="text"?n.whitespace==="normal"?eX(t,n):rbe(t):[]}function nbe(t,e,n){const r=tX(t,n),i=t.children||[];let s=-1,a=[];if(ebe(t))return a;let o,l;for(DR(t)||WL(t)&&BL(e,t,WL)?l=`
`:Jye(t)?(o=2,l=2):Qq(t)&&(o=1,l=1);++s<i.length;)a=a.concat(Jq(i[s],t,{whitespace:r,breakBefore:s?void 0:o,breakAfter:s<i.length-1?DR(i[s+1]):l}));return GL(t)&&BL(e,t,GL)&&a.push("	"),o&&a.unshift(o),l&&a.push(l),a}function eX(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){HL.lastIndex=s;const l=HL.exec(n),c=l&&"index"in l?l.index:n.length;r.push(ibe(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 a=-1,o;for(;++a<r.length;)r[a].charCodeAt(r[a].length-1)===8203||a<r.length-1&&r[a+1].charCodeAt(0)===8203?(i.push(r[a]),o=void 0):r[a]?(typeof o=="number"&&i.push(o),i.push(r[a]),o=0):(a===0||a===r.length-1)&&i.push(0);return i}function rbe(t){return[String(t.value)]}function ibe(t,e,n){const r=[];let i=0,s;for(;i<t.length;){VL.lastIndex=i;const a=VL.exec(t);s=a?a.index:t.length,!i&&!s&&a&&!e&&r.push(""),i!==s&&r.push(t.slice(i,s)),i=a?s+a[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function tX(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 sbe(t){return!!(t.properties||{}).hidden}function abe(t){return t.tagName==="td"||t.tagName==="th"}function obe(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const lbe={},cbe=[];function ube(t){const e=t||lbe;return function(n,r){Z$(n,"element",function(i,s){const a=Array.isArray(i.properties.className)?i.properties.className:cbe,o=a.includes("language-math"),l=a.includes("math-display"),c=a.includes("math-inline");let d=l;if(!o&&!l&&!c)return;let h=s[s.length-1],g=i;if(i.tagName==="code"&&o&&h&&h.type==="element"&&h.tagName==="pre"&&(g=h,h=s[s.length-2],d=!0),!h)return;const v=tbe(g,{whitespace:"pre"});let b;try{b=kR.renderToString(v,{...e,displayMode:d,throwOnError:!0})}catch(w){const S=w,E=S.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...s,i],cause:S,place:i.position,ruleId:E,source:"rehype-katex"});try{b=kR.renderToString(v,{...e,displayMode:d,strict:"ignore",throwOnError:!1})}catch{b=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(e.errorColor||"#cc0000"),title:String(w)},children:[{type:"text",value:v}]}]}}typeof b=="string"&&(b=qye(b).children);const _=h.children.indexOf(g);return h.children.splice(_,1,...b),K$})}}function zk(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 pw(t){const e=new Map,n=zk(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 mw(t){const e=new Map,n=zk(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 a=new Map;for(const[o,l]of Object.entries(s)){const c=l;typeof(c==null?void 0:c.min)=="number"&&typeof(c==null?void 0:c.max)=="number"&&a.set(o,{min:c.min,max:c.max})}a.size>0&&e.set(i.name,a)}}return e}function gw(t){const e=new Map;if(!t)return e;for(const[n,r]of Object.entries(t)){const i=new Map;for(const[s,a]of Object.entries(r))typeof(a==null?void 0:a.min)=="number"&&typeof(a==null?void 0:a.max)=="number"&&i.set(s,{min:a.min,max:a.max});i.size>0&&e.set(n,i)}return e}function vw(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[a,o]of i)s.set(a,o);n.set(r,s)}return n}function y1({prompts:t,data:e,samplesData:n,rolloutMetrics:r,goldenAnswers:i,infoTurns:s,isLoading:a,step:o,scrollToSampleId:l=null,showGoTo:c=!1,goToBasePath:d="/rollouts",goToStepParam:h="step",filterGroupId:g=null,filterSampleIdx:v=null,lastValidSampleAtom:b=MG,collapseAllSignal:_=0,expandAllSignal:w=0,defaultSectionsOpen:S=!0,envRewardRanges:E,envMetricRanges:A,advantageRange:N,renderOptions:I=[],formatThinkBlocks:P=!0}){var le;const L=T.useMemo(()=>{if(!r)return new Map;const fe=new Map;for(const xe of r){const he=fe.get(xe.sample_idx)||[];he.push(xe),fe.set(xe.sample_idx,he)}return fe},[r]),R=T.useMemo(()=>{if(!r)return[];const fe=new Set;for(const xe of r)fe.add(xe.metric_name);return[...fe].sort()},[r]),O=T.useMemo(()=>{if(!i)return new Map;const fe=new Map;for(const xe of i){const he=fe.get(xe.sample_idx)||[];he.push(xe),fe.set(xe.sample_idx,he)}return fe},[i]),W=T.useMemo(()=>{if(!s)return new Map;const fe=new Map;for(const xe of s){const he=fe.get(xe.sample_idx)||[];he.push(xe),fe.set(xe.sample_idx,he)}return fe},[s]),U=T.useMemo(()=>{if(!t)return new Map;const fe=new Map;for(const xe of t)fe.set(xe.group_id,xe);return fe},[t]),V=T.useMemo(()=>{if(!n)return new Map;const fe=new Map;for(const xe of n)fe.set(xe.sample_idx,xe);return fe},[n]),G=T.useMemo(()=>{if(!e)return[];const fe=new Map,xe=new Map;for(const We of e){const Se=fe.get(We.sample_idx)||[];Se.push(We),fe.set(We.sample_idx,Se),xe.set(We.sample_idx,We.group_id)}const he=[];for(const[We,Se]of fe){const Le=[...Se].sort((Xe,Ae)=>Xe.turn_order-Ae.turn_order),pe=xe.get(We)??-1,Re=U.get(pe)??null,ne=V.get(We);he.push({sample_idx:We,group_id:pe,prompt:Re,turns:Le,reward:(ne==null?void 0:ne.reward)??null,advantage:(ne==null?void 0:ne.advantage)??null,total_tokens:(ne==null?void 0:ne.total_tokens)??null,raw_string:(ne==null?void 0:ne.raw_string)??null})}let Te=he.sort((We,Se)=>We.sample_idx-Se.sample_idx);return g!==null&&(Te=Te.filter(We=>We.group_id===g)),v!==null&&(Te=Te.filter(We=>We.sample_idx===v)),Te},[e,U,V,g,v]),[Z,B]=cn(b),q=G[0],Y=(q==null?void 0:q.sample_idx)??null,K=T.useMemo(()=>Y!==null?L.get(Y)??[]:[],[L,Y]),J=T.useMemo(()=>Y!==null?O.get(Y)??[]:[],[O,Y]),F=T.useMemo(()=>Y!==null?W.get(Y)??[]:[],[W,Y]);T.useEffect(()=>{!q||v===null||B({sample:q,rolloutMetrics:K,goldenAnswers:J})},[q,K,J,v,B]);const j=v!==null&&(Z==null?void 0:Z.sample.sample_idx)===v?Z:null,X=q||(j==null?void 0:j.sample),H=q?K:(j==null?void 0:j.rolloutMetrics)||[],se=q?J:(j==null?void 0:j.goldenAnswers)||[],re=q?F:[],ie=T.useRef(null);T.useEffect(()=>{if(l==null||ie.current===l)return;const fe=document.getElementById(`sample-${l}`);fe&&(fe.scrollIntoView({behavior:"smooth",block:"start"}),ie.current=l)},[l,G]);const ue=o!==void 0?o:(le=e==null?void 0:e[0])==null?void 0:le.step;return v===null?p.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground text-sm",children:p.jsx("p",{children:"Select a sample from the sidebar to view"})}):!X&&!a?p.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:p.jsx("p",{children:"No rollouts data available"})}):X?p.jsx("div",{className:"space-y-4 min-w-0",children:p.jsx(dbe,{sample:X,rolloutMetrics:H,goldenAnswers:se,infoTurns:re,availableMetricNames:R,showGoTo:c,goToStep:ue,goToBasePath:d,goToStepParam:h,collapseAllSignal:_,expandAllSignal:w,defaultSectionsOpen:S,envRewardRanges:E,envMetricRanges:A,advantageRange:N,renderOptions:I,formatThinkBlocks:P},X.sample_idx)}):null}function dbe({sample:t,rolloutMetrics:e,goldenAnswers:n,infoTurns:r,availableMetricNames:i,showGoTo:s,goToStep:a,goToBasePath:o="/rollouts",goToStepParam:l="step",collapseAllSignal:c=0,expandAllSignal:d=0,defaultSectionsOpen:h=!0,envRewardRanges:g,envMetricRanges:v,advantageRange:b,renderOptions:_=[],formatThinkBlocks:w=!0}){var Te,We;const[S,E]=cn(Bce),A=S.length===0,N=S.length===1&&S[0]==="__none__",I=Se=>A?!0:N?!1:S.includes(Se),P=Se=>{E(Le=>{if(Le.length===0)return i.filter(ne=>ne!==Se);const pe=Le.filter(ne=>ne!=="__none__");if(pe.length===0)return[Se];if(pe.includes(Se)){const ne=pe.filter(Xe=>Xe!==Se);return ne.length===0?["__none__"]:ne}const Re=[...pe,Se];return i.length>0&&Re.length>=i.length?[]:Re})},L=T.useMemo(()=>[...e].sort((Se,Le)=>Se.metric_name.localeCompare(Le.metric_name)),[e]),R=T.useMemo(()=>S.length===0?L:L.filter(Se=>S.includes(Se.metric_name)),[L,S]),O=T.useMemo(()=>n.filter(Se=>Se.value!=null&&Se.value!==""),[n]),W=((Te=t.prompt)==null?void 0:Te.env)??null,U=k5(),V=()=>{a!=null&&U(`${o}?${l}=${a}&group=${t.group_id}&sample=${t.sample_idx}`)},G=T.useMemo(()=>{if(!r||r.length===0)return new Map;const Se=new Map;for(const Le of r){const pe=Se.get(Le.turn_order)||[];pe.push(Le),Se.set(Le.turn_order,pe)}return Se},[r]),[Z,B]=T.useState(!1),[q,Y]=T.useState(!1),[K,J]=T.useState(h),[F,j]=T.useState({}),[X,H]=T.useState(c),[se,re]=T.useState(d),ie=t.turns.length;if(c!==X){H(c),B(!1),Y(!1),J(!1);const Se={};for(let Le=0;Le<ie;Le++)Se[Le]=!1;j(Se)}if(d!==se){re(d),B(!0),Y(!0),J(!0);const Se={};for(let Le=0;Le<ie;Le++)Se[Le]=!0;j(Se)}const ue=Se=>{j(Le=>({...Le,[Se]:!Le[Se]}))},le=W?g==null?void 0:g.get(W):void 0,fe=[];W&&fe.push({label:"Env",value:W});const xe=t.turns.filter(Se=>Se.turn_type==="model").length;if(xe>1&&fe.push({label:"Turns",value:String(xe)}),t.reward!==null){const Se=LA(t.reward,(le==null?void 0:le.min)??null,(le==null?void 0:le.max)??null);fe.push({label:"Reward",value:t.reward.toFixed(2),rangeColor:Se})}if(t.advantage!==null){const Se=LA(t.advantage,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null);fe.push({label:"Advantage",value:t.advantage.toFixed(2),rangeColor:Se})}const he=[];for(const Se of R){const Le=Se.env??W,pe=Sbe(v,Le,Se.metric_name),Re=LA(Se.value,(pe==null?void 0:pe.min)??null,(pe==null?void 0:pe.max)??null);he.push({label:M4(Se.metric_name),value:_be(Se.value),highlight:Re?void 0:Se.value===1?"positive":Se.value===0?"negative":void 0,rangeColor:Re})}return p.jsxs("div",{id:`sample-${t.sample_idx}`,children:[(fe.length>0||he.length>0||s)&&p.jsxs("div",{className:"mb-2 space-y-0.5",children:[(fe.length>0||s||i.length>0)&&p.jsxs("div",{className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[s&&p.jsx(Tn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs mr-1",onClick:V,disabled:a==null,children:"Go to"}),fe.map((Se,Le)=>p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Le>0&&p.jsx("span",{className:"text-foreground/20",children:"·"}),p.jsx("span",{className:"text-muted-foreground",children:Se.label}),p.jsx("span",{className:"font-medium tabular-nums text-foreground/80",style:Se.rangeColor?{color:Se.rangeColor}:void 0,children:Se.value})]},Se.label)),i.length>0&&p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:underline cursor-pointer",children:["Sample Metrics",p.jsx(Vr,{className:"h-3 w-3"})]})}),p.jsxs(pl,{align:"start",className:"w-max max-w-[400px]",children:[p.jsx(_c,{onSelect:Se=>{Se.preventDefault(),E([])},children:"Select All"}),p.jsx(_c,{onSelect:Se=>{Se.preventDefault(),E(["__none__"])},children:"Unselect All"}),p.jsx(Hl,{}),i.map(Se=>p.jsx(vi,{checked:I(Se),onCheckedChange:()=>P(Se),onSelect:Le=>Le.preventDefault(),children:M4(Se)},Se))]})]})]}),he.length>0&&p.jsx("div",{className:"flex items-center gap-1.5 text-xs min-w-0 flex-wrap",children:he.map((Se,Le)=>p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[p.jsx("span",{className:"text-muted-foreground",children:Se.label}),p.jsx("span",{className:Rt("font-medium tabular-nums",!Se.rangeColor&&Se.highlight==="positive"&&"text-emerald-600 dark:text-emerald-400",!Se.rangeColor&&Se.highlight==="negative"&&"text-red-500 dark:text-red-400",!Se.rangeColor&&!Se.highlight&&"text-foreground/80"),style:Se.rangeColor?{color:Se.rangeColor}:void 0,children:Se.value}),Le<he.length-1&&p.jsx("span",{className:"text-foreground/20",children:"·"})]},Se.label))})]}),O.length>0&&p.jsxs(Ki,{open:Z,onOpenChange:B,className:"mb-2",children:[p.jsx(Zi,{asChild:!0,children:p.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:p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/70 font-medium text-[11px] uppercase tracking-wide shrink-0",children:"Golden"}),!Z&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:O.map(Se=>`${M4(Se.key)}: ${Se.value}`).join(" · ")}),p.jsx("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!Z&&"-rotate-90")})})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-2 px-2 -mx-2 bg-amber-500/[0.03] rounded-b",children:p.jsx("div",{className:"flex items-baseline gap-2 text-xs min-w-0 flex-wrap",children:O.map((Se,Le)=>p.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[Le>0&&p.jsx("span",{className:"text-foreground/20",children:"·"}),p.jsx("span",{className:"text-muted-foreground",children:M4(Se.key)}),p.jsx("span",{className:"font-medium text-foreground/80 whitespace-pre-wrap break-words",children:_.length>0&&Se.value?p.jsx(N2,{content:Se.value,renderOptions:_}):Se.value})]},Se.key))})})})]}),((We=t.prompt)==null?void 0:We.system_prompt)&&p.jsxs(Ki,{open:q,onOpenChange:Y,className:"mb-2",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"System"}),!q&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:DA(t.prompt.system_prompt,60,w)}),p.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_system_prompt!=null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_system_prompt.toLocaleString()," ","tokens"]}),p.jsx(OA,{text:t.prompt.system_prompt}),p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!q&&"-rotate-90")})]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-2",children:p.jsx(IA,{content:t.prompt.system_prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.prompt&&p.jsxs(Ki,{open:K,onOpenChange:J,className:"mb-2",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"User"}),!K&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:DA(t.prompt.prompt,60,w)}),p.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_prompt!=null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_prompt.toLocaleString()," tokens"]}),p.jsx(OA,{text:t.prompt.prompt}),p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!K&&"-rotate-90")})]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-2",children:p.jsx(IA,{content:t.prompt.prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.turns.map((Se,Le)=>{const pe=F[Le]??h,Re=Se.turn_type==="model"?t.turns.slice(0,Le).filter(ne=>ne.turn_type==="model").length:null;return p.jsxs(Ki,{open:pe,onOpenChange:()=>ue(Le),className:"mb-2",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:hbe(Se.turn_type)}),!pe&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:DA(Se.content,60,Se.turn_type==="model"&&w)}),p.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[Se.tokens!=null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[Se.tokens.toLocaleString()," tokens"]}),Re!==null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:["Turn ",Re]}),p.jsx(OA,{text:Se.content}),p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!pe&&"-rotate-90")})]})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"py-2",children:[p.jsx(IA,{content:Se.content,renderOptions:_,enableThinkBlocks:Se.turn_type==="model"&&w}),(()=>{const ne=G.get(Se.turn_order);return!ne||ne.length===0?null:p.jsx("div",{className:"mt-2 space-y-1",children:ne.map((Xe,Ae)=>p.jsx(fbe,{info:Xe,renderOptions:_},`${Xe.info_key}-${Ae}`))})})()]})})]},`${Se.sample_idx}-${Se.turn_order}`)})]})}function fbe({info:t,renderOptions:e=[]}){const[n,r]=T.useState(!1);return p.jsxs(Ki,{open:n,onOpenChange:r,children:[p.jsx(Zi,{asChild:!0,children:p.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:[p.jsx(Vr,{className:Rt("h-3 w-3 text-muted-foreground transition-transform shrink-0",!n&&"-rotate-90")}),p.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t.info_key}),!n&&t.info_value&&p.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?"…":""]})]})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-1.5 px-2 text-xs bg-accent/20 rounded mt-0.5",children:e.length>0&&t.info_value?p.jsx(N2,{content:t.info_value,renderOptions:e}):p.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:t.info_value})})})]})}function hbe(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function pbe(t){return t.replace(/<think>[\s\S]*?<\/think>\s*/g,"").trimStart()}function DA(t,e=60,n=!0){if(!t)return"";const i=(n?pbe(t):t).replace(/\s+/g," ").trim();return i.length<=e?i:i.slice(0,e)+"…"}function mbe(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 gbe(t,e=80){const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"…"}function $L({content:t}){const[e,n]=T.useState(!0);return p.jsxs("span",{className:"block",children:[p.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&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-foreground/40 italic text-xs ml-1",children:gbe(t)}),p.jsx("span",{children:"</think>"}),p.jsx(u1,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&p.jsx(Vr,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&p.jsxs("span",{className:"block text-foreground/70",children:[t,p.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 vbe(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 xbe(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 ybe({code:t,language:e}){const[n,r]=T.useState(!1),i=async s=>{s.stopPropagation(),await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsxs("div",{className:"my-2 rounded-md border bg-muted/50 overflow-hidden",children:[e&&p.jsxs("div",{className:"flex items-center justify-between px-3 py-1 text-xs text-muted-foreground border-b bg-muted/30",children:[p.jsx("span",{children:e}),p.jsx("button",{onClick:i,className:"hover:text-foreground transition-colors",title:"Copy code",children:n?p.jsx(xv,{className:"h-3 w-3"}):p.jsx(iT,{className:"h-3 w-3"})})]}),p.jsx("pre",{className:"p-3 text-sm font-sans whitespace-pre-wrap break-words overflow-x-auto",children:p.jsx("code",{children:t})})]})}function bbe({content:t}){const e="katex-scroll",n=vbe(t);return p.jsx("div",{className:Rt("whitespace-pre-wrap break-words [&_.katex]:text-sm",e),children:n.map((r,i)=>{if(r.type==="text")return p.jsx("span",{children:r.value},i);try{const s=kR.renderToString(r.value,{displayMode:r.type==="display",throwOnError:!1});return p.jsx("span",{dangerouslySetInnerHTML:{__html:s}},i)}catch{return p.jsx("span",{children:r.type==="display"?`$$${r.value}$$`:`$${r.value}$`},i)}})})}function qL({content:t,renderMarkdown:e,renderLatex:n}){const r="katex-scroll";if(e){const i=[],s=[];return n&&(i.push(Pye),s.push(ube)),p.jsx("div",{className:Rt("prose prose-sm dark:prose-invert max-w-none break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>*+*]:mt-[0.75em]",n&&r),children:p.jsx(Nxe,{remarkPlugins:i,rehypePlugins:s,children:t})})}return n?p.jsx(bbe,{content:t}):p.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})}function N2({content:t,renderOptions:e=[]}){const n=e.includes("markdown"),r=e.includes("latex"),i=e.includes("code");if(!n&&!r&&!i)return p.jsx(p.Fragment,{children:t});if(i){const s=xbe(t);if(s.some(a=>a.type==="code"))return p.jsx(p.Fragment,{children:s.map((a,o)=>a.type==="code"?p.jsx(ybe,{code:a.value,language:a.language},o):p.jsx(qL,{content:a.value,renderMarkdown:n,renderLatex:r},o))})}return p.jsx(qL,{content:t,renderMarkdown:n,renderLatex:r})}function IA({content:t,renderOptions:e=[],enableThinkBlocks:n=!0}){const r=T.useMemo(()=>n?mbe(t):[{type:"text",value:t}],[t,n]),i=e.length>0;return r.length===1&&r[0].type==="text"?i?p.jsx("div",{className:"text-sm text-foreground/90",children:p.jsx(N2,{content:t,renderOptions:e})}):p.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:t}):i?p.jsx("div",{className:"text-sm text-foreground/90",children:r.map((s,a)=>s.type==="text"?p.jsx(N2,{content:s.value,renderOptions:e},a):p.jsx($L,{content:s.value},a))}):p.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:r.map((s,a)=>s.type==="text"?p.jsx("span",{children:s.value},a):p.jsx($L,{content:s.value},a))})}function OA({text:t}){const[e,n]=T.useState(!1),r=async i=>{i.stopPropagation(),await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),2e3)};return p.jsx("button",{onClick:r,className:"p-0.5 rounded hover:bg-muted-foreground/10 transition-colors",title:e?"Copied!":"Copy to clipboard",children:e?p.jsx(xv,{className:"h-3.5 w-3.5 text-foreground/30"}):p.jsx(iT,{className:"h-3.5 w-3.5 text-foreground/30"})})}function M4(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function _be(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function Sbe(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 LA(t,e,n){return e==null||n==null||e>=n?void 0:`hsl(${(Math.max(0,Math.min(1,(t-e)/(n-e)))*120).toFixed(0)} 80% 38%)`}function GT({rawString:t,totalTokens:e,turns:n}){const[r,i]=T.useState(!1),[s,a]=T.useState(!1),o=async()=>{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)},l=c=>{const d=c.split(`
`);return d.map((h,g)=>p.jsxs("span",{children:[h,g<d.length-1&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/50",children:"\\n"}),`
`]})]},g))};return p.jsxs($f,{children:[p.jsx(sT,{asChild:!0,children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Raw Text"})}),p.jsxs(qf,{className:"sm:max-w-[75vw] max-h-[80vh]",children:[p.jsx(jd,{children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Fd,{children:"Raw Text"}),p.jsxs("span",{className:"text-xs text-muted-foreground",children:[e!=null&&p.jsxs(p.Fragment,{children:[e.toLocaleString()," tokens"]}),e!=null&&n!=null&&n>0&&" • ",n!=null&&n>0&&p.jsxs(p.Fragment,{children:[n," ",n===1?"turn":"turns"]})]}),p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:o,children:[r?p.jsx(xv,{className:"size-3"}):p.jsx(iT,{className:"size-3"}),r?"Copied":"Copy"]}),p.jsx(p1,{variant:"outline",size:"sm",pressed:s,onPressedChange:a,className:"text-xs",children:"Line breaks"})]})}),p.jsx(yv,{className:"h-[60vh] w-full rounded-md border bg-background p-4",children:p.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:s?l(t):t})})]})]})}function wbe(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 Mbe(t){switch(t){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}}function Tbe(t){const e=T.useMemo(()=>{if(t!=null&&t.prompts)return t.prompts.map(o=>({step:o.trainer_step,group_id:o.group_id,env:o.env,system_prompt:o.system_prompt,tokens_system_prompt:o.tokens_system_prompt,prompt:o.prompt,tokens_prompt:o.tokens_prompt}))},[t]),n=T.useMemo(()=>{if(t!=null&&t.rollouts)return t.rollouts.map(o=>({step:o.trainer_step,group_id:o.group_id,sample_idx:o.sample_idx,turn_order:o.turn_order,turn_type:o.turn_type,content:o.content,tokens:o.tokens}))},[t]),r=T.useMemo(()=>{if(t!=null&&t.samples_data)return t.samples_data.map(o=>({step:o.trainer_step,group_id:o.group_id,sample_idx:o.sample_idx,reward:o.reward,advantage:o.advantage,turns:o.turns,total_tokens:o.total_tokens,raw_string:o.raw_string}))},[t]),i=T.useMemo(()=>{if(!(t!=null&&t.rollout_metrics))return;const o=t.trainer_step??0;return t.rollout_metrics.map(l=>({step:o,sample_idx:l.sample_idx,env:l.env,metric_name:l.metric_name,value:l.value}))},[t]),s=T.useMemo(()=>{if(!(t!=null&&t.golden_answers))return;const o=t.trainer_step??0;return t.golden_answers.map(l=>({step:o,sample_idx:l.sample_idx,env:l.env,key:l.key,value:l.value}))},[t]),a=T.useMemo(()=>{if(!(t!=null&&t.info_turns))return;const o=t.trainer_step??0;return t.info_turns.map(l=>({step:o,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:a}}function Ebe({runPath:t,groupId:e,sampleId:n,isEval:r,isCanceled:i,children:s}){var ie,ue,le,fe;const[a,o]=T.useState(!1),{data:l,isLoading:c,error:d}=RG(t,e,n,a,r),{data:h}=ed(t,a&&!!t,!1),g=r?((ie=h==null?void 0:h.summary)==null?void 0:ie.eval_env_details)??((ue=h==null?void 0:h.config)==null?void 0:ue.eval_env_details):(le=h==null?void 0:h.config)==null?void 0:le.environments,v=T.useMemo(()=>pw(g),[g]),b=T.useMemo(()=>{const xe=mw(g),he=gw(h==null?void 0:h.data_metric_ranges);return vw(xe,he)},[g,h==null?void 0:h.data_metric_ranges]),_=T.useMemo(()=>{var We;const xe=(We=h==null?void 0:h.config)==null?void 0:We.group_size,he=typeof xe=="object"&&xe!==null&&"value"in xe?Number(xe.value):Number(xe);if(!he||isNaN(he)||he<=1)return null;const Te=Math.sqrt(he-1);return{min:-Te,max:Te}},[(fe=h==null?void 0:h.config)==null?void 0:fe.group_size]),w=(l==null?void 0:l.kind)==="rollouts_discarded"?l:null,{mappedPrompts:S,mappedRollouts:E,mappedSamplesData:A,mappedRolloutMetrics:N,mappedGoldenAnswers:I,mappedInfoTurns:P}=Tbe(w),L=T.useMemo(()=>{var he;if(!l||l.kind!=="eval")return null;const xe=(he=l.samples_data)==null?void 0:he[0];return xe?{groupId:xe.group_id,sampleIdx:xe.sample_idx}:null},[l]),R=(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,O=k5(),W=T.useMemo(()=>l?l.kind==="rollouts"?`/rollouts?step=${l.step}&group=${e}&sample=${n}`:l.kind==="rollouts_discarded"?`/rollouts-discarded?trainer_step=${l.trainer_step}&group=${e}&sample=${n}`:l.kind==="eval"?`/evals?step=${l.step}&eval_name=${encodeURIComponent(l.eval_name)}&group=${e}&sample=${n}`:null:null,[l,e,n]),U=()=>{W&&(o(!1),O(W))},[V,G]=T.useState(0),[Z,B]=T.useState(0),[q,Y]=T.useState(!0),[K,J]=cn(hT),[F,j]=cn(pT),X=K.length+(F?1:0),H=xe=>{J(he=>he.includes(xe)?he.filter(Te=>Te!==xe):[...he,xe])},se=T.useMemo(()=>{if(!l)return null;const xe=l.kind==="rollouts"?l.samples_data:l.kind==="rollouts_discarded"?A:l.kind==="eval"?l.samples_data:null;if(!xe)return null;const he=l.kind==="eval"?(L==null?void 0:L.sampleIdx)??n:n;return xe.find(Te=>Te.sample_idx===he)??null},[l,A,n,L]),re=!c&&!d&&l&&l.kind!==null;return p.jsxs($f,{open:a,onOpenChange:o,children:[p.jsx(sT,{asChild:!0,children:s??p.jsx(Tn,{variant:"outline",size:"sm",className:"h-6 px-2 text-[10px]",children:"Check"})}),p.jsxs(qf,{className:"sm:max-w-[85vw] max-h-[85vh] overflow-auto",children:[p.jsx(jd,{children:p.jsxs(Fd,{className:"flex items-center gap-2 flex-wrap",children:[p.jsx("span",{children:(l==null?void 0:l.kind)==="eval"?`Completion ${n} / Sample ${e}`:`Sample ${n} / Group ${e}`}),R&&p.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[R,(l==null?void 0:l.kind)==="eval"&&l.eval_name&&` — ${l.eval_name}`]}),(w==null?void 0:w.discard_reason)&&p.jsx(W1,{variant:Mbe(w.discard_reason),className:"text-xs",children:wbe(w.discard_reason)}),W&&p.jsx(Tn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:U,children:"Go to"}),re&&p.jsxs(p.Fragment,{children:[(se==null?void 0:se.raw_string)&&p.jsx(GT,{rawString:se.raw_string,totalTokens:se.total_tokens,turns:se.turns??void 0}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{G(xe=>xe+1),Y(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{B(xe=>xe+1),Y(!0)},children:"Expand All"}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",X>0&&` (${X})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(vi,{checked:F,onCheckedChange:xe=>j(!!xe),onSelect:xe=>xe.preventDefault(),children:"Format Think"}),p.jsx(vi,{checked:K.includes("markdown"),onCheckedChange:()=>H("markdown"),onSelect:xe=>xe.preventDefault(),children:"Markdown"}),p.jsx(vi,{checked:K.includes("latex"),onCheckedChange:()=>H("latex"),onSelect:xe=>xe.preventDefault(),children:"LaTeX"}),p.jsx(vi,{checked:K.includes("code"),onCheckedChange:()=>H("code"),onSelect:xe=>xe.preventDefault(),children:"Code"})]})]})]})]})}),d&&p.jsx($u,{className:"border-destructive",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-sm text-destructive",children:["Error: ",d instanceof Error?d.message:"Unknown error"]})})}),c&&!d&&p.jsx($u,{children:p.jsxs(eh,{className:"pt-6 space-y-3",children:[p.jsx(Zh,{className:"h-5 w-40"}),p.jsx(Zh,{className:"h-32 w-full"}),p.jsx(Zh,{className:"h-24 w-full"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(Zh,{className:"h-6 w-20"}),p.jsx(Zh,{className:"h-6 w-20"}),p.jsx(Zh,{className:"h-6 w-20"})]})]})}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts"&&p.jsx(y1,{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:v,envMetricRanges:b,advantageRange:_,collapseAllSignal:V,expandAllSignal:Z,defaultSectionsOpen:q,renderOptions:K,formatThinkBlocks:F}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts_discarded"&&p.jsx(y1,{prompts:S,data:E,samplesData:A,rolloutMetrics:N,goldenAnswers:I,infoTurns:P,step:l.trainer_step,goToBasePath:"/rollouts-discarded",goToStepParam:"trainer_step",filterGroupId:e,filterSampleIdx:n,envRewardRanges:v,envMetricRanges:b,advantageRange:_,collapseAllSignal:V,expandAllSignal:Z,defaultSectionsOpen:q,renderOptions:K,formatThinkBlocks:F}),!c&&!d&&(l==null?void 0:l.kind)==="eval"&&p.jsx(y1,{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:(L==null?void 0:L.groupId)??e,filterSampleIdx:(L==null?void 0:L.sampleIdx)??n,envRewardRanges:v,envMetricRanges:b,advantageRange:_,collapseAllSignal:V,expandAllSignal:Z,defaultSectionsOpen:q,renderOptions:K,formatThinkBlocks:F}),!c&&!d&&(l==null?void 0:l.kind)===null&&p.jsx($u,{children:p.jsx(eh,{className:"pt-6",children:p.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 Cbe=.005;function Abe(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,a=s>=1?`${s}ms`:`${Number(s.toPrecision(2))}ms`;return{thresholdSeconds:s/1e3,displayLabel:a}}function Ns(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 zA(t){return t.toLocaleString("en-US")}function nX(t,e,n=[]){return[{label:"Duration",value:Ns(e)},...t.prompt_tokens!==void 0?[{label:"Prompt tokens",value:zA(t.prompt_tokens)}]:[],...t.rollout_tokens!==void 0?[{label:"Rollout tokens",value:zA(t.rollout_tokens)}]:[],...t.max_tokens!==void 0&&t.max_tokens!==null?[{label:"Max tokens",value:zA(t.max_tokens)}]:[],...n,...t.queue_time!==void 0&&t.queue_time!==null?[{label:"Queue time",value:Ns(t.queue_time*1e3)}]:[],...t.time_to_first_token!==void 0&&t.time_to_first_token!==null?[{label:"TTFT",value:Ns(t.time_to_first_token*1e3)}]:[],...t.prefill_time!==void 0&&t.prefill_time!==null?[{label:"Prefill time",value:Ns(t.prefill_time*1e3)}]:[],...t.decode_time!==void 0&&t.decode_time!==null?[{label:"Decode time",value:Ns(t.decode_time*1e3)}]:[],...t.inference_time!==void 0&&t.inference_time!==null?[{label:"Inference time",value:Ns(t.inference_time*1e3)}]:[],...t.e2e_latency!==void 0&&t.e2e_latency!==null?[{label:"E2E latency",value:Ns(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 Nbe(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),a=Math.round(r+(255-r)*e),o=Math.round(i+(255-i)*e),l=Math.round(s+(255-s)*e);return`#${a.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}`}const Rbe=new Set;function rX(t){var n;const e=(n=NT[t])==null?void 0:n.label;return e||t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function kbe(t,e=Cbe){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,a=0;for(let l=0;l<n.length;l++){const c=n[l].event.timestamp;for(;c-n[s].event.timestamp>e;)s++;for(a<l&&(a=l);a+1<n.length&&n[a+1].event.timestamp-c<=e;)a++;r[l]=s,i[l]=a}const o=new Map;return n.forEach((l,c)=>{o.set(l.originalIndex,{start:r[c],end:i[c],sortedIndex:c})}),{sortedEvents:n,windowByOriginalIndex:o}}function Pbe({orchestratorData:t,trainerData:e,inferenceData:n,isLoading:r,intervalStart:i,intervalEnd:s,trainerGpuMetricsByGpuIndex:a,trainerGpuMetricsByRank:o,trainerGpuMetricsIsLoading:l=!1,trainerAvailableGpuMetrics:c=[],selectedTrainerGpuMetrics:d=[],onSelectedTrainerGpuMetricsChange:h,trainerSystemGpuIndices:g,trainerRankInfoByRank:v,totalSetupNodes:b,inferenceServerNodeMap:_,numInferenceServers:w=0,maxConcurrentPrompts:S=12,groupSize:E=1}){const A=ki(dT),N=T.useMemo(()=>{const B=(g??[]).filter(Y=>Number.isFinite(Y));return B.length>0?B:a?Object.keys(a).map(Number).filter(Y=>Number.isFinite(Y)).sort((Y,K)=>Y-K):[]},[g,a]),I=s-i,P=T.useMemo(()=>!t||t.length===0?[]:t.filter(B=>B.timestamp>=i&&B.timestamp<s),[t,i,s]),L=T.useMemo(()=>!e||e.length===0?[]:e.filter(B=>B.start_time<s&&B.end_time>i),[e,i,s]),R=T.useMemo(()=>!n||n.length===0?[]:n.filter(B=>{const q=B.end_time+(B.environment_response_time??0)+(B.compute_reward_time??0);return B.start_time<s&&q>i}),[n,i,s]),{eventsByRank:O,ranks:W}=T.useMemo(()=>{const B={};L.forEach(Y=>{B[Y.rank]||(B[Y.rank]=[]),B[Y.rank].push(Y)});const q=Object.keys(B).map(Number).sort((Y,K)=>Y-K);return{eventsByRank:B,ranks:q}},[L]),{eventsByServer:U,servers:V}=T.useMemo(()=>{const B={};R.forEach(Y=>{B[Y.server]||(B[Y.server]=[]),B[Y.server].push(Y)});const q=Object.keys(B).map(Number).sort((Y,K)=>Y-K);return{eventsByServer:B,servers:q}},[R]),G=w>0?w:Math.max(1,V.length),Z=Math.max(1,Math.floor(S/G*E));return p.jsx("div",{className:`transition-opacity duration-200 overflow-visible ${r&&!A?"opacity-50":""}`,children:p.jsxs("div",{className:"space-y-6",children:[(V.length>0||w>0)&&p.jsx(Lbe,{servers:V.length>0?V:Array.from({length:w},(B,q)=>q),eventsByServer:U,intervalStart:i,intervalDuration:I,lanesPerServer:Z,inferenceServerNodeMap:_,totalSetupNodes:b,isLoading:r}),p.jsx(Dbe,{events:P,intervalStart:i,intervalDuration:I,isLoading:r}),p.jsx(Qbe,{ranks:W,eventsByRank:O,intervalStart:i,intervalDuration:I,intervalEnd:s,trainerGpuMetricsByGpuIndex:a,trainerGpuMetricsByRank:o,trainerGpuMetricsIsLoading:l,trainerAvailableGpuMetrics:c,selectedMetricNames:d,onSelectedMetricNamesChange:h,trainerSystemGpuIndices:N,trainerRankInfoByRank:v,totalSetupNodes:b,isLoading:r})]})})}function Dbe({events:t,intervalStart:e,intervalDuration:n,isLoading:r}){const[i,s]=T.useState(!0),[a,o]=T.useState(null),[l,c]=T.useState(null),d=l??a,{thresholdSeconds:h,displayLabel:g}=T.useMemo(()=>Abe(n),[n]),{sortedEvents:v,windowByOriginalIndex:b}=T.useMemo(()=>kbe(t,h),[t,h]),_=T.useMemo(()=>{const w=[],S=new Map;return t.forEach(E=>{const A=S8(E.event_type),N=S.get(A);N!==void 0?w[N].count++:(S.set(A,w.length),w.push({displayName:A,color:_8(E.event_type),count:1}))}),w},[t]);return p.jsxs(Ki,{open:i,onOpenChange:s,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!i&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Orchestrator"}),r&&p.jsx(ll,{className:"size-3.5 text-muted-foreground"})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"mt-3",children:[_.length>0&&p.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 mb-6 text-xs",children:_.map(({displayName:w,color:S,count:E})=>{const A=d===w,N=d!==null&&!A;return p.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:()=>o(w),onPointerLeave:()=>o(null),onClick:()=>c(I=>I===w?null:w),children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:S}}),p.jsx("span",{className:"capitalize text-muted-foreground",children:w}),p.jsx("span",{className:"text-muted-foreground/50",children:E})]},w)})}),p.jsx("div",{className:"relative",children:p.jsxs("div",{className:"relative h-32 bg-white rounded-lg border border-border/50",children:[p.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:[p.jsx("span",{children:sp(0)}),p.jsx("span",{children:sp(n/2)}),p.jsx("span",{children:sp(n)})]}),p.jsx("div",{className:"absolute top-0 left-0 right-0 h-24",children:t.map((w,S)=>p.jsx(Ibe,{event:w,intervalStart:e,intervalDuration:n,sortedEvents:v,closeEventWindow:b.get(S),thresholdLabel:g,highlightedDisplayName:d},`${w.timestamp}-${S}`))})]})})]})})]})}function Ibe({event:t,intervalStart:e,intervalDuration:n,sortedEvents:r,closeEventWindow:i,thresholdLabel:s,highlightedDisplayName:a}){const l=(t.timestamp-e)/n*100;if(l<0||l>100)return null;const c=_8(t.event_type),h=(i?Math.max(0,i.end-i.start):0)>0,g=S8(t.event_type),v=a===null?null:g===a;return p.jsx(Kc,{className:"absolute top-0 bottom-0 w-0.5 group cursor-pointer",style:{left:`${l}%`,backgroundColor:v===!1?Nbe(c,.8):c,zIndex:v===!0?20:1},interactive:h,tooltip:p.jsx(Obe,{event:t,sortedEvents:r,closeEventWindow:i,thresholdLabel:s})})}function Obe({event:t,sortedEvents:e,closeEventWindow:n,thresholdLabel:r}){const i=o=>{const l=S8(o.event_type).split(" ").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ");return(o.event_type==="weight_update"||o.event_type==="save_batch")&&o.step!==-1?`${l} ${o.step}`:l},s=T.useMemo(()=>!n||e.length===0?[t]:e.slice(n.start,n.end+1).map(l=>l.event),[n,e,t]),a=s.length>1;return p.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:[a&&p.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:[p.jsx("div",{className:"w-1 h-1 rounded-full bg-amber-500 flex-shrink-0"}),p.jsxs("span",{className:"text-amber-500 font-medium text-[10px]",children:[s.length," events within ",r]})]}),p.jsx("div",{className:`px-3 ${a?"pt-2 pb-2 space-y-3":"py-2"}`,children:s.map((o,l)=>{const c=_8(o.event_type),d=i(o);return p.jsxs("div",{className:a&&l>0?"pt-2 border-t border-border/30":"",children:[p.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:c}}),p.jsx("span",{children:d})]}),p.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[o.step!==-1&&p.jsxs("div",{children:["Step: ",o.step]}),p.jsxs("div",{children:["Time:"," ",new Date(o.timestamp*1e3).toISOString().slice(11,23)]})]})]},`${o.timestamp}-${l}`)})})]})}function Lbe({servers:t,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i,inferenceServerNodeMap:s,totalSetupNodes:a,isLoading:o}){var ve;const[g,v]=T.useState(!0),[b,_]=cn(Ice),[w,S]=cn(dT),[E,A]=cn(Dce),[N,I]=cn(yG),[P,L]=cn(Oce),[R,O]=cn(Lce),[W,U]=cn(kce),[V,G]=cn(_G),Z=ki(ml),B=8,q=t.length>B,Y=T.useMemo(()=>{if(!q)return[];const ye=[];for(let ke=0;ke<t.length;ke+=B){const Be=t.slice(ke,ke+B),ge=ke,Ye=Math.min(ke+B,t.length)-1;ye.push({label:`${ge} – ${Ye}`,servers:Be})}return ye},[t,q]),K=q?Math.min(W,Math.max(0,Y.length-1)):0;T.useEffect(()=>{q&&W!==K&&U(K)},[q,W,K,U]);const J=q?((ve=Y[K])==null?void 0:ve.servers)??t.slice(0,B):t,F=T.useMemo(()=>typeof a=="number"&&Number.isFinite(a)?a>1:s?new Set(Object.values(s).filter(ke=>ke!==null)).size>1:!1,[s,a]),j=T.useMemo(()=>{const ye=new Set,ke=[];for(const Be of Object.values(e))for(const ge of Be){if(ge.event_type!=="request"||ge.sample_id==null||ge.group_id==null)continue;const Ye=`${ge.group_id}:${ge.sample_id}`;ye.has(Ye)||(ye.add(Ye),ke.push({group_id:ge.group_id,sample_idx:ge.sample_id}))}return ke},[e]),{data:X}=w8(Z??"",j,!!Z&&j.length>0&&w),H=!w||j.length===0||!!X,se=!w||H,re=T.useMemo(()=>{const ye=new Map;return X==null||X.statuses.forEach(ke=>{ye.set(`${ke.group_id}:${ke.sample_idx}`,ke.kind)}),ye},[X]),ie=T.useMemo(()=>{let ye=i;for(const ke of Object.values(e))for(const Be of ke)Be.event_type==="request"&&Be.lane!=null&&Be.lane+1>ye&&(ye=Be.lane+1);return ye},[e,i]),ue=Math.max(1,t.length),le=Math.max(1,Math.floor(R/ue)),fe=ie,xe=Math.max(1,Math.ceil(fe/le)),he=Math.min(P,Math.max(0,xe-1));T.useEffect(()=>{P!==he&&L(he)},[P,he,L]);const Te=he*le,We=le,Se=Math.min(Te+le-1,fe-1),Le=T.useMemo(()=>{let ye=0;for(const ke of Object.values(e))ye+=ke.length;return ye},[e]),pe=T.useMemo(()=>({servers:J,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i}),[J,e,n,r,i]),Re=T.useMemo(()=>`${n}:${r}:${J.join(",")}:${Le}:${w}`,[n,r,J,Le,w]),[ne,Xe]=T.useState(null),[Ae,Pe]=T.useState(null),[Ke,oe]=T.useState(null);se&&(ne!==pe||Ae!==re||Ke!==Re)&&(Xe(pe),Pe(re),oe(Re));const te=w&&Ke!==null&&Re!==Ke,_e=T.useCallback(ye=>{if(ye.event_type==="request"&&!(ye.sample_id===void 0||ye.group_id===void 0)){if((V==null?void 0:V.sampleId)===ye.sample_id){G(null);return}G({sampleId:ye.sample_id,groupId:ye.group_id,isEval:ye.is_eval})}},[V,G]);return p.jsxs(Ki,{open:g,onOpenChange:v,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!g&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Inference Servers"}),p.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:o&&p.jsx(ll,{className:"size-3.5 text-muted-foreground"})})]})}),g&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[p.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:()=>_(ye=>Math.max(2,ye-4)),disabled:b<=2,children:p.jsx(Wle,{className:"h-3 w-3"})}),p.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:()=>_(14),children:"Reset"}),p.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:()=>_(ye=>Math.min(42,ye+4)),disabled:b>=42,children:p.jsx(ip,{className:"h-3 w-3"})})]}),p.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[p.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:()=>L(ye=>Math.max(0,ye-1)),disabled:he<=0,children:p.jsx(h8,{className:"h-3 w-3"})}),p.jsx("span",{className:"flex items-center justify-center h-7 px-2 text-xs text-muted-foreground border-x border-input tabular-nums whitespace-nowrap select-none",children:fe===0?"0":`${Te}–${Se}`}),p.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:()=>L(ye=>Math.min(xe-1,ye+1)),disabled:he>=xe-1,children:p.jsx(Vr,{className:"h-3 w-3"})})]}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.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:p.jsx(uG,{className:"h-3.5 w-3.5"})})}),p.jsxs(pl,{align:"end",children:[p.jsx(eS,{children:"Max Lanes"}),p.jsx(Hl,{}),[64,128,256,512,1024].map(ye=>p.jsx(vi,{checked:R===ye,onCheckedChange:()=>{O(ye),L(0)},children:ye},ye))]})]}),q&&p.jsxs(Z8,{value:String(K),onValueChange:ye=>U(Number(ye)),children:[p.jsx(J8,{size:"sm",className:"text-xs h-7 gap-1",children:p.jsx(Q8,{})}),p.jsx(ek,{children:Y.map((ye,ke)=>p.jsxs(tk,{value:String(ke),children:["Servers ",ye.label]},ke))})]}),p.jsx(p1,{variant:"selecting",size:"sm",pressed:w,onPressedChange:S,className:"text-xs px-2 h-7",children:"Highlight Discarded"}),p.jsx(p1,{variant:"selecting",size:"sm",pressed:E,onPressedChange:A,className:"text-xs px-2 h-7",children:"Show Weight Update"}),p.jsx(p1,{variant:"selecting",size:"sm",pressed:N,onPressedChange:I,className:"text-xs px-2 h-7",children:"Show Compute Reward"})]})]}),p.jsxs(Qi,{children:[p.jsx("div",{className:"space-y-4",children:t.length>0?(()=>{const ye=ne??(se?pe:null),ke=Ae??(se?re:null);if(!ye||!ke)return null;const Be=te?!0:H;return p.jsx("div",{className:`transition-opacity ${te?"opacity-60":"opacity-100"}`,children:p.jsx("div",{className:"space-y-3",children:ye.servers.map(ge=>p.jsx(Xbe,{server:ge,nodeId:(s==null?void 0:s[ge])??null,showNodeLabel:F,events:ye.eventsByServer[ge]||[],intervalStart:ye.intervalStart,intervalDuration:ye.intervalDuration,numLanes:ye.lanesPerServer,selectedRequest:V,sampleStatusByKey:ke,highlightDiscarded:w,discardStatusReady:Be,onEventClick:_e,showWeightUpdate:E,showComputeReward:N,laneHeight:b,laneStart:Te,maxLanesToShow:We},ge))})})})():p.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"})}),p.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[p.jsx("span",{children:sp(0)}),p.jsx("span",{children:sp(r/2)}),p.jsx("span",{children:sp(r)})]})]})]})}const zbe="#075985",jbe="#047857",iX="#0284c7",sX="#10b981",aX="#a1a1a1",oX="#b0b0b0",Fbe="#0c4a6e",Ube="#065f46",lX="#8a8a8a",Bbe="#0ea5e9",Hbe="#ababab",Vbe="#0ea5e9",Gbe="#ababab",Wbe="#34d399",$be="#ababab",cX="#0369a1",uX="#0369a1",dX="#047857",fX="#0284c7",hX="#0284c7",pX="#10b981",mX="#b3b3b3",gX="#b3b3b3",vX="#b3b3b3";function qbe({eventsBySampleId:t,selectedSampleId:e,timeBounds:n,groupId:r,runPath:i,envResponseTimesBySample:s,computeRewardTimeBySample:a,onSampleClick:o,showNodeLabel:l,isEval:c}){const d=Object.keys(t).map(Number).sort((L,R)=>L-R),h=ki(dT),g=T.useMemo(()=>d.map(L=>({group_id:r,sample_idx:L})),[r,d.join(",")]),{data:v}=w8(i,g,!!i&&g.length>0&&h),b=!h||g.length===0||!!v,_=T.useMemo(()=>!h||!(v!=null&&v.statuses)?!1:v.statuses.some(L=>L.kind==="rollouts_discarded"),[h,v]),w=T.useMemo(()=>{for(const L of Object.values(t))if(L.some(R=>R.is_eval))return!0;return!1},[t]),S=T.useMemo(()=>{for(const L of Object.values(t))if(L.some(R=>R.is_canceled))return!0;return!1},[t]),E=S?oX:_?aX:w?sX:iX,A=16,N=3,I=d.length*A+(d.length-1)*N,P=48;return b?p.jsxs("div",{className:"px-3 pb-2",children:[p.jsxs("div",{className:"flex items-start",children:[p.jsx("div",{className:"flex flex-col pr-2",style:{width:P,gap:N},children:d.map(L=>{const R=L===e;return p.jsx(Ebe,{runPath:i,groupId:r,sampleId:L,isEval:c,isCanceled:S,children:p.jsx("button",{className:`text-[10px] font-semibold text-center rounded transition-colors flex items-center justify-center ${R?S?"text-gray-500 bg-gray-400/15 hover:bg-gray-400/25":_?"text-gray-600 bg-gray-500/15 hover:bg-gray-500/25":w?"text-emerald-800 bg-emerald-500/15 hover:bg-emerald-500/25":"text-sky-900 bg-sky-500/15 hover:bg-sky-500/25":S?"text-gray-400 bg-gray-400/10 hover:bg-gray-400/20":_?"text-gray-500 bg-gray-500/10 hover:bg-gray-500/20":w?"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:A,width:34},children:L})},L)})}),p.jsx("div",{className:"relative flex-1 bg-muted/30 rounded-lg border border-border/50",style:{height:I},children:d.map((L,R)=>{const O=t[L],W=L===e,U=R*(A+N),V=W?S?lX:_?"#6b7280":w?Ube:Fbe:E,G=[...O].sort((K,J)=>K.start_time-J.start_time),Z=(s==null?void 0:s[L])??[],B=(a==null?void 0:a[L])??0,q=[];for(let K=0;K<G.length&&K<Z.length;K++){const J=Z[K].time;J>0&&q.push({start:G[K].end_time,duration:J,idx:K})}let Y=0;if(B>0&&G.length>0&&(Y=G[G.length-1].end_time,Z.length>=G.length)){const J=Z[G.length-1];J&&J.time>0&&(Y+=J.time)}return p.jsxs("div",{className:"absolute left-0 right-0",style:{top:U,height:A},children:[O.map((K,J)=>{const j=(K.start_time-n.start)/n.duration*100,X=K.end_time-K.start_time,H=X*1e3,se=Math.max(.5,X/n.duration*100);return p.jsx(Kc,{className:`absolute top-px bottom-px group ${o?"cursor-pointer":""}`,style:{left:`${j}%`,width:`${Math.min(se,100-j)}%`,backgroundColor:V,borderRadius:"1px",border:S?"1px solid rgba(0, 0, 0, 0.12)":"1px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},onClick:o?()=>o(L):void 0,tooltip:p.jsx(Hu,{title:K.sample_id!==void 0?`Sample ${K.sample_id}`:K.group_id!==void 0?`Group ${K.group_id}`:"Request",titleSecondary:K.group_id!==void 0?`Group ${K.group_id}`:null,color:V,statusLabel:S?{text:"Canceled",className:"text-gray-500"}:_?{text:"Discarded",className:"text-red-700"}:null,details:nX(K,H,[{label:"Server",value:String(K.server)},...l&&K.node_id!==null&&K.node_id!==void 0?[{label:"Node",value:String(K.node_id)}]:[]]),startTime:K.start_time,endTime:K.end_time})},`req-${J}`)}),q.map(K=>{const F=(K.start-n.start)/n.duration*100,j=Math.max(.3,K.duration/n.duration*100),X=K.duration*1e3,H=W?_?"#6b7280":cX:_?mX:fX;return p.jsx(Kc,{className:`absolute top-px bottom-px group ${o?"cursor-pointer":""}`,style:{left:`${F}%`,width:`${Math.min(j,100-F)}%`,backgroundColor:H,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.85},onClick:o?()=>o(L):void 0,tooltip:p.jsx(Hu,{title:"Env Response",titleSecondary:`Turn ${K.idx}`,color:H,details:[{label:"Duration",value:Ns(X)}]})},`env-${K.idx}`)}),B>0&&G.length>0&&(()=>{const J=(Y-n.start)/n.duration*100,F=Math.max(.3,B/n.duration*100),j=B*1e3,X=W?_?"#6b7280":c?dX:uX:_?c?vX:gX:c?pX:hX;return p.jsx(Kc,{className:`absolute top-px bottom-px group ${o?"cursor-pointer":""}`,style:{left:`${J}%`,width:`${Math.min(F,100-J)}%`,backgroundColor:X,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.85},onClick:o?()=>o(L):void 0,tooltip:p.jsx(Hu,{title:c?"Compute Metrics":"Compute Reward",color:X,details:[{label:"Duration",value:Ns(j)}]})})})()]},L)})})]}),p.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",style:{marginLeft:P},children:[p.jsx("span",{children:Ns(0)}),p.jsx("span",{children:Ns(n.duration/2*1e3)}),p.jsx("span",{children:Ns(n.duration*1e3)})]})]}):p.jsx("div",{className:"px-3 pb-2 flex items-center justify-center",style:{height:I+24},children:p.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})})}function Xbe({server:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,numLanes:a,selectedRequest:o,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:d,onEventClick:h,showWeightUpdate:g=!0,showComputeReward:v=!1,laneHeight:b=14,laneStart:_=0,maxLanesToShow:w}){const S=n&&e!==null&&e!==void 0?e:void 0,E=T.useMemo(()=>r.filter(Z=>Z.event_type==="weight_broadcast"),[r]),A=T.useMemo(()=>r.filter(Z=>Z.event_type==="request"),[r]),{assignedEvents:N,actualNumLanes:I}=T.useMemo(()=>{const Z=[],B=[];for(const Y of A)Y.lane!=null&&Y.lane>=0?Z.push({...Y,lane:Y.lane}):B.push(Y);if(B.length>0){const Y=[...B].sort((J,F)=>J.start_time-F.start_time),K=[];for(const J of Y){let F=!1;for(let j=0;j<K.length;j++)if(K[j]<=J.start_time){K[j]=J.end_time+(J.environment_response_time??0)+(J.compute_reward_time??0),Z.push({...J,lane:j}),F=!0;break}if(!F){const j=K.length;K.push(J.end_time+(J.environment_response_time??0)+(J.compute_reward_time??0)),Z.push({...J,lane:j})}}}const q=Z.reduce((Y,K)=>Math.max(Y,K.lane),-1);return{assignedEvents:Z,actualNumLanes:Math.max(a,q+1)}},[A,a]),P=i+s,L=b,R=w!==void 0?Math.min(_+w,I):I,O=Math.max(0,R-_),W=O*L+Math.max(0,O-1)*2,U=T.useMemo(()=>Array.from({length:O},(Z,B)=>B),[O]),{laneEventsByIndex:V,idlePeriodsByLane:G}=T.useMemo(()=>{const Z=Array.from({length:I},()=>[]);for(const q of N){const Y=q.lane;Z[Y]&&Z[Y].push(q)}const B=Z.map(q=>{const Y=[];if(q.length>0){q[0].start_time>i&&Y.push({start:i,end:q[0].start_time,duration:q[0].start_time-i});for(let J=0;J<q.length-1;J++){const F=q[J].end_time,j=q[J+1].start_time;F<j&&Y.push({start:F,end:j,duration:j-F})}const K=q[q.length-1];K.end_time<P&&Y.push({start:K.end_time,end:P,duration:P-K.end_time})}else Y.push({start:i,end:P,duration:s});return Y});return{laneEventsByIndex:Z,idlePeriodsByLane:B}},[N,i,P,s,I]);return p.jsxs("div",{children:[p.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[p.jsxs("span",{children:["Server ",t]}),n&&e!==null&&e!==void 0&&p.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),p.jsx("div",{className:"relative",children:p.jsxs("div",{className:"relative bg-muted/30 rounded-lg border border-border/50",style:{height:W},children:[U.map(Z=>{const B=Z+_,q=Z*(L+2),Y=V[B]||[],K=G[B]||[];return p.jsxs("div",{className:"absolute left-0 right-0",style:{top:q,height:L},children:[K.map((J,F)=>{const j=Math.max(J.start,i),X=Math.min(J.end,P),H=X-j,se=(j-i)/s*100,re=H/s*100;return re<.5||se>=100||X<=j?null:p.jsx(Kc,{className:"absolute top-0 bottom-0 group",style:{left:`${se}%`,width:`${Math.min(re,100-se)}%`,backgroundColor:H1,borderRadius:"1px"},tooltip:p.jsx(Hu,{title:"Idle",color:H1,details:[{label:"Duration",value:Ns(J.duration*1e3)},{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(B)}]})},`idle-${F}`)}),Y.map((J,F)=>{const j=J.environment_response_time,X=J.compute_reward_time,H=XL(J,"env",o,l,c,d),se=XL(J,"reward",o,l,c,d);return p.jsxs(T.Fragment,{children:[p.jsx(Zbe,{event:J,server:t,nodeId:S,lane:B,intervalStart:i,intervalDuration:s,selectedRequest:o,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:d,onClick:()=>h(J)}),j!=null&&j>0&&(()=>{const re=i+s,ie=J.end_time,ue=ie+j;if(ie>=re||ue<=i)return null;const le=Math.max(ie,i),fe=Math.min(ue,re),xe=Math.max(0,(le-i)/s*100),he=Math.max(.3,(fe-le)/s*100),Te=j*1e3;return p.jsx(Kc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${xe}%`,width:`${Math.min(he,100-xe)}%`,backgroundColor:H.color,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:H.opacity},onClick:()=>h(J),tooltip:p.jsx(Hu,{title:"Env Response",titleSecondary:J.sample_id!==void 0?`Sample ${J.sample_id}`:void 0,color:H.color,details:[{label:"Duration",value:Ns(Te)},...J.group_id!==void 0?[{label:"Group",value:String(J.group_id)}]:[],{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(B)}]})})})(),v&&X!=null&&X>0&&(()=>{const re=i+s,ie=J.end_time+(j!=null&&j>0?j:0),ue=ie+X;if(ie>=re||ue<=i)return null;const le=Math.max(ie,i),fe=Math.min(ue,re),xe=Math.max(0,(le-i)/s*100),he=Math.max(.3,(fe-le)/s*100),Te=X*1e3;return p.jsx(Kc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${xe}%`,width:`${Math.min(he,100-xe)}%`,backgroundColor:se.color,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:se.opacity},onClick:()=>h(J),tooltip:p.jsx(Hu,{title:J.is_eval?"Compute Metrics":"Compute Reward",titleSecondary:J.sample_id!==void 0?`Sample ${J.sample_id}`:void 0,color:se.color,details:[{label:"Duration",value:Ns(Te)},...J.group_id!==void 0?[{label:"Group",value:String(J.group_id)}]:[],{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(B)}]})})})()]},`event-${F}`)})]},B)}),g&&E.map((Z,B)=>{const q=Z.start_time-i,Y=Math.max(0,q/s*100),J=(Z.end_time-Z.start_time)*1e3,F=Math.max(Z.start_time,i),j=Z.end_time-F,X=Math.max(.5,j/s*100),H=AG(Z.event_type);return p.jsx(Kc,{className:"absolute group cursor-default",style:{top:0,left:`${Y}%`,width:`${Math.min(X,100-Y)}%`,height:W,backgroundColor:H,borderRadius:"2px",border:"1.5px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.6},tooltip:p.jsx(Hu,{title:"Weight Broadcast",color:H,details:[...Z.step!=null?[{label:"Step",value:String(Z.step)}]:[],{label:"Duration",value:Ns(J)},{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[]],startTime:Z.start_time,endTime:Z.end_time})},`wb-${B}`)})]})})]})}function Ybe(t,e,n=!0,r=!0){if(t.event_type!=="request")return AG(t.event_type);if(t.is_canceled)return CG;if(!n)return t.is_eval?BC:IM;if(!r)return qN;if(!e||t.sample_id==null||t.group_id==null)return t.is_eval?BC:IM;const i=`${t.group_id}:${t.sample_id}`;return e.get(i)==="rollouts_discarded"?qN:t.is_eval?BC:IM}function Kbe(t,e,n,r=!0,i=!0){const s=Ybe(t,n,r,i);if(!e)return{color:s,opacity:1};const a=s===qN,o=s===CG;return t.sample_id===e.sampleId?o?{color:lX,opacity:1}:a?{color:"#6b7280",opacity:1}:{color:t.is_eval?jbe:zbe,opacity:1}:t.group_id===e.groupId?o?{color:oX,opacity:1}:a?{color:aX,opacity:1}:{color:t.is_eval?sX:iX,opacity:1}:{color:s,opacity:.55}}function XL(t,e,n,r,i,s){const a=e==="reward"&&t.is_eval,o=(()=>{if(!i)return!1;if(!s)return!0;if(t.sample_id==null||t.group_id==null)return!1;const c=`${t.group_id}:${t.sample_id}`;return r.get(c)==="rollouts_discarded"})(),l=o?e==="env"?Hbe:a?$be:Gbe:e==="env"?Bbe:a?Wbe:Vbe;return n?t.sample_id===n.sampleId?o?{color:"#6b7280",opacity:1}:{color:e==="env"?cX:a?dX:uX,opacity:1}:t.group_id===n.groupId?{color:o?e==="env"?mX:a?vX:gX:e==="env"?fX:a?pX:hX,opacity:1}:{color:l,opacity:.35}:{color:l,opacity:.85}}function Zbe({event:t,server:e,nodeId:n,lane:r,intervalStart:i,intervalDuration:s,selectedRequest:a,sampleStatusByKey:o,highlightDiscarded:l,discardStatusReady:c,onClick:d}){const h=i+s;if(t.end_time<=i||t.start_time>=h)return null;const g=t.start_time-i,v=Math.max(0,g/s*100),_=(t.end_time-t.start_time)*1e3,w=Math.max(t.start_time,i),E=(t.end_time-w)/s*100,{color:A,opacity:N}=Kbe(t,a,o,l,c),I=t.event_type==="request"&&t.sample_id!==void 0,P=(()=>{if(t.event_type!=="request")return null;if(t.is_canceled)return{text:"Canceled",className:"text-gray-500"};if(l&&c&&t.sample_id!=null&&t.group_id!=null){const L=`${t.group_id}:${t.sample_id}`;if(o.get(L)==="rollouts_discarded")return{text:"Discarded",className:"text-red-700"}}return null})();return p.jsx(Kc,{className:`absolute top-0 bottom-0 group ${I?"cursor-pointer":"cursor-default"}`,style:{left:`${v}%`,width:`${Math.min(E,100-v)}%`,minWidth:"1px",backgroundColor:A,borderRadius:"1px",border:t.is_canceled?"1.5px solid rgba(0, 0, 0, 0.2)":"1.5px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box",opacity:N},onClick:I?d:void 0,tooltip:p.jsx(Hu,{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:A,capitalize:!0,statusLabel:P,details:t.event_type==="request"?nX(t,_,[{label:"Server",value:String(e)},...n!=null?[{label:"Node",value:String(n)}]:[],{label:"Lane",value:String(r)}]):[{label:"Duration",value:Ns(_)},{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 Qbe({ranks:t,eventsByRank:e,intervalStart:n,intervalDuration:r,intervalEnd:i,trainerGpuMetricsByGpuIndex:s,trainerGpuMetricsByRank:a,trainerGpuMetricsIsLoading:o,trainerAvailableGpuMetrics:l,selectedMetricNames:c,onSelectedMetricNamesChange:d,trainerSystemGpuIndices:h,trainerRankInfoByRank:g,totalSetupNodes:v,isLoading:b}){var ue;const[_,w]=T.useState(!0),[S,E]=cn(bG),[A,N]=cn(Pce),I=T.useMemo(()=>{const le=new Set;return(l??[]).forEach(fe=>{typeof fe=="string"&&le.add(fe)}),Array.from(le)},[l]),[P,L]=T.useState([]),R=((h==null?void 0:h.length)??0)===0;R&&P.length>0?L([]):!R&&I.length>0&&P!==I&&L(I);const O=T.useMemo(()=>R?[]:I.length>0?I:P,[R,I,P]),W=T.useMemo(()=>Array.from(new Set((c??[]).filter(le=>typeof le=="string"&&le.trim().length>0))),[c]),U=T.useMemo(()=>O.length===0?W:W.filter(le=>O.includes(le)),[O,W]),V=T.useMemo(()=>{const le=Object.keys(g??{}).map(Number).filter(fe=>Number.isFinite(fe)).sort((fe,xe)=>fe-xe);return le.length>0?le:!h||h.length===0?[]:h.map((fe,xe)=>xe)},[g,h]),G=T.useMemo(()=>{const le=new Set;return t.forEach(fe=>le.add(fe)),V.forEach(fe=>le.add(fe)),Array.from(le).sort((fe,xe)=>fe-xe)},[t,V]),Z=8,B=G.length>Z,q=T.useMemo(()=>{if(!B)return[];const le=[];for(let fe=0;fe<G.length;fe+=Z){const xe=G.slice(fe,fe+Z),he=fe+1,Te=Math.min(fe+Z,G.length);le.push({label:`${he} – ${Te}`,ranks:xe})}return le},[G,B]),Y=B?Math.min(A,Math.max(0,q.length-1)):0;T.useEffect(()=>{B&&A!==Y&&N(Y)},[B,A,Y,N]);const K=B?((ue=q[Y])==null?void 0:ue.ranks)??G.slice(0,Z):G;T.useMemo(()=>new Set(K),[K]);const J=T.useMemo(()=>{const le=new Map;return Object.entries(e).forEach(([fe,xe])=>{const he=new Set;xe.forEach(Te=>{if(!Te.event_type.includes("/"))return;const We=Te.event_type.split("/")[0];he.add(`${We}|${Te.step}`)}),le.set(Number(fe),he)}),le},[e]),F=T.useMemo(()=>{const le=new Map;return K.forEach(fe=>{var Te;const xe=((Te=g==null?void 0:g[fe])==null?void 0:Te.node_id)??null,he=xe===null?"__unknown__":String(xe);le.has(he)||le.set(he,{nodeId:xe,ranks:[]}),le.get(he).ranks.push(fe)}),Array.from(le.values()).map(fe=>({nodeId:fe.nodeId,ranks:fe.ranks.sort((xe,he)=>xe-he)})).sort((fe,xe)=>fe.nodeId===null&&xe.nodeId===null?0:fe.nodeId===null?1:xe.nodeId===null?-1:fe.nodeId-xe.nodeId)},[K,g]),j=T.useMemo(()=>typeof v=="number"&&Number.isFinite(v)?v>1:F.filter(fe=>fe.nodeId!==null).length>1,[F,v]),X=T.useCallback(le=>{var xe;le.event_type.includes("/")||!(((xe=J.get(le.rank))==null?void 0:xe.has(`${le.event_type}|${le.step}`))??!1)||E(he=>(he==null?void 0:he.eventType)===le.event_type&&(he==null?void 0:he.rank)===le.rank&&(he==null?void 0:he.step)===le.step?null:{eventType:le.event_type,rank:le.rank,step:le.step})},[J,E]),H=T.useCallback((le,fe)=>{const xe=U,Te=fe===!0?xe.includes(le)?xe:[...xe,le]:xe.filter(We=>We!==le);d==null||d(Te)},[U,d]),se=T.useCallback(()=>d==null?void 0:d([...O]),[O,d]),re=T.useCallback(()=>d==null?void 0:d([]),[d]),ie=T.useCallback(le=>{const fe=g==null?void 0:g[le],xe=(fe==null?void 0:fe.local_rank)??(h?h[le]:void 0),he=(a==null?void 0:a[le])??(xe!==void 0&&s?s[xe]??[]:void 0);return p.jsx(e_e,{rank:le,nodeId:(fe==null?void 0:fe.node_id)??null,showNodeLabel:j,events:e[le]||[],intervalStart:n,intervalDuration:r,intervalEnd:i,selectedEvent:S,onEventClick:X,childEventKeys:J.get(le)??Rbe,systemGpuIndex:xe,gpuMetrics:he,selectedMetricNames:U,gpuMetricsIsLoading:o??!1},le)},[J,U,e,X,r,i,n,S,s,a,o,g,h,j]);return p.jsxs(Ki,{open:_,onOpenChange:w,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!_&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Trainer GPUs"}),p.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:b&&p.jsx(ll,{className:"size-3.5 text-muted-foreground"})})]})}),_&&p.jsxs(p.Fragment,{children:[B&&p.jsxs(Z8,{value:String(Y),onValueChange:le=>N(Number(le)),children:[p.jsx(J8,{size:"sm",className:"text-xs h-7 gap-1",children:p.jsx(Q8,{})}),p.jsx(ek,{children:q.map((le,fe)=>p.jsxs(tk,{value:String(fe),children:["GPUs ",le.label]},fe))})]}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.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",p.jsx("span",{className:"text-[10px] font-medium rounded bg-accent text-accent-foreground px-1.5 py-0.5",children:U.length}),p.jsx(Vr,{className:"h-3 w-3 text-muted-foreground"})]})}),p.jsxs(pl,{align:"start",className:"w-64",children:[p.jsx(eS,{children:"Trainer GPU Plots"}),p.jsx(Hl,{}),p.jsx(_c,{onSelect:le=>{le.preventDefault(),se()},className:"text-xs",children:"Select All"}),p.jsx(_c,{onSelect:le=>{le.preventDefault(),re()},className:"text-xs",children:"Unselect All"}),p.jsx(Hl,{}),O.length>0?O.map(le=>p.jsx(vi,{checked:U.includes(le),onCheckedChange:fe=>H(le,fe),onSelect:fe=>fe.preventDefault(),className:"text-xs",children:rX(le)},le)):p.jsx(_c,{disabled:!0,className:"text-xs text-muted-foreground",children:o?"Loading plots...":"No plots available"})]})]})]})]}),p.jsxs(Qi,{children:[p.jsx("div",{className:"space-y-4",children:K.length>0?j?F.map(le=>p.jsx(Jbe,{nodeId:le.nodeId,rankCount:le.ranks.length,children:le.ranks.map(fe=>ie(fe))},le.nodeId===null?"__unknown__":String(le.nodeId))):K.map(le=>ie(le)):p.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"})}),p.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[p.jsx("span",{children:sp(0)}),p.jsx("span",{children:sp(r/2)}),p.jsx("span",{children:sp(r)})]})]})]})}function Jbe({nodeId:t,rankCount:e,children:n}){const[r,i]=T.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return p.jsxs(Ki,{open:r,onOpenChange:i,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),p.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-4 mt-2",children:n})})]})}function e_e({rank:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,intervalEnd:a,selectedEvent:o,onEventClick:l,childEventKeys:c,systemGpuIndex:d,gpuMetrics:h,selectedMetricNames:g,gpuMetricsIsLoading:v}){const b=T.useMemo(()=>[...r.filter(I=>!I.event_type.includes("/"))].sort((I,P)=>I.start_time-P.start_time),[r]),_=T.useMemo(()=>xX(b,i,a),[b,i,a]),w=T.useMemo(()=>{if(!h||h.length===0)return{};const N={};return h.forEach(I=>{N[I.metric_name]||(N[I.metric_name]=[]),N[I.metric_name].push(I)}),N},[h]),S=T.useMemo(()=>{const N=new Set;return h==null||h.forEach(I=>{Number.isFinite(I.gpu_index)&&N.add(I.gpu_index)}),N.size>0?Array.from(N).sort((I,P)=>I-P):d!==void 0?[d]:[]},[h,d]),E=n&&e!==null&&e!==void 0?`Rank ${t} Node ${e}`:`Rank ${t}`,A=T.useMemo(()=>{if(S.length===0)return;const N={};return S.forEach(I=>{N[I]=E}),N},[S,E]);return p.jsxs("div",{children:[p.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[p.jsxs("span",{children:["Rank ",t]}),n&&e!==null&&e!==void 0&&p.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),p.jsxs("div",{className:"relative",children:[p.jsxs("div",{className:"relative h-12 bg-muted/30 rounded-lg border border-border/50",children:[_.map((N,I)=>p.jsx(t_e,{idle:N,rank:t,intervalStart:i,intervalDuration:s,dimmed:o!==null},`idle-${I}`)),b.map((N,I)=>{const P=(o==null?void 0:o.eventType)===N.event_type&&(o==null?void 0:o.rank)===N.rank&&(o==null?void 0:o.step)===N.step,L=c.has(`${N.event_type}|${N.step}`),R=o!==null&&!P;return p.jsx(n_e,{event:N,intervalStart:i,intervalDuration:s,isSelected:P,isDimmed:R,hasChildren:L,onClick:()=>l(N)},`${N.start_time}-${N.rank}-${I}`)})]}),S.length>0&&g.map(N=>p.jsxs("div",{className:`mt-2 transition-opacity duration-200 ${v?"opacity-50":""}`,children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-0.5",children:rX(N)}),p.jsx(m$,{metricName:N,data:w[N]??[],gpuIndices:S,intervalStart:i,intervalEnd:a,variant:"timeline",strokeColor:"#ef4444",gpuDisplayNames:A,isLoading:v})]},N))]})]})}function t_e({idle:t,rank:e,intervalStart:n,intervalDuration:r,dimmed:i=!1}){const a=(t.start-n)/r*100,o=t.duration/r*100;return o<.5||a<0||a>=100?null:p.jsx(Kc,{className:"absolute top-1 bottom-1 group cursor-pointer transition-opacity duration-200",style:{left:`${a}%`,width:`${Math.min(o,100-a)}%`,backgroundColor:H1,borderRadius:"2px",opacity:i?.3:1},tooltip:p.jsx(Hu,{title:"Idle",color:H1,details:[{label:"Duration",value:Ns(t.duration*1e3)},{label:"Rank",value:String(e)}],startTime:t.start,endTime:t.end})})}function n_e({event:t,intervalStart:e,intervalDuration:n,isSelected:r=!1,isDimmed:i=!1,hasChildren:s=!1,onClick:a}){const o=e+n;if(t.end_time<=e||t.start_time>=o)return null;const l=t.start_time-e,c=Math.max(0,l/n*100),h=(t.end_time-t.start_time)*1e3,g=Math.max(t.start_time,e),b=(t.end_time-g)/n*100,_=u2(t.event_type),w=NG(t.event_type,t.step,t.microbatch,t.minibatch);return p.jsx(Kc,{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?a:void 0,tooltip:p.jsx(Hu,{title:w.primary,titleSecondary:w.secondary,color:_,details:[{label:"Duration",value:Ns(h)},{label:"Rank",value:String(t.rank)},...s?[{label:"Click",value:"to expand children"}]:[]],startTime:t.start_time,endTime:t.end_time})})}function r_e({parentEvent:t,childEvents:e}){const n=[...e].sort((o,l)=>o.start_time-l.start_time),r=t.start_time,i=t.end_time,s=i-r,a=xX(n,r,i);return p.jsxs("div",{className:"px-3 pb-2",children:[p.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 text-xs",children:n.map(o=>{const l=u2(o.event_type),c=o.event_type.includes("/")?o.event_type.split("/").pop():o.event_type,d=o.end_time-o.start_time,h=s>0?(d/s*100).toFixed(0):"0";return p.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full",style:{backgroundColor:`${l}20`},children:[p.jsx("div",{className:"w-2 h-2 rounded-sm",style:{backgroundColor:l}}),p.jsx("span",{className:"capitalize text-muted-foreground",children:c}),p.jsx("span",{className:"font-medium",children:Ns(d*1e3)}),p.jsxs("span",{className:"text-muted-foreground",children:[h,"%"]})]},o.event_type)})}),p.jsx("div",{className:"relative",children:p.jsxs("div",{className:"relative h-7 bg-muted/30 rounded-lg border border-border/50",children:[a.map((o,l)=>{const d=(o.start-r)/s*100,h=o.duration/s*100;return h<.5||d<0||d>=100?null:p.jsx(Kc,{className:"absolute top-px bottom-px group",style:{left:`${d}%`,width:`${Math.min(h,100-d)}%`,backgroundColor:H1,borderRadius:"1px",opacity:.5},tooltip:p.jsx(Hu,{title:"Gap",color:H1,details:[{label:"Duration",value:Ns(o.duration*1e3)}]})},`child-idle-${l}`)}),n.map((o,l)=>{const c=o.start_time-r,d=Math.max(0,c/s*100),h=o.end_time-o.start_time,g=h*1e3,v=Math.max(.5,h/s*100),b=u2(o.event_type),_=o.event_type.includes("/")?o.event_type.split("/").pop():o.event_type;return p.jsx(Kc,{className:"absolute top-px bottom-px group cursor-default flex items-center justify-center",style:{left:`${d}%`,width:`${Math.min(v,100-d)}%`,backgroundColor:b,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},tooltip:p.jsx(Hu,{title:_||o.event_type,color:b,capitalize:!0,details:[{label:"Duration",value:Ns(g)},{label:"% of parent",value:`${(h/s*100).toFixed(1)}%`}],startTime:o.start_time,endTime:o.end_time}),children:v>8&&p.jsx("span",{className:"text-[9px] font-medium text-white truncate px-1 drop-shadow-sm pointer-events-none",children:_})},`child-${o.start_time}-${l}`)})]})}),p.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[p.jsx("span",{children:Ns(0)}),p.jsx("span",{children:Ns(s/2*1e3)}),p.jsx("span",{children:Ns(s*1e3)})]})]})}function Hu({title:t,titleSecondary:e,color:n,details:r,capitalize:i=!1,timestamp:s,startTime:a,endTime:o,statusLabel:l}){return p.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:[p.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:n}}),p.jsxs("span",{className:i?"capitalize":"",children:[t,e&&p.jsx("span",{className:"text-muted-foreground font-normal ml-1",children:e})]})]}),l&&p.jsx("div",{className:`font-semibold mb-1.5 ${l.className}`,children:l.text}),p.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[r.map(c=>p.jsxs("div",{children:[c.label,": ",c.value]},c.label)),s!==void 0&&p.jsxs("div",{children:["Time: ",new Date(s*1e3).toISOString().slice(11,23)]}),a!==void 0&&p.jsxs("div",{children:["Start: ",new Date(a*1e3).toISOString().slice(11,23)]}),o!==void 0&&p.jsxs("div",{children:["End: ",new Date(o*1e3).toISOString().slice(11,23)]})]})]})}function Kc({className:t,style:e,onClick:n,tooltip:r,children:i,interactive:s=!1}){const[a,o]=T.useState(!1),[l,c]=T.useState(!1),[d,h]=T.useState({x:0,y:0}),[g,v]=T.useState(null),b=T.useRef(null),_=T.useRef(null),w=a||l,S=l&&g?g:d;T.useLayoutEffect(()=>{const A=b.current;if(!w||!A)return;const N=A.getBoundingClientRect(),I=8;let P=S.x-N.width/2;P+N.width+I>window.innerWidth&&(P=window.innerWidth-N.width-I),P<I&&(P=I);let L=S.y-N.height-12;L<I&&(L=S.y+16),L+N.height+I>window.innerHeight&&(L=window.innerHeight-N.height-I),A.style.left=`${P}px`,A.style.top=`${L}px`,A.style.visibility="visible"},[w,S]),T.useEffect(()=>{if(!l)return;const A=I=>{var L,R;const P=I.target;(L=b.current)!=null&&L.contains(P)||(R=_.current)!=null&&R.contains(P)||(c(!1),v(null))},N=setTimeout(()=>{document.addEventListener("pointerdown",A)},0);return()=>{clearTimeout(N),document.removeEventListener("pointerdown",A)}},[l]);const E=T.useCallback(()=>{s&&c(A=>A?(v(null),!1):(v(d),!0)),n==null||n()},[s,n,d]);return p.jsxs("div",{ref:_,className:t,style:e,onClick:E,onPointerEnter:A=>{h({x:A.clientX,y:A.clientY}),o(!0)},onPointerLeave:()=>{o(!1)},onPointerMove:A=>{l||h({x:A.clientX,y:A.clientY})},children:[i,w?Ld.createPortal(p.jsx("div",{ref:b,className:"fixed",style:{left:S.x,top:S.y,zIndex:99999,visibility:"hidden",pointerEvents:l?"auto":"none"},children:r}),document.body):null]})}function xX(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,a=t[i+1].start_time;s<a&&r.push({start:s,end:a,duration:a-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 jk({currentPage:t,totalPages:e,onPageChange:n,disabled:r=!1,pageValues:i}){const s=(i==null?void 0:i[t])??t,a=(i==null?void 0:i[0])??0,o=i&&i.length>0?i[i.length-1]:Math.max(0,e-1),[l,c]=T.useState(s.toString());T.useEffect(()=>{c(s.toString())},[s]);const d=v=>{c(v.target.value)},h=v=>{if(v.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())}},g=()=>{c(s.toString())};return p.jsxs("div",{className:"flex items-center gap-0.5",children:[p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(0),disabled:r||t===0,title:"First page",children:p.jsx(wle,{className:"h-3.5 w-3.5"})}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t-1),disabled:r||t===0,title:"Previous page",children:p.jsx(f8,{className:"h-3.5 w-3.5"})}),p.jsxs("div",{className:"flex items-center gap-1 text-xs px-1",children:[p.jsx(V0,{type:"number",value:l,onChange:d,onKeyDown:h,onBlur:g,disabled:r,className:"w-12 h-6 text-center px-1 py-0 text-xs",min:a,max:o}),p.jsxs("span",{className:"text-muted-foreground",children:["/ ",o]})]}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t+1),disabled:r||t>=e-1,title:"Next page",children:p.jsx(u1,{className:"h-3.5 w-3.5"})}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(e-1),disabled:r||t>=e-1,title:"Last page",children:p.jsx(Tle,{className:"h-3.5 w-3.5"})})]})}/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const xw="183",wg={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Mg={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},yX=0,IR=1,bX=2,i_e=3,_X=0,b1=1,D_=2,Rg=3,pp=0,Vl=1,Xc=2,th=0,Wg=1,OR=2,LR=3,zR=4,SX=5,s_e=6,E0=100,wX=101,MX=102,TX=103,EX=104,CX=200,AX=201,NX=202,RX=203,R2=204,k2=205,kX=206,PX=207,DX=208,IX=209,OX=210,LX=211,zX=212,jX=213,FX=214,P2=0,D2=1,I2=2,av=3,O2=4,L2=5,z2=6,j2=7,yw=0,UX=1,BX=2,nu=0,Fk=1,Uk=2,Bk=3,WT=4,Hk=5,Vk=6,Gk=7,jR="attached",HX="detached",$T=300,sh=301,tm=302,I_=303,O_=304,Ny=306,mS=1e3,Tc=1001,gS=1002,Ea=1003,Wk=1004,a_e=1004,n1=1005,o_e=1005,rs=1006,L_=1007,l_e=1007,Kf=1008,c_e=1008,zl=1009,$k=1010,qk=1011,ey=1012,qT=1013,Ku=1014,Bl=1015,ah=1016,XT=1017,YT=1018,ty=1020,Xk=35902,Yk=35899,Kk=1021,Zk=1022,ul=1023,oh=1026,F0=1027,KT=1028,bw=1029,ov=1030,ZT=1031,u_e=1032,QT=1033,z_=33776,j_=33777,F_=33778,U_=33779,F2=35840,U2=35841,B2=35842,H2=35843,V2=36196,G2=37492,W2=37496,$2=37488,q2=37489,X2=37490,Y2=37491,K2=37808,Z2=37809,Q2=37810,J2=37811,e5=37812,t5=37813,n5=37814,r5=37815,i5=37816,s5=37817,a5=37818,o5=37819,l5=37820,c5=37821,u5=36492,d5=36494,f5=36495,h5=36283,p5=36284,m5=36285,g5=36286,VX=2200,GX=2201,WX=2202,vS=2300,v5=2301,UM=2302,FR=2303,kg=2400,Pg=2401,xS=2402,JT=2500,Qk=2501,d_e=0,f_e=1,h_e=2,$X=3200,qX=3201,p_e=3202,m_e=3203,gm=0,XX=1,np="",cl="srgb",nm="srgb-linear",yS="linear",ji="srgb",g_e="",v_e="rg",x_e="ga",y_e=0,Tg=7680,b_e=7681,__e=7682,S_e=7683,w_e=34055,M_e=34056,T_e=5386,E_e=512,C_e=513,A_e=514,N_e=515,R_e=516,k_e=517,P_e=518,UR=519,YX=512,KX=513,ZX=514,eE=515,QX=516,JX=517,tE=518,eY=519,bS=35044,D_e=35048,I_e=35040,O_e=35045,L_e=35049,z_e=35041,j_e=35046,F_e=35050,U_e=35042,B_e="100",BR="300 es",Zc=2e3,lv=2001,H_e={COMPUTE:"compute",RENDER:"render"},V_e={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},G_e={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},W_e={TEXTURE_COMPARE:"depthTextureCompare"};function $_e(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const q_e={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function r1(t,e){return new q_e[t](e)}function tY(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function _S(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function nY(){const t=_S("canvas");return t.style.display="block",t}const YL={};let rm=null;function X_e(t){rm=t}function Y_e(){return rm}function SS(...t){const e="THREE."+t.shift();rm?rm("log",e,...t):console.log(e,...t)}function rY(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 fn(...t){t=rY(t);const e="THREE."+t.shift();if(rm)rm("warn",e,...t);else{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function Hn(...t){t=rY(t);const e="THREE."+t.shift();if(rm)rm("error",e,...t);else{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function wS(...t){const e=t.join(" ");e in YL||(YL[e]=!0,fn(...t))}function K_e(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 Z_e={[P2]:D2,[I2]:z2,[O2]:j2,[av]:L2,[D2]:P2,[z2]:I2,[j2]:O2,[L2]:av};let mh=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){const r=this._listeners;if(r===void 0)return;const i=r[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const r=n[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}};const il=["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 KL=1234567;const $g=Math.PI/180,ny=180/Math.PI;function ru(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(il[t&255]+il[t>>8&255]+il[t>>16&255]+il[t>>24&255]+"-"+il[e&255]+il[e>>8&255]+"-"+il[e>>16&15|64]+il[e>>24&255]+"-"+il[n&63|128]+il[n>>8&255]+"-"+il[n>>16&255]+il[n>>24&255]+il[r&255]+il[r>>8&255]+il[r>>16&255]+il[r>>24&255]).toLowerCase()}function sr(t,e,n){return Math.max(e,Math.min(n,t))}function Jk(t,e){return(t%e+e)%e}function Q_e(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function J_e(t,e,n){return t!==e?(n-t)/(e-t):0}function B_(t,e,n){return(1-n)*t+n*e}function eSe(t,e,n,r){return B_(t,e,1-Math.exp(-n*r))}function tSe(t,e=1){return e-Math.abs(Jk(t,e*2)-e)}function nSe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function rSe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function iSe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function sSe(t,e){return t+Math.random()*(e-t)}function aSe(t){return t*(.5-Math.random())}function oSe(t){t!==void 0&&(KL=t);let e=KL+=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 lSe(t){return t*$g}function cSe(t){return t*ny}function uSe(t){return(t&t-1)===0&&t!==0}function dSe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function fSe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function hSe(t,e,n,r,i){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+r)/2),d=a((e+r)/2),h=s((e-r)/2),g=a((e-r)/2),v=s((r-e)/2),b=a((r-e)/2);switch(i){case"XYX":t.set(o*d,l*h,l*g,o*c);break;case"YZY":t.set(l*g,o*d,l*h,o*c);break;case"ZXZ":t.set(l*h,l*g,o*d,o*c);break;case"XZX":t.set(o*d,l*b,l*v,o*c);break;case"YXY":t.set(l*v,o*d,l*b,o*c);break;case"ZYZ":t.set(l*b,l*v,o*d,o*c);break;default:fn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function jl(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 Cr(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 iY={DEG2RAD:$g,RAD2DEG:ny,generateUUID:ru,clamp:sr,euclideanModulo:Jk,mapLinear:Q_e,inverseLerp:J_e,lerp:B_,damp:eSe,pingpong:tSe,smoothstep:nSe,smootherstep:rSe,randInt:iSe,randFloat:sSe,randFloatSpread:aSe,seededRandom:oSe,degToRad:lSe,radToDeg:cSe,isPowerOfTwo:uSe,ceilPowerOfTwo:dSe,floorPowerOfTwo:fSe,setQuaternionFromProperEuler:hSe,normalize:Cr,denormalize:jl};class Lt{constructor(e=0,n=0){Lt.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=sr(this.x,e.x,n.x),this.y=sr(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=sr(this.x,e,n),this.y=sr(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(sr(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(sr(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,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bo{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,a,o){let l=r[i+0],c=r[i+1],d=r[i+2],h=r[i+3],g=s[a+0],v=s[a+1],b=s[a+2],_=s[a+3];if(h!==_||l!==g||c!==v||d!==b){let w=l*g+c*v+d*b+h*_;w<0&&(g=-g,v=-v,b=-b,_=-_,w=-w);let S=1-o;if(w<.9995){const E=Math.acos(w),A=Math.sin(E);S=Math.sin(S*E)/A,o=Math.sin(o*E)/A,l=l*S+g*o,c=c*S+v*o,d=d*S+b*o,h=h*S+_*o}else{l=l*S+g*o,c=c*S+v*o,d=d*S+b*o,h=h*S+_*o;const E=1/Math.sqrt(l*l+c*c+d*d+h*h);l*=E,c*=E,d*=E,h*=E}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=h}static multiplyQuaternionsFlat(e,n,r,i,s,a){const o=r[i],l=r[i+1],c=r[i+2],d=r[i+3],h=s[a],g=s[a+1],v=s[a+2],b=s[a+3];return e[n]=o*b+d*h+l*v-c*g,e[n+1]=l*b+d*g+c*h-o*v,e[n+2]=c*b+d*v+o*g-l*h,e[n+3]=d*b-o*h-l*g-c*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,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,a=e._order,o=Math.cos,l=Math.sin,c=o(r/2),d=o(i/2),h=o(s/2),g=l(r/2),v=l(i/2),b=l(s/2);switch(a){case"XYZ":this._x=g*d*h+c*v*b,this._y=c*v*h-g*d*b,this._z=c*d*b+g*v*h,this._w=c*d*h-g*v*b;break;case"YXZ":this._x=g*d*h+c*v*b,this._y=c*v*h-g*d*b,this._z=c*d*b-g*v*h,this._w=c*d*h+g*v*b;break;case"ZXY":this._x=g*d*h-c*v*b,this._y=c*v*h+g*d*b,this._z=c*d*b+g*v*h,this._w=c*d*h-g*v*b;break;case"ZYX":this._x=g*d*h-c*v*b,this._y=c*v*h+g*d*b,this._z=c*d*b-g*v*h,this._w=c*d*h+g*v*b;break;case"YZX":this._x=g*d*h+c*v*b,this._y=c*v*h+g*d*b,this._z=c*d*b-g*v*h,this._w=c*d*h-g*v*b;break;case"XZY":this._x=g*d*h-c*v*b,this._y=c*v*h-g*d*b,this._z=c*d*b+g*v*h,this._w=c*d*h+g*v*b;break;default:fn("Quaternion: .setFromEuler() encountered an unknown order: "+a)}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],a=n[1],o=n[5],l=n[9],c=n[2],d=n[6],h=n[10],g=r+o+h;if(g>0){const v=.5/Math.sqrt(g+1);this._w=.25/v,this._x=(d-l)*v,this._y=(s-c)*v,this._z=(a-i)*v}else if(r>o&&r>h){const v=2*Math.sqrt(1+r-o-h);this._w=(d-l)/v,this._x=.25*v,this._y=(i+a)/v,this._z=(s+c)/v}else if(o>h){const v=2*Math.sqrt(1+o-r-h);this._w=(s-c)/v,this._x=(i+a)/v,this._y=.25*v,this._z=(l+d)/v}else{const v=2*Math.sqrt(1+h-r-o);this._w=(a-i)/v,this._x=(s+c)/v,this._y=(l+d)/v,this._z=.25*v}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(sr(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,a=e._w,o=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+a*o+i*c-s*l,this._y=i*d+a*l+s*o-r*c,this._z=s*d+a*c+r*l-i*o,this._w=a*d-r*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){let r=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(r=-r,i=-i,s=-s,a=-a,o=-o);let l=1-n;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,n=Math.sin(n*c)/d,this._x=this._x*l+r*n,this._y=this._y*l+i*n,this._z=this._z*l+s*n,this._w=this._w*l+a*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+a*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 ze{constructor(e=0,n=0,r=0){ze.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(ZL.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(ZL.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,a=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])*a,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*a,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*a,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*r),d=2*(o*n-s*i),h=2*(s*r-a*n);return this.x=n+l*c+a*h-o*d,this.y=r+l*d+o*c-s*h,this.z=i+l*h+s*d-a*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=sr(this.x,e.x,n.x),this.y=sr(this.y,e.y,n.y),this.z=sr(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=sr(this.x,e,n),this.y=sr(this.y,e,n),this.z=sr(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(sr(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,a=n.x,o=n.y,l=n.z;return this.x=i*l-s*o,this.y=s*a-r*l,this.z=r*o-i*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return jA.copy(this).projectOnVector(e),this.sub(jA)}reflect(e){return this.sub(jA.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(sr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jA=new ze,ZL=new Bo;class yr{constructor(e,n,r,i,s,a,o,l,c){yr.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,c)}set(e,n,r,i,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=o,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],o=r[3],l=r[6],c=r[1],d=r[4],h=r[7],g=r[2],v=r[5],b=r[8],_=i[0],w=i[3],S=i[6],E=i[1],A=i[4],N=i[7],I=i[2],P=i[5],L=i[8];return s[0]=a*_+o*E+l*I,s[3]=a*w+o*A+l*P,s[6]=a*S+o*N+l*L,s[1]=c*_+d*E+h*I,s[4]=c*w+d*A+h*P,s[7]=c*S+d*N+h*L,s[2]=g*_+v*E+b*I,s[5]=g*w+v*A+b*P,s[8]=g*S+v*N+b*L,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return n*a*d-n*o*c-r*s*d+r*o*l+i*s*c-i*a*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],h=d*a-o*c,g=o*l-d*s,v=c*s-a*l,b=n*h+r*g+i*v;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/b;return e[0]=h*_,e[1]=(i*c-d*r)*_,e[2]=(o*r-i*a)*_,e[3]=g*_,e[4]=(d*n-i*l)*_,e[5]=(i*s-o*n)*_,e[6]=v*_,e[7]=(r*l-c*n)*_,e[8]=(a*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,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(FA.makeScale(e,n)),this}rotate(e){return this.premultiply(FA.makeRotation(-e)),this}translate(e,n){return this.premultiply(FA.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 FA=new yr,QL=new yr().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),JL=new yr().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function pSe(){const t={enabled:!0,workingColorSpace:nm,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ji&&(i.r=cp(i.r),i.g=cp(i.g),i.b=cp(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ji&&(i.r=_1(i.r),i.g=_1(i.g),i.b=_1(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===np?yS: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,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].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 wS("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return wS("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({[nm]:{primaries:e,whitePoint:r,transfer:yS,toXYZ:QL,fromXYZ:JL,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:cl},outputColorSpaceConfig:{drawingBufferColorSpace:cl}},[cl]:{primaries:e,whitePoint:r,transfer:ji,toXYZ:QL,fromXYZ:JL,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:cl}}}),t}const ii=pSe();function cp(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function _1(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Cx;class sY{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{Cx===void 0&&(Cx=_S("canvas")),Cx.width=e.width,Cx.height=e.height;const i=Cx.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Cx}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 a=0;a<s.length;a++)s[a]=cp(s[a]/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(cp(n[r]/255)*255):n[r]=cp(n[r]);return{data:n,width:e.width,height:e.height}}else return fn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let mSe=0;class U0{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:mSe++}),this.uuid=ru(),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 a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(UA(i[a].image)):s.push(UA(i[a]))}else s=UA(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function UA(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?sY.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(fn("Texture: Unable to serialize Texture."),{})}let gSe=0;const BA=new ze;class ra extends mh{constructor(e=ra.DEFAULT_IMAGE,n=ra.DEFAULT_MAPPING,r=Tc,i=Tc,s=rs,a=Kf,o=ul,l=zl,c=ra.DEFAULT_ANISOTROPY,d=np){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:gSe++}),this.uuid=ru(),this.name="",this.source=new U0(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Lt(0,0),this.repeat=new Lt(1,1),this.center=new Lt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new yr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(BA).x}get height(){return this.source.getSize(BA).y}get depth(){return this.source.getSize(BA).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){fn(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){fn(`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!==$T)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case mS:e.x=e.x-Math.floor(e.x);break;case Tc:e.x=e.x<0?0:1;break;case gS: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 mS:e.y=e.y-Math.floor(e.y);break;case Tc:e.y=e.y<0?0:1;break;case gS: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++}}ra.DEFAULT_IMAGE=null;ra.DEFAULT_MAPPING=$T;ra.DEFAULT_ANISOTROPY=1;class ci{constructor(e=0,n=0,r=0,i=1){ci.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,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i+a[12]*s,this.y=a[1]*n+a[5]*r+a[9]*i+a[13]*s,this.z=a[2]*n+a[6]*r+a[10]*i+a[14]*s,this.w=a[3]*n+a[7]*r+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],h=l[8],g=l[1],v=l[5],b=l[9],_=l[2],w=l[6],S=l[10];if(Math.abs(d-g)<.01&&Math.abs(h-_)<.01&&Math.abs(b-w)<.01){if(Math.abs(d+g)<.1&&Math.abs(h+_)<.1&&Math.abs(b+w)<.1&&Math.abs(c+v+S-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const A=(c+1)/2,N=(v+1)/2,I=(S+1)/2,P=(d+g)/4,L=(h+_)/4,R=(b+w)/4;return A>N&&A>I?A<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(A),i=P/r,s=L/r):N>I?N<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(N),r=P/i,s=R/i):I<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(I),r=L/s,i=R/s),this.set(r,i,s,n),this}let E=Math.sqrt((w-b)*(w-b)+(h-_)*(h-_)+(g-d)*(g-d));return Math.abs(E)<.001&&(E=1),this.x=(w-b)/E,this.y=(h-_)/E,this.z=(g-d)/E,this.w=Math.acos((c+v+S-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=sr(this.x,e.x,n.x),this.y=sr(this.y,e.y,n.y),this.z=sr(this.z,e.z,n.z),this.w=sr(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=sr(this.x,e,n),this.y=sr(this.y,e,n),this.z=sr(this.z,e,n),this.w=sr(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(sr(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 e9 extends mh{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:rs,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=r.depth,this.scissor=new ci(0,0,e,n),this.scissorTest=!1,this.viewport=new ci(0,0,e,n),this.textures=[];const i={width:e,height:n,depth:r.depth},s=new ra(i),a=r.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const n={minFilter:rs,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const i=Object.assign({},e.textures[n].image);this.textures[n].source=new U0(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 iu extends e9{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class nE extends ra{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=Ea,this.minFilter=Ea,this.wrapR=Tc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class vSe extends iu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new nE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class rE extends ra{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=Ea,this.minFilter=Ea,this.wrapR=Tc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class xSe extends iu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new rE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class rr{constructor(e,n,r,i,s,a,o,l,c,d,h,g,v,b,_,w){rr.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,a,o,l,c,d,h,g,v,b,_,w)}set(e,n,r,i,s,a,o,l,c,d,h,g,v,b,_,w){const S=this.elements;return S[0]=e,S[4]=n,S[8]=r,S[12]=i,S[1]=s,S[5]=a,S[9]=o,S[13]=l,S[2]=c,S[6]=d,S[10]=h,S[14]=g,S[3]=v,S[7]=b,S[11]=_,S[15]=w,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 rr().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/Ax.setFromMatrixColumn(e,0).length(),s=1/Ax.setFromMatrixColumn(e,1).length(),a=1/Ax.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]*a,n[9]=r[9]*a,n[10]=r[10]*a,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,a=Math.cos(r),o=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const g=a*d,v=a*h,b=o*d,_=o*h;n[0]=l*d,n[4]=-l*h,n[8]=c,n[1]=v+b*c,n[5]=g-_*c,n[9]=-o*l,n[2]=_-g*c,n[6]=b+v*c,n[10]=a*l}else if(e.order==="YXZ"){const g=l*d,v=l*h,b=c*d,_=c*h;n[0]=g+_*o,n[4]=b*o-v,n[8]=a*c,n[1]=a*h,n[5]=a*d,n[9]=-o,n[2]=v*o-b,n[6]=_+g*o,n[10]=a*l}else if(e.order==="ZXY"){const g=l*d,v=l*h,b=c*d,_=c*h;n[0]=g-_*o,n[4]=-a*h,n[8]=b+v*o,n[1]=v+b*o,n[5]=a*d,n[9]=_-g*o,n[2]=-a*c,n[6]=o,n[10]=a*l}else if(e.order==="ZYX"){const g=a*d,v=a*h,b=o*d,_=o*h;n[0]=l*d,n[4]=b*c-v,n[8]=g*c+_,n[1]=l*h,n[5]=_*c+g,n[9]=v*c-b,n[2]=-c,n[6]=o*l,n[10]=a*l}else if(e.order==="YZX"){const g=a*l,v=a*c,b=o*l,_=o*c;n[0]=l*d,n[4]=_-g*h,n[8]=b*h+v,n[1]=h,n[5]=a*d,n[9]=-o*d,n[2]=-c*d,n[6]=v*h+b,n[10]=g-_*h}else if(e.order==="XZY"){const g=a*l,v=a*c,b=o*l,_=o*c;n[0]=l*d,n[4]=-h,n[8]=c*d,n[1]=g*h+_,n[5]=a*d,n[9]=v*h-b,n[2]=b*h-v,n[6]=o*d,n[10]=_*h+g}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(ySe,e,bSe)}lookAt(e,n,r){const i=this.elements;return Bc.subVectors(e,n),Bc.lengthSq()===0&&(Bc.z=1),Bc.normalize(),h0.crossVectors(r,Bc),h0.lengthSq()===0&&(Math.abs(r.z)===1?Bc.x+=1e-4:Bc.z+=1e-4,Bc.normalize(),h0.crossVectors(r,Bc)),h0.normalize(),T4.crossVectors(Bc,h0),i[0]=h0.x,i[4]=T4.x,i[8]=Bc.x,i[1]=h0.y,i[5]=T4.y,i[9]=Bc.y,i[2]=h0.z,i[6]=T4.z,i[10]=Bc.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,a=r[0],o=r[4],l=r[8],c=r[12],d=r[1],h=r[5],g=r[9],v=r[13],b=r[2],_=r[6],w=r[10],S=r[14],E=r[3],A=r[7],N=r[11],I=r[15],P=i[0],L=i[4],R=i[8],O=i[12],W=i[1],U=i[5],V=i[9],G=i[13],Z=i[2],B=i[6],q=i[10],Y=i[14],K=i[3],J=i[7],F=i[11],j=i[15];return s[0]=a*P+o*W+l*Z+c*K,s[4]=a*L+o*U+l*B+c*J,s[8]=a*R+o*V+l*q+c*F,s[12]=a*O+o*G+l*Y+c*j,s[1]=d*P+h*W+g*Z+v*K,s[5]=d*L+h*U+g*B+v*J,s[9]=d*R+h*V+g*q+v*F,s[13]=d*O+h*G+g*Y+v*j,s[2]=b*P+_*W+w*Z+S*K,s[6]=b*L+_*U+w*B+S*J,s[10]=b*R+_*V+w*q+S*F,s[14]=b*O+_*G+w*Y+S*j,s[3]=E*P+A*W+N*Z+I*K,s[7]=E*L+A*U+N*B+I*J,s[11]=E*R+A*V+N*q+I*F,s[15]=E*O+A*G+N*Y+I*j,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],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],h=e[6],g=e[10],v=e[14],b=e[3],_=e[7],w=e[11],S=e[15],E=l*v-c*g,A=o*v-c*h,N=o*g-l*h,I=a*v-c*d,P=a*g-l*d,L=a*h-o*d;return n*(_*E-w*A+S*N)-r*(b*E-w*I+S*P)+i*(b*A-_*I+S*L)-s*(b*N-_*P+w*L)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],h=e[9],g=e[10],v=e[11],b=e[12],_=e[13],w=e[14],S=e[15],E=n*o-r*a,A=n*l-i*a,N=n*c-s*a,I=r*l-i*o,P=r*c-s*o,L=i*c-s*l,R=d*_-h*b,O=d*w-g*b,W=d*S-v*b,U=h*w-g*_,V=h*S-v*_,G=g*S-v*w,Z=E*G-A*V+N*U+I*W-P*O+L*R;if(Z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/Z;return e[0]=(o*G-l*V+c*U)*B,e[1]=(i*V-r*G-s*U)*B,e[2]=(_*L-w*P+S*I)*B,e[3]=(g*P-h*L-v*I)*B,e[4]=(l*W-a*G-c*O)*B,e[5]=(n*G-i*W+s*O)*B,e[6]=(w*N-b*L-S*A)*B,e[7]=(d*L-g*N+v*A)*B,e[8]=(a*V-o*W+c*R)*B,e[9]=(r*W-n*V-s*R)*B,e[10]=(b*P-_*N+S*E)*B,e[11]=(h*N-d*P-v*E)*B,e[12]=(o*O-a*U-l*R)*B,e[13]=(n*U-r*O+i*R)*B,e[14]=(_*A-b*I-w*E)*B,e[15]=(d*I-h*A+g*E)*B,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,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+r,c*o-i*l,c*l+i*o,0,c*o+i*l,d*o+r,d*l-i*a,0,c*l-i*o,d*l+i*a,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,a){return this.set(1,r,s,0,e,1,a,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,a=n._y,o=n._z,l=n._w,c=s+s,d=a+a,h=o+o,g=s*c,v=s*d,b=s*h,_=a*d,w=a*h,S=o*h,E=l*c,A=l*d,N=l*h,I=r.x,P=r.y,L=r.z;return i[0]=(1-(_+S))*I,i[1]=(v+N)*I,i[2]=(b-A)*I,i[3]=0,i[4]=(v-N)*P,i[5]=(1-(g+S))*P,i[6]=(w+E)*P,i[7]=0,i[8]=(b+A)*L,i[9]=(w-E)*L,i[10]=(1-(g+_))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinant();if(s===0)return r.set(1,1,1),n.identity(),this;let a=Ax.set(i[0],i[1],i[2]).length();const o=Ax.set(i[4],i[5],i[6]).length(),l=Ax.set(i[8],i[9],i[10]).length();s<0&&(a=-a),Ed.copy(this);const c=1/a,d=1/o,h=1/l;return Ed.elements[0]*=c,Ed.elements[1]*=c,Ed.elements[2]*=c,Ed.elements[4]*=d,Ed.elements[5]*=d,Ed.elements[6]*=d,Ed.elements[8]*=h,Ed.elements[9]*=h,Ed.elements[10]*=h,n.setFromRotationMatrix(Ed),r.x=a,r.y=o,r.z=l,this}makePerspective(e,n,r,i,s,a,o=Zc,l=!1){const c=this.elements,d=2*s/(n-e),h=2*s/(r-i),g=(n+e)/(n-e),v=(r+i)/(r-i);let b,_;if(l)b=s/(a-s),_=a*s/(a-s);else if(o===Zc)b=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===lv)b=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=g,c[12]=0,c[1]=0,c[5]=h,c[9]=v,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,a,o=Zc,l=!1){const c=this.elements,d=2/(n-e),h=2/(r-i),g=-(n+e)/(n-e),v=-(r+i)/(r-i);let b,_;if(l)b=1/(a-s),_=a/(a-s);else if(o===Zc)b=-2/(a-s),_=-(a+s)/(a-s);else if(o===lv)b=-1/(a-s),_=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=g,c[1]=0,c[5]=h,c[9]=0,c[13]=v,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 Ax=new ze,Ed=new rr,ySe=new ze(0,0,0),bSe=new ze(1,1,1),h0=new ze,T4=new ze,Bc=new ze,ez=new rr,tz=new Bo;class su{constructor(e=0,n=0,r=0,i=su.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],a=i[4],o=i[8],l=i[1],c=i[5],d=i[9],h=i[2],g=i[6],v=i[10];switch(n){case"XYZ":this._y=Math.asin(sr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,v),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(g,c),this._z=0);break;case"YXZ":this._x=Math.asin(-sr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,v),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(sr(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-h,v),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-sr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(g,v),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(sr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,v));break;case"XZY":this._z=Math.asin(-sr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(g,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,v),this._y=0);break;default:fn("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return ez.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ez,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return tz.setFromEuler(this),this.setFromQuaternion(tz,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}}su.DEFAULT_ORDER="XYZ";class ry{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 _Se=0;const nz=new ze,Nx=new Bo,Gh=new rr,E4=new ze,Yb=new ze,SSe=new ze,wSe=new Bo,rz=new ze(1,0,0),iz=new ze(0,1,0),sz=new ze(0,0,1),az={type:"added"},MSe={type:"removed"},Rx={type:"childadded",child:null},HA={type:"childremoved",child:null};class yi extends mh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_Se++}),this.uuid=ru(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yi.DEFAULT_UP.clone();const e=new ze,n=new su,r=new Bo,i=new ze(1,1,1);function s(){r.setFromEuler(n,!1)}function a(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(a),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 rr},normalMatrix:{value:new yr}}),this.matrix=new rr,this.matrixWorld=new rr,this.matrixAutoUpdate=yi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=yi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ry,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 Nx.setFromAxisAngle(e,n),this.quaternion.multiply(Nx),this}rotateOnWorldAxis(e,n){return Nx.setFromAxisAngle(e,n),this.quaternion.premultiply(Nx),this}rotateX(e){return this.rotateOnAxis(rz,e)}rotateY(e){return this.rotateOnAxis(iz,e)}rotateZ(e){return this.rotateOnAxis(sz,e)}translateOnAxis(e,n){return nz.copy(e).applyQuaternion(this.quaternion),this.position.add(nz.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(rz,e)}translateY(e){return this.translateOnAxis(iz,e)}translateZ(e){return this.translateOnAxis(sz,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Gh.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?E4.copy(e):E4.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),Yb.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Gh.lookAt(Yb,E4,this.up):Gh.lookAt(E4,Yb,this.up),this.quaternion.setFromRotationMatrix(Gh),i&&(Gh.extractRotation(i.matrixWorld),Nx.setFromRotationMatrix(Gh),this.quaternion.premultiply(Nx.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Hn("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(az),Rx.child=e,this.dispatchEvent(Rx),Rx.child=null):Hn("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(MSe),HA.child=e,this.dispatchEvent(HA),HA.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),Gh.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Gh.multiply(e.parent.matrixWorld)),e.applyMatrix4(Gh),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(az),Rx.child=e,this.dispatchEvent(Rx),Rx.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 a=this.children[r].getObjectByProperty(e,n);if(a!==void 0)return a}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,a=i.length;s<a;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(Yb,e,SSe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Yb,wSe,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,a=i.length;s<a;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(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),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(o,l){return o[l.uuid]===void 0&&(o[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 o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const h=l[c];s(e.shapes,h)}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 o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(n){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),h=a(e.shapes),g=a(e.skeletons),v=a(e.animations),b=a(e.nodes);o.length>0&&(r.geometries=o),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),h.length>0&&(r.shapes=h),g.length>0&&(r.skeletons=g),v.length>0&&(r.animations=v),b.length>0&&(r.nodes=b)}return r.object=i,r;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}yi.DEFAULT_UP=new ze(0,1,0);yi.DEFAULT_MATRIX_AUTO_UPDATE=!0;yi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class i1 extends yi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const TSe={type:"move"};class BM{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new i1,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 i1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ze,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ze),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new i1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ze,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ze),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,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const w=n.getJointPose(_,r),S=this._getHandJoint(c,_);w!==null&&(S.matrix.fromArray(w.transform.matrix),S.matrix.decompose(S.position,S.rotation,S.scale),S.matrixWorldNeedsUpdate=!0,S.jointRadius=w.radius),S.visible=w!==null}const d=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],g=d.position.distanceTo(h.position),v=.02,b=.005;c.inputState.pinching&&g>v+b?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&g<=v-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));o!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(TSe)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new i1;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const aY={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},p0={h:0,s:0,l:0},C4={h:0,s:0,l:0};function VA(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 xn{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=cl){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ii.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=ii.workingColorSpace){return this.r=e,this.g=n,this.b=r,ii.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=ii.workingColorSpace){if(e=Jk(e,1),n=sr(n,0,1),r=sr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,a=2*r-s;this.r=VA(a,s,e+1/3),this.g=VA(a,s,e),this.b=VA(a,s,e-1/3)}return ii.colorSpaceToWorking(this,i),this}setStyle(e,n=cl){function r(s){s!==void 0&&parseFloat(s)<1&&fn("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))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(o))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(o))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:fn("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(a===6)return this.setHex(parseInt(s,16),n);fn("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=cl){const r=aY[e.toLowerCase()];return r!==void 0?this.setHex(r,n):fn("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=cp(e.r),this.g=cp(e.g),this.b=cp(e.b),this}copyLinearToSRGB(e){return this.r=_1(e.r),this.g=_1(e.g),this.b=_1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=cl){return ii.workingToColorSpace(sl.copy(this),e),Math.round(sr(sl.r*255,0,255))*65536+Math.round(sr(sl.g*255,0,255))*256+Math.round(sr(sl.b*255,0,255))}getHexString(e=cl){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=ii.workingColorSpace){ii.workingToColorSpace(sl.copy(this),n);const r=sl.r,i=sl.g,s=sl.b,a=Math.max(r,i,s),o=Math.min(r,i,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=d<=.5?h/(a+o):h/(2-a-o),a){case r:l=(i-s)/h+(i<s?6:0);break;case i:l=(s-r)/h+2;break;case s:l=(r-i)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,n=ii.workingColorSpace){return ii.workingToColorSpace(sl.copy(this),n),e.r=sl.r,e.g=sl.g,e.b=sl.b,e}getStyle(e=cl){ii.workingToColorSpace(sl.copy(this),e);const n=sl.r,r=sl.g,i=sl.b;return e!==cl?`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(p0),this.setHSL(p0.h+e,p0.s+n,p0.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(p0),e.getHSL(C4);const r=B_(p0.h,C4.h,n),i=B_(p0.s,C4.s,n),s=B_(p0.l,C4.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 sl=new xn;xn.NAMES=aY;class iE{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new xn(e),this.density=n}clone(){return new iE(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class sE{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new xn(e),this.near=n,this.far=r}clone(){return new sE(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let t9=class extends yi{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 su,this.environmentIntensity=1,this.environmentRotation=new su,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 Cd=new ze,Wh=new ze,GA=new ze,$h=new ze,kx=new ze,Px=new ze,oz=new ze,WA=new ze,$A=new ze,qA=new ze,XA=new ci,YA=new ci,KA=new ci;class Mc{constructor(e=new ze,n=new ze,r=new ze){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Cd.subVectors(e,n),i.cross(Cd);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){Cd.subVectors(i,n),Wh.subVectors(r,n),GA.subVectors(e,n);const a=Cd.dot(Cd),o=Cd.dot(Wh),l=Cd.dot(GA),c=Wh.dot(Wh),d=Wh.dot(GA),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const g=1/h,v=(c*l-o*d)*g,b=(a*d-o*l)*g;return s.set(1-v-b,b,v)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,$h)===null?!1:$h.x>=0&&$h.y>=0&&$h.x+$h.y<=1}static getInterpolation(e,n,r,i,s,a,o,l){return this.getBarycoord(e,n,r,i,$h)===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,$h.x),l.addScaledVector(a,$h.y),l.addScaledVector(o,$h.z),l)}static getInterpolatedAttribute(e,n,r,i,s,a){return XA.setScalar(0),YA.setScalar(0),KA.setScalar(0),XA.fromBufferAttribute(e,n),YA.fromBufferAttribute(e,r),KA.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(XA,s.x),a.addScaledVector(YA,s.y),a.addScaledVector(KA,s.z),a}static isFrontFacing(e,n,r,i){return Cd.subVectors(r,n),Wh.subVectors(e,n),Cd.cross(Wh).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 Cd.subVectors(this.c,this.b),Wh.subVectors(this.a,this.b),Cd.cross(Wh).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Mc.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Mc.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Mc.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Mc.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Mc.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 a,o;kx.subVectors(i,r),Px.subVectors(s,r),WA.subVectors(e,r);const l=kx.dot(WA),c=Px.dot(WA);if(l<=0&&c<=0)return n.copy(r);$A.subVectors(e,i);const d=kx.dot($A),h=Px.dot($A);if(d>=0&&h<=d)return n.copy(i);const g=l*h-d*c;if(g<=0&&l>=0&&d<=0)return a=l/(l-d),n.copy(r).addScaledVector(kx,a);qA.subVectors(e,s);const v=kx.dot(qA),b=Px.dot(qA);if(b>=0&&v<=b)return n.copy(s);const _=v*c-l*b;if(_<=0&&c>=0&&b<=0)return o=c/(c-b),n.copy(r).addScaledVector(Px,o);const w=d*b-v*h;if(w<=0&&h-d>=0&&v-b>=0)return oz.subVectors(s,i),o=(h-d)/(h-d+(v-b)),n.copy(i).addScaledVector(oz,o);const S=1/(w+_+g);return a=_*S,o=g*S,n.copy(r).addScaledVector(kx,a).addScaledVector(Px,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Ca{constructor(e=new ze(1/0,1/0,1/0),n=new ze(-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(Ad.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Ad.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=Ad.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 a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Ad):Ad.fromBufferAttribute(s,a),Ad.applyMatrix4(e.matrixWorld),this.expandByPoint(Ad);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),A4.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),A4.copy(r.boundingBox)),A4.applyMatrix4(e.matrixWorld),this.union(A4)}const i=e.children;for(let s=0,a=i.length;s<a;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,Ad),Ad.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(Kb),N4.subVectors(this.max,Kb),Dx.subVectors(e.a,Kb),Ix.subVectors(e.b,Kb),Ox.subVectors(e.c,Kb),m0.subVectors(Ix,Dx),g0.subVectors(Ox,Ix),ag.subVectors(Dx,Ox);let n=[0,-m0.z,m0.y,0,-g0.z,g0.y,0,-ag.z,ag.y,m0.z,0,-m0.x,g0.z,0,-g0.x,ag.z,0,-ag.x,-m0.y,m0.x,0,-g0.y,g0.x,0,-ag.y,ag.x,0];return!ZA(n,Dx,Ix,Ox,N4)||(n=[1,0,0,0,1,0,0,0,1],!ZA(n,Dx,Ix,Ox,N4))?!1:(R4.crossVectors(m0,g0),n=[R4.x,R4.y,R4.z],ZA(n,Dx,Ix,Ox,N4))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ad).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ad).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:(qh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qh),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 qh=[new ze,new ze,new ze,new ze,new ze,new ze,new ze,new ze],Ad=new ze,A4=new Ca,Dx=new ze,Ix=new ze,Ox=new ze,m0=new ze,g0=new ze,ag=new ze,Kb=new ze,N4=new ze,R4=new ze,og=new ze;function ZA(t,e,n,r,i){for(let s=0,a=t.length-3;s<=a;s+=3){og.fromArray(t,s);const o=i.x*Math.abs(og.x)+i.y*Math.abs(og.y)+i.z*Math.abs(og.z),l=e.dot(og),c=n.dot(og),d=r.dot(og);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const rp=ESe();function ESe(){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),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function yc(t){Math.abs(t)>65504&&fn("DataUtils.toHalfFloat(): Value out of range."),t=sr(t,-65504,65504),rp.floatView[0]=t;const e=rp.uint32View[0],n=e>>23&511;return rp.baseTable[n]+((e&8388607)>>rp.shiftTable[n])}function x_(t){const e=t>>10;return rp.uint32View[0]=rp.mantissaTable[rp.offsetTable[e]+(t&1023)]+rp.exponentTable[e],rp.floatView[0]}class CSe{static toHalfFloat(e){return yc(e)}static fromHalfFloat(e){return x_(e)}}const Fa=new ze,k4=new Lt;let ASe=0;class Vi{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:ASe++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=bS,this.updateRanges=[],this.gpuType=Bl,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++)k4.fromBufferAttribute(this,n),k4.applyMatrix3(e),this.setXY(n,k4.x,k4.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Fa.fromBufferAttribute(this,n),Fa.applyMatrix3(e),this.setXYZ(n,Fa.x,Fa.y,Fa.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Fa.fromBufferAttribute(this,n),Fa.applyMatrix4(e),this.setXYZ(n,Fa.x,Fa.y,Fa.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Fa.fromBufferAttribute(this,n),Fa.applyNormalMatrix(e),this.setXYZ(n,Fa.x,Fa.y,Fa.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Fa.fromBufferAttribute(this,n),Fa.transformDirection(e),this.setXYZ(n,Fa.x,Fa.y,Fa.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=jl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Cr(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=jl(n,this.array)),n}setX(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=jl(n,this.array)),n}setY(e,n){return this.normalized&&(n=Cr(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=jl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Cr(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=jl(n,this.array)),n}setW(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(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=Cr(n,this.array),r=Cr(r,this.array),i=Cr(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=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array),s=Cr(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!==bS&&(e.usage=this.usage),e}}class NSe extends Vi{constructor(e,n,r){super(new Int8Array(e),n,r)}}class RSe extends Vi{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class kSe extends Vi{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class PSe extends Vi{constructor(e,n,r){super(new Int16Array(e),n,r)}}class n9 extends Vi{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class DSe extends Vi{constructor(e,n,r){super(new Int32Array(e),n,r)}}class r9 extends Vi{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class ISe extends Vi{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=x_(this.array[e*this.itemSize]);return this.normalized&&(n=jl(n,this.array)),n}setX(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize]=yc(n),this}getY(e){let n=x_(this.array[e*this.itemSize+1]);return this.normalized&&(n=jl(n,this.array)),n}setY(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+1]=yc(n),this}getZ(e){let n=x_(this.array[e*this.itemSize+2]);return this.normalized&&(n=jl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+2]=yc(n),this}getW(e){let n=x_(this.array[e*this.itemSize+3]);return this.normalized&&(n=jl(n,this.array)),n}setW(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+3]=yc(n),this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array)),this.array[e+0]=yc(n),this.array[e+1]=yc(r),this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array)),this.array[e+0]=yc(n),this.array[e+1]=yc(r),this.array[e+2]=yc(i),this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array),s=Cr(s,this.array)),this.array[e+0]=yc(n),this.array[e+1]=yc(r),this.array[e+2]=yc(i),this.array[e+3]=yc(s),this}}class An extends Vi{constructor(e,n,r){super(new Float32Array(e),n,r)}}const OSe=new Ca,Zb=new ze,QA=new ze;class Ga{constructor(e=new ze,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):OSe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,a=e.length;s<a;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;Zb.subVectors(e,this.center);const n=Zb.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(Zb,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):(QA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Zb.copy(e.center).add(QA)),this.expandByPoint(Zb.copy(e.center).sub(QA))),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 LSe=0;const Du=new rr,JA=new yi,Lx=new ze,Hc=new Ca,Qb=new Ca,go=new ze;class br extends mh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:LSe++}),this.uuid=ru(),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($_e(e)?r9:n9)(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 yr().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 Du.makeRotationFromQuaternion(e),this.applyMatrix4(Du),this}rotateX(e){return Du.makeRotationX(e),this.applyMatrix4(Du),this}rotateY(e){return Du.makeRotationY(e),this.applyMatrix4(Du),this}rotateZ(e){return Du.makeRotationZ(e),this.applyMatrix4(Du),this}translate(e,n,r){return Du.makeTranslation(e,n,r),this.applyMatrix4(Du),this}scale(e,n,r){return Du.makeScale(e,n,r),this.applyMatrix4(Du),this}lookAt(e){return JA.lookAt(e),JA.updateMatrix(),this.applyMatrix4(JA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Lx).negate(),this.translate(Lx.x,Lx.y,Lx.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 a=e[i];r.push(a.x,a.y,a.z||0)}this.setAttribute("position",new An(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&&fn("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 Ca);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Hn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ze(-1/0,-1/0,-1/0),new ze(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];Hc.setFromBufferAttribute(s),this.morphTargetsRelative?(go.addVectors(this.boundingBox.min,Hc.min),this.boundingBox.expandByPoint(go),go.addVectors(this.boundingBox.max,Hc.max),this.boundingBox.expandByPoint(go)):(this.boundingBox.expandByPoint(Hc.min),this.boundingBox.expandByPoint(Hc.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Hn('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 Ga);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Hn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ze,1/0);return}if(e){const r=this.boundingSphere.center;if(Hc.setFromBufferAttribute(e),n)for(let s=0,a=n.length;s<a;s++){const o=n[s];Qb.setFromBufferAttribute(o),this.morphTargetsRelative?(go.addVectors(Hc.min,Qb.min),Hc.expandByPoint(go),go.addVectors(Hc.max,Qb.max),Hc.expandByPoint(go)):(Hc.expandByPoint(Qb.min),Hc.expandByPoint(Qb.max))}Hc.getCenter(r);let i=0;for(let s=0,a=e.count;s<a;s++)go.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(go));if(n)for(let s=0,a=n.length;s<a;s++){const o=n[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)go.fromBufferAttribute(o,c),l&&(Lx.fromBufferAttribute(e,c),go.add(Lx)),i=Math.max(i,r.distanceToSquared(go))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Hn('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){Hn("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 Vi(new Float32Array(4*r.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let R=0;R<r.count;R++)o[R]=new ze,l[R]=new ze;const c=new ze,d=new ze,h=new ze,g=new Lt,v=new Lt,b=new Lt,_=new ze,w=new ze;function S(R,O,W){c.fromBufferAttribute(r,R),d.fromBufferAttribute(r,O),h.fromBufferAttribute(r,W),g.fromBufferAttribute(s,R),v.fromBufferAttribute(s,O),b.fromBufferAttribute(s,W),d.sub(c),h.sub(c),v.sub(g),b.sub(g);const U=1/(v.x*b.y-b.x*v.y);isFinite(U)&&(_.copy(d).multiplyScalar(b.y).addScaledVector(h,-v.y).multiplyScalar(U),w.copy(h).multiplyScalar(v.x).addScaledVector(d,-b.x).multiplyScalar(U),o[R].add(_),o[O].add(_),o[W].add(_),l[R].add(w),l[O].add(w),l[W].add(w))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let R=0,O=E.length;R<O;++R){const W=E[R],U=W.start,V=W.count;for(let G=U,Z=U+V;G<Z;G+=3)S(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const A=new ze,N=new ze,I=new ze,P=new ze;function L(R){I.fromBufferAttribute(i,R),P.copy(I);const O=o[R];A.copy(O),A.sub(I.multiplyScalar(I.dot(O))).normalize(),N.crossVectors(P,O);const U=N.dot(l[R])<0?-1:1;a.setXYZW(R,A.x,A.y,A.z,U)}for(let R=0,O=E.length;R<O;++R){const W=E[R],U=W.start,V=W.count;for(let G=U,Z=U+V;G<Z;G+=3)L(e.getX(G+0)),L(e.getX(G+1)),L(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 Vi(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let g=0,v=r.count;g<v;g++)r.setXYZ(g,0,0,0);const i=new ze,s=new ze,a=new ze,o=new ze,l=new ze,c=new ze,d=new ze,h=new ze;if(e)for(let g=0,v=e.count;g<v;g+=3){const b=e.getX(g+0),_=e.getX(g+1),w=e.getX(g+2);i.fromBufferAttribute(n,b),s.fromBufferAttribute(n,_),a.fromBufferAttribute(n,w),d.subVectors(a,s),h.subVectors(i,s),d.cross(h),o.fromBufferAttribute(r,b),l.fromBufferAttribute(r,_),c.fromBufferAttribute(r,w),o.add(d),l.add(d),c.add(d),r.setXYZ(b,o.x,o.y,o.z),r.setXYZ(_,l.x,l.y,l.z),r.setXYZ(w,c.x,c.y,c.z)}else for(let g=0,v=n.count;g<v;g+=3)i.fromBufferAttribute(n,g+0),s.fromBufferAttribute(n,g+1),a.fromBufferAttribute(n,g+2),d.subVectors(a,s),h.subVectors(i,s),d.cross(h),r.setXYZ(g+0,d.x,d.y,d.z),r.setXYZ(g+1,d.x,d.y,d.z),r.setXYZ(g+2,d.x,d.y,d.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)go.fromBufferAttribute(e,n),go.normalize(),e.setXYZ(n,go.x,go.y,go.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,h=o.normalized,g=new c.constructor(l.length*d);let v=0,b=0;for(let _=0,w=l.length;_<w;_++){o.isInterleavedBufferAttribute?v=l[_]*o.data.stride+o.offset:v=l[_]*d;for(let S=0;S<d;S++)g[b++]=c[v++]}return new Vi(g,d,h)}if(this.index===null)return fn("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new br,r=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,r);n.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,h=c.length;d<h;d++){const g=c[d],v=e(g,r);l.push(v)}n.morphAttributes[o]=l}n.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];n.addGroup(c.start,c.count,c.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let h=0,g=c.length;h<g;h++){const v=c[h];d.push(v.toJSON(e.data))}d.length>0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],h=s[c];for(let g=0,v=h.length;g<v;g++)d.push(h[g].clone(n));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.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 aE{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=bS,this.updateRanges=[],this.version=0,this.uuid=ru()}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=ru()),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=ru()),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 Pl=new ze;class Qc{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++)Pl.fromBufferAttribute(this,n),Pl.applyMatrix4(e),this.setXYZ(n,Pl.x,Pl.y,Pl.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Pl.fromBufferAttribute(this,n),Pl.applyNormalMatrix(e),this.setXYZ(n,Pl.x,Pl.y,Pl.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Pl.fromBufferAttribute(this,n),Pl.transformDirection(e),this.setXYZ(n,Pl.x,Pl.y,Pl.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=jl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Cr(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=Cr(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Cr(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Cr(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Cr(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=jl(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=jl(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=jl(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=jl(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=Cr(n,this.array),r=Cr(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=Cr(n,this.array),r=Cr(r,this.array),i=Cr(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=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array),s=Cr(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){SS("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 Vi(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 Qc(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){SS("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 zSe=0;class vl extends mh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zSe++}),this.uuid=ru(),this.name="",this.type="Material",this.blending=Wg,this.side=pp,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=R2,this.blendDst=k2,this.blendEquation=E0,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new xn(0,0,0),this.blendAlpha=0,this.depthFunc=av,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=UR,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Tg,this.stencilZFail=Tg,this.stencilZPass=Tg,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){fn(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){fn(`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!==Wg&&(r.blending=this.blending),this.side!==pp&&(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!==R2&&(r.blendSrc=this.blendSrc),this.blendDst!==k2&&(r.blendDst=this.blendDst),this.blendEquation!==E0&&(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!==av&&(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!==UR&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Tg&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Tg&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Tg&&(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 a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(n){const s=i(e.textures),a=i(e.images);s.length>0&&(r.textures=s),a.length>0&&(r.images=a)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class i9 extends vl{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new xn(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 zx;const Jb=new ze,jx=new ze,Fx=new ze,Ux=new Lt,e_=new Lt,oY=new rr,P4=new ze,t_=new ze,D4=new ze,lz=new Lt,e6=new Lt,cz=new Lt;class lY extends yi{constructor(e=new i9){if(super(),this.isSprite=!0,this.type="Sprite",zx===void 0){zx=new br;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 aE(n,5);zx.setIndex([0,1,2,0,2,3]),zx.setAttribute("position",new Qc(r,3,0,!1)),zx.setAttribute("uv",new Qc(r,2,3,!1))}this.geometry=zx,this.material=e,this.center=new Lt(.5,.5),this.count=1}raycast(e,n){e.camera===null&&Hn('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),jx.setFromMatrixScale(this.matrixWorld),oY.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Fx.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&jx.multiplyScalar(-Fx.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const a=this.center;I4(P4.set(-.5,-.5,0),Fx,a,jx,i,s),I4(t_.set(.5,-.5,0),Fx,a,jx,i,s),I4(D4.set(.5,.5,0),Fx,a,jx,i,s),lz.set(0,0),e6.set(1,0),cz.set(1,1);let o=e.ray.intersectTriangle(P4,t_,D4,!1,Jb);if(o===null&&(I4(t_.set(-.5,.5,0),Fx,a,jx,i,s),e6.set(0,1),o=e.ray.intersectTriangle(P4,D4,t_,!1,Jb),o===null))return;const l=e.ray.origin.distanceTo(Jb);l<e.near||l>e.far||n.push({distance:l,point:Jb.clone(),uv:Mc.getInterpolation(Jb,P4,t_,D4,lz,e6,cz,new Lt),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 I4(t,e,n,r,i,s){Ux.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(e_.x=s*Ux.x-i*Ux.y,e_.y=i*Ux.x+s*Ux.y):e_.copy(Ux),t.copy(e),t.x+=e_.x,t.y+=e_.y,t.applyMatrix4(oY)}const O4=new ze,uz=new ze;class cY extends yi{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){O4.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(O4);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){O4.setFromMatrixPosition(e.matrixWorld),uz.setFromMatrixPosition(this.matrixWorld);const r=O4.distanceTo(uz)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i<s;i++){let a=n[i].distance;if(n[i].object.visible&&(a-=a*n[i].hysteresis),r>=a)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 a=r[i];n.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return n}}const Xh=new ze,t6=new ze,L4=new ze,v0=new ze,n6=new ze,z4=new ze,r6=new ze;class Mv{constructor(e=new ze,n=new ze(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,Xh)),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=Xh.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Xh.copy(this.origin).addScaledVector(this.direction,n),Xh.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){t6.copy(e).add(n).multiplyScalar(.5),L4.copy(n).sub(e).normalize(),v0.copy(this.origin).sub(t6);const s=e.distanceTo(n)*.5,a=-this.direction.dot(L4),o=v0.dot(this.direction),l=-v0.dot(L4),c=v0.lengthSq(),d=Math.abs(1-a*a);let h,g,v,b;if(d>0)if(h=a*l-o,g=a*o-l,b=s*d,h>=0)if(g>=-b)if(g<=b){const _=1/d;h*=_,g*=_,v=h*(h+a*g+2*o)+g*(a*h+g+2*l)+c}else g=s,h=Math.max(0,-(a*g+o)),v=-h*h+g*(g+2*l)+c;else g=-s,h=Math.max(0,-(a*g+o)),v=-h*h+g*(g+2*l)+c;else g<=-b?(h=Math.max(0,-(-a*s+o)),g=h>0?-s:Math.min(Math.max(-s,-l),s),v=-h*h+g*(g+2*l)+c):g<=b?(h=0,g=Math.min(Math.max(-s,-l),s),v=g*(g+2*l)+c):(h=Math.max(0,-(a*s+o)),g=h>0?s:Math.min(Math.max(-s,-l),s),v=-h*h+g*(g+2*l)+c);else g=a>0?-s:s,h=Math.max(0,-(a*g+o)),v=-h*h+g*(g+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(t6).addScaledVector(L4,g),v}intersectSphere(e,n){Xh.subVectors(e.center,this.origin);const r=Xh.dot(this.direction),i=Xh.dot(Xh)-r*r,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=r-a,l=r+a;return l<0?null:o<0?this.at(l,n):this.at(o,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,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,g=this.origin;return c>=0?(r=(e.min.x-g.x)*c,i=(e.max.x-g.x)*c):(r=(e.max.x-g.x)*c,i=(e.min.x-g.x)*c),d>=0?(s=(e.min.y-g.y)*d,a=(e.max.y-g.y)*d):(s=(e.max.y-g.y)*d,a=(e.min.y-g.y)*d),r>a||s>i||((s>r||isNaN(r))&&(r=s),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-g.z)*h,l=(e.max.z-g.z)*h):(o=(e.max.z-g.z)*h,l=(e.min.z-g.z)*h),r>l||o>i)||((o>r||r!==r)&&(r=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Xh)!==null}intersectTriangle(e,n,r,i,s){n6.subVectors(n,e),z4.subVectors(r,e),r6.crossVectors(n6,z4);let a=this.direction.dot(r6),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;v0.subVectors(this.origin,e);const l=o*this.direction.dot(z4.crossVectors(v0,z4));if(l<0)return null;const c=o*this.direction.dot(n6.cross(v0));if(c<0||l+c>a)return null;const d=-o*v0.dot(r6);return d<0?null:this.at(d/a,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 _p extends vl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new xn(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 su,this.combine=yw,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 dz=new rr,lg=new Mv,j4=new Ga,fz=new ze,F4=new ze,U4=new ze,B4=new ze,i6=new ze,H4=new ze,hz=new ze,V4=new ze;class Us extends yi{constructor(e=new br,n=new _p){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,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,a=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){H4.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],h=s[l];d!==0&&(i6.fromBufferAttribute(h,e),a?H4.addScaledVector(i6,d):H4.addScaledVector(i6.sub(n),d))}n.add(H4)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),j4.copy(r.boundingSphere),j4.applyMatrix4(s),lg.copy(e.ray).recast(e.near),!(j4.containsPoint(lg.origin)===!1&&(lg.intersectSphere(j4,fz)===null||lg.origin.distanceToSquared(fz)>(e.far-e.near)**2))&&(dz.copy(s).invert(),lg.copy(e.ray).applyMatrix4(dz),!(r.boundingBox!==null&&lg.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,lg)))}_computeIntersections(e,n,r){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,h=s.attributes.normal,g=s.groups,v=s.drawRange;if(o!==null)if(Array.isArray(a))for(let b=0,_=g.length;b<_;b++){const w=g[b],S=a[w.materialIndex],E=Math.max(w.start,v.start),A=Math.min(o.count,Math.min(w.start+w.count,v.start+v.count));for(let N=E,I=A;N<I;N+=3){const P=o.getX(N),L=o.getX(N+1),R=o.getX(N+2);i=G4(this,S,e,r,c,d,h,P,L,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=w.materialIndex,n.push(i))}}else{const b=Math.max(0,v.start),_=Math.min(o.count,v.start+v.count);for(let w=b,S=_;w<S;w+=3){const E=o.getX(w),A=o.getX(w+1),N=o.getX(w+2);i=G4(this,a,e,r,c,d,h,E,A,N),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let b=0,_=g.length;b<_;b++){const w=g[b],S=a[w.materialIndex],E=Math.max(w.start,v.start),A=Math.min(l.count,Math.min(w.start+w.count,v.start+v.count));for(let N=E,I=A;N<I;N+=3){const P=N,L=N+1,R=N+2;i=G4(this,S,e,r,c,d,h,P,L,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=w.materialIndex,n.push(i))}}else{const b=Math.max(0,v.start),_=Math.min(l.count,v.start+v.count);for(let w=b,S=_;w<S;w+=3){const E=w,A=w+1,N=w+2;i=G4(this,a,e,r,c,d,h,E,A,N),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}}}function jSe(t,e,n,r,i,s,a,o){let l;if(e.side===Vl?l=r.intersectTriangle(a,s,i,!0,o):l=r.intersectTriangle(i,s,a,e.side===pp,o),l===null)return null;V4.copy(o),V4.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(V4);return c<n.near||c>n.far?null:{distance:c,point:V4.clone(),object:t}}function G4(t,e,n,r,i,s,a,o,l,c){t.getVertexPosition(o,F4),t.getVertexPosition(l,U4),t.getVertexPosition(c,B4);const d=jSe(t,e,n,r,F4,U4,B4,hz);if(d){const h=new ze;Mc.getBarycoord(hz,F4,U4,B4,h),i&&(d.uv=Mc.getInterpolatedAttribute(i,o,l,c,h,new Lt)),s&&(d.uv1=Mc.getInterpolatedAttribute(s,o,l,c,h,new Lt)),a&&(d.normal=Mc.getInterpolatedAttribute(a,o,l,c,h,new ze),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const g={a:o,b:l,c,normal:new ze,materialIndex:0};Mc.getNormal(F4,U4,B4,g.normal),d.face=g,d.barycoord=h}return d}const pz=new ze,mz=new ci,gz=new ci,FSe=new ze,vz=new rr,W4=new ze,s6=new Ga,xz=new rr,a6=new Mv;class uY extends Us{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=jR,this.bindMatrix=new rr,this.bindMatrixInverse=new rr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ca),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,W4),this.boundingBox.expandByPoint(W4)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Ga),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,W4),this.boundingSphere.expandByPoint(W4)}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(),s6.copy(this.boundingSphere),s6.applyMatrix4(i),e.ray.intersectsSphere(s6)!==!1&&(xz.copy(i).invert(),a6.copy(e.ray).applyMatrix4(xz),!(this.boundingBox!==null&&a6.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,a6)))}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 ci,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===jR?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===HX?this.bindMatrixInverse.copy(this.bindMatrix).invert():fn("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;mz.fromBufferAttribute(i.attributes.skinIndex,e),gz.fromBufferAttribute(i.attributes.skinWeight,e),pz.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const a=gz.getComponent(s);if(a!==0){const o=mz.getComponent(s);vz.multiplyMatrices(r.bones[o].matrixWorld,r.boneInverses[o]),n.addScaledVector(FSe.copy(pz).applyMatrix4(vz),a)}}return n.applyMatrix4(this.bindMatrixInverse)}}class s9 extends yi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Bd extends ra{constructor(e=null,n=1,r=1,i,s,a,o,l,c=Ea,d=Ea,h,g){super(null,a,o,l,c,d,i,s,h,g),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const yz=new rr,USe=new rr;class oE{constructor(e=[],n=[]){this.uuid=ru(),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){fn("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 rr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new rr;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,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:USe;yz.multiplyMatrices(o,n[s]),yz.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new oE(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 Bd(n,e,e,ul,Bl);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 a=n[s];a===void 0&&(fn("Skeleton: No bone found with UUID:",s),a=new s9),this.bones.push(a),this.boneInverses.push(new rr().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 a=n[i];e.bones.push(a.uuid);const o=r[i];e.boneInverses.push(o.toArray())}return e}}class cv extends Vi{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 Bx=new rr,bz=new rr,$4=[],_z=new Ca,BSe=new rr,n_=new Us,r_=new Ga;class dY extends Us{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new cv(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,BSe)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new Ca),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Bx),_z.copy(e.boundingBox).applyMatrix4(Bx),this.boundingBox.union(_z)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Ga),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Bx),r_.copy(e.boundingSphere).applyMatrix4(Bx),this.boundingSphere.union(r_)}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,a=e*s+1;for(let o=0;o<r.length;o++)r[o]=i[a+o]}raycast(e,n){const r=this.matrixWorld,i=this.count;if(n_.geometry=this.geometry,n_.material=this.material,n_.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),r_.copy(this.boundingSphere),r_.applyMatrix4(r),e.ray.intersectsSphere(r_)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Bx),bz.multiplyMatrices(r,Bx),n_.matrixWorld=bz,n_.raycast(e,$4);for(let a=0,o=$4.length;a<o;a++){const l=$4[a];l.instanceId=s,l.object=this,n.push(l)}$4.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new cv(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 Bd(new Float32Array(i*this.count),i,this.count,KT,Bl));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<r.length;c++)a+=r[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*e;s[l]=o,s.set(r,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const o6=new ze,HSe=new ze,VSe=new yr;class Jh{constructor(e=new ze(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=o6.subVectors(r,n).cross(HSe.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(o6),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||VSe.getNormalMatrix(e),i=this.coplanarPoint(o6).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 cg=new Ga,GSe=new Lt(.5,.5),q4=new ze;class Ry{constructor(e=new Jh,n=new Jh,r=new Jh,i=new Jh,s=new Jh,a=new Jh){this.planes=[e,n,r,i,s,a]}set(e,n,r,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(r),o[3].copy(i),o[4].copy(s),o[5].copy(a),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=Zc,r=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],h=s[5],g=s[6],v=s[7],b=s[8],_=s[9],w=s[10],S=s[11],E=s[12],A=s[13],N=s[14],I=s[15];if(i[0].setComponents(c-a,v-d,S-b,I-E).normalize(),i[1].setComponents(c+a,v+d,S+b,I+E).normalize(),i[2].setComponents(c+o,v+h,S+_,I+A).normalize(),i[3].setComponents(c-o,v-h,S-_,I-A).normalize(),r)i[4].setComponents(l,g,w,N).normalize(),i[5].setComponents(c-l,v-g,S-w,I-N).normalize();else if(i[4].setComponents(c-l,v-g,S-w,I-N).normalize(),n===Zc)i[5].setComponents(c+l,v+g,S+w,I+N).normalize();else if(n===lv)i[5].setComponents(l,g,w,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(),cg.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),cg.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(cg)}intersectsSprite(e){cg.center.set(0,0,0);const n=GSe.distanceTo(e.center);return cg.radius=.7071067811865476+n,cg.applyMatrix4(e.matrixWorld),this.intersectsSphere(cg)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(q4.x=i.normal.x>0?e.max.x:e.min.x,q4.y=i.normal.y>0?e.max.y:e.min.y,q4.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(q4)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Cf=new rr,Af=new Ry;class lE{constructor(){this.coordinateSystem=Zc}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(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.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(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.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(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.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(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.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(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.containsPoint(e))return!0}return!1}clone(){return new lE}}function l6(t,e){return t-e}function WSe(t,e){return t.z-e.z}function $Se(t,e){return e.z-t.z}class qSe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,n,r,i){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=e,o.count=n,o.z=r,o.index=i}reset(){this.list.length=0,this.index=0}}const vc=new rr,XSe=new xn(1,1,1),Sz=new Ry,YSe=new lE,X4=new Ca,ug=new Ga,i_=new ze,wz=new ze,KSe=new ze,c6=new qSe,al=new Us,Y4=[];function ZSe(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 a=0;a<r;a++)e.setComponent(s+n,a,t.getComponent(s,a))}else e.array.set(t.array,n*r);e.needsUpdate=!0}function dg(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 fY extends Us{constructor(e,n,r=n*2,i){super(new br,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 Bd(n,e,e,ul,Bl);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new Bd(n,e,e,bw,Ku);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 Bd(n,e,e,ul,Bl);r.colorSpace=ii.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 a=e.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,d=new o.constructor(r*l),h=new Vi(d,l,c);n.setAttribute(s,h)}if(e.getIndex()!==null){const s=r>65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new Vi(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 Ca);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,vc),this.getBoundingBoxAt(s,X4).applyMatrix4(vc),e.union(X4)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ga);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,vc),this.getBoundingSphereAt(s,ug).applyMatrix4(vc),e.union(ug)}}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(l6),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=r):(i=this._instanceInfo.length,this._instanceInfo.push(r));const s=this._matricesTexture;vc.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(XSe.toArray(a.image.data,i*4),a.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 a=e.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=r===-1?a.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(l6),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(),a=n.getIndex(),o=this._geometryInfo[e];if(i&&a.count>o.reservedIndexCount||n.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=n.getAttribute("position").count;for(const d in r.attributes){const h=n.getAttribute(d),g=r.getAttribute(d);ZSe(h,g,l);const v=h.itemSize;for(let b=h.count,_=c;b<_;b++){const w=l+b;for(let S=0;S<v;S++)g.setComponent(w,S,0)}g.needsUpdate=!0,g.addUpdateRange(l*v,c*v)}if(i){const d=o.indexStart,h=o.reservedIndexCount;o.indexCount=n.getIndex().count;for(let g=0;g<a.count;g++)s.setX(d+g,l+a.getX(g));for(let g=a.count,v=h;g<v;g++)s.setX(d+g,l);s.needsUpdate=!0,s.addUpdateRange(d,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,n.boundingBox!==null&&(o.boundingBox=n.boundingBox.clone()),o.boundingSphere=null,n.boundingSphere!==null&&(o.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((a,o)=>o).sort((a,o)=>r[a].vertexStart-r[o].vertexStart),s=this.geometry;for(let a=0,o=r.length;a<o;a++){const l=i[a],c=r[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==n){const{indexStart:d,vertexStart:h,reservedIndexCount:g}=c,v=s.index,b=v.array,_=e-h;for(let w=d;w<d+g;w++)b[w]=b[w]+_;v.array.copyWithin(n,d,d+g),v.addUpdateRange(n,g),v.needsUpdate=!0,c.indexStart=n}n+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:d,reservedVertexCount:h}=c,g=s.attributes;for(const v in g){const b=g[v],{array:_,itemSize:w}=b;_.copyWithin(e*w,d*w,(d+h)*w),b.addUpdateRange(e*w,h*w),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 Ca,a=r.index,o=r.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let d=l;a&&(d=a.getX(d)),s.expandByPoint(i_.fromBufferAttribute(o,d))}i.boundingBox=s}return n.copy(i.boundingBox),n}getBoundingSphereAt(e,n){if(e>=this._geometryCount)return null;const r=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new Ga;this.getBoundingBoxAt(e,X4),X4.getCenter(s.center);const a=r.index,o=r.attributes.position;let l=0;for(let c=i.start,d=i.start+i.count;c<d;c++){let h=c;a&&(h=a.getX(h)),i_.fromBufferAttribute(o,h),l=Math.max(l,s.center.distanceToSquared(i_))}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(l6);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);dg(this._multiDrawCounts,i),dg(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),dg(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),dg(o.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),dg(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,n){const r=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...r.map(o=>o.vertexStart+o.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 br,this._initializeGeometry(s));const a=this.geometry;s.index&&dg(s.index.array,a.index.array);for(const o in s.attributes)dg(s.attributes[o].array,a.attributes[o].array)}raycast(e,n){const r=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;al.material=this.material,al.geometry.index=a.index,al.geometry.attributes=a.attributes,al.geometry.boundingBox===null&&(al.geometry.boundingBox=new Ca),al.geometry.boundingSphere===null&&(al.geometry.boundingSphere=new Ga);for(let o=0,l=r.length;o<l;o++){if(!r[o].visible||!r[o].active)continue;const c=r[o].geometryIndex,d=i[c];al.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(o,al.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,al.geometry.boundingBox),this.getBoundingSphereAt(c,al.geometry.boundingSphere),al.raycast(e,Y4);for(let h=0,g=Y4.length;h<g;h++){const v=Y4[h];v.object=this,v.batchId=o,n.push(v)}Y4.length=0}al.material=null,al.geometry.index=null,al.geometry.attributes={},al.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 a=i.getIndex();let o=a===null?1:a.array.BYTES_PER_ELEMENT,l=1;s.wireframe&&(l=2,o=i.attributes.position.count>65535?4:2);const c=this._instanceInfo,d=this._multiDrawStarts,h=this._multiDrawCounts,g=this._geometryInfo,v=this.perObjectFrustumCulled,b=this._indirectTexture,_=b.image.data,w=r.isArrayCamera?YSe:Sz;v&&!r.isArrayCamera&&(vc.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),Sz.setFromProjectionMatrix(vc,r.coordinateSystem,r.reversedDepth));let S=0;if(this.sortObjects){vc.copy(this.matrixWorld).invert(),i_.setFromMatrixPosition(r.matrixWorld).applyMatrix4(vc),wz.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(vc);for(let N=0,I=c.length;N<I;N++)if(c[N].visible&&c[N].active){const P=c[N].geometryIndex;this.getMatrixAt(N,vc),this.getBoundingSphereAt(P,ug).applyMatrix4(vc);let L=!1;if(v&&(L=!w.intersectsSphere(ug,r)),!L){const R=g[P],O=KSe.subVectors(ug.center,i_).dot(wz);c6.push(R.start,R.count,O,N)}}const E=c6.list,A=this.customSort;A===null?E.sort(s.transparent?$Se:WSe):A.call(this,E,r);for(let N=0,I=E.length;N<I;N++){const P=E[N];d[S]=P.start*o*l,h[S]=P.count*l,_[S]=P.index,S++}c6.reset()}else for(let E=0,A=c.length;E<A;E++)if(c[E].visible&&c[E].active){const N=c[E].geometryIndex;let I=!1;if(v&&(this.getMatrixAt(E,vc),this.getBoundingSphereAt(N,ug).applyMatrix4(vc),I=!w.intersectsSphere(ug,r)),!I){const P=g[N];d[S]=P.start*o*l,h[S]=P.count*l,_[S]=E,S++}}b.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class $l extends vl{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new xn(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 x5=new ze,y5=new ze,Mz=new rr,s_=new Mv,K4=new Ga,u6=new ze,Tz=new ze;let im=class extends yi{constructor(e=new br,n=new $l){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++)x5.fromBufferAttribute(n,i-1),y5.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=x5.distanceTo(y5);e.setAttribute("lineDistance",new An(r,1))}else fn("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,a=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),K4.copy(r.boundingSphere),K4.applyMatrix4(i),K4.radius+=s,e.ray.intersectsSphere(K4)===!1)return;Mz.copy(i).invert(),s_.copy(e.ray).applyMatrix4(Mz);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=r.index,g=r.attributes.position;if(d!==null){const v=Math.max(0,a.start),b=Math.min(d.count,a.start+a.count);for(let _=v,w=b-1;_<w;_+=c){const S=d.getX(_),E=d.getX(_+1),A=Z4(this,e,s_,l,S,E,_);A&&n.push(A)}if(this.isLineLoop){const _=d.getX(b-1),w=d.getX(v),S=Z4(this,e,s_,l,_,w,b-1);S&&n.push(S)}}else{const v=Math.max(0,a.start),b=Math.min(g.count,a.start+a.count);for(let _=v,w=b-1;_<w;_+=c){const S=Z4(this,e,s_,l,_,_+1,_);S&&n.push(S)}if(this.isLineLoop){const _=Z4(this,e,s_,l,b-1,v,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,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}};function Z4(t,e,n,r,i,s,a){const o=t.geometry.attributes.position;if(x5.fromBufferAttribute(o,i),y5.fromBufferAttribute(o,s),n.distanceSqToSegment(x5,y5,u6,Tz)>r)return;u6.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(u6);if(!(c<e.near||c>e.far))return{distance:c,point:Tz.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const Ez=new ze,Cz=new ze;class gh extends im{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)Ez.fromBufferAttribute(n,i),Cz.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+Ez.distanceTo(Cz);e.setAttribute("lineDistance",new An(r,1))}else fn("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class hY extends im{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class a9 extends vl{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new xn(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 rr,HR=new Mv,Q4=new Ga,J4=new ze;class pY extends yi{constructor(e=new br,n=new a9){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,a=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Q4.copy(r.boundingSphere),Q4.applyMatrix4(i),Q4.radius+=s,e.ray.intersectsSphere(Q4)===!1)return;Az.copy(i).invert(),HR.copy(e.ray).applyMatrix4(Az);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=r.index,h=r.attributes.position;if(c!==null){const g=Math.max(0,a.start),v=Math.min(c.count,a.start+a.count);for(let b=g,_=v;b<_;b++){const w=c.getX(b);J4.fromBufferAttribute(h,w),Nz(J4,w,l,i,e,n,this)}}else{const g=Math.max(0,a.start),v=Math.min(h.count,a.start+a.count);for(let b=g,_=v;b<_;b++)J4.fromBufferAttribute(h,b),Nz(J4,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,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Nz(t,e,n,r,i,s,a){const o=HR.distanceSqToPoint(t);if(o<n){const l=new ze;HR.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(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class mY extends ra{constructor(e,n,r,i,s=rs,a=rs,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const d=this;function h(){d.needsUpdate=!0,d._requestVideoFrameCallbackId=e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(h))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class QSe extends mY{constructor(e,n,r,i,s,a,o,l){super({},e,n,r,i,s,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class JSe extends ra{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Ea,this.minFilter=Ea,this.generateMipmaps=!1,this.needsUpdate=!0}}class cE extends ra{constructor(e,n,r,i,s,a,o,l,c,d,h,g){super(null,a,o,l,c,d,i,s,h,g),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class ewe extends cE{constructor(e,n,r,i,s,a){super(e,n,r,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Tc,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class twe extends cE{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,sh),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class _w extends ra{constructor(e=[],n=sh,r,i,s,a,o,l,c,d){super(e,n,r,i,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class nwe extends ra{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class iy extends ra{constructor(e,n,r=Ku,i,s,a,o=Ea,l=Ea,c,d=oh,h=1){if(d!==oh&&d!==F0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const g={width:e,height:n,depth:h};super(g,i,s,a,o,l,d,r,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new U0(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 gY extends iy{constructor(e,n=Ku,r=sh,i,s,a=Ea,o=Ea,l,c=oh){const d={width:e,height:e,depth:1},h=[d,d,d,d,d,d];super(e,e,n,r,i,s,a,o,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class o9 extends ra{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Tv extends br{constructor(e=1,n=1,r=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],h=[];let g=0,v=0;b("z","y","x",-1,-1,r,n,e,a,s,0),b("z","y","x",1,-1,r,n,-e,a,s,1),b("x","z","y",1,1,e,r,n,i,a,2),b("x","z","y",1,-1,e,r,-n,i,a,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 An(c,3)),this.setAttribute("normal",new An(d,3)),this.setAttribute("uv",new An(h,2));function b(_,w,S,E,A,N,I,P,L,R,O){const W=N/L,U=I/R,V=N/2,G=I/2,Z=P/2,B=L+1,q=R+1;let Y=0,K=0;const J=new ze;for(let F=0;F<q;F++){const j=F*U-G;for(let X=0;X<B;X++){const H=X*W-V;J[_]=H*E,J[w]=j*A,J[S]=Z,c.push(J.x,J.y,J.z),J[_]=0,J[w]=0,J[S]=P>0?1:-1,d.push(J.x,J.y,J.z),h.push(X/L),h.push(1-F/R),Y+=1}}for(let F=0;F<R;F++)for(let j=0;j<L;j++){const X=g+j+B*F,H=g+j+B*(F+1),se=g+(j+1)+B*(F+1),re=g+(j+1)+B*F;l.push(X,H,re),l.push(H,se,re),K+=6}o.addGroup(v,K,O),v+=K,g+=Y}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tv(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class uE extends br{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 a=[],o=[],l=[],c=[],d=n/2,h=Math.PI/2*e,g=n,v=2*h+g,b=r*2+s,_=i+1,w=new ze,S=new ze;for(let E=0;E<=b;E++){let A=0,N=0,I=0,P=0;if(E<=r){const O=E/r,W=O*Math.PI/2;N=-d-e*Math.cos(W),I=e*Math.sin(W),P=-e*Math.cos(W),A=O*h}else if(E<=r+s){const O=(E-r)/s;N=-d+O*n,I=e,P=0,A=h+O*g}else{const O=(E-r-s)/r,W=O*Math.PI/2;N=d+e*Math.sin(W),I=e*Math.cos(W),P=e*Math.sin(W),A=h+g+O*h}const L=Math.max(0,Math.min(1,A/v));let R=0;E===0?R=.5/i:E===b&&(R=-.5/i);for(let O=0;O<=i;O++){const W=O/i,U=W*Math.PI*2,V=Math.sin(U),G=Math.cos(U);S.x=-I*G,S.y=N,S.z=I*V,o.push(S.x,S.y,S.z),w.set(-I*G,P,I*V),w.normalize(),l.push(w.x,w.y,w.z),c.push(W+R,L)}if(E>0){const O=(E-1)*_;for(let W=0;W<i;W++){const U=O+W,V=O+W+1,G=E*_+W,Z=E*_+W+1;a.push(U,V,G),a.push(V,Z,G)}}}this.setIndex(a),this.setAttribute("position",new An(o,3)),this.setAttribute("normal",new An(l,3)),this.setAttribute("uv",new An(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uE(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class dE extends br{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=[],a=[],o=[],l=[],c=new ze,d=new Lt;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let h=0,g=3;h<=n;h++,g+=3){const v=r+h/n*i;c.x=e*Math.cos(v),c.y=e*Math.sin(v),a.push(c.x,c.y,c.z),o.push(0,0,1),d.x=(a[g]/e+1)/2,d.y=(a[g+1]/e+1)/2,l.push(d.x,d.y)}for(let h=1;h<=n;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new An(a,3)),this.setAttribute("normal",new An(o,3)),this.setAttribute("uv",new An(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dE(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Sw extends br{constructor(e=1,n=1,r=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const d=[],h=[],g=[],v=[];let b=0;const _=[],w=r/2;let S=0;E(),a===!1&&(e>0&&A(!0),n>0&&A(!1)),this.setIndex(d),this.setAttribute("position",new An(h,3)),this.setAttribute("normal",new An(g,3)),this.setAttribute("uv",new An(v,2));function E(){const N=new ze,I=new ze;let P=0;const L=(n-e)/r;for(let R=0;R<=s;R++){const O=[],W=R/s,U=W*(n-e)+e;for(let V=0;V<=i;V++){const G=V/i,Z=G*l+o,B=Math.sin(Z),q=Math.cos(Z);I.x=U*B,I.y=-W*r+w,I.z=U*q,h.push(I.x,I.y,I.z),N.set(B,L,q).normalize(),g.push(N.x,N.y,N.z),v.push(G,1-W),O.push(b++)}_.push(O)}for(let R=0;R<i;R++)for(let O=0;O<s;O++){const W=_[O][R],U=_[O+1][R],V=_[O+1][R+1],G=_[O][R+1];(e>0||O!==0)&&(d.push(W,U,G),P+=3),(n>0||O!==s-1)&&(d.push(U,V,G),P+=3)}c.addGroup(S,P,0),S+=P}function A(N){const I=b,P=new Lt,L=new ze;let R=0;const O=N===!0?e:n,W=N===!0?1:-1;for(let V=1;V<=i;V++)h.push(0,w*W,0),g.push(0,W,0),v.push(.5,.5),b++;const U=b;for(let V=0;V<=i;V++){const Z=V/i*l+o,B=Math.cos(Z),q=Math.sin(Z);L.x=O*q,L.y=w*W,L.z=O*B,h.push(L.x,L.y,L.z),g.push(0,W,0),P.x=B*.5+.5,P.y=q*.5*W+.5,v.push(P.x,P.y),b++}for(let V=0;V<i;V++){const G=I+V,Z=U+V;N===!0?d.push(Z,Z+1,G):d.push(Z+1,Z,G),R+=3}c.addGroup(S,R,N===!0?1:2),S+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sw(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ww extends Sw{constructor(e=1,n=1,r=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,e,n,r,i,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new ww(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class vm extends br{constructor(e=[],n=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:n,radius:r,detail:i};const s=[],a=[];o(i),c(r),d(),this.setAttribute("position",new An(s,3)),this.setAttribute("normal",new An(s.slice(),3)),this.setAttribute("uv",new An(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(E){const A=new ze,N=new ze,I=new ze;for(let P=0;P<n.length;P+=3)v(n[P+0],A),v(n[P+1],N),v(n[P+2],I),l(A,N,I,E)}function l(E,A,N,I){const P=I+1,L=[];for(let R=0;R<=P;R++){L[R]=[];const O=E.clone().lerp(N,R/P),W=A.clone().lerp(N,R/P),U=P-R;for(let V=0;V<=U;V++)V===0&&R===P?L[R][V]=O:L[R][V]=O.clone().lerp(W,V/U)}for(let R=0;R<P;R++)for(let O=0;O<2*(P-R)-1;O++){const W=Math.floor(O/2);O%2===0?(g(L[R][W+1]),g(L[R+1][W]),g(L[R][W])):(g(L[R][W+1]),g(L[R+1][W+1]),g(L[R+1][W]))}}function c(E){const A=new ze;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(E),s[N+0]=A.x,s[N+1]=A.y,s[N+2]=A.z}function d(){const E=new ze;for(let A=0;A<s.length;A+=3){E.x=s[A+0],E.y=s[A+1],E.z=s[A+2];const N=w(E)/2/Math.PI+.5,I=S(E)/Math.PI+.5;a.push(N,1-I)}b(),h()}function h(){for(let E=0;E<a.length;E+=6){const A=a[E+0],N=a[E+2],I=a[E+4],P=Math.max(A,N,I),L=Math.min(A,N,I);P>.9&&L<.1&&(A<.2&&(a[E+0]+=1),N<.2&&(a[E+2]+=1),I<.2&&(a[E+4]+=1))}}function g(E){s.push(E.x,E.y,E.z)}function v(E,A){const N=E*3;A.x=e[N+0],A.y=e[N+1],A.z=e[N+2]}function b(){const E=new ze,A=new ze,N=new ze,I=new ze,P=new Lt,L=new Lt,R=new Lt;for(let O=0,W=0;O<s.length;O+=9,W+=6){E.set(s[O+0],s[O+1],s[O+2]),A.set(s[O+3],s[O+4],s[O+5]),N.set(s[O+6],s[O+7],s[O+8]),P.set(a[W+0],a[W+1]),L.set(a[W+2],a[W+3]),R.set(a[W+4],a[W+5]),I.copy(E).add(A).add(N).divideScalar(3);const U=w(I);_(P,W+0,E,U),_(L,W+2,A,U),_(R,W+4,N,U)}}function _(E,A,N,I){I<0&&E.x===1&&(a[A]=E.x-1),N.x===0&&N.z===0&&(a[A]=I/2/Math.PI+.5)}function w(E){return Math.atan2(E.z,-E.x)}function S(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vm(e.vertices,e.indices,e.radius,e.detail)}}class fE extends vm{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],a=[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,a,e,n),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new fE(e.radius,e.detail)}}const eM=new ze,tM=new ze,d6=new ze,nM=new Mc;class l9 extends br{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($g*n),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],d=["a","b","c"],h=new Array(3),g={},v=[];for(let b=0;b<l;b+=3){a?(c[0]=a.getX(b),c[1]=a.getX(b+1),c[2]=a.getX(b+2)):(c[0]=b,c[1]=b+1,c[2]=b+2);const{a:_,b:w,c:S}=nM;if(_.fromBufferAttribute(o,c[0]),w.fromBufferAttribute(o,c[1]),S.fromBufferAttribute(o,c[2]),nM.getNormal(d6),h[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,h[1]=`${Math.round(w.x*i)},${Math.round(w.y*i)},${Math.round(w.z*i)}`,h[2]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let E=0;E<3;E++){const A=(E+1)%3,N=h[E],I=h[A],P=nM[d[E]],L=nM[d[A]],R=`${N}_${I}`,O=`${I}_${N}`;O in g&&g[O]?(d6.dot(g[O].normal)<=s&&(v.push(P.x,P.y,P.z),v.push(L.x,L.y,L.z)),g[O]=null):R in g||(g[R]={index0:c[E],index1:c[A],normal:d6.clone()})}}for(const b in g)if(g[b]){const{index0:_,index1:w}=g[b];eM.fromBufferAttribute(o,_),tM.fromBufferAttribute(o,w),v.push(eM.x,eM.y,eM.z),v.push(tM.x,tM.y,tM.z)}this.setAttribute("position",new An(v,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Zd{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){fn("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 a=1;a<=e;a++)r=this.getPoint(a/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 a;n?a=n:a=e*r[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=r[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===a)return i/(s-1);const d=r[i],g=r[i+1]-d,v=(a-d)/g;return(i+v)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=n||(a.isVector2?new Lt:new ze);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n=!1){const r=new ze,i=[],s=[],a=[],o=new ze,l=new rr;for(let v=0;v<=e;v++){const b=v/e;i[v]=this.getTangentAt(b,new ze)}s[0]=new ze,a[0]=new ze;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),h=Math.abs(i[0].y),g=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),g<=c&&r.set(0,0,1),o.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let v=1;v<=e;v++){if(s[v]=s[v-1].clone(),a[v]=a[v-1].clone(),o.crossVectors(i[v-1],i[v]),o.length()>Number.EPSILON){o.normalize();const b=Math.acos(sr(i[v-1].dot(i[v]),-1,1));s[v].applyMatrix4(l.makeRotationAxis(o,b))}a[v].crossVectors(i[v],s[v])}if(n===!0){let v=Math.acos(sr(s[0].dot(s[e]),-1,1));v/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(v=-v);for(let b=1;b<=e;b++)s[b].applyMatrix4(l.makeRotationAxis(i[b],v*b)),a[b].crossVectors(i[b],s[b])}return{tangents:i,normals:s,binormals:a}}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 hE extends Zd{constructor(e=0,n=0,r=1,i=1,s=0,a=Math.PI*2,o=!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=a,this.aClockwise=o,this.aRotation=l}getPoint(e,n=new Lt){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const d=Math.cos(this.aRotation),h=Math.sin(this.aRotation),g=l-this.aX,v=c-this.aY;l=g*d-v*h+this.aX,c=g*h+v*d+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class vY extends hE{constructor(e,n,r,i,s,a){super(e,n,r,r,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function c9(){let t=0,e=0,n=0,r=0;function i(s,a,o,l){t=s,e=o,n=-3*s+3*a-2*o-l,r=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){i(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,d,h){let g=(a-s)/c-(o-s)/(c+d)+(o-a)/d,v=(o-a)/d-(l-a)/(d+h)+(l-o)/h;g*=d,v*=d,i(a,o,g,v)},calc:function(s){const a=s*s,o=a*s;return t+e*s+n*a+r*o}}}const rM=new ze,f6=new c9,h6=new c9,p6=new c9;class xY extends Zd{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 ze){const r=n,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,d;this.closed||o>0?c=i[(o-1)%s]:(rM.subVectors(i[0],i[1]).add(i[0]),c=rM);const h=i[o%s],g=i[(o+1)%s];if(this.closed||o+2<s?d=i[(o+2)%s]:(rM.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=rM),this.curveType==="centripetal"||this.curveType==="chordal"){const v=this.curveType==="chordal"?.5:.25;let b=Math.pow(c.distanceToSquared(h),v),_=Math.pow(h.distanceToSquared(g),v),w=Math.pow(g.distanceToSquared(d),v);_<1e-4&&(_=1),b<1e-4&&(b=_),w<1e-4&&(w=_),f6.initNonuniformCatmullRom(c.x,h.x,g.x,d.x,b,_,w),h6.initNonuniformCatmullRom(c.y,h.y,g.y,d.y,b,_,w),p6.initNonuniformCatmullRom(c.z,h.z,g.z,d.z,b,_,w)}else this.curveType==="catmullrom"&&(f6.initCatmullRom(c.x,h.x,g.x,d.x,this.tension),h6.initCatmullRom(c.y,h.y,g.y,d.y,this.tension),p6.initCatmullRom(c.z,h.z,g.z,d.z,this.tension));return r.set(f6.calc(l),h6.calc(l),p6.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 ze().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Rz(t,e,n,r,i){const s=(r-e)*.5,a=(i-n)*.5,o=t*t,l=t*o;return(2*n-2*r+s+a)*l+(-3*n+3*r-2*s-a)*o+s*t+n}function rwe(t,e){const n=1-t;return n*n*e}function iwe(t,e){return 2*(1-t)*t*e}function swe(t,e){return t*t*e}function H_(t,e,n,r){return rwe(t,e)+iwe(t,n)+swe(t,r)}function awe(t,e){const n=1-t;return n*n*n*e}function owe(t,e){const n=1-t;return 3*n*n*t*e}function lwe(t,e){return 3*(1-t)*t*t*e}function cwe(t,e){return t*t*t*e}function V_(t,e,n,r,i){return awe(t,e)+owe(t,n)+lwe(t,r)+cwe(t,i)}class u9 extends Zd{constructor(e=new Lt,n=new Lt,r=new Lt,i=new Lt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new Lt){const r=n,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return r.set(V_(e,i.x,s.x,a.x,o.x),V_(e,i.y,s.y,a.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.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 yY extends Zd{constructor(e=new ze,n=new ze,r=new ze,i=new ze){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new ze){const r=n,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return r.set(V_(e,i.x,s.x,a.x,o.x),V_(e,i.y,s.y,a.y,o.y),V_(e,i.z,s.z,a.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.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 d9 extends Zd{constructor(e=new Lt,n=new Lt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new Lt){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 Lt){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class bY extends Zd{constructor(e=new ze,n=new ze){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new ze){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 ze){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 f9 extends Zd{constructor(e=new Lt,n=new Lt,r=new Lt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new Lt){const r=n,i=this.v0,s=this.v1,a=this.v2;return r.set(H_(e,i.x,s.x,a.x),H_(e,i.y,s.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}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 h9 extends Zd{constructor(e=new ze,n=new ze,r=new ze){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new ze){const r=n,i=this.v0,s=this.v1,a=this.v2;return r.set(H_(e,i.x,s.x,a.x),H_(e,i.y,s.y,a.y),H_(e,i.z,s.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}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 p9 extends Zd{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new Lt){const r=n,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,l=i[a===0?a:a-1],c=i[a],d=i[a>i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return r.set(Rz(o,l.x,c.x,d.x,h.x),Rz(o,l.y,c.y,d.y,h.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 Lt().fromArray(i))}return this}}var b5=Object.freeze({__proto__:null,ArcCurve:vY,CatmullRomCurve3:xY,CubicBezierCurve:u9,CubicBezierCurve3:yY,EllipseCurve:hE,LineCurve:d9,LineCurve3:bY,QuadraticBezierCurve:f9,QuadraticBezierCurve3:h9,SplineCurve:p9});class _Y extends Zd{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 b5[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 a=i[s]-r,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.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 a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const d=l[c];r&&r.equals(d)||(n.push(d),r=d)}}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let n=0,r=this.curves.length;n<r;n++){const i=this.curves[n];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(new b5[i.type]().fromJSON(i))}return this}}class _5 extends _Y{constructor(e){super(),this.type="Path",this.currentPoint=new Lt,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 d9(this.currentPoint.clone(),new Lt(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new f9(this.currentPoint.clone(),new Lt(e,n),new Lt(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,a){const o=new u9(this.currentPoint.clone(),new Lt(e,n),new Lt(r,i),new Lt(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new p9(n);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,n,r,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,n+l,r,i,s,a),this}absarc(e,n,r,i,s,a){return this.absellipse(e,n,r,r,i,s,a),this}ellipse(e,n,r,i,s,a,o,l){const c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,n+d,r,i,s,a,o,l),this}absellipse(e,n,r,i,s,a,o,l){const c=new hE(e,n,r,i,s,a,o,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class G0 extends _5{constructor(e){super(e),this.uuid=ru(),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 _5().fromJSON(i))}return this}}function uwe(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=SY(t,0,i,n,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(r&&(s=mwe(t,e,s,n)),t.length>80*n){o=t[0],l=t[1];let d=o,h=l;for(let g=n;g<i;g+=n){const v=t[g],b=t[g+1];v<o&&(o=v),b<l&&(l=b),v>d&&(d=v),b>h&&(h=b)}c=Math.max(d-o,h-l),c=c!==0?32767/c:0}return MS(s,a,n,o,l,c,0),a}function SY(t,e,n,r,i){let s;if(i===Ewe(t,e,n,r)>0)for(let a=e;a<n;a+=r)s=kz(a/r|0,t[a],t[a+1],s);else for(let a=n-r;a>=e;a-=r)s=kz(a/r|0,t[a],t[a+1],s);return s&&sy(s,s.next)&&(ES(s),s=s.next),s}function uv(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(sy(n,n.next)||ta(n.prev,n,n.next)===0)){if(ES(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function MS(t,e,n,r,i,s,a){if(!t)return;!a&&s&&bwe(t,r,i,s);let o=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?fwe(t,r,i,s):dwe(t)){e.push(l.i,t.i,c.i),ES(t),t=c.next,o=c.next;continue}if(t=c,t===o){a?a===1?(t=hwe(uv(t),e),MS(t,e,n,r,i,s,2)):a===2&&pwe(t,e,n,r,i,s):MS(uv(t),e,n,r,i,s,1);break}}}function dwe(t){const e=t.prev,n=t,r=t.next;if(ta(e,n,r)>=0)return!1;const i=e.x,s=n.x,a=r.x,o=e.y,l=n.y,c=r.y,d=Math.min(i,s,a),h=Math.min(o,l,c),g=Math.max(i,s,a),v=Math.max(o,l,c);let b=r.next;for(;b!==e;){if(b.x>=d&&b.x<=g&&b.y>=h&&b.y<=v&&y_(i,o,s,l,a,c,b.x,b.y)&&ta(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function fwe(t,e,n,r){const i=t.prev,s=t,a=t.next;if(ta(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,d=i.y,h=s.y,g=a.y,v=Math.min(o,l,c),b=Math.min(d,h,g),_=Math.max(o,l,c),w=Math.max(d,h,g),S=VR(v,b,e,n,r),E=VR(_,w,e,n,r);let A=t.prevZ,N=t.nextZ;for(;A&&A.z>=S&&N&&N.z<=E;){if(A.x>=v&&A.x<=_&&A.y>=b&&A.y<=w&&A!==i&&A!==a&&y_(o,d,l,h,c,g,A.x,A.y)&&ta(A.prev,A,A.next)>=0||(A=A.prevZ,N.x>=v&&N.x<=_&&N.y>=b&&N.y<=w&&N!==i&&N!==a&&y_(o,d,l,h,c,g,N.x,N.y)&&ta(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;A&&A.z>=S;){if(A.x>=v&&A.x<=_&&A.y>=b&&A.y<=w&&A!==i&&A!==a&&y_(o,d,l,h,c,g,A.x,A.y)&&ta(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;N&&N.z<=E;){if(N.x>=v&&N.x<=_&&N.y>=b&&N.y<=w&&N!==i&&N!==a&&y_(o,d,l,h,c,g,N.x,N.y)&&ta(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function hwe(t,e){let n=t;do{const r=n.prev,i=n.next.next;!sy(r,i)&&MY(r,n,n.next,i)&&TS(r,i)&&TS(i,r)&&(e.push(r.i,n.i,i.i),ES(n),ES(n.next),n=t=i),n=n.next}while(n!==t);return uv(n)}function pwe(t,e,n,r,i,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&wwe(a,o)){let l=TY(a,o);a=uv(a,a.next),l=uv(l,l.next),MS(a,e,n,r,i,s,0),MS(l,e,n,r,i,s,0);return}o=o.next}a=a.next}while(a!==t)}function mwe(t,e,n,r){const i=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*r,l=s<a-1?e[s+1]*r:t.length,c=SY(t,o,l,r,!1);c===c.next&&(c.steiner=!0),i.push(Swe(c))}i.sort(gwe);for(let s=0;s<i.length;s++)n=vwe(i[s],n);return n}function gwe(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 vwe(t,e){const n=xwe(t,e);if(!n)return e;const r=TY(n,t);return uv(r,r.next),uv(n,n.next)}function xwe(t,e){let n=e;const r=t.x,i=t.y;let s=-1/0,a;if(sy(t,n))return n;do{if(sy(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const h=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>s&&(s=h,a=n.x<n.next.x?n:n.next,h===r))return a}n=n.next}while(n!==e);if(!a)return null;const o=a,l=a.x,c=a.y;let d=1/0;n=a;do{if(r>=n.x&&n.x>=l&&r!==n.x&&wY(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)){const h=Math.abs(i-n.y)/(r-n.x);TS(n,t)&&(h<d||h===d&&(n.x>a.x||n.x===a.x&&ywe(a,n)))&&(a=n,d=h)}n=n.next}while(n!==o);return a}function ywe(t,e){return ta(t.prev,t,e.prev)<0&&ta(e.next,t,t.next)<0}function bwe(t,e,n,r){let i=t;do i.z===0&&(i.z=VR(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,_we(i)}function _we(t){let e,n=1;do{let r=t,i;t=null;let s=null;for(e=0;r;){e++;let a=r,o=0;for(let c=0;c<n&&(o++,a=a.nextZ,!!a);c++);let l=n;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||r.z<=a.z)?(i=r,r=r.nextZ,o--):(i=a,a=a.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=a}s.nextZ=null,n*=2}while(e>1);return t}function VR(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 Swe(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 wY(t,e,n,r,i,s,a,o){return(i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(r-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(i-a)*(r-o)}function y_(t,e,n,r,i,s,a,o){return!(t===a&&e===o)&&wY(t,e,n,r,i,s,a,o)}function wwe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Mwe(t,e)&&(TS(t,e)&&TS(e,t)&&Twe(t,e)&&(ta(t.prev,t,e.prev)||ta(t,e.prev,e))||sy(t,e)&&ta(t.prev,t,t.next)>0&&ta(e.prev,e,e.next)>0)}function ta(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function sy(t,e){return t.x===e.x&&t.y===e.y}function MY(t,e,n,r){const i=sM(ta(t,e,n)),s=sM(ta(t,e,r)),a=sM(ta(n,r,t)),o=sM(ta(n,r,e));return!!(i!==s&&a!==o||i===0&&iM(t,n,e)||s===0&&iM(t,r,e)||a===0&&iM(n,t,r)||o===0&&iM(n,e,r))}function iM(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 sM(t){return t>0?1:t<0?-1:0}function Mwe(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&&MY(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function TS(t,e){return ta(t.prev,t,t.next)<0?ta(t,e,t.next)>=0&&ta(t,t.prev,e)>=0:ta(t,e,t.prev)<0||ta(t,t.next,e)<0}function Twe(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 TY(t,e){const n=GR(t.i,t.x,t.y),r=GR(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 kz(t,e,n,r){const i=GR(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 ES(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 GR(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ewe(t,e,n,r){let i=0;for(let s=e,a=n-r;s<n;s+=r)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}class Cwe{static triangulate(e,n,r=2){return uwe(e,n,r)}}class Ud{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 Ud.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];Pz(e),Dz(r,e);let a=e.length;n.forEach(Pz);for(let l=0;l<n.length;l++)i.push(a),a+=n[l].length,Dz(r,n[l]);const o=Cwe.triangulate(r,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function Pz(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Dz(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class pE extends br{constructor(e=new G0([new Lt(.5,.5),new Lt(-.5,.5),new Lt(-.5,-.5),new Lt(.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 o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new An(i,3)),this.setAttribute("uv",new An(s,2)),this.computeVertexNormals();function a(o){const l=[],c=n.curveSegments!==void 0?n.curveSegments:12,d=n.steps!==void 0?n.steps:1,h=n.depth!==void 0?n.depth:1;let g=n.bevelEnabled!==void 0?n.bevelEnabled:!0,v=n.bevelThickness!==void 0?n.bevelThickness:.2,b=n.bevelSize!==void 0?n.bevelSize:v-.1,_=n.bevelOffset!==void 0?n.bevelOffset:0,w=n.bevelSegments!==void 0?n.bevelSegments:3;const S=n.extrudePath,E=n.UVGenerator!==void 0?n.UVGenerator:Awe;let A,N=!1,I,P,L,R;if(S){A=S.getSpacedPoints(d),N=!0,g=!1;const Se=S.isCatmullRomCurve3?S.closed:!1;I=S.computeFrenetFrames(d,Se),P=new ze,L=new ze,R=new ze}g||(w=0,v=0,b=0,_=0);const O=o.extractPoints(c);let W=O.shape;const U=O.holes;if(!Ud.isClockWise(W)){W=W.reverse();for(let Se=0,Le=U.length;Se<Le;Se++){const pe=U[Se];Ud.isClockWise(pe)&&(U[Se]=pe.reverse())}}function G(Se){const pe=10000000000000001e-36;let Re=Se[0];for(let ne=1;ne<=Se.length;ne++){const Xe=ne%Se.length,Ae=Se[Xe],Pe=Ae.x-Re.x,Ke=Ae.y-Re.y,oe=Pe*Pe+Ke*Ke,te=Math.max(Math.abs(Ae.x),Math.abs(Ae.y),Math.abs(Re.x),Math.abs(Re.y)),_e=pe*te*te;if(oe<=_e){Se.splice(Xe,1),ne--;continue}Re=Ae}}G(W),U.forEach(G);const Z=U.length,B=W;for(let Se=0;Se<Z;Se++){const Le=U[Se];W=W.concat(Le)}function q(Se,Le,pe){return Le||Hn("ExtrudeGeometry: vec does not exist"),Se.clone().addScaledVector(Le,pe)}const Y=W.length;function K(Se,Le,pe){let Re,ne,Xe;const Ae=Se.x-Le.x,Pe=Se.y-Le.y,Ke=pe.x-Se.x,oe=pe.y-Se.y,te=Ae*Ae+Pe*Pe,_e=Ae*oe-Pe*Ke;if(Math.abs(_e)>Number.EPSILON){const ve=Math.sqrt(te),ye=Math.sqrt(Ke*Ke+oe*oe),ke=Le.x-Pe/ve,Be=Le.y+Ae/ve,ge=pe.x-oe/ye,Ye=pe.y+Ke/ye,Qe=((ge-ke)*oe-(Ye-Be)*Ke)/(Ae*oe-Pe*Ke);Re=ke+Ae*Qe-Se.x,ne=Be+Pe*Qe-Se.y;const Ie=Re*Re+ne*ne;if(Ie<=2)return new Lt(Re,ne);Xe=Math.sqrt(Ie/2)}else{let ve=!1;Ae>Number.EPSILON?Ke>Number.EPSILON&&(ve=!0):Ae<-Number.EPSILON?Ke<-Number.EPSILON&&(ve=!0):Math.sign(Pe)===Math.sign(oe)&&(ve=!0),ve?(Re=-Pe,ne=Ae,Xe=Math.sqrt(te)):(Re=Ae,ne=Pe,Xe=Math.sqrt(te/2))}return new Lt(Re/Xe,ne/Xe)}const J=[];for(let Se=0,Le=B.length,pe=Le-1,Re=Se+1;Se<Le;Se++,pe++,Re++)pe===Le&&(pe=0),Re===Le&&(Re=0),J[Se]=K(B[Se],B[pe],B[Re]);const F=[];let j,X=J.concat();for(let Se=0,Le=Z;Se<Le;Se++){const pe=U[Se];j=[];for(let Re=0,ne=pe.length,Xe=ne-1,Ae=Re+1;Re<ne;Re++,Xe++,Ae++)Xe===ne&&(Xe=0),Ae===ne&&(Ae=0),j[Re]=K(pe[Re],pe[Xe],pe[Ae]);F.push(j),X=X.concat(j)}let H;if(w===0)H=Ud.triangulateShape(B,U);else{const Se=[],Le=[];for(let pe=0;pe<w;pe++){const Re=pe/w,ne=v*Math.cos(Re*Math.PI/2),Xe=b*Math.sin(Re*Math.PI/2)+_;for(let Ae=0,Pe=B.length;Ae<Pe;Ae++){const Ke=q(B[Ae],J[Ae],Xe);fe(Ke.x,Ke.y,-ne),Re===0&&Se.push(Ke)}for(let Ae=0,Pe=Z;Ae<Pe;Ae++){const Ke=U[Ae];j=F[Ae];const oe=[];for(let te=0,_e=Ke.length;te<_e;te++){const ve=q(Ke[te],j[te],Xe);fe(ve.x,ve.y,-ne),Re===0&&oe.push(ve)}Re===0&&Le.push(oe)}}H=Ud.triangulateShape(Se,Le)}const se=H.length,re=b+_;for(let Se=0;Se<Y;Se++){const Le=g?q(W[Se],X[Se],re):W[Se];N?(L.copy(I.normals[0]).multiplyScalar(Le.x),P.copy(I.binormals[0]).multiplyScalar(Le.y),R.copy(A[0]).add(L).add(P),fe(R.x,R.y,R.z)):fe(Le.x,Le.y,0)}for(let Se=1;Se<=d;Se++)for(let Le=0;Le<Y;Le++){const pe=g?q(W[Le],X[Le],re):W[Le];N?(L.copy(I.normals[Se]).multiplyScalar(pe.x),P.copy(I.binormals[Se]).multiplyScalar(pe.y),R.copy(A[Se]).add(L).add(P),fe(R.x,R.y,R.z)):fe(pe.x,pe.y,h/d*Se)}for(let Se=w-1;Se>=0;Se--){const Le=Se/w,pe=v*Math.cos(Le*Math.PI/2),Re=b*Math.sin(Le*Math.PI/2)+_;for(let ne=0,Xe=B.length;ne<Xe;ne++){const Ae=q(B[ne],J[ne],Re);fe(Ae.x,Ae.y,h+pe)}for(let ne=0,Xe=U.length;ne<Xe;ne++){const Ae=U[ne];j=F[ne];for(let Pe=0,Ke=Ae.length;Pe<Ke;Pe++){const oe=q(Ae[Pe],j[Pe],Re);N?fe(oe.x,oe.y+A[d-1].y,A[d-1].x+pe):fe(oe.x,oe.y,h+pe)}}}ie(),ue();function ie(){const Se=i.length/3;if(g){let Le=0,pe=Y*Le;for(let Re=0;Re<se;Re++){const ne=H[Re];xe(ne[2]+pe,ne[1]+pe,ne[0]+pe)}Le=d+w*2,pe=Y*Le;for(let Re=0;Re<se;Re++){const ne=H[Re];xe(ne[0]+pe,ne[1]+pe,ne[2]+pe)}}else{for(let Le=0;Le<se;Le++){const pe=H[Le];xe(pe[2],pe[1],pe[0])}for(let Le=0;Le<se;Le++){const pe=H[Le];xe(pe[0]+Y*d,pe[1]+Y*d,pe[2]+Y*d)}}r.addGroup(Se,i.length/3-Se,0)}function ue(){const Se=i.length/3;let Le=0;le(B,Le),Le+=B.length;for(let pe=0,Re=U.length;pe<Re;pe++){const ne=U[pe];le(ne,Le),Le+=ne.length}r.addGroup(Se,i.length/3-Se,1)}function le(Se,Le){let pe=Se.length;for(;--pe>=0;){const Re=pe;let ne=pe-1;ne<0&&(ne=Se.length-1);for(let Xe=0,Ae=d+w*2;Xe<Ae;Xe++){const Pe=Y*Xe,Ke=Y*(Xe+1),oe=Le+Re+Pe,te=Le+ne+Pe,_e=Le+ne+Ke,ve=Le+Re+Ke;he(oe,te,_e,ve)}}}function fe(Se,Le,pe){l.push(Se),l.push(Le),l.push(pe)}function xe(Se,Le,pe){Te(Se),Te(Le),Te(pe);const Re=i.length/3,ne=E.generateTopUV(r,i,Re-3,Re-2,Re-1);We(ne[0]),We(ne[1]),We(ne[2])}function he(Se,Le,pe,Re){Te(Se),Te(Le),Te(Re),Te(Le),Te(pe),Te(Re);const ne=i.length/3,Xe=E.generateSideWallUV(r,i,ne-6,ne-3,ne-2,ne-1);We(Xe[0]),We(Xe[1]),We(Xe[3]),We(Xe[1]),We(Xe[2]),We(Xe[3])}function Te(Se){i.push(l[Se*3+0]),i.push(l[Se*3+1]),i.push(l[Se*3+2])}function We(Se){s.push(Se.x),s.push(Se.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 Nwe(n,r,e)}static fromJSON(e,n){const r=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=n[e.shapes[s]];r.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new b5[i.type]().fromJSON(i)),new pE(r,e.options)}}const Awe={generateTopUV:function(t,e,n,r,i){const s=e[n*3],a=e[n*3+1],o=e[r*3],l=e[r*3+1],c=e[i*3],d=e[i*3+1];return[new Lt(s,a),new Lt(o,l),new Lt(c,d)]},generateSideWallUV:function(t,e,n,r,i,s){const a=e[n*3],o=e[n*3+1],l=e[n*3+2],c=e[r*3],d=e[r*3+1],h=e[r*3+2],g=e[i*3],v=e[i*3+1],b=e[i*3+2],_=e[s*3],w=e[s*3+1],S=e[s*3+2];return Math.abs(o-d)<Math.abs(a-c)?[new Lt(a,1-l),new Lt(c,1-h),new Lt(g,1-b),new Lt(_,1-S)]:[new Lt(o,1-l),new Lt(d,1-h),new Lt(v,1-b),new Lt(w,1-S)]}};function Nwe(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 mE extends vm{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 mE(e.radius,e.detail)}}class gE extends br{constructor(e=[new Lt(0,-.5),new Lt(.5,0),new Lt(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=sr(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],d=1/n,h=new ze,g=new Lt,v=new ze,b=new ze,_=new ze;let w=0,S=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:w=e[E+1].x-e[E].x,S=e[E+1].y-e[E].y,v.x=S*1,v.y=-w,v.z=S*0,_.copy(v),v.normalize(),l.push(v.x,v.y,v.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:w=e[E+1].x-e[E].x,S=e[E+1].y-e[E].y,v.x=S*1,v.y=-w,v.z=S*0,b.copy(v),v.x+=_.x,v.y+=_.y,v.z+=_.z,v.normalize(),l.push(v.x,v.y,v.z),_.copy(b)}for(let E=0;E<=n;E++){const A=r+E*d*i,N=Math.sin(A),I=Math.cos(A);for(let P=0;P<=e.length-1;P++){h.x=e[P].x*N,h.y=e[P].y,h.z=e[P].x*I,a.push(h.x,h.y,h.z),g.x=E/n,g.y=P/(e.length-1),o.push(g.x,g.y);const L=l[3*P+0]*N,R=l[3*P+1],O=l[3*P+0]*I;c.push(L,R,O)}}for(let E=0;E<n;E++)for(let A=0;A<e.length-1;A++){const N=A+E*e.length,I=N,P=N+e.length,L=N+e.length+1,R=N+1;s.push(I,P,R),s.push(L,R,P)}this.setIndex(s),this.setAttribute("position",new An(a,3)),this.setAttribute("uv",new An(o,2)),this.setAttribute("normal",new An(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gE(e.points,e.segments,e.phiStart,e.phiLength)}}class Mw extends vm{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 Mw(e.radius,e.detail)}}class Sp extends br{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,a=n/2,o=Math.floor(r),l=Math.floor(i),c=o+1,d=l+1,h=e/o,g=n/l,v=[],b=[],_=[],w=[];for(let S=0;S<d;S++){const E=S*g-a;for(let A=0;A<c;A++){const N=A*h-s;b.push(N,-E,0),_.push(0,0,1),w.push(A/o),w.push(1-S/l)}}for(let S=0;S<l;S++)for(let E=0;E<o;E++){const A=E+c*S,N=E+c*(S+1),I=E+1+c*(S+1),P=E+1+c*S;v.push(A,N,P),v.push(N,I,P)}this.setIndex(v),this.setAttribute("position",new An(b,3)),this.setAttribute("normal",new An(_,3)),this.setAttribute("uv",new An(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sp(e.width,e.height,e.widthSegments,e.heightSegments)}}class vE extends br{constructor(e=.5,n=1,r=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:s,thetaLength:a},r=Math.max(3,r),i=Math.max(1,i);const o=[],l=[],c=[],d=[];let h=e;const g=(n-e)/i,v=new ze,b=new Lt;for(let _=0;_<=i;_++){for(let w=0;w<=r;w++){const S=s+w/r*a;v.x=h*Math.cos(S),v.y=h*Math.sin(S),l.push(v.x,v.y,v.z),c.push(0,0,1),b.x=(v.x/n+1)/2,b.y=(v.y/n+1)/2,d.push(b.x,b.y)}h+=g}for(let _=0;_<i;_++){const w=_*(r+1);for(let S=0;S<r;S++){const E=S+w,A=E,N=E+r+1,I=E+r+2,P=E+1;o.push(A,N,P),o.push(N,I,P)}}this.setIndex(o),this.setAttribute("position",new An(l,3)),this.setAttribute("normal",new An(c,3)),this.setAttribute("uv",new An(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vE(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class xE extends br{constructor(e=new G0([new Lt(0,.5),new Lt(-.5,-.5),new Lt(.5,-.5)]),n=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:n};const r=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let d=0;d<e.length;d++)c(e[d]),this.addGroup(o,l,d),o+=l,l=0;this.setIndex(r),this.setAttribute("position",new An(i,3)),this.setAttribute("normal",new An(s,3)),this.setAttribute("uv",new An(a,2));function c(d){const h=i.length/3,g=d.extractPoints(n);let v=g.shape;const b=g.holes;Ud.isClockWise(v)===!1&&(v=v.reverse());for(let w=0,S=b.length;w<S;w++){const E=b[w];Ud.isClockWise(E)===!0&&(b[w]=E.reverse())}const _=Ud.triangulateShape(v,b);for(let w=0,S=b.length;w<S;w++){const E=b[w];v=v.concat(E)}for(let w=0,S=v.length;w<S;w++){const E=v[w];i.push(E.x,E.y,0),s.push(0,0,1),a.push(E.x,E.y)}for(let w=0,S=_.length;w<S;w++){const E=_[w],A=E[0]+h,N=E[1]+h,I=E[2]+h;r.push(A,N,I),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 Rwe(n,e)}static fromJSON(e,n){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=n[e.shapes[i]];r.push(a)}return new xE(r,e.curveSegments)}}function Rwe(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 Tw extends br{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(a+o,Math.PI);let c=0;const d=[],h=new ze,g=new ze,v=[],b=[],_=[],w=[];for(let S=0;S<=r;S++){const E=[],A=S/r;let N=0;S===0&&a===0?N=.5/n:S===r&&l===Math.PI&&(N=-.5/n);for(let I=0;I<=n;I++){const P=I/n;h.x=-e*Math.cos(i+P*s)*Math.sin(a+A*o),h.y=e*Math.cos(a+A*o),h.z=e*Math.sin(i+P*s)*Math.sin(a+A*o),b.push(h.x,h.y,h.z),g.copy(h).normalize(),_.push(g.x,g.y,g.z),w.push(P+N,1-A),E.push(c++)}d.push(E)}for(let S=0;S<r;S++)for(let E=0;E<n;E++){const A=d[S][E+1],N=d[S][E],I=d[S+1][E],P=d[S+1][E+1];(S!==0||a>0)&&v.push(A,N,P),(S!==r-1||l<Math.PI)&&v.push(N,I,P)}this.setIndex(v),this.setAttribute("position",new An(b,3)),this.setAttribute("normal",new An(_,3)),this.setAttribute("uv",new An(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tw(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class yE extends vm{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 yE(e.radius,e.detail)}}class bE extends br{constructor(e=1,n=.4,r=12,i=48,s=Math.PI*2,a=0,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:n,radialSegments:r,tubularSegments:i,arc:s,thetaStart:a,thetaLength:o},r=Math.floor(r),i=Math.floor(i);const l=[],c=[],d=[],h=[],g=new ze,v=new ze,b=new ze;for(let _=0;_<=r;_++){const w=a+_/r*o;for(let S=0;S<=i;S++){const E=S/i*s;v.x=(e+n*Math.cos(w))*Math.cos(E),v.y=(e+n*Math.cos(w))*Math.sin(E),v.z=n*Math.sin(w),c.push(v.x,v.y,v.z),g.x=e*Math.cos(E),g.y=e*Math.sin(E),b.subVectors(v,g).normalize(),d.push(b.x,b.y,b.z),h.push(S/i),h.push(_/r)}}for(let _=1;_<=r;_++)for(let w=1;w<=i;w++){const S=(i+1)*_+w-1,E=(i+1)*(_-1)+w-1,A=(i+1)*(_-1)+w,N=(i+1)*_+w;l.push(S,E,N),l.push(E,A,N)}this.setIndex(l),this.setAttribute("position",new An(c,3)),this.setAttribute("normal",new An(d,3)),this.setAttribute("uv",new An(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bE(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class _E extends br{constructor(e=1,n=.4,r=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:s,q:a},r=Math.floor(r),i=Math.floor(i);const o=[],l=[],c=[],d=[],h=new ze,g=new ze,v=new ze,b=new ze,_=new ze,w=new ze,S=new ze;for(let A=0;A<=r;++A){const N=A/r*s*Math.PI*2;E(N,s,a,e,v),E(N+.01,s,a,e,b),w.subVectors(b,v),S.addVectors(b,v),_.crossVectors(w,S),S.crossVectors(_,w),_.normalize(),S.normalize();for(let I=0;I<=i;++I){const P=I/i*Math.PI*2,L=-n*Math.cos(P),R=n*Math.sin(P);h.x=v.x+(L*S.x+R*_.x),h.y=v.y+(L*S.y+R*_.y),h.z=v.z+(L*S.z+R*_.z),l.push(h.x,h.y,h.z),g.subVectors(h,v).normalize(),c.push(g.x,g.y,g.z),d.push(A/r),d.push(I/i)}}for(let A=1;A<=r;A++)for(let N=1;N<=i;N++){const I=(i+1)*(A-1)+(N-1),P=(i+1)*A+(N-1),L=(i+1)*A+N,R=(i+1)*(A-1)+N;o.push(I,P,R),o.push(P,L,R)}this.setIndex(o),this.setAttribute("position",new An(l,3)),this.setAttribute("normal",new An(c,3)),this.setAttribute("uv",new An(d,2));function E(A,N,I,P,L){const R=Math.cos(A),O=Math.sin(A),W=I/N*A,U=Math.cos(W);L.x=P*(2+U)*.5*R,L.y=P*(2+U)*O*.5,L.z=P*Math.sin(W)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _E(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class SE extends br{constructor(e=new h9(new ze(-1,-1,0),new ze(-1,1,0),new ze(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 a=e.computeFrenetFrames(n,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new ze,l=new ze,c=new Lt;let d=new ze;const h=[],g=[],v=[],b=[];_(),this.setIndex(b),this.setAttribute("position",new An(h,3)),this.setAttribute("normal",new An(g,3)),this.setAttribute("uv",new An(v,2));function _(){for(let A=0;A<n;A++)w(A);w(s===!1?n:0),E(),S()}function w(A){d=e.getPointAt(A/n,d);const N=a.normals[A],I=a.binormals[A];for(let P=0;P<=i;P++){const L=P/i*Math.PI*2,R=Math.sin(L),O=-Math.cos(L);l.x=O*N.x+R*I.x,l.y=O*N.y+R*I.y,l.z=O*N.z+R*I.z,l.normalize(),g.push(l.x,l.y,l.z),o.x=d.x+r*l.x,o.y=d.y+r*l.y,o.z=d.z+r*l.z,h.push(o.x,o.y,o.z)}}function S(){for(let A=1;A<=n;A++)for(let N=1;N<=i;N++){const I=(i+1)*(A-1)+(N-1),P=(i+1)*A+(N-1),L=(i+1)*A+N,R=(i+1)*(A-1)+N;b.push(I,P,R),b.push(P,L,R)}}function E(){for(let A=0;A<=n;A++)for(let N=0;N<=i;N++)c.x=A/n,c.y=N/i,v.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 SE(new b5[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class m9 extends br{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new ze,s=new ze;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const h=l[c],g=h.start,v=h.count;for(let b=g,_=g+v;b<_;b+=3)for(let w=0;w<3;w++){const S=o.getX(b+w),E=o.getX(b+(w+1)%3);i.fromBufferAttribute(a,S),s.fromBufferAttribute(a,E),Iz(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const d=3*o+c,h=3*o+(c+1)%3;i.fromBufferAttribute(a,d),s.fromBufferAttribute(a,h),Iz(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new An(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Iz(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 Oz=Object.freeze({__proto__:null,BoxGeometry:Tv,CapsuleGeometry:uE,CircleGeometry:dE,ConeGeometry:ww,CylinderGeometry:Sw,DodecahedronGeometry:fE,EdgesGeometry:l9,ExtrudeGeometry:pE,IcosahedronGeometry:mE,LatheGeometry:gE,OctahedronGeometry:Mw,PlaneGeometry:Sp,PolyhedronGeometry:vm,RingGeometry:vE,ShapeGeometry:xE,SphereGeometry:Tw,TetrahedronGeometry:yE,TorusGeometry:bE,TorusKnotGeometry:_E,TubeGeometry:SE,WireframeGeometry:m9});class EY extends vl{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new xn(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 ay(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?(fn("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 Dl(t){const e={};for(let n=0;n<t.length;n++){const r=ay(t[n]);for(const i in r)e[i]=r[i]}return e}function kwe(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function CY(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ii.workingColorSpace}const CS={clone:ay,merge:Dl};var Pwe=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Dwe=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class au extends vl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Pwe,this.fragmentShader=Dwe,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=ay(e.uniforms),this.uniformsGroups=kwe(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 a=this.uniforms[i].value;a&&a.isTexture?n.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?n.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?n.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?n.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?n.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?n.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?n.uniforms[i]={type:"m4",value:a.toArray()}:n.uniforms[i]={value:a}}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 g9 extends au{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class v9 extends vl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new xn(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 xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new Lt(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 su,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 AY extends v9{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 Lt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return sr(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 xn(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 xn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xn(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 NY extends vl{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new xn(16777215),this.specular=new xn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new Lt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new su,this.combine=yw,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 RY extends vl{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new Lt(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 kY extends vl{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new Lt(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 PY extends vl{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new xn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new Lt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new su,this.combine=yw,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 wE extends vl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$X,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 ME extends vl{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 DY extends vl{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new Lt(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 IY extends $l{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 Dg(t,e){return!t||t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function OY(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 WR(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,a=0;a!==r;++s){const o=n[s]*e;for(let l=0;l!==e;++l)i[a++]=t[o+l]}return i}function x9(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let a=s[r];if(a!==void 0)if(Array.isArray(a))do a=s[r],a!==void 0&&(e.push(s.time),n.push(...a)),s=t[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[r],a!==void 0&&(e.push(s.time),a.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do a=s[r],a!==void 0&&(e.push(s.time),n.push(a)),s=t[i++];while(s!==void 0)}function Iwe(t,e,n,r,i=30){const s=t.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],d=c.getValueSize(),h=[],g=[];for(let v=0;v<c.times.length;++v){const b=c.times[v]*i;if(!(b<n||b>=r)){h.push(c.times[v]);for(let _=0;_<d;++_)g.push(c.values[v*d+_])}}h.length!==0&&(c.times=Dg(h,c.times.constructor),c.values=Dg(g,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function Owe(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let a=0;a<i;++a){const o=n.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=t.tracks.find(function(S){return S.name===o.name&&S.ValueTypeName===l});if(c===void 0)continue;let d=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=h/3);let g=0;const v=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(g=v/3);const b=o.times.length-1;let _;if(s<=o.times[0]){const S=d,E=h-d;_=o.values.slice(S,E)}else if(s>=o.times[b]){const S=b*h+d,E=S+h-d;_=o.values.slice(S,E)}else{const S=o.createInterpolant(),E=d,A=h-d;S.evaluate(s),_=S.resultBuffer.slice(E,A)}l==="quaternion"&&new Bo().fromArray(_).normalize().conjugate().toArray(_);const w=c.times.length;for(let S=0;S<w;++S){const E=S*v+g;if(l==="quaternion")Bo.multiplyQuaternionsFlat(c.values,E,_,0,c.values,E);else{const A=v-g*2;for(let N=0;N<A;++N)c.values[E+N]-=_[N]}}}return t.blendMode=Qk,t}class Lwe{static convertArray(e,n){return Dg(e,n)}static isTypedArray(e){return tY(e)}static getKeyframeOrder(e){return OY(e)}static sortedArray(e,n,r){return WR(e,n,r)}static flattenJSON(e,n,r,i){x9(e,n,r,i)}static subclip(e,n,r,i,s=30){return Iwe(e,n,r,i,s)}static makeClipAdditive(e,n=0,r=e,i=30){return Owe(e,n,r,i)}}class ky{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 a;n:{r:if(!(e<i)){for(let o=r+2;;){if(i===void 0){if(e<s)break r;return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===o)break;if(s=i,i=n[++r],e<i)break t}a=n.length;break n}if(!(e>=s)){const o=n[1];e<o&&(r=2,s=o);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}a=r,r=0;break n}break e}for(;r<a;){const o=r+a>>>1;e<n[o]?a=o:r=o+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 a=0;a!==i;++a)n[a]=r[s+a];return n}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class LY extends ky{constructor(e,n,r,i){super(e,n,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:kg,endingEnd:kg}}intervalChanged_(e,n,r){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Pg:s=e,o=2*n-r;break;case xS:s=i.length-2,o=n+i[s]-i[s+1];break;default:s=e,o=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Pg:a=e,l=2*r-n;break;case xS:a=1,l=r+i[1]-i[0];break;default:a=e-1,l=n}const c=(r-n)*.5,d=this.valueSize;this._weightPrev=c/(n-o),this._weightNext=c/(l-r),this._offsetPrev=s*d,this._offsetNext=a*d}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,d=this._offsetPrev,h=this._offsetNext,g=this._weightPrev,v=this._weightNext,b=(r-n)/(i-n),_=b*b,w=_*b,S=-g*w+2*g*_-g*b,E=(1+g)*w+(-1.5-2*g)*_+(-.5+g)*b+1,A=(-1-v)*w+(1.5+v)*_+.5*b,N=v*w-v*_;for(let I=0;I!==o;++I)s[I]=S*a[d+I]+E*a[c+I]+A*a[l+I]+N*a[h+I];return s}}class y9 extends ky{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,d=(r-n)/(i-n),h=1-d;for(let g=0;g!==o;++g)s[g]=a[c+g]*h+a[l+g]*d;return s}}class zY extends ky{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class jY extends ky{interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,d=this.settings||this.DefaultSettings_,h=d.inTangents,g=d.outTangents;if(!h||!g){const _=(r-n)/(i-n),w=1-_;for(let S=0;S!==o;++S)s[S]=a[c+S]*w+a[l+S]*_;return s}const v=o*2,b=e-1;for(let _=0;_!==o;++_){const w=a[c+_],S=a[l+_],E=b*v+_*2,A=g[E],N=g[E+1],I=e*v+_*2,P=h[I],L=h[I+1];let R=(r-n)/(i-n),O,W,U,V,G;for(let Z=0;Z<8;Z++){O=R*R,W=O*R,U=1-R,V=U*U,G=V*U;const q=G*n+3*V*R*A+3*U*O*P+W*i-r;if(Math.abs(q)<1e-10)break;const Y=3*V*(A-n)+6*U*R*(P-A)+3*O*(i-P);if(Math.abs(Y)<1e-10)break;R=R-q/Y,R=Math.max(0,Math.min(1,R))}s[_]=G*w+3*V*R*N+3*U*O*L+W*S}return s}}class td{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=Dg(n,this.TimeBufferType),this.values=Dg(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:Dg(e.times,Array),values:Dg(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new zY(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new y9(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new LY(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const n=new jY(this.times,this.values,this.getValueSize(),e);return this.settings&&(n.settings=this.settings),n}setInterpolation(e){let n;switch(e){case vS:n=this.InterpolantFactoryMethodDiscrete;break;case v5:n=this.InterpolantFactoryMethodLinear;break;case UM:n=this.InterpolantFactoryMethodSmooth;break;case FR: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 fn("KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return vS;case this.InterpolantFactoryMethodLinear:return v5;case this.InterpolantFactoryMethodSmooth:return UM;case this.InterpolantFactoryMethodBezier:return FR}}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,a=i-1;for(;s!==i&&r[s]<e;)++s;for(;a!==-1&&r[a]>n;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=r.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(Hn("KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(Hn("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=r[o];if(typeof l=="number"&&isNaN(l)){Hn("KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){Hn("KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&tY(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){Hn("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===UM,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],d=e[o+1];if(c!==d&&(o!==1||c!==e[0]))if(i)l=!0;else{const h=o*r,g=h-r,v=h+r;for(let b=0;b!==r;++b){const _=n[h+b];if(_!==n[g+b]||_!==n[v+b]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const h=o*r,g=a*r;for(let v=0;v!==r;++v)n[g+v]=n[h+v]}++a}}if(s>0){e[a]=e[s];for(let o=s*r,l=a*r,c=0;c!==r;++c)n[l+c]=n[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*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}}td.prototype.ValueTypeName="";td.prototype.TimeBufferType=Float32Array;td.prototype.ValueBufferType=Float32Array;td.prototype.DefaultInterpolation=v5;class Ev extends td{constructor(e,n,r){super(e,n,r)}}Ev.prototype.ValueTypeName="bool";Ev.prototype.ValueBufferType=Array;Ev.prototype.DefaultInterpolation=vS;Ev.prototype.InterpolantFactoryMethodLinear=void 0;Ev.prototype.InterpolantFactoryMethodSmooth=void 0;class b9 extends td{constructor(e,n,r,i){super(e,n,r,i)}}b9.prototype.ValueTypeName="color";class AS extends td{constructor(e,n,r,i){super(e,n,r,i)}}AS.prototype.ValueTypeName="number";class FY extends ky{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(r-n)/(i-n);let c=e*o;for(let d=c+o;c!==d;c+=4)Bo.slerpFlat(s,0,a,c-o,a,c,l);return s}}class Ew extends td{constructor(e,n,r,i){super(e,n,r,i)}InterpolantFactoryMethodLinear(e){return new FY(this.times,this.values,this.getValueSize(),e)}}Ew.prototype.ValueTypeName="quaternion";Ew.prototype.InterpolantFactoryMethodSmooth=void 0;class Cv extends td{constructor(e,n,r){super(e,n,r)}}Cv.prototype.ValueTypeName="string";Cv.prototype.ValueBufferType=Array;Cv.prototype.DefaultInterpolation=vS;Cv.prototype.InterpolantFactoryMethodLinear=void 0;Cv.prototype.InterpolantFactoryMethodSmooth=void 0;class NS extends td{constructor(e,n,r,i){super(e,n,r,i)}}NS.prototype.ValueTypeName="vector";class RS{constructor(e="",n=-1,r=[],i=JT){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=ru(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let a=0,o=r.length;a!==o;++a)n.push(jwe(r[a]).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,a=r.length;s!==a;++s)n.push(td.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const d=OY(l);l=WR(l,1,d),c=WR(c,1,d),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new AS(".morphTargetInfluences["+n[o].name+"]",l,c).scale(1/r))}return new this(e,-1,a)}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 o=0,l=e.length;o<l;o++){const c=e[o],d=c.name.match(s);if(d&&d.length>1){const h=d[1];let g=i[h];g||(i[h]=g=[]),g.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],n,r));return a}static parseAnimation(e,n){if(fn("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Hn("AnimationClip: No animation in JSONLoader data."),null;const r=function(h,g,v,b,_){if(v.length!==0){const w=[],S=[];x9(v,w,S,b),w.length!==0&&_.push(new h(g,w,S))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const g=c[h].keys;if(!(!g||g.length===0))if(g[0].morphTargets){const v={};let b;for(b=0;b<g.length;b++)if(g[b].morphTargets)for(let _=0;_<g[b].morphTargets.length;_++)v[g[b].morphTargets[_]]=-1;for(const _ in v){const w=[],S=[];for(let E=0;E!==g[b].morphTargets.length;++E){const A=g[b];w.push(A.time),S.push(A.morphTarget===_?1:0)}i.push(new AS(".morphTargetInfluence["+_+"]",w,S))}l=v.length*a}else{const v=".bones["+n[h].name+"]";r(NS,v+".position",g,"pos",i),r(Ew,v+".quaternion",g,"rot",i),r(NS,v+".scale",g,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}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 zwe(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return AS;case"vector":case"vector2":case"vector3":case"vector4":return NS;case"color":return b9;case"quaternion":return Ew;case"bool":case"boolean":return Ev;case"string":return Cv}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function jwe(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=zwe(t.type);if(t.times===void 0){const n=[],r=[];x9(t.keys,n,r,"value"),t.times=n,t.values=r}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Zf={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(Lz(t)||(this.files[t]=e))},get:function(t){if(this.enabled!==!1&&!Lz(t))return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function Lz(t){try{const e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class _9{constructor(e,n,r){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this._abortController=null,this.itemStart=function(d){o++,s===!1&&i.onStart!==void 0&&i.onStart(d,a,o),s=!0},this.itemEnd=function(d){a++,i.onProgress!==void 0&&i.onProgress(d,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,h){return c.push(d,h),this},this.removeHandler=function(d){const h=c.indexOf(d);return h!==-1&&c.splice(h,2),this},this.getHandler=function(d){for(let h=0,g=c.length;h<g;h+=2){const v=c[h],b=c[h+1];if(v.global&&(v.lastIndex=0),v.test(d))return b}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const UY=new _9;class Rc{constructor(e){this.manager=e!==void 0?e:UY,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}}Rc.DEFAULT_MATERIAL_NAME="__DEFAULT";const Yh={};class Fwe extends Error{constructor(e,n){super(e),this.response=n}}class mp extends Rc{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=Zf.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(Yh[e]!==void 0){Yh[e].push({onLoad:n,onProgress:r,onError:i});return}Yh[e]=[],Yh[e].push({onLoad:n,onProgress:r,onError:i});const a=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}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&fn("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Yh[e],h=c.body.getReader(),g=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),v=g?parseInt(g):0,b=v!==0;let _=0;const w=new ReadableStream({start(S){E();function E(){h.read().then(({done:A,value:N})=>{if(A)S.close();else{_+=N.byteLength;const I=new ProgressEvent("progress",{lengthComputable:b,loaded:_,total:v});for(let P=0,L=d.length;P<L;P++){const R=d[P];R.onProgress&&R.onProgress(I)}S.enqueue(N),E()}},A=>{S.error(A)})}}});return new Response(w)}else throw new Fwe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,o));case"json":return c.json();default:if(o==="")return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),g=h&&h[1]?h[1].toLowerCase():void 0,v=new TextDecoder(g);return c.arrayBuffer().then(b=>v.decode(b))}}}).then(c=>{Zf.add(`file:${e}`,c);const d=Yh[e];delete Yh[e];for(let h=0,g=d.length;h<g;h++){const v=d[h];v.onLoad&&v.onLoad(c)}}).catch(c=>{const d=Yh[e];if(d===void 0)throw this.manager.itemError(e),c;delete Yh[e];for(let h=0,g=d.length;h<g;h++){const v=d[h];v.onError&&v.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 Uwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new mp(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):Hn(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=RS.parse(e[r]);n.push(i)}return n}}class Bwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=[],o=new cE,l=new mp(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function d(h){l.load(e[h],function(g){const v=s.parse(g,!0);a[h]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},c+=1,c===6&&(v.mipmapCount===1&&(o.minFilter=rs),o.image=a,o.format=v.format,o.needsUpdate=!0,n&&n(o))},r,i)}if(Array.isArray(e))for(let h=0,g=e.length;h<g;++h)d(h);else l.load(e,function(h){const g=s.parse(h,!0);if(g.isCubemap){const v=g.mipmaps.length/g.mipmapCount;for(let b=0;b<v;b++){a[b]={mipmaps:[]};for(let _=0;_<g.mipmapCount;_++)a[b].mipmaps.push(g.mipmaps[b*g.mipmapCount+_]),a[b].format=g.format,a[b].width=g.width,a[b].height=g.height}o.image=a}else o.image.width=g.width,o.image.height=g.height,o.mipmaps=g.mipmaps;g.mipmapCount===1&&(o.minFilter=rs),o.format=g.format,o.needsUpdate=!0,n&&n(o)},r,i);return o}}const Hx=new WeakMap;class kS extends Rc{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,a=Zf.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0);else{let h=Hx.get(a);h===void 0&&(h=[],Hx.set(a,h)),h.push({onLoad:n,onError:i})}return a}const o=_S("img");function l(){d(),n&&n(this);const h=Hx.get(this)||[];for(let g=0;g<h.length;g++){const v=h[g];v.onLoad&&v.onLoad(this)}Hx.delete(this),s.manager.itemEnd(e)}function c(h){d(),i&&i(h),Zf.remove(`image:${e}`);const g=Hx.get(this)||[];for(let v=0;v<g.length;v++){const b=g[v];b.onError&&b.onError(h)}Hx.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Zf.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class Hwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=new _w;s.colorSpace=cl;const a=new kS(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(d){s.images[c]=d,o++,o===6&&(s.needsUpdate=!0,n&&n(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class Vwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Bd,o=new mp(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(d){if(i!==void 0)i(d);else{d(d);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Tc,a.wrapT=c.wrapT!==void 0?c.wrapT:Tc,a.magFilter=c.magFilter!==void 0?c.magFilter:rs,a.minFilter=c.minFilter!==void 0?c.minFilter:rs,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Kf),c.mipmapCount===1&&(a.minFilter=rs),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,n&&n(a,c)},r,i),a}}class Gwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=new ra,a=new kS(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,n!==void 0&&n(s)},r,i),s}}class xm extends yi{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new xn(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 BY extends xm{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(yi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new xn(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 m6=new rr,zz=new ze,jz=new ze;class S9{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 Lt(512,512),this.mapType=zl,this.map=null,this.mapPass=null,this.matrix=new rr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ry,this._frameExtents=new Lt(1,1),this._viewportCount=1,this._viewports=[new ci(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;zz.setFromMatrixPosition(e.matrixWorld),n.position.copy(zz),jz.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(jz),n.updateMatrixWorld(),m6.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(m6,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===lv||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(m6)}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 aM=new ze,oM=new Bo,Nf=new ze;class TE extends yi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rr,this.projectionMatrix=new rr,this.projectionMatrixInverse=new rr,this.coordinateSystem=Zc,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(aM,oM,Nf),Nf.x===1&&Nf.y===1&&Nf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aM,oM,Nf.set(1,1,1)).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorld.decompose(aM,oM,Nf),Nf.x===1&&Nf.y===1&&Nf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aM,oM,Nf.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const x0=new ze,Fz=new Lt,Uz=new Lt;class ea extends TE{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=ny*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan($g*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ny*2*Math.atan(Math.tan($g*.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){x0.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(x0.x,x0.y).multiplyScalar(-e/x0.z),x0.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(x0.x,x0.y).multiplyScalar(-e/x0.z)}getViewSize(e,n){return this.getViewBounds(e,Fz,Uz),n.subVectors(Uz,Fz)}setViewOffset(e,n,r,i,s,a){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=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan($g*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,n-=a.offsetY*r/c,i*=a.width/l,r*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/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 Wwe extends S9{constructor(){super(new ea(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const n=this.camera,r=ny*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 HY extends xm{constructor(e,n,r=0,i=Math.PI/3,s=0,a=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(yi.DEFAULT_UP),this.updateMatrix(),this.target=new yi,this.distance=r,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Wwe}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 $we extends S9{constructor(){super(new ea(90,1,.5,500)),this.isPointLightShadow=!0}}class VY extends xm{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 $we}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 Hd extends TE{constructor(e=-1,n=1,r=1,i=-1,s=.1,a=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=a,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,a){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=a,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,a=r+e,o=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,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 qwe extends S9{constructor(){super(new Hd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class GY extends xm{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(yi.DEFAULT_UP),this.updateMatrix(),this.target=new yi,this.shadow=new qwe}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 WY extends xm{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class $Y extends xm{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 w9{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ze)}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,a=this.coefficients;return n.copy(a[0]).multiplyScalar(.282095),n.addScaledVector(a[1],.488603*i),n.addScaledVector(a[2],.488603*s),n.addScaledVector(a[3],.488603*r),n.addScaledVector(a[4],1.092548*(r*i)),n.addScaledVector(a[5],1.092548*(i*s)),n.addScaledVector(a[6],.315392*(3*s*s-1)),n.addScaledVector(a[7],1.092548*(r*s)),n.addScaledVector(a[8],.546274*(r*r-i*i)),n}getIrradianceAt(e,n){const r=e.x,i=e.y,s=e.z,a=this.coefficients;return n.copy(a[0]).multiplyScalar(.886227),n.addScaledVector(a[1],2*.511664*i),n.addScaledVector(a[2],2*.511664*s),n.addScaledVector(a[3],2*.511664*r),n.addScaledVector(a[4],2*.429043*r*i),n.addScaledVector(a[5],2*.429043*i*s),n.addScaledVector(a[6],.743125*s*s-.247708),n.addScaledVector(a[7],2*.429043*r*s),n.addScaledVector(a[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 qY extends xm{constructor(e=new w9,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 EE extends Rc{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,a=new mp(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):Hn(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this.textures;function r(s){return n[s]===void 0&&fn("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 xn().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 a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=r(a.value);break;case"c":i.uniforms[s].value=new xn().setHex(a.value);break;case"v2":i.uniforms[s].value=new Lt().fromArray(a.value);break;case"v3":i.uniforms[s].value=new ze().fromArray(a.value);break;case"v4":i.uniforms[s].value=new ci().fromArray(a.value);break;case"m3":i.uniforms[s].value=new yr().fromArray(a.value);break;case"m4":i.uniforms[s].value=new rr().fromArray(a.value);break;default:i.uniforms[s].value=a.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 Lt().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 Lt().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 EE.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:EY,SpriteMaterial:i9,RawShaderMaterial:g9,ShaderMaterial:au,PointsMaterial:a9,MeshPhysicalMaterial:AY,MeshStandardMaterial:v9,MeshPhongMaterial:NY,MeshToonMaterial:RY,MeshNormalMaterial:kY,MeshLambertMaterial:PY,MeshDepthMaterial:wE,MeshDistanceMaterial:ME,MeshBasicMaterial:_p,MeshMatcapMaterial:DY,LineDashedMaterial:IY,LineBasicMaterial:$l,Material:vl};return new n[e]}}class $R{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 CE extends br{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 XY extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new mp(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):Hn(l),s.manager.itemError(e)}},r,i)}parse(e){const n={},r={};function i(v,b){if(n[b]!==void 0)return n[b];const w=v.interleavedBuffers[b],S=s(v,w.buffer),E=r1(w.type,S),A=new aE(E,w.stride);return A.uuid=w.uuid,n[b]=A,A}function s(v,b){if(r[b]!==void 0)return r[b];const w=v.arrayBuffers[b],S=new Uint32Array(w).buffer;return r[b]=S,S}const a=e.isInstancedBufferGeometry?new CE:new br,o=e.data.index;if(o!==void 0){const v=r1(o.type,o.array);a.setIndex(new Vi(v,1))}const l=e.data.attributes;for(const v in l){const b=l[v];let _;if(b.isInterleavedBufferAttribute){const w=i(e.data,b.data);_=new Qc(w,b.itemSize,b.offset,b.normalized)}else{const w=r1(b.type,b.array),S=b.isInstancedBufferAttribute?cv:Vi;_=new S(w,b.itemSize,b.normalized)}b.name!==void 0&&(_.name=b.name),b.usage!==void 0&&_.setUsage(b.usage),a.setAttribute(v,_)}const c=e.data.morphAttributes;if(c)for(const v in c){const b=c[v],_=[];for(let w=0,S=b.length;w<S;w++){const E=b[w];let A;if(E.isInterleavedBufferAttribute){const N=i(e.data,E.data);A=new Qc(N,E.itemSize,E.offset,E.normalized)}else{const N=r1(E.type,E.array);A=new Vi(N,E.itemSize,E.normalized)}E.name!==void 0&&(A.name=E.name),_.push(A)}a.morphAttributes[v]=_}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let v=0,b=h.length;v!==b;++v){const _=h[v];a.addGroup(_.start,_.count,_.materialIndex)}const g=e.data.boundingSphere;return g!==void 0&&(a.boundingSphere=new Ga().fromJSON(g)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class Xwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=this.path===""?$R.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new mp(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){i!==void 0&&i(h),h("ObjectLoader: Can't parse "+e+".",h.message);return}const d=c.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),Hn("ObjectLoader: Can't load "+e);return}s.parse(c,n)},r,i)}async loadAsync(e,n){const r=this,i=this.path===""?$R.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new mp(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,n);let o;try{o=JSON.parse(a)}catch(c){throw new Error("ObjectLoader: Can't parse "+e+". "+c.message)}const l=o.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(o)}parse(e,n){const r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){n!==void 0&&n(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,r),d=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,d),this.bindLightTargets(c),n!==void 0){let h=!1;for(const g in a)if(a[g].data instanceof HTMLImageElement){h=!0;break}h===!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),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,i,o,a,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 G0().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,a=e.length;s<a;s++){const o=new oE().fromJSON(e[s],i);r[o.uuid]=o}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new XY;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in Oz?o=Oz[l.type].fromJSON(l,n):fn(`ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),r[l.uuid]=o}}return r}parseMaterials(e,n){const r={},i={};if(e!==void 0){const s=new EE;s.setTextures(n);for(let a=0,o=e.length;a<o;a++){const l=e[a];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=RS.parse(i);n[s.uuid]=s}return n}parseImages(e,n){const r=this,i={};let s;function a(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 o(l){if(typeof l=="string"){const c=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return a(d)}else return l.data?{data:r1(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new _9(n);s=new kS(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c<d;c++){const h=e[c],g=h.url;if(Array.isArray(g)){const v=[];for(let b=0,_=g.length;b<_;b++){const w=g[b],S=o(w);S!==null&&(S instanceof HTMLImageElement?v.push(S):v.push(new Bd(S.data,S.width,S.height)))}i[h.uuid]=new U0(v)}else{const v=o(h.url);i[h.uuid]=new U0(v)}}}return i}async parseImagesAsync(e){const n=this,r={};let i;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:n.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:r1(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new kS(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const d=[];for(let h=0,g=c.length;h<g;h++){const v=c[h],b=await s(v);b!==null&&(b instanceof HTMLImageElement?d.push(b):d.push(new Bd(b.data,b.width,b.height)))}r[l.uuid]=new U0(d)}else{const d=await s(l.url);r[l.uuid]=new U0(d)}}}return r}parseTextures(e,n){function r(s,a){return typeof s=="number"?s:(fn("ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&fn('ObjectLoader: No "image" specified for',o.uuid),n[o.image]===void 0&&fn("ObjectLoader: Undefined image",o.image);const l=n[o.image],c=l.data;let d;Array.isArray(c)?(d=new _w,c.length===6&&(d.needsUpdate=!0)):(c&&c.data?d=new Bd:d=new ra,c&&(d.needsUpdate=!0)),d.source=l,d.uuid=o.uuid,o.name!==void 0&&(d.name=o.name),o.mapping!==void 0&&(d.mapping=r(o.mapping,Ywe)),o.channel!==void 0&&(d.channel=o.channel),o.offset!==void 0&&d.offset.fromArray(o.offset),o.repeat!==void 0&&d.repeat.fromArray(o.repeat),o.center!==void 0&&d.center.fromArray(o.center),o.rotation!==void 0&&(d.rotation=o.rotation),o.wrap!==void 0&&(d.wrapS=r(o.wrap[0],Bz),d.wrapT=r(o.wrap[1],Bz)),o.format!==void 0&&(d.format=o.format),o.internalFormat!==void 0&&(d.internalFormat=o.internalFormat),o.type!==void 0&&(d.type=o.type),o.colorSpace!==void 0&&(d.colorSpace=o.colorSpace),o.minFilter!==void 0&&(d.minFilter=r(o.minFilter,Hz)),o.magFilter!==void 0&&(d.magFilter=r(o.magFilter,Hz)),o.anisotropy!==void 0&&(d.anisotropy=o.anisotropy),o.flipY!==void 0&&(d.flipY=o.flipY),o.generateMipmaps!==void 0&&(d.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(d.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(d.compareFunction=o.compareFunction),o.userData!==void 0&&(d.userData=o.userData),i[o.uuid]=d}return i}parseObject(e,n,r,i,s){let a;function o(g){return n[g]===void 0&&fn("ObjectLoader: Undefined geometry",g),n[g]}function l(g){if(g!==void 0){if(Array.isArray(g)){const v=[];for(let b=0,_=g.length;b<_;b++){const w=g[b];r[w]===void 0&&fn("ObjectLoader: Undefined material",w),v.push(r[w])}return v}return r[g]===void 0&&fn("ObjectLoader: Undefined material",g),r[g]}}function c(g){return i[g]===void 0&&fn("ObjectLoader: Undefined texture",g),i[g]}let d,h;switch(e.type){case"Scene":a=new t9,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new xn(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new sE(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new iE(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new ea(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Hd(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new WY(e.color,e.intensity);break;case"DirectionalLight":a=new GY(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new VY(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new $Y(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new HY(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new BY(e.color,e.groundColor,e.intensity);break;case"LightProbe":const g=new w9().fromArray(e.sh);a=new qY(g,e.intensity);break;case"SkinnedMesh":d=o(e.geometry),h=l(e.material),a=new uY(d,h),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":d=o(e.geometry),h=l(e.material),a=new Us(d,h);break;case"InstancedMesh":d=o(e.geometry),h=l(e.material);const v=e.count,b=e.instanceMatrix,_=e.instanceColor;a=new dY(d,h,v),a.instanceMatrix=new cv(new Float32Array(b.array),16),_!==void 0&&(a.instanceColor=new cv(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":d=o(e.geometry),h=l(e.material),a=new fY(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),a.geometry=d,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(w=>{let S=null,E=null;return w.boundingBox!==void 0&&(S=new Ca().fromJSON(w.boundingBox)),w.boundingSphere!==void 0&&(E=new Ga().fromJSON(w.boundingSphere)),{...w,boundingBox:S,boundingSphere:E}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new Ga().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new Ca().fromJSON(e.boundingBox));break;case"LOD":a=new cY;break;case"Line":a=new im(o(e.geometry),l(e.material));break;case"LineLoop":a=new hY(o(e.geometry),l(e.material));break;case"LineSegments":a=new gh(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new pY(o(e.geometry),l(e.material));break;case"Sprite":a=new lY(l(e.material));break;case"Group":a=new i1;break;case"Bone":a=new s9;break;default:a=new yi}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.pivot!==void 0&&(a.pivot=new ze().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.static!==void 0&&(a.static=e.static),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const g=e.children;for(let v=0;v<g.length;v++)a.add(this.parseObject(g[v],n,r,i,s))}if(e.animations!==void 0){const g=e.animations;for(let v=0;v<g.length;v++){const b=g[v];a.animations.push(s[b])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const g=e.levels;for(let v=0;v<g.length;v++){const b=g[v],_=a.getObjectByProperty("uuid",b.object);_!==void 0&&a.addLevel(_,b.distance,b.hysteresis)}}return a}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?fn("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 yi}})}}const Ywe={UVMapping:$T,CubeReflectionMapping:sh,CubeRefractionMapping:tm,EquirectangularReflectionMapping:I_,EquirectangularRefractionMapping:O_,CubeUVReflectionMapping:Ny},Bz={RepeatWrapping:mS,ClampToEdgeWrapping:Tc,MirroredRepeatWrapping:gS},Hz={NearestFilter:Ea,NearestMipmapNearestFilter:Wk,NearestMipmapLinearFilter:n1,LinearFilter:rs,LinearMipmapNearestFilter:L_,LinearMipmapLinearFilter:Kf},g6=new WeakMap;class Kwe extends Rc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&fn("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&fn("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,a=Zf.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{if(g6.has(a)===!0)i&&i(g6.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return n&&n(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Zf.add(`image-bitmap:${e}`,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),g6.set(l,c),Zf.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Zf.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let lM;class M9{static getContext(){return lM===void 0&&(lM=new(window.AudioContext||window.webkitAudioContext)),lM}static setContext(e){lM=e}}class Zwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new mp(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);M9.getContext().decodeAudioData(c,function(h){n(h)}).catch(o)}catch(c){o(c)}},r,i);function o(l){i?i(l):Hn(l),s.manager.itemError(e)}}}const Vz=new rr,Gz=new rr,fg=new rr;class Qwe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ea,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ea,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,fg.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,a=n.near*Math.tan($g*n.fov*.5)/n.zoom;let o,l;Gz.elements[12]=-i,Vz.elements[12]=i,o=-a*n.aspect+s,l=a*n.aspect+s,fg.elements[0]=2*n.near/(l-o),fg.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(fg),o=-a*n.aspect-s,l=a*n.aspect-s,fg.elements[0]=2*n.near/(l-o),fg.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(fg)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Gz),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Vz)}}const Vx=-90,Gx=1;class YY extends yi{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new ea(Vx,Gx,e,n);i.layers=this.layers,this.add(i);const s=new ea(Vx,Gx,e,n);s.layers=this.layers,this.add(s);const a=new ea(Vx,Gx,e,n);a.layers=this.layers,this.add(a);const o=new ea(Vx,Gx,e,n);o.layers=this.layers,this.add(o);const l=new ea(Vx,Gx,e,n);l.layers=this.layers,this.add(l);const c=new ea(Vx,Gx,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,a,o,l]=n;for(const c of n)this.remove(c);if(e===Zc)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),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===lv)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),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.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,a,o,l,c,d]=this.children,h=e.getRenderTarget(),g=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const _=r.texture.generateMipmaps;r.texture.generateMipmaps=!1;let w=!1;e.isWebGLRenderer===!0?w=e.state.buffers.depth.getReversed():w=e.reversedDepthBuffer,e.setRenderTarget(r,0,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,s),e.setRenderTarget(r,1,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,a),e.setRenderTarget(r,2,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,o),e.setRenderTarget(r,3,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,l),e.setRenderTarget(r,4,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,c),r.texture.generateMipmaps=_,e.setRenderTarget(r,5,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,d),e.setRenderTarget(h,g,v),e.xr.enabled=b,r.texture.needsPMREMUpdate=!0}}class KY extends ea{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class ZY{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=Jwe.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 Jwe(){this._document.hidden===!1&&this.reset()}const hg=new ze,v6=new Bo,e3e=new ze,pg=new ze,mg=new ze;class t3e extends yi{constructor(){super(),this.type="AudioListener",this.context=M9.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new ZY}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(hg,v6,e3e),pg.set(0,0,-1).applyQuaternion(v6),mg.set(0,1,0).applyQuaternion(v6),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(hg.x,r),n.positionY.linearRampToValueAtTime(hg.y,r),n.positionZ.linearRampToValueAtTime(hg.z,r),n.forwardX.linearRampToValueAtTime(pg.x,r),n.forwardY.linearRampToValueAtTime(pg.y,r),n.forwardZ.linearRampToValueAtTime(pg.z,r),n.upX.linearRampToValueAtTime(mg.x,r),n.upY.linearRampToValueAtTime(mg.y,r),n.upZ.linearRampToValueAtTime(mg.z,r)}else n.setPosition(hg.x,hg.y,hg.z),n.setOrientation(pg.x,pg.y,pg.z,mg.x,mg.y,mg.z)}}class QY extends yi{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){fn("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){fn("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){fn("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){fn("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){fn("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?(fn("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){fn("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"?(fn("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 gg=new ze,Wz=new Bo,n3e=new ze,vg=new ze;class r3e extends QY{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(gg,Wz,n3e),vg.set(0,0,1).applyQuaternion(Wz);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(gg.x,r),n.positionY.linearRampToValueAtTime(gg.y,r),n.positionZ.linearRampToValueAtTime(gg.z,r),n.orientationX.linearRampToValueAtTime(vg.x,r),n.orientationY.linearRampToValueAtTime(vg.y,r),n.orientationZ.linearRampToValueAtTime(vg.z,r)}else n.setPosition(gg.x,gg.y,gg.z),n.setOrientation(vg.x,vg.y,vg.z)}}class i3e{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 JY{constructor(e,n,r){this.binding=e,this.valueSize=r;let i,s,a;switch(n){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,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 a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)r[s+o]=r[o];a=n}else{a+=n;const o=n/a;this._mixBufferRegion(r,s,0,o,i)}this.cumulativeWeight=a}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,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=n*this._origIndex;this._mixBufferRegion(r,i,l,1-s,n)}a>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]){o.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,a=i;s!==a;++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 a=0;a!==s;++a)e[n+a]=e[r+a]}_slerp(e,n,r,i){Bo.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const a=this._workIndex*s;Bo.multiplyQuaternionsFlat(e,a,e,n,e,r),Bo.slerpFlat(e,n,e,n,e,a,i)}_lerp(e,n,r,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=n+o;e[l]=e[l]*a+e[r+o]*i}}_lerpAdditive(e,n,r,i,s){for(let a=0;a!==s;++a){const o=n+a;e[o]=e[o]+e[r+a]*i}}}const T9="\\[\\]\\.:\\/",s3e=new RegExp("["+T9+"]","g"),E9="[^"+T9+"]",a3e="[^"+T9.replace("\\.","")+"]",o3e=/((?:WC+[\/:])*)/.source.replace("WC",E9),l3e=/(WCOD+)?/.source.replace("WCOD",a3e),c3e=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",E9),u3e=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",E9),d3e=new RegExp("^"+o3e+l3e+c3e+u3e+"$"),f3e=["material","materials","bones","map"];class h3e{constructor(e,n,r){const i=r||gi.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 gi{constructor(e,n,r){this.path=n,this.parsedPath=r||gi.parseTrackName(n),this.node=gi.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 gi.Composite(e,n,r):new gi(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(s3e,"")}static parseTrackName(e){const n=d3e.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);f3e.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 a=0;a<s.length;a++){const o=s[a];if(o.name===n||o.uuid===n)return o;const l=r(o.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=gi.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){fn("PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){Hn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Hn("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){Hn("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===c){c=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Hn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Hn("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){Hn("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){Hn("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[i];if(a===void 0){const c=n.nodeName;Hn("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Hn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Hn("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=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}gi.Composite=h3e;gi.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};gi.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};gi.prototype.GetterByBindingType=[gi.prototype._getValue_direct,gi.prototype._getValue_array,gi.prototype._getValue_arrayElement,gi.prototype._getValue_toArray];gi.prototype.SetterByBindingTypeAndVersioning=[[gi.prototype._setValue_direct,gi.prototype._setValue_direct_setNeedsUpdate,gi.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[gi.prototype._setValue_array,gi.prototype._setValue_array_setNeedsUpdate,gi.prototype._setValue_array_setMatrixWorldNeedsUpdate],[gi.prototype._setValue_arrayElement,gi.prototype._setValue_arrayElement_setNeedsUpdate,gi.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[gi.prototype._setValue_fromArray,gi.prototype._setValue_fromArray_setNeedsUpdate,gi.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class p3e{constructor(){this.isAnimationObjectGroup=!0,this.uuid=ru(),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,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let d=0,h=arguments.length;d!==h;++d){const g=arguments[d],v=g.uuid;let b=n[v];if(b===void 0){b=l++,n[v]=b,e.push(g);for(let _=0,w=a;_!==w;++_)s[_].push(new gi(g,r[_],i[_]))}else if(b<c){o=e[b];const _=--c,w=e[_];n[w.uuid]=b,e[b]=w,n[v]=_,e[_]=g;for(let S=0,E=a;S!==E;++S){const A=s[S],N=A[_];let I=A[b];A[b]=N,I===void 0&&(I=new gi(g,r[S],i[S])),A[_]=I}}else e[b]!==o&&Hn("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 a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,d=n[c];if(d!==void 0&&d>=s){const h=s++,g=e[h];n[g.uuid]=d,e[d]=g,n[c]=h,e[h]=l;for(let v=0,b=i;v!==b;++v){const _=r[v],w=_[h],S=_[d];_[d]=w,_[h]=S}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],d=c.uuid,h=n[d];if(h!==void 0)if(delete n[d],h<s){const g=--s,v=e[g],b=--a,_=e[b];n[v.uuid]=h,e[h]=v,n[_.uuid]=g,e[g]=_,e.pop();for(let w=0,S=i;w!==S;++w){const E=r[w],A=E[g],N=E[b];E[h]=A,E[g]=N,E.pop()}}else{const g=--a,v=e[g];g>0&&(n[v.uuid]=h),e[h]=v,e.pop();for(let b=0,_=i;b!==_;++b){const w=r[b];w[h]=w[g],w.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 a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,h=new Array(c);i=s.length,r[e]=i,a.push(e),o.push(n),s.push(h);for(let g=d,v=l.length;g!==v;++g){const b=l[g];h[g]=new gi(b,e,n)}return h}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];n[c]=r,a[r]=l,a.pop(),s[r]=s[o],s.pop(),i[r]=i[o],i.pop()}}}class eK{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,a=s.length,o=new Array(a),l={endingStart:kg,endingEnd:kg};for(let c=0;c!==a;++c){const d=s[c].createInterpolant(null);o[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=GX,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,a=s/i,o=i/s;e.warp(1,a,n),this.warp(o,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,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/a,c[1]=n/a,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 a=this._updateTime(n),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Qk:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(a),c[d].accumulateAdditive(o);break;case JT:default:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(a),c[d].accumulate(i,o)}}}_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 a=r===WX;if(e===0)return s===-1?i:a&&(s&1)===1?n-i:i;if(r===VX){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,a)):this._setEndings(this.repetitions===0,!0,a)),i>=n||i<0){const o=Math.floor(i/n);i-=n*o,s+=Math.abs(o);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,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=Pg,i.endingEnd=Pg):(e?i.endingStart=this.zeroSlopeAtStart?Pg:kg:i.endingStart=xS,n?i.endingEnd=this.zeroSlopeAtEnd?Pg:kg:i.endingEnd=xS)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=n,o[1]=s+e,l[1]=r,this}}const m3e=new Float32Array(1);class g3e extends mh{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let h=0;h!==s;++h){const g=i[h],v=g.name;let b=d[v];if(b!==void 0)++b.referenceCount,a[h]=b;else{if(b=a[h],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,l,v));continue}const _=n&&n._propertyBindings[h].binding.parsedPath;b=new JY(gi.create(r,v,_),g.ValueTypeName,g.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,l,v),a[h]=b}o[h].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 a=s[n];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[n]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.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,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,l[d]=c,l.pop(),e._byClipCacheIndex=null;const h=o.actionByRoot,g=(e._localRoot||this._root).uuid;delete h[g],l.length===0&&delete a[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 a=i[n];a===void 0&&(a={},i[n]=a),a[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,a=this._bindingsByRootAndName,o=a[i],l=n[n.length-1],c=e._cacheIndex;l._cacheIndex=c,n[c]=l,n.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const n=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackBinding(e){const n=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_lendControlInterpolant(){const e=this._controlInterpolants,n=this._nActiveControlInterpolants++;let r=e[n];return r===void 0&&(r=new y9(new Float32Array(2),new Float32Array(2),1,m3e),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 a=typeof e=="string"?RS.findByName(i,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(r===void 0&&(a!==null?r=a.blendMode:r=JT),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===r)return h;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const d=new eK(this,a,n,r);return this._bindAction(d,c),this._addInactiveAction(d,o,s),d}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?RS.findByName(r,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.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),a=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);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 a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const d=c._cacheIndex,h=n[n.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=d,n[d]=h,n.pop(),this._removeInactiveBindingsForAction(c)}delete i[r]}}uncacheRoot(e){const n=e.uuid,r=this._actionsByClip;for(const a in r){const o=r[a].actionByRoot,l=o[n];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[n];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,n){const r=this.existingAction(e,n);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class v3e extends e9{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isRenderTarget3D=!0,this.depth=r,this.texture=new rE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class C9{constructor(e){this.value=e}clone(){return new C9(this.value.clone===void 0?this.value:this.value.clone())}}let x3e=0;class y3e extends mh{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:x3e++}),this.name="",this.usage=bS,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 a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class S5 extends aE{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 b3e{constructor(e,n,r,i,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=n,this.itemSize=r,this.elementSize=i,this.count=s,this.normalized=a,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 $z=new rr;class tK{constructor(e,n,r=0,i=1/0){this.ray=new Mv(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new ry,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):Hn("Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return $z.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4($z),this}intersectObject(e,n=!0,r=[]){return qR(e,this,r,n),r.sort(qz),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)qR(e[i],this,r,n);return r.sort(qz),r}}function qz(t,e){return t.distance-e.distance}function qR(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 a=0,o=s.length;a<o;a++)qR(s[a],e,n,!0)}}class nK{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,fn("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 XR{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=sr(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(sr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class _3e{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 A9{constructor(e,n,r,i){A9.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 Xz=new Lt;class S3e{constructor(e=new Lt(1/0,1/0),n=new Lt(-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=Xz.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,Xz).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 Yz=new ze,cM=new ze,Wx=new ze,$x=new ze,x6=new ze,w3e=new ze,M3e=new ze;class rK{constructor(e=new ze,n=new ze){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){Yz.subVectors(e,this.start),cM.subVectors(this.end,this.start);const r=cM.dot(cM);let s=cM.dot(Yz)/r;return n&&(s=sr(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=w3e,r=M3e){const i=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,d=e.end;Wx.subVectors(c,o),$x.subVectors(d,l),x6.subVectors(o,l);const h=Wx.dot(Wx),g=$x.dot($x),v=$x.dot(x6);if(h<=i&&g<=i)return n.copy(o),r.copy(l),n.sub(r),n.dot(n);if(h<=i)s=0,a=v/g,a=sr(a,0,1);else{const b=Wx.dot(x6);if(g<=i)a=0,s=sr(-b/h,0,1);else{const _=Wx.dot($x),w=h*g-_*_;w!==0?s=sr((_*v-b*g)/w,0,1):s=0,a=(_*s+v)/g,a<0?(a=0,s=sr(-b/h,0,1)):a>1&&(a=1,s=sr((_-b)/h,0,1))}}return n.copy(o).addScaledVector(Wx,s),r.copy(l).addScaledVector($x,a),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 Kz=new ze;class T3e extends yi{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new br,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 a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,d=o/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(d),Math.sin(d),1)}r.setAttribute("position",new An(i,3));const s=new $l({fog:!1,toneMapped:!1});this.cone=new gh(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),Kz.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Kz),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const y0=new ze,uM=new rr,y6=new rr;class E3e extends gh{constructor(e){const n=iK(e),r=new br,i=[],s=[];for(let c=0;c<n.length;c++){const d=n[c];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}r.setAttribute("position",new An(i,3)),r.setAttribute("color",new An(s,3));const a=new $l({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=n,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const o=new xn(255),l=new xn(65280);this.setColors(o,l)}updateMatrixWorld(e){const n=this.bones,r=this.geometry,i=r.getAttribute("position");y6.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<n.length;s++){const o=n[s];o.parent&&o.parent.isBone&&(uM.multiplyMatrices(y6,o.matrixWorld),y0.setFromMatrixPosition(uM),i.setXYZ(a,y0.x,y0.y,y0.z),uM.multiplyMatrices(y6,o.parent.matrixWorld),y0.setFromMatrixPosition(uM),i.setXYZ(a+1,y0.x,y0.y,y0.z),a+=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 iK(t){const e=[];t.isBone===!0&&e.push(t);for(let n=0;n<t.children.length;n++)e.push(...iK(t.children[n]));return e}class C3e extends Us{constructor(e,n,r){const i=new Tw(n,4,2),s=new _p({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 A3e=new ze,Zz=new xn,Qz=new xn;class N3e extends yi{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const i=new Mw(n);i.rotateY(Math.PI*.5),this.material=new _p({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new Vi(a,3)),this.add(new Us(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");Zz.copy(this.light.color),Qz.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?Zz:Qz;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(A3e.setFromMatrixPosition(this.light.matrixWorld).negate())}}class R3e extends gh{constructor(e=10,n=10,r=4473924,i=8947848){r=new xn(r),i=new xn(i);const s=n/2,a=e/n,o=e/2,l=[],c=[];for(let g=0,v=0,b=-o;g<=n;g++,b+=a){l.push(-o,0,b,o,0,b),l.push(b,0,-o,b,0,o);const _=g===s?r:i;_.toArray(c,v),v+=3,_.toArray(c,v),v+=3,_.toArray(c,v),v+=3,_.toArray(c,v),v+=3}const d=new br;d.setAttribute("position",new An(l,3)),d.setAttribute("color",new An(c,3));const h=new $l({vertexColors:!0,toneMapped:!1});super(d,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class k3e extends gh{constructor(e=10,n=16,r=8,i=64,s=4473924,a=8947848){s=new xn(s),a=new xn(a);const o=[],l=[];if(n>1)for(let h=0;h<n;h++){const g=h/n*(Math.PI*2),v=Math.sin(g)*e,b=Math.cos(g)*e;o.push(0,0,0),o.push(v,0,b);const _=h&1?s:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let h=0;h<r;h++){const g=h&1?s:a,v=e-e/r*h;for(let b=0;b<i;b++){let _=b/i*(Math.PI*2),w=Math.sin(_)*v,S=Math.cos(_)*v;o.push(w,0,S),l.push(g.r,g.g,g.b),_=(b+1)/i*(Math.PI*2),w=Math.sin(_)*v,S=Math.cos(_)*v,o.push(w,0,S),l.push(g.r,g.g,g.b)}}const c=new br;c.setAttribute("position",new An(o,3)),c.setAttribute("color",new An(l,3));const d=new $l({vertexColors:!0,toneMapped:!1});super(c,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Jz=new ze,dM=new ze,ej=new ze;class P3e extends yi{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 br;i.setAttribute("position",new An([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));const s=new $l({fog:!1,toneMapped:!1});this.lightPlane=new im(i,s),this.add(this.lightPlane),i=new br,i.setAttribute("position",new An([0,0,0,0,0,1],3)),this.targetLine=new im(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),Jz.setFromMatrixPosition(this.light.matrixWorld),dM.setFromMatrixPosition(this.light.target.matrixWorld),ej.subVectors(dM,Jz),this.lightPlane.lookAt(dM),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(dM),this.targetLine.scale.z=ej.length()}}const fM=new ze,fa=new TE;class D3e extends gh{constructor(e){const n=new br,r=new $l({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(b,_){l(b),l(_)}function l(b){i.push(0,0,0),s.push(0,0,0),a[b]===void 0&&(a[b]=[]),a[b].push(i.length/3-1)}n.setAttribute("position",new An(i,3)),n.setAttribute("color",new An(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=a,this.update();const c=new xn(16755200),d=new xn(16711680),h=new xn(43775),g=new xn(16777215),v=new xn(3355443);this.setColors(c,d,h,g,v)}setColors(e,n,r,i,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,n.r,n.g,n.b),o.setXYZ(25,n.r,n.g,n.b),o.setXYZ(26,n.r,n.g,n.b),o.setXYZ(27,n.r,n.g,n.b),o.setXYZ(28,n.r,n.g,n.b),o.setXYZ(29,n.r,n.g,n.b),o.setXYZ(30,n.r,n.g,n.b),o.setXYZ(31,n.r,n.g,n.b),o.setXYZ(32,r.r,r.g,r.b),o.setXYZ(33,r.r,r.g,r.b),o.setXYZ(34,r.r,r.g,r.b),o.setXYZ(35,r.r,r.g,r.b),o.setXYZ(36,r.r,r.g,r.b),o.setXYZ(37,r.r,r.g,r.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0,this}update(){const e=this.geometry,n=this.pointMap,r=1,i=1;let s,a;if(fa.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===Zc)s=-1,a=1;else if(this.camera.coordinateSystem===lv)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Ma("c",n,e,fa,0,0,s),Ma("t",n,e,fa,0,0,a),Ma("n1",n,e,fa,-r,-i,s),Ma("n2",n,e,fa,r,-i,s),Ma("n3",n,e,fa,-r,i,s),Ma("n4",n,e,fa,r,i,s),Ma("f1",n,e,fa,-r,-i,a),Ma("f2",n,e,fa,r,-i,a),Ma("f3",n,e,fa,-r,i,a),Ma("f4",n,e,fa,r,i,a),Ma("u1",n,e,fa,r*.7,i*1.1,s),Ma("u2",n,e,fa,-r*.7,i*1.1,s),Ma("u3",n,e,fa,0,i*2,s),Ma("cf1",n,e,fa,-r,0,a),Ma("cf2",n,e,fa,r,0,a),Ma("cf3",n,e,fa,0,-i,a),Ma("cf4",n,e,fa,0,i,a),Ma("cn1",n,e,fa,-r,0,s),Ma("cn2",n,e,fa,r,0,s),Ma("cn3",n,e,fa,0,-i,s),Ma("cn4",n,e,fa,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ma(t,e,n,r,i,s,a){fM.set(i,s,a).unproject(r);const o=e[t];if(o!==void 0){const l=n.getAttribute("position");for(let c=0,d=o.length;c<d;c++)l.setXYZ(o[c],fM.x,fM.y,fM.z)}}const hM=new Ca;class I3e extends gh{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 br;s.setIndex(new Vi(r,1)),s.setAttribute("position",new Vi(i,3)),super(s,new $l({color:n,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&hM.setFromObject(this.object),hM.isEmpty())return;const e=hM.min,n=hM.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 O3e extends gh{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 br;s.setIndex(new Vi(r,1)),s.setAttribute("position",new An(i,3)),super(s,new $l({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 L3e extends im{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],a=new br;a.setAttribute("position",new An(s,3)),a.computeBoundingSphere(),super(a,new $l({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=n;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new br;l.setAttribute("position",new An(o,3)),l.computeBoundingSphere(),this.add(new Us(l,new _p({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 tj=new ze;let pM,b6;class z3e extends yi{constructor(e=new ze(0,0,1),n=new ze(0,0,0),r=1,i=16776960,s=r*.2,a=s*.2){super(),this.type="ArrowHelper",pM===void 0&&(pM=new br,pM.setAttribute("position",new An([0,0,0,0,1,0],3)),b6=new ww(.5,1,5,1),b6.translate(0,-.5,0)),this.position.copy(n),this.line=new im(pM,new $l({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Us(b6,new _p({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,s,a)}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{tj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(tj,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 j3e extends gh{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 br;i.setAttribute("position",new An(n,3)),i.setAttribute("color",new An(r,3));const s=new $l({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new xn,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 F3e{constructor(){this.type="ShapePath",this.color=new xn,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new _5,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,a){return this.currentPath.bezierCurveTo(e,n,r,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(S){const E=[];for(let A=0,N=S.length;A<N;A++){const I=S[A],P=new G0;P.curves=I.curves,E.push(P)}return E}function r(S,E){const A=E.length;let N=!1;for(let I=A-1,P=0;P<A;I=P++){let L=E[I],R=E[P],O=R.x-L.x,W=R.y-L.y;if(Math.abs(W)>Number.EPSILON){if(W<0&&(L=E[P],O=-O,R=E[I],W=-W),S.y<L.y||S.y>R.y)continue;if(S.y===L.y){if(S.x===L.x)return!0}else{const U=W*(S.x-L.x)-O*(S.y-L.y);if(U===0)return!0;if(U<0)continue;N=!N}}else{if(S.y!==L.y)continue;if(R.x<=S.x&&S.x<=L.x||L.x<=S.x&&S.x<=R.x)return!0}}return N}const i=Ud.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new G0,l.curves=o.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const h=[],g=[];let v=[],b=0,_;g[b]=void 0,v[b]=[];for(let S=0,E=s.length;S<E;S++)o=s[S],_=o.getPoints(),a=i(_),a=e?!a:a,a?(!d&&g[b]&&b++,g[b]={s:new G0,p:_},g[b].s.curves=o.curves,d&&b++,v[b]=[]):v[b].push({h:o,p:_[0]});if(!g[0])return n(s);if(g.length>1){let S=!1,E=0;for(let A=0,N=g.length;A<N;A++)h[A]=[];for(let A=0,N=g.length;A<N;A++){const I=v[A];for(let P=0;P<I.length;P++){const L=I[P];let R=!0;for(let O=0;O<g.length;O++)r(L.p,g[O].p)&&(A!==O&&E++,R?(R=!1,h[O].push(L)):S=!0);R&&h[A].push(L)}}E>0&&S===!1&&(v=h)}let w;for(let S=0,E=g.length;S<E;S++){l=g[S].s,c.push(l),w=v[S];for(let A=0,N=w.length;A<N;A++)l.holes.push(w[A].h)}return c}}class U3e extends mh{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){fn("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function B3e(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 H3e(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 V3e(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function YR(t,e,n,r){const i=G3e(r);switch(n){case Kk:return t*e;case KT:return t*e/i.components*i.byteLength;case bw:return t*e/i.components*i.byteLength;case ov:return t*e*2/i.components*i.byteLength;case ZT:return t*e*2/i.components*i.byteLength;case Zk:return t*e*3/i.components*i.byteLength;case ul:return t*e*4/i.components*i.byteLength;case QT:return t*e*4/i.components*i.byteLength;case z_:case j_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case F_:case U_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case U2:case H2:return Math.max(t,16)*Math.max(e,8)/4;case F2:case B2:return Math.max(t,8)*Math.max(e,8)/2;case V2:case G2:case $2:case q2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case W2:case X2:case Y2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case K2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Z2:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Q2:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case J2:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case e5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case t5:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case n5:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case r5:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case i5:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case s5:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case a5:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case o5:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case l5:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case c5:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case u5:case d5:case f5:return Math.ceil(t/4)*Math.ceil(e/4)*16;case h5:case p5:return Math.ceil(t/4)*Math.ceil(e/4)*8;case m5:case g5:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function G3e(t){switch(t){case zl:case $k:return{byteLength:1,components:1};case ey:case qk:case ah:return{byteLength:2,components:1};case XT:case YT:return{byteLength:2,components:4};case Ku:case qT:case Bl:return{byteLength:4,components:1};case Xk:case Yk:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class W3e{static contain(e,n){return B3e(e,n)}static cover(e,n){return H3e(e,n)}static fill(e){return V3e(e)}static getByteLength(e,n,r,i){return YR(e,n,r,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:xw}}));typeof window<"u"&&(window.__THREE__?fn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=xw);/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function sK(){let t=null,e=!1,n=null,r=null;function i(s,a){n(s,a),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 $3e(t){const e=new WeakMap;function n(o,l){const c=o.array,d=o.usage,h=c.byteLength,g=t.createBuffer();t.bindBuffer(l,g),t.bufferData(l,c,d),o.onUploadCallback();let v;if(c instanceof Float32Array)v=t.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)v=t.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?v=t.HALF_FLOAT:v=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)v=t.SHORT;else if(c instanceof Uint32Array)v=t.UNSIGNED_INT;else if(c instanceof Int32Array)v=t.INT;else if(c instanceof Int8Array)v=t.BYTE;else if(c instanceof Uint8Array)v=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)v=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:g,type:v,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function r(o,l,c){const d=l.array,h=l.updateRanges;if(t.bindBuffer(c,o),h.length===0)t.bufferSubData(c,0,d);else{h.sort((v,b)=>v.start-b.start);let g=0;for(let v=1;v<h.length;v++){const b=h[g],_=h[v];_.start<=b.start+b.count+1?b.count=Math.max(b.count,_.start+_.count-b.start):(++g,h[g]=_)}h.length=g+1;for(let v=0,b=h.length;v<b;v++){const _=h[v];t.bufferSubData(c,_.start*d.BYTES_PER_ELEMENT,d,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(t.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,n(o,l));else if(c.version<o.version){if(c.size!==o.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,o,l),c.version=o.version}}return{get:i,remove:s,update:a}}var q3e=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,X3e=`#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`,Y3e=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,K3e=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,Z3e=`#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`,Q3e=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,J3e=`#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`,e4e=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,t4e=`#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`,n4e=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,r4e=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,i4e=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,s4e=`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`,a4e=`#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`,o4e=`#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`,l4e=`#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`,c4e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,u4e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,d4e=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,f4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#endif`,h4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#endif`,p4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec4 vColor;
#endif`,m4e=`#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`,g4e=`#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`,v4e=`#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`,x4e=`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`,y4e=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,b4e=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,_4e=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,S4e=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,w4e="gl_FragColor = linearToOutputTexel( gl_FragColor );",M4e=`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 );
}`,T4e=`#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`,E4e=`#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`,C4e=`#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`,A4e=`#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`,N4e=`#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`,R4e=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,k4e=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,P4e=`#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`,D4e=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,I4e=`#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
}`,O4e=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,L4e=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,z4e=`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`,j4e=`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`,F4e=`#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`,U4e=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,B4e=`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`,H4e=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,V4e=`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`,G4e=`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`,W4e=`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 );
}`,$4e=`
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`,q4e=`#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`,X4e=`#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`,Y4e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,K4e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,Z4e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,Q4e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,J4e=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,eMe=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,tMe=`#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`,nMe=`#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`,rMe=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,iMe=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,sMe=`#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`,aMe=`#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`,oMe=`#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`,lMe=`#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`,cMe=`#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`,uMe=`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;`,dMe=`#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`,fMe=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,hMe=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,pMe=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,mMe=`#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`,gMe=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,vMe=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,xMe=`#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`,yMe=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,bMe=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,_Me=`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
}`,SMe=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,wMe=`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;`,MMe=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,TMe=`#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`,EMe=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,CMe=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,AMe=`#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`,NMe=`#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`,RMe=`#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`,kMe=`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;
}`,PMe=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,DMe=`#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`,IMe=`#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`,OMe=`#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`,LMe=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,zMe=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,jMe=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,FMe=`#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; }`,UMe=`#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`,BMe=`#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`,HMe=`#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`,VMe=`#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`,GMe=`#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`,WMe=`#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 $Me=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,qMe=`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>
}`,XMe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,YMe=`#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>
}`,KMe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,ZMe=`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>
}`,QMe=`#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;
}`,JMe=`#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
}`,e2e=`#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;
}`,t2e=`#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 );
}`,n2e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,r2e=`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>
}`,i2e=`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>
}`,s2e=`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>
}`,a2e=`#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>
}`,o2e=`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>
}`,l2e=`#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>
}`,c2e=`#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>
}`,u2e=`#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;
}`,d2e=`#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>
}`,f2e=`#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
}`,h2e=`#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
}`,p2e=`#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>
}`,m2e=`#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>
}`,g2e=`#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
}`,v2e=`#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>
}`,x2e=`#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>
}`,y2e=`#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>
}`,b2e=`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>
}`,_2e=`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>
}`,S2e=`#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>
}`,w2e=`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>
}`,M2e=`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>
}`,T2e=`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>
}`,Tr={alphahash_fragment:q3e,alphahash_pars_fragment:X3e,alphamap_fragment:Y3e,alphamap_pars_fragment:K3e,alphatest_fragment:Z3e,alphatest_pars_fragment:Q3e,aomap_fragment:J3e,aomap_pars_fragment:e4e,batching_pars_vertex:t4e,batching_vertex:n4e,begin_vertex:r4e,beginnormal_vertex:i4e,bsdfs:s4e,iridescence_fragment:a4e,bumpmap_pars_fragment:o4e,clipping_planes_fragment:l4e,clipping_planes_pars_fragment:c4e,clipping_planes_pars_vertex:u4e,clipping_planes_vertex:d4e,color_fragment:f4e,color_pars_fragment:h4e,color_pars_vertex:p4e,color_vertex:m4e,common:g4e,cube_uv_reflection_fragment:v4e,defaultnormal_vertex:x4e,displacementmap_pars_vertex:y4e,displacementmap_vertex:b4e,emissivemap_fragment:_4e,emissivemap_pars_fragment:S4e,colorspace_fragment:w4e,colorspace_pars_fragment:M4e,envmap_fragment:T4e,envmap_common_pars_fragment:E4e,envmap_pars_fragment:C4e,envmap_pars_vertex:A4e,envmap_physical_pars_fragment:F4e,envmap_vertex:N4e,fog_vertex:R4e,fog_pars_vertex:k4e,fog_fragment:P4e,fog_pars_fragment:D4e,gradientmap_pars_fragment:I4e,lightmap_pars_fragment:O4e,lights_lambert_fragment:L4e,lights_lambert_pars_fragment:z4e,lights_pars_begin:j4e,lights_toon_fragment:U4e,lights_toon_pars_fragment:B4e,lights_phong_fragment:H4e,lights_phong_pars_fragment:V4e,lights_physical_fragment:G4e,lights_physical_pars_fragment:W4e,lights_fragment_begin:$4e,lights_fragment_maps:q4e,lights_fragment_end:X4e,logdepthbuf_fragment:Y4e,logdepthbuf_pars_fragment:K4e,logdepthbuf_pars_vertex:Z4e,logdepthbuf_vertex:Q4e,map_fragment:J4e,map_pars_fragment:eMe,map_particle_fragment:tMe,map_particle_pars_fragment:nMe,metalnessmap_fragment:rMe,metalnessmap_pars_fragment:iMe,morphinstance_vertex:sMe,morphcolor_vertex:aMe,morphnormal_vertex:oMe,morphtarget_pars_vertex:lMe,morphtarget_vertex:cMe,normal_fragment_begin:uMe,normal_fragment_maps:dMe,normal_pars_fragment:fMe,normal_pars_vertex:hMe,normal_vertex:pMe,normalmap_pars_fragment:mMe,clearcoat_normal_fragment_begin:gMe,clearcoat_normal_fragment_maps:vMe,clearcoat_pars_fragment:xMe,iridescence_pars_fragment:yMe,opaque_fragment:bMe,packing:_Me,premultiplied_alpha_fragment:SMe,project_vertex:wMe,dithering_fragment:MMe,dithering_pars_fragment:TMe,roughnessmap_fragment:EMe,roughnessmap_pars_fragment:CMe,shadowmap_pars_fragment:AMe,shadowmap_pars_vertex:NMe,shadowmap_vertex:RMe,shadowmask_pars_fragment:kMe,skinbase_vertex:PMe,skinning_pars_vertex:DMe,skinning_vertex:IMe,skinnormal_vertex:OMe,specularmap_fragment:LMe,specularmap_pars_fragment:zMe,tonemapping_fragment:jMe,tonemapping_pars_fragment:FMe,transmission_fragment:UMe,transmission_pars_fragment:BMe,uv_pars_fragment:HMe,uv_pars_vertex:VMe,uv_vertex:GMe,worldpos_vertex:WMe,background_vert:$Me,background_frag:qMe,backgroundCube_vert:XMe,backgroundCube_frag:YMe,cube_vert:KMe,cube_frag:ZMe,depth_vert:QMe,depth_frag:JMe,distance_vert:e2e,distance_frag:t2e,equirect_vert:n2e,equirect_frag:r2e,linedashed_vert:i2e,linedashed_frag:s2e,meshbasic_vert:a2e,meshbasic_frag:o2e,meshlambert_vert:l2e,meshlambert_frag:c2e,meshmatcap_vert:u2e,meshmatcap_frag:d2e,meshnormal_vert:f2e,meshnormal_frag:h2e,meshphong_vert:p2e,meshphong_frag:m2e,meshphysical_vert:g2e,meshphysical_frag:v2e,meshtoon_vert:x2e,meshtoon_frag:y2e,points_vert:b2e,points_frag:_2e,shadow_vert:S2e,shadow_frag:w2e,sprite_vert:M2e,sprite_frag:T2e},hn={common:{diffuse:{value:new xn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new yr},alphaMap:{value:null},alphaMapTransform:{value:new yr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new yr}},envmap:{envMap:{value:null},envMapRotation:{value:new yr},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 yr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new yr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new yr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new yr},normalScale:{value:new Lt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new yr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new yr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new yr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new yr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xn(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 xn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new yr},alphaTest:{value:0},uvTransform:{value:new yr}},sprite:{diffuse:{value:new xn(16777215)},opacity:{value:1},center:{value:new Lt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new yr},alphaMap:{value:null},alphaMapTransform:{value:new yr},alphaTest:{value:0}}},Id={basic:{uniforms:Dl([hn.common,hn.specularmap,hn.envmap,hn.aomap,hn.lightmap,hn.fog]),vertexShader:Tr.meshbasic_vert,fragmentShader:Tr.meshbasic_frag},lambert:{uniforms:Dl([hn.common,hn.specularmap,hn.envmap,hn.aomap,hn.lightmap,hn.emissivemap,hn.bumpmap,hn.normalmap,hn.displacementmap,hn.fog,hn.lights,{emissive:{value:new xn(0)},envMapIntensity:{value:1}}]),vertexShader:Tr.meshlambert_vert,fragmentShader:Tr.meshlambert_frag},phong:{uniforms:Dl([hn.common,hn.specularmap,hn.envmap,hn.aomap,hn.lightmap,hn.emissivemap,hn.bumpmap,hn.normalmap,hn.displacementmap,hn.fog,hn.lights,{emissive:{value:new xn(0)},specular:{value:new xn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Tr.meshphong_vert,fragmentShader:Tr.meshphong_frag},standard:{uniforms:Dl([hn.common,hn.envmap,hn.aomap,hn.lightmap,hn.emissivemap,hn.bumpmap,hn.normalmap,hn.displacementmap,hn.roughnessmap,hn.metalnessmap,hn.fog,hn.lights,{emissive:{value:new xn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Tr.meshphysical_vert,fragmentShader:Tr.meshphysical_frag},toon:{uniforms:Dl([hn.common,hn.aomap,hn.lightmap,hn.emissivemap,hn.bumpmap,hn.normalmap,hn.displacementmap,hn.gradientmap,hn.fog,hn.lights,{emissive:{value:new xn(0)}}]),vertexShader:Tr.meshtoon_vert,fragmentShader:Tr.meshtoon_frag},matcap:{uniforms:Dl([hn.common,hn.bumpmap,hn.normalmap,hn.displacementmap,hn.fog,{matcap:{value:null}}]),vertexShader:Tr.meshmatcap_vert,fragmentShader:Tr.meshmatcap_frag},points:{uniforms:Dl([hn.points,hn.fog]),vertexShader:Tr.points_vert,fragmentShader:Tr.points_frag},dashed:{uniforms:Dl([hn.common,hn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Tr.linedashed_vert,fragmentShader:Tr.linedashed_frag},depth:{uniforms:Dl([hn.common,hn.displacementmap]),vertexShader:Tr.depth_vert,fragmentShader:Tr.depth_frag},normal:{uniforms:Dl([hn.common,hn.bumpmap,hn.normalmap,hn.displacementmap,{opacity:{value:1}}]),vertexShader:Tr.meshnormal_vert,fragmentShader:Tr.meshnormal_frag},sprite:{uniforms:Dl([hn.sprite,hn.fog]),vertexShader:Tr.sprite_vert,fragmentShader:Tr.sprite_frag},background:{uniforms:{uvTransform:{value:new yr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Tr.background_vert,fragmentShader:Tr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new yr}},vertexShader:Tr.backgroundCube_vert,fragmentShader:Tr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Tr.cube_vert,fragmentShader:Tr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Tr.equirect_vert,fragmentShader:Tr.equirect_frag},distance:{uniforms:Dl([hn.common,hn.displacementmap,{referencePosition:{value:new ze},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Tr.distance_vert,fragmentShader:Tr.distance_frag},shadow:{uniforms:Dl([hn.lights,hn.fog,{color:{value:new xn(0)},opacity:{value:1}}]),vertexShader:Tr.shadow_vert,fragmentShader:Tr.shadow_frag}};Id.physical={uniforms:Dl([Id.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new yr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new yr},clearcoatNormalScale:{value:new Lt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new yr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new yr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new yr},sheen:{value:0},sheenColor:{value:new xn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new yr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new yr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new yr},transmissionSamplerSize:{value:new Lt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new yr},attenuationDistance:{value:0},attenuationColor:{value:new xn(0)},specularColor:{value:new xn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new yr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new yr},anisotropyVector:{value:new Lt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new yr}}]),vertexShader:Tr.meshphysical_vert,fragmentShader:Tr.meshphysical_frag};const mM={r:0,b:0,g:0},xg=new su,E2e=new rr;function C2e(t,e,n,r,i,s){const a=new xn(0);let o=i===!0?0:1,l,c,d=null,h=0,g=null;function v(E){let A=E.isScene===!0?E.background:null;if(A&&A.isTexture){const N=E.backgroundBlurriness>0;A=e.get(A,N)}return A}function b(E){let A=!1;const N=v(E);N===null?w(a,o):N&&N.isColor&&(w(N,1),A=!0);const I=t.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,s):I==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,s),(t.autoClear||A)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function _(E,A){const N=v(A);N&&(N.isCubeTexture||N.mapping===Ny)?(c===void 0&&(c=new Us(new Tv(1,1,1),new au({name:"BackgroundCubeMaterial",uniforms:ay(Id.backgroundCube.uniforms),vertexShader:Id.backgroundCube.vertexShader,fragmentShader:Id.backgroundCube.fragmentShader,side:Vl,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(I,P,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),xg.copy(A.backgroundRotation),xg.x*=-1,xg.y*=-1,xg.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(xg.y*=-1,xg.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(E2e.makeRotationFromEuler(xg)),c.material.toneMapped=ii.getTransfer(N.colorSpace)!==ji,(d!==N||h!==N.version||g!==t.toneMapping)&&(c.material.needsUpdate=!0,d=N,h=N.version,g=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null)):N&&N.isTexture&&(l===void 0&&(l=new Us(new Sp(2,2),new au({name:"BackgroundMaterial",uniforms:ay(Id.background.uniforms),vertexShader:Id.background.vertexShader,fragmentShader:Id.background.fragmentShader,side:pp,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=ii.getTransfer(N.colorSpace)!==ji,N.matrixAutoUpdate===!0&&N.updateMatrix(),l.material.uniforms.uvTransform.value.copy(N.matrix),(d!==N||h!==N.version||g!==t.toneMapping)&&(l.material.needsUpdate=!0,d=N,h=N.version,g=t.toneMapping),l.layers.enableAll(),E.unshift(l,l.geometry,l.material,0,0,null))}function w(E,A){E.getRGB(mM,CY(t)),n.buffers.color.setClear(mM.r,mM.g,mM.b,A,s)}function S(){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 a},setClearColor:function(E,A=1){a.set(E),o=A,w(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(E){o=E,w(a,o)},render:b,addToRenderList:_,dispose:S}}function A2e(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=g(null);let s=i,a=!1;function o(U,V,G,Z,B){let q=!1;const Y=h(U,Z,G,V);s!==Y&&(s=Y,c(s.object)),q=v(U,Z,G,B),q&&b(U,Z,G,B),B!==null&&e.update(B,t.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,N(U,V,G,Z),B!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(B).buffer))}function l(){return t.createVertexArray()}function c(U){return t.bindVertexArray(U)}function d(U){return t.deleteVertexArray(U)}function h(U,V,G,Z){const B=Z.wireframe===!0;let q=r[V.id];q===void 0&&(q={},r[V.id]=q);const Y=U.isInstancedMesh===!0?U.id:0;let K=q[Y];K===void 0&&(K={},q[Y]=K);let J=K[G.id];J===void 0&&(J={},K[G.id]=J);let F=J[B];return F===void 0&&(F=g(l()),J[B]=F),F}function g(U){const V=[],G=[],Z=[];for(let B=0;B<n;B++)V[B]=0,G[B]=0,Z[B]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:V,enabledAttributes:G,attributeDivisors:Z,object:U,attributes:{},index:null}}function v(U,V,G,Z){const B=s.attributes,q=V.attributes;let Y=0;const K=G.getAttributes();for(const J in K)if(K[J].location>=0){const j=B[J];let X=q[J];if(X===void 0&&(J==="instanceMatrix"&&U.instanceMatrix&&(X=U.instanceMatrix),J==="instanceColor"&&U.instanceColor&&(X=U.instanceColor)),j===void 0||j.attribute!==X||X&&j.data!==X.data)return!0;Y++}return s.attributesNum!==Y||s.index!==Z}function b(U,V,G,Z){const B={},q=V.attributes;let Y=0;const K=G.getAttributes();for(const J in K)if(K[J].location>=0){let j=q[J];j===void 0&&(J==="instanceMatrix"&&U.instanceMatrix&&(j=U.instanceMatrix),J==="instanceColor"&&U.instanceColor&&(j=U.instanceColor));const X={};X.attribute=j,j&&j.data&&(X.data=j.data),B[J]=X,Y++}s.attributes=B,s.attributesNum=Y,s.index=Z}function _(){const U=s.newAttributes;for(let V=0,G=U.length;V<G;V++)U[V]=0}function w(U){S(U,0)}function S(U,V){const G=s.newAttributes,Z=s.enabledAttributes,B=s.attributeDivisors;G[U]=1,Z[U]===0&&(t.enableVertexAttribArray(U),Z[U]=1),B[U]!==V&&(t.vertexAttribDivisor(U,V),B[U]=V)}function E(){const U=s.newAttributes,V=s.enabledAttributes;for(let G=0,Z=V.length;G<Z;G++)V[G]!==U[G]&&(t.disableVertexAttribArray(G),V[G]=0)}function A(U,V,G,Z,B,q,Y){Y===!0?t.vertexAttribIPointer(U,V,G,B,q):t.vertexAttribPointer(U,V,G,Z,B,q)}function N(U,V,G,Z){_();const B=Z.attributes,q=G.getAttributes(),Y=V.defaultAttributeValues;for(const K in q){const J=q[K];if(J.location>=0){let F=B[K];if(F===void 0&&(K==="instanceMatrix"&&U.instanceMatrix&&(F=U.instanceMatrix),K==="instanceColor"&&U.instanceColor&&(F=U.instanceColor)),F!==void 0){const j=F.normalized,X=F.itemSize,H=e.get(F);if(H===void 0)continue;const se=H.buffer,re=H.type,ie=H.bytesPerElement,ue=re===t.INT||re===t.UNSIGNED_INT||F.gpuType===qT;if(F.isInterleavedBufferAttribute){const le=F.data,fe=le.stride,xe=F.offset;if(le.isInstancedInterleavedBuffer){for(let he=0;he<J.locationSize;he++)S(J.location+he,le.meshPerAttribute);U.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let he=0;he<J.locationSize;he++)w(J.location+he);t.bindBuffer(t.ARRAY_BUFFER,se);for(let he=0;he<J.locationSize;he++)A(J.location+he,X/J.locationSize,re,j,fe*ie,(xe+X/J.locationSize*he)*ie,ue)}else{if(F.isInstancedBufferAttribute){for(let le=0;le<J.locationSize;le++)S(J.location+le,F.meshPerAttribute);U.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=F.meshPerAttribute*F.count)}else for(let le=0;le<J.locationSize;le++)w(J.location+le);t.bindBuffer(t.ARRAY_BUFFER,se);for(let le=0;le<J.locationSize;le++)A(J.location+le,X/J.locationSize,re,j,X*ie,X/J.locationSize*le*ie,ue)}}else if(Y!==void 0){const j=Y[K];if(j!==void 0)switch(j.length){case 2:t.vertexAttrib2fv(J.location,j);break;case 3:t.vertexAttrib3fv(J.location,j);break;case 4:t.vertexAttrib4fv(J.location,j);break;default:t.vertexAttrib1fv(J.location,j)}}}}E()}function I(){O();for(const U in r){const V=r[U];for(const G in V){const Z=V[G];for(const B in Z){const q=Z[B];for(const Y in q)d(q[Y].object),delete q[Y];delete Z[B]}}delete r[U]}}function P(U){if(r[U.id]===void 0)return;const V=r[U.id];for(const G in V){const Z=V[G];for(const B in Z){const q=Z[B];for(const Y in q)d(q[Y].object),delete q[Y];delete Z[B]}}delete r[U.id]}function L(U){for(const V in r){const G=r[V];for(const Z in G){const B=G[Z];if(B[U.id]===void 0)continue;const q=B[U.id];for(const Y in q)d(q[Y].object),delete q[Y];delete B[U.id]}}}function R(U){for(const V in r){const G=r[V],Z=U.isInstancedMesh===!0?U.id:0,B=G[Z];if(B!==void 0){for(const q in B){const Y=B[q];for(const K in Y)d(Y[K].object),delete Y[K];delete B[q]}delete G[Z],Object.keys(G).length===0&&delete r[V]}}}function O(){W(),a=!0,s!==i&&(s=i,c(s.object))}function W(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:O,resetDefaultState:W,dispose:I,releaseStatesOfGeometry:P,releaseStatesOfObject:R,releaseStatesOfProgram:L,initAttributes:_,enableAttribute:w,disableUnusedAttributes:E}}function N2e(t,e,n){let r;function i(c){r=c}function s(c,d){t.drawArrays(r,c,d),n.update(d,r,1)}function a(c,d,h){h!==0&&(t.drawArraysInstanced(r,c,d,h),n.update(d,r,h))}function o(c,d,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,d,0,h);let v=0;for(let b=0;b<h;b++)v+=d[b];n.update(v,r,1)}function l(c,d,h,g){if(h===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let b=0;b<c.length;b++)a(c[b],d[b],g[b]);else{v.multiDrawArraysInstancedWEBGL(r,c,0,d,0,g,0,h);let b=0;for(let _=0;_<h;_++)b+=d[_]*g[_];n.update(b,r,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function R2e(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(L){return!(L!==ul&&r.convert(L)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(L){const R=L===ah&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==zl&&r.convert(L)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Bl&&!R)}function l(L){if(L==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(fn("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const h=n.logarithmicDepthBuffer===!0,g=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),S=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),A=t.getParameter(t.MAX_VARYING_VECTORS),N=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),I=t.getParameter(t.MAX_SAMPLES),P=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reversedDepthBuffer:g,maxTextures:v,maxVertexTextures:b,maxTextureSize:_,maxCubemapSize:w,maxAttributes:S,maxVertexUniforms:E,maxVaryings:A,maxFragmentUniforms:N,maxSamples:I,samples:P}}function k2e(t){const e=this;let n=null,r=0,i=!1,s=!1;const a=new Jh,o=new yr,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,g){const v=h.length!==0||g||r!==0||i;return i=g,r=h.length,v},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,g){n=d(h,g,0)},this.setState=function(h,g,v){const b=h.clippingPlanes,_=h.clipIntersection,w=h.clipShadows,S=t.get(h);if(!i||b===null||b.length===0||s&&!w)s?d(null):c();else{const E=s?0:r,A=E*4;let N=S.clippingState||null;l.value=N,N=d(b,g,A,v);for(let I=0;I!==A;++I)N[I]=n[I];S.clippingState=N,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(h,g,v,b){const _=h!==null?h.length:0;let w=null;if(_!==0){if(w=l.value,b!==!0||w===null){const S=v+_*4,E=g.matrixWorldInverse;o.getNormalMatrix(E),(w===null||w.length<S)&&(w=new Float32Array(S));for(let A=0,N=v;A!==_;++A,N+=4)a.copy(h[A]).applyMatrix4(E,o),a.normal.toArray(w,N),w[N+3]=a.constant}l.value=w,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,w}}const B0=4,nj=[.125,.215,.35,.446,.526,.582],Cg=20,P2e=256,a_=new Hd,rj=new xn;let _6=null,S6=0,w6=0,M6=!1;const D2e=new ze;class KR{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:a=256,position:o=D2e}=s;_6=this._renderer.getRenderTarget(),S6=this._renderer.getActiveCubeFace(),w6=this._renderer.getActiveMipmapLevel(),M6=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,r,i,l,o),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=aj(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=sj(),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(_6,S6,w6),this._renderer.xr.enabled=M6,e.scissorTest=!1,qx(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===sh||e.mapping===tm?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),_6=this._renderer.getRenderTarget(),S6=this._renderer.getActiveCubeFace(),w6=this._renderer.getActiveMipmapLevel(),M6=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:rs,minFilter:rs,generateMipmaps:!1,type:ah,format:ul,colorSpace:nm,depthBuffer:!1},i=ij(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ij(e,n,r);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=I2e(s)),this._blurMaterial=L2e(s,e,n),this._ggxMaterial=O2e(s,e,n)}return i}_compileMaterial(e){const n=new Us(new br,e);this._renderer.compile(n,a_)}_sceneToCubeUV(e,n,r,i,s){const l=new ea(90,1,n,r),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],h=this._renderer,g=h.autoClear,v=h.toneMapping;h.getClearColor(rj),h.toneMapping=nu,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(i),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Us(new Tv,new _p({name:"PMREM.Background",side:Vl,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,w=_.material;let S=!1;const E=e.background;E?E.isColor&&(w.color.copy(E),e.background=null,S=!0):(w.color.copy(rj),S=!0);for(let A=0;A<6;A++){const N=A%3;N===0?(l.up.set(0,c[A],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[A],s.y,s.z)):N===1?(l.up.set(0,0,c[A]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[A],s.z)):(l.up.set(0,c[A],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[A]));const I=this._cubeSize;qx(i,N*I,A>2?I:0,I,I),h.setRenderTarget(i),S&&h.render(_,l),h.render(e,l)}h.toneMapping=v,h.autoClear=g,e.background=E}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===sh||e.mapping===tm;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=aj()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=sj());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;qx(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(a,a_)}_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,a=this._ggxMaterial,o=this._lodMeshes[r];o.material=a;const l=a.uniforms,c=r/(this._lodMeshes.length-1),d=n/(this._lodMeshes.length-1),h=Math.sqrt(c*c-d*d),g=0+c*1.25,v=h*g,{_lodMax:b}=this,_=this._sizeLods[r],w=3*_*(r>b-B0?r-b+B0:0),S=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=v,l.mipInt.value=b-n,qx(s,w,S,3*_,2*_),i.setRenderTarget(s),i.render(o,a_),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=b-r,qx(e,w,S,3*_,2*_),i.setRenderTarget(e),i.render(o,a_)}_blur(e,n,r,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,r,i,"latitudinal",s),this._halfBlur(a,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Hn("blur direction must be either latitudinal or longitudinal!");const d=3,h=this._lodMeshes[i];h.material=c;const g=c.uniforms,v=this._sizeLods[r]-1,b=isFinite(s)?Math.PI/(2*v):2*Math.PI/(2*Cg-1),_=s/b,w=isFinite(s)?1+Math.floor(d*_):Cg;w>Cg&&fn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Cg}`);const S=[];let E=0;for(let L=0;L<Cg;++L){const R=L/_,O=Math.exp(-R*R/2);S.push(O),L===0?E+=O:L<w&&(E+=2*O)}for(let L=0;L<S.length;L++)S[L]=S[L]/E;g.envMap.value=e.texture,g.samples.value=w,g.weights.value=S,g.latitudinal.value=a==="latitudinal",o&&(g.poleAxis.value=o);const{_lodMax:A}=this;g.dTheta.value=b,g.mipInt.value=A-r;const N=this._sizeLods[i],I=3*N*(i>A-B0?i-A+B0:0),P=4*(this._cubeSize-N);qx(n,I,P,3*N,2*N),l.setRenderTarget(n),l.render(h,a_)}}function I2e(t){const e=[],n=[],r=[];let i=t;const s=t-B0+1+nj.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>t-B0?l=nj[a-t+B0-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),d=-c,h=1+c,g=[d,d,h,d,h,h,d,d,h,h,d,h],v=6,b=6,_=3,w=2,S=1,E=new Float32Array(_*b*v),A=new Float32Array(w*b*v),N=new Float32Array(S*b*v);for(let P=0;P<v;P++){const L=P%3*2/3-1,R=P>2?0:-1,O=[L,R,0,L+2/3,R,0,L+2/3,R+1,0,L,R,0,L+2/3,R+1,0,L,R+1,0];E.set(O,_*b*P),A.set(g,w*b*P);const W=[P,P,P,P,P,P];N.set(W,S*b*P)}const I=new br;I.setAttribute("position",new Vi(E,_)),I.setAttribute("uv",new Vi(A,w)),I.setAttribute("faceIndex",new Vi(N,S)),r.push(new Us(I,null)),i>B0&&i--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function ij(t,e,n){const r=new iu(t,e,n);return r.texture.mapping=Ny,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function qx(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function O2e(t,e,n){return new au({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:P2e,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:AE(),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:th,depthTest:!1,depthWrite:!1})}function L2e(t,e,n){const r=new Float32Array(Cg),i=new ze(0,1,0);return new au({name:"SphericalGaussianBlur",defines:{n:Cg,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:AE(),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:th,depthTest:!1,depthWrite:!1})}function sj(){return new au({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:AE(),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:th,depthTest:!1,depthWrite:!1})}function aj(){return new au({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:AE(),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:th,depthTest:!1,depthWrite:!1})}function AE(){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 N9 extends iu{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 _w(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 Tv(5,5,5),s=new au({name:"CubemapFromEquirect",uniforms:ay(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Vl,blending:th});s.uniforms.tEquirect.value=n;const a=new Us(i,s),o=n.minFilter;return n.minFilter===Kf&&(n.minFilter=rs),new YY(1,10,this).update(e,a),n.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,n=!0,r=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(n,r,i);e.setRenderTarget(s)}}function z2e(t){let e=new WeakMap,n=new WeakMap,r=null;function i(g,v=!1){return g==null?null:v?a(g):s(g)}function s(g){if(g&&g.isTexture){const v=g.mapping;if(v===I_||v===O_)if(e.has(g)){const b=e.get(g).texture;return o(b,g.mapping)}else{const b=g.image;if(b&&b.height>0){const _=new N9(b.height);return _.fromEquirectangularTexture(t,g),e.set(g,_),g.addEventListener("dispose",c),o(_.texture,g.mapping)}else return null}}return g}function a(g){if(g&&g.isTexture){const v=g.mapping,b=v===I_||v===O_,_=v===sh||v===tm;if(b||_){let w=n.get(g);const S=w!==void 0?w.texture.pmremVersion:0;if(g.isRenderTargetTexture&&g.pmremVersion!==S)return r===null&&(r=new KR(t)),w=b?r.fromEquirectangular(g,w):r.fromCubemap(g,w),w.texture.pmremVersion=g.pmremVersion,n.set(g,w),w.texture;if(w!==void 0)return w.texture;{const E=g.image;return b&&E&&E.height>0||_&&E&&l(E)?(r===null&&(r=new KR(t)),w=b?r.fromEquirectangular(g):r.fromCubemap(g),w.texture.pmremVersion=g.pmremVersion,n.set(g,w),g.addEventListener("dispose",d),w.texture):null}}}return g}function o(g,v){return v===I_?g.mapping=sh:v===O_&&(g.mapping=tm),g}function l(g){let v=0;const b=6;for(let _=0;_<b;_++)g[_]!==void 0&&v++;return v===b}function c(g){const v=g.target;v.removeEventListener("dispose",c);const b=e.get(v);b!==void 0&&(e.delete(v),b.dispose())}function d(g){const v=g.target;v.removeEventListener("dispose",d);const b=n.get(v);b!==void 0&&(n.delete(v),b.dispose())}function h(){e=new WeakMap,n=new WeakMap,r!==null&&(r.dispose(),r=null)}return{get:i,dispose:h}}function j2e(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&&wS("WebGLRenderer: "+r+" extension not supported."),i}}}function F2e(t,e,n,r){const i={},s=new WeakMap;function a(h){const g=h.target;g.index!==null&&e.remove(g.index);for(const b in g.attributes)e.remove(g.attributes[b]);g.removeEventListener("dispose",a),delete i[g.id];const v=s.get(g);v&&(e.remove(v),s.delete(g)),r.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,n.memory.geometries--}function o(h,g){return i[g.id]===!0||(g.addEventListener("dispose",a),i[g.id]=!0,n.memory.geometries++),g}function l(h){const g=h.attributes;for(const v in g)e.update(g[v],t.ARRAY_BUFFER)}function c(h){const g=[],v=h.index,b=h.attributes.position;let _=0;if(b===void 0)return;if(v!==null){const E=v.array;_=v.version;for(let A=0,N=E.length;A<N;A+=3){const I=E[A+0],P=E[A+1],L=E[A+2];g.push(I,P,P,L,L,I)}}else{const E=b.array;_=b.version;for(let A=0,N=E.length/3-1;A<N;A+=3){const I=A+0,P=A+1,L=A+2;g.push(I,P,P,L,L,I)}}const w=new(b.count>=65535?r9:n9)(g,1);w.version=_;const S=s.get(h);S&&e.remove(S),s.set(h,w)}function d(h){const g=s.get(h);if(g){const v=h.index;v!==null&&g.version<v.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:d}}function U2e(t,e,n){let r;function i(g){r=g}let s,a;function o(g){s=g.type,a=g.bytesPerElement}function l(g,v){t.drawElements(r,v,s,g*a),n.update(v,r,1)}function c(g,v,b){b!==0&&(t.drawElementsInstanced(r,v,s,g*a,b),n.update(v,r,b))}function d(g,v,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,v,0,s,g,0,b);let w=0;for(let S=0;S<b;S++)w+=v[S];n.update(w,r,1)}function h(g,v,b,_){if(b===0)return;const w=e.get("WEBGL_multi_draw");if(w===null)for(let S=0;S<g.length;S++)c(g[S]/a,v[S],_[S]);else{w.multiDrawElementsInstancedWEBGL(r,v,0,s,g,0,_,0,b);let S=0;for(let E=0;E<b;E++)S+=v[E]*_[E];n.update(S,r,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=h}function B2e(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,a,o){switch(n.calls++,a){case t.TRIANGLES:n.triangles+=o*(s/3);break;case t.LINES:n.lines+=o*(s/2);break;case t.LINE_STRIP:n.lines+=o*(s-1);break;case t.LINE_LOOP:n.lines+=o*s;break;case t.POINTS:n.points+=o*s;break;default:Hn("WebGLInfo: Unknown draw mode:",a);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 H2e(t,e,n){const r=new WeakMap,i=new ci;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=d!==void 0?d.length:0;let g=r.get(o);if(g===void 0||g.count!==h){let W=function(){R.dispose(),r.delete(o),o.removeEventListener("dispose",W)};var v=W;g!==void 0&&g.texture.dispose();const b=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,w=o.morphAttributes.color!==void 0,S=o.morphAttributes.position||[],E=o.morphAttributes.normal||[],A=o.morphAttributes.color||[];let N=0;b===!0&&(N=1),_===!0&&(N=2),w===!0&&(N=3);let I=o.attributes.position.count*N,P=1;I>e.maxTextureSize&&(P=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const L=new Float32Array(I*P*4*h),R=new nE(L,I,P,h);R.type=Bl,R.needsUpdate=!0;const O=N*4;for(let U=0;U<h;U++){const V=S[U],G=E[U],Z=A[U],B=I*P*4*U;for(let q=0;q<V.count;q++){const Y=q*O;b===!0&&(i.fromBufferAttribute(V,q),L[B+Y+0]=i.x,L[B+Y+1]=i.y,L[B+Y+2]=i.z,L[B+Y+3]=0),_===!0&&(i.fromBufferAttribute(G,q),L[B+Y+4]=i.x,L[B+Y+5]=i.y,L[B+Y+6]=i.z,L[B+Y+7]=0),w===!0&&(i.fromBufferAttribute(Z,q),L[B+Y+8]=i.x,L[B+Y+9]=i.y,L[B+Y+10]=i.z,L[B+Y+11]=Z.itemSize===4?i.w:1)}}g={count:h,texture:R,size:new Lt(I,P)},r.set(o,g),o.addEventListener("dispose",W)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{let b=0;for(let w=0;w<c.length;w++)b+=c[w];const _=o.morphTargetsRelative?1:1-b;l.getUniforms().setValue(t,"morphTargetBaseInfluence",_),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",g.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",g.size)}return{update:s}}function V2e(t,e,n,r,i){let s=new WeakMap;function a(c){const d=i.render.frame,h=c.geometry,g=e.get(c,h);if(s.get(g)!==d&&(e.update(g),s.set(g,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==d&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),s.set(c,d))),c.isSkinnedMesh){const v=c.skeleton;s.get(v)!==d&&(v.update(),s.set(v,d))}return g}function o(){s=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),r.releaseStatesOfObject(d),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:a,dispose:o}}const G2e={[Fk]:"LINEAR_TONE_MAPPING",[Uk]:"REINHARD_TONE_MAPPING",[Bk]:"CINEON_TONE_MAPPING",[WT]:"ACES_FILMIC_TONE_MAPPING",[Vk]:"AGX_TONE_MAPPING",[Gk]:"NEUTRAL_TONE_MAPPING",[Hk]:"CUSTOM_TONE_MAPPING"};function W2e(t,e,n,r,i){const s=new iu(e,n,{type:t,depthBuffer:r,stencilBuffer:i}),a=new iu(e,n,{type:ah,depthBuffer:!1,stencilBuffer:!1}),o=new br;o.setAttribute("position",new An([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new An([0,2,0,0,2,0],2));const l=new g9({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 Us(o,l),d=new Hd(-1,1,1,-1,0,1);let h=null,g=null,v=!1,b,_=null,w=[],S=!1;this.setSize=function(E,A){s.setSize(E,A),a.setSize(E,A);for(let N=0;N<w.length;N++){const I=w[N];I.setSize&&I.setSize(E,A)}},this.setEffects=function(E){w=E,S=w.length>0&&w[0].isRenderPass===!0;const A=s.width,N=s.height;for(let I=0;I<w.length;I++){const P=w[I];P.setSize&&P.setSize(A,N)}},this.begin=function(E,A){if(v||E.toneMapping===nu&&w.length===0)return!1;if(_=A,A!==null){const N=A.width,I=A.height;(s.width!==N||s.height!==I)&&this.setSize(N,I)}return S===!1&&E.setRenderTarget(s),b=E.toneMapping,E.toneMapping=nu,!0},this.hasRenderPass=function(){return S},this.end=function(E,A){E.toneMapping=b,v=!0;let N=s,I=a;for(let P=0;P<w.length;P++){const L=w[P];if(L.enabled!==!1&&(L.render(E,I,N,A),L.needsSwap!==!1)){const R=N;N=I,I=R}}if(h!==E.outputColorSpace||g!==E.toneMapping){h=E.outputColorSpace,g=E.toneMapping,l.defines={},ii.getTransfer(h)===ji&&(l.defines.SRGB_TRANSFER="");const P=G2e[g];P&&(l.defines[P]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=N.texture,E.setRenderTarget(_),E.render(c,d),_=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const aK=new ra,ZR=new iy(1,1),oK=new nE,lK=new rE,cK=new _w,oj=[],lj=[],cj=new Float32Array(16),uj=new Float32Array(9),dj=new Float32Array(4);function Py(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=oj[i];if(s===void 0&&(s=new Float32Array(i),oj[i]=s),e!==0){r.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=n,t[a].toArray(s,o)}return s}function ao(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 oo(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function NE(t,e){let n=lj[e];n===void 0&&(n=new Int32Array(e),lj[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function $2e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function q2e(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(ao(n,e))return;t.uniform2fv(this.addr,e),oo(n,e)}}function X2e(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(ao(n,e))return;t.uniform3fv(this.addr,e),oo(n,e)}}function Y2e(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(ao(n,e))return;t.uniform4fv(this.addr,e),oo(n,e)}}function K2e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ao(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),oo(n,e)}else{if(ao(n,r))return;dj.set(r),t.uniformMatrix2fv(this.addr,!1,dj),oo(n,r)}}function Z2e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ao(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),oo(n,e)}else{if(ao(n,r))return;uj.set(r),t.uniformMatrix3fv(this.addr,!1,uj),oo(n,r)}}function Q2e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ao(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),oo(n,e)}else{if(ao(n,r))return;cj.set(r),t.uniformMatrix4fv(this.addr,!1,cj),oo(n,r)}}function J2e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function e5e(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(ao(n,e))return;t.uniform2iv(this.addr,e),oo(n,e)}}function t5e(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(ao(n,e))return;t.uniform3iv(this.addr,e),oo(n,e)}}function n5e(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(ao(n,e))return;t.uniform4iv(this.addr,e),oo(n,e)}}function r5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function i5e(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(ao(n,e))return;t.uniform2uiv(this.addr,e),oo(n,e)}}function s5e(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(ao(n,e))return;t.uniform3uiv(this.addr,e),oo(n,e)}}function a5e(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(ao(n,e))return;t.uniform4uiv(this.addr,e),oo(n,e)}}function o5e(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?(ZR.compareFunction=n.isReversedDepthBuffer()?tE:eE,s=ZR):s=aK,n.setTexture2D(e||s,i)}function l5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||lK,i)}function c5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||cK,i)}function u5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||oK,i)}function d5e(t){switch(t){case 5126:return $2e;case 35664:return q2e;case 35665:return X2e;case 35666:return Y2e;case 35674:return K2e;case 35675:return Z2e;case 35676:return Q2e;case 5124:case 35670:return J2e;case 35667:case 35671:return e5e;case 35668:case 35672:return t5e;case 35669:case 35673:return n5e;case 5125:return r5e;case 36294:return i5e;case 36295:return s5e;case 36296:return a5e;case 35678:case 36198:case 36298:case 36306:case 35682:return o5e;case 35679:case 36299:case 36307:return l5e;case 35680:case 36300:case 36308:case 36293:return c5e;case 36289:case 36303:case 36311:case 36292:return u5e}}function f5e(t,e){t.uniform1fv(this.addr,e)}function h5e(t,e){const n=Py(e,this.size,2);t.uniform2fv(this.addr,n)}function p5e(t,e){const n=Py(e,this.size,3);t.uniform3fv(this.addr,n)}function m5e(t,e){const n=Py(e,this.size,4);t.uniform4fv(this.addr,n)}function g5e(t,e){const n=Py(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function v5e(t,e){const n=Py(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function x5e(t,e){const n=Py(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function y5e(t,e){t.uniform1iv(this.addr,e)}function b5e(t,e){t.uniform2iv(this.addr,e)}function _5e(t,e){t.uniform3iv(this.addr,e)}function S5e(t,e){t.uniform4iv(this.addr,e)}function w5e(t,e){t.uniform1uiv(this.addr,e)}function M5e(t,e){t.uniform2uiv(this.addr,e)}function T5e(t,e){t.uniform3uiv(this.addr,e)}function E5e(t,e){t.uniform4uiv(this.addr,e)}function C5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);ao(r,s)||(t.uniform1iv(this.addr,s),oo(r,s));let a;this.type===t.SAMPLER_2D_SHADOW?a=ZR:a=aK;for(let o=0;o!==i;++o)n.setTexture2D(e[o]||a,s[o])}function A5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);ao(r,s)||(t.uniform1iv(this.addr,s),oo(r,s));for(let a=0;a!==i;++a)n.setTexture3D(e[a]||lK,s[a])}function N5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);ao(r,s)||(t.uniform1iv(this.addr,s),oo(r,s));for(let a=0;a!==i;++a)n.setTextureCube(e[a]||cK,s[a])}function R5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);ao(r,s)||(t.uniform1iv(this.addr,s),oo(r,s));for(let a=0;a!==i;++a)n.setTexture2DArray(e[a]||oK,s[a])}function k5e(t){switch(t){case 5126:return f5e;case 35664:return h5e;case 35665:return p5e;case 35666:return m5e;case 35674:return g5e;case 35675:return v5e;case 35676:return x5e;case 5124:case 35670:return y5e;case 35667:case 35671:return b5e;case 35668:case 35672:return _5e;case 35669:case 35673:return S5e;case 5125:return w5e;case 36294:return M5e;case 36295:return T5e;case 36296:return E5e;case 35678:case 36198:case 36298:case 36306:case 35682:return C5e;case 35679:case 36299:case 36307:return A5e;case 35680:case 36300:case 36308:case 36293:return N5e;case 36289:case 36303:case 36311:case 36292:return R5e}}class P5e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=d5e(n.type)}}class D5e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=k5e(n.type)}}class I5e{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,n[o.id],r)}}}const T6=/(\w+)(\])?(\[|\.)?/g;function fj(t,e){t.seq.push(e),t.map[e.id]=e}function O5e(t,e,n){const r=t.name,i=r.length;for(T6.lastIndex=0;;){const s=T6.exec(r),a=T6.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){fj(n,c===void 0?new P5e(o,t,e):new D5e(o,t,e));break}else{let h=n.map[o];h===void 0&&(h=new I5e(o),fj(n,h)),n=h}}}class HM{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let a=0;a<r;++a){const o=e.getActiveUniform(n,a),l=e.getUniformLocation(n,o.name);O5e(o,l,this)}const i=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):s.push(a);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,a=n.length;s!==a;++s){const o=n[s],l=r[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in n&&r.push(a)}return r}}function hj(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const L5e=37297;let z5e=0;function j5e(t,e){const n=t.split(`
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let a=i;a<s;a++){const o=a+1;r.push(`${o===e?">":" "} ${o}: ${n[a]}`)}return r.join(`
`)}const pj=new yr;function F5e(t){ii._getMatrix(pj,ii.workingColorSpace,t);const e=`mat3( ${pj.elements.map(n=>n.toFixed(4))} )`;switch(ii.getTransfer(t)){case yS:return[e,"LinearTransferOETF"];case ji:return[e,"sRGBTransferOETF"];default:return fn("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function mj(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),s=(t.getShaderInfoLog(e)||"").trim();if(r&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return n.toUpperCase()+`

`+s+`

`+j5e(t.getShaderSource(e),o)}else return s}function U5e(t,e){const n=F5e(e);return[`vec4 ${t}( vec4 value ) {`,`	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
`)}const B5e={[Fk]:"Linear",[Uk]:"Reinhard",[Bk]:"Cineon",[WT]:"ACESFilmic",[Vk]:"AgX",[Gk]:"Neutral",[Hk]:"Custom"};function H5e(t,e){const n=B5e[e];return n===void 0?(fn("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const gM=new ze;function V5e(){ii.getLuminanceCoefficients(gM);const t=gM.x.toFixed(4),e=gM.y.toFixed(4),n=gM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
`)}function G5e(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(b_).join(`
`)}function W5e(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
`)}function $5e(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),a=s.name;let o=1;s.type===t.FLOAT_MAT2&&(o=2),s.type===t.FLOAT_MAT3&&(o=3),s.type===t.FLOAT_MAT4&&(o=4),n[a]={type:s.type,location:t.getAttribLocation(e,a),locationSize:o}}return n}function b_(t){return t!==""}function gj(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 vj(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const q5e=/^[ \t]*#include +<([\w\d./]+)>/gm;function QR(t){return t.replace(q5e,Y5e)}const X5e=new Map;function Y5e(t,e){let n=Tr[e];if(n===void 0){const r=X5e.get(e);if(r!==void 0)n=Tr[r],fn('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return QR(n)}const K5e=/#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 xj(t){return t.replace(K5e,Z5e)}function Z5e(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 yj(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 Q5e={[b1]:"SHADOWMAP_TYPE_PCF",[Rg]:"SHADOWMAP_TYPE_VSM"};function J5e(t){return Q5e[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const eTe={[sh]:"ENVMAP_TYPE_CUBE",[tm]:"ENVMAP_TYPE_CUBE",[Ny]:"ENVMAP_TYPE_CUBE_UV"};function tTe(t){return t.envMap===!1?"ENVMAP_TYPE_CUBE":eTe[t.envMapMode]||"ENVMAP_TYPE_CUBE"}const nTe={[tm]:"ENVMAP_MODE_REFRACTION"};function rTe(t){return t.envMap===!1?"ENVMAP_MODE_REFLECTION":nTe[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}const iTe={[yw]:"ENVMAP_BLENDING_MULTIPLY",[UX]:"ENVMAP_BLENDING_MIX",[BX]:"ENVMAP_BLENDING_ADD"};function sTe(t){return t.envMap===!1?"ENVMAP_BLENDING_NONE":iTe[t.combine]||"ENVMAP_BLENDING_NONE"}function aTe(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 oTe(t,e,n,r){const i=t.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const l=J5e(n),c=tTe(n),d=rTe(n),h=sTe(n),g=aTe(n),v=G5e(n),b=W5e(s),_=i.createProgram();let w,S,E=n.glslVersion?"#version "+n.glslVersion+`
`:"";n.isRawShaderMaterial?(w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(b_).join(`
`),w.length>0&&(w+=`
`),S=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(b_).join(`
`),S.length>0&&(S+=`
`)):(w=[yj(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(b_).join(`
`),S=[yj(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+h:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.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!==nu?"#define TONE_MAPPING":"",n.toneMapping!==nu?Tr.tonemapping_pars_fragment:"",n.toneMapping!==nu?H5e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Tr.colorspace_pars_fragment,U5e("linearToOutputTexel",n.outputColorSpace),V5e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(b_).join(`
`)),a=QR(a),a=gj(a,n),a=vj(a,n),o=QR(o),o=gj(o,n),o=vj(o,n),a=xj(a),o=xj(o),n.isRawShaderMaterial!==!0&&(E=`#version 300 es
`,w=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+w,S=["#define varying in",n.glslVersion===BR?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===BR?"":"#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(`
`)+`
`+S);const A=E+w+a,N=E+S+o,I=hj(i,i.VERTEX_SHADER,A),P=hj(i,i.FRAGMENT_SHADER,N);i.attachShader(_,I),i.attachShader(_,P),n.index0AttributeName!==void 0?i.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function L(U){if(t.debug.checkShaderErrors){const V=i.getProgramInfoLog(_)||"",G=i.getShaderInfoLog(I)||"",Z=i.getShaderInfoLog(P)||"",B=V.trim(),q=G.trim(),Y=Z.trim();let K=!0,J=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(K=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,_,I,P);else{const F=mj(i,I,"vertex"),j=mj(i,P,"fragment");Hn("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`

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

Program Info Log: `+B+`
`+F+`
`+j)}else B!==""?fn("WebGLProgram: Program Info Log:",B):(q===""||Y==="")&&(J=!1);J&&(U.diagnostics={runnable:K,programLog:B,vertexShader:{log:q,prefix:w},fragmentShader:{log:Y,prefix:S}})}i.deleteShader(I),i.deleteShader(P),R=new HM(i,_),O=$5e(i,_)}let R;this.getUniforms=function(){return R===void 0&&L(this),R};let O;this.getAttributes=function(){return O===void 0&&L(this),O};let W=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return W===!1&&(W=i.getProgramParameter(_,L5e)),W},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=z5e++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=I,this.fragmentShader=P,this}let lTe=0;class cTe{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),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.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 uTe(e),n.set(e,r)),r}}class uTe{constructor(e){this.id=lTe++,this.code=e,this.usedTimes=0}}function dTe(t,e,n,r,i,s){const a=new ry,o=new cTe,l=new Set,c=[],d=new Map,h=r.logarithmicDepthBuffer;let g=r.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function b(R){return l.add(R),R===0?"uv":`uv${R}`}function _(R,O,W,U,V){const G=U.fog,Z=V.geometry,B=R.isMeshStandardMaterial||R.isMeshLambertMaterial||R.isMeshPhongMaterial?U.environment:null,q=R.isMeshStandardMaterial||R.isMeshLambertMaterial&&!R.envMap||R.isMeshPhongMaterial&&!R.envMap,Y=e.get(R.envMap||B,q),K=Y&&Y.mapping===Ny?Y.image.height:null,J=v[R.type];R.precision!==null&&(g=r.getMaxPrecision(R.precision),g!==R.precision&&fn("WebGLProgram.getParameters:",R.precision,"not supported, using",g,"instead."));const F=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,j=F!==void 0?F.length:0;let X=0;Z.morphAttributes.position!==void 0&&(X=1),Z.morphAttributes.normal!==void 0&&(X=2),Z.morphAttributes.color!==void 0&&(X=3);let H,se,re,ie;if(J){const nt=Id[J];H=nt.vertexShader,se=nt.fragmentShader}else H=R.vertexShader,se=R.fragmentShader,o.update(R),re=o.getVertexShaderID(R),ie=o.getFragmentShaderID(R);const ue=t.getRenderTarget(),le=t.state.buffers.depth.getReversed(),fe=V.isInstancedMesh===!0,xe=V.isBatchedMesh===!0,he=!!R.map,Te=!!R.matcap,We=!!Y,Se=!!R.aoMap,Le=!!R.lightMap,pe=!!R.bumpMap,Re=!!R.normalMap,ne=!!R.displacementMap,Xe=!!R.emissiveMap,Ae=!!R.metalnessMap,Pe=!!R.roughnessMap,Ke=R.anisotropy>0,oe=R.clearcoat>0,te=R.dispersion>0,_e=R.iridescence>0,ve=R.sheen>0,ye=R.transmission>0,ke=Ke&&!!R.anisotropyMap,Be=oe&&!!R.clearcoatMap,ge=oe&&!!R.clearcoatNormalMap,Ye=oe&&!!R.clearcoatRoughnessMap,Qe=_e&&!!R.iridescenceMap,Ie=_e&&!!R.iridescenceThicknessMap,Fe=ve&&!!R.sheenColorMap,Ge=ve&&!!R.sheenRoughnessMap,Me=!!R.specularMap,$e=!!R.specularColorMap,dt=!!R.specularIntensityMap,Oe=ye&&!!R.transmissionMap,st=ye&&!!R.thicknessMap,ft=!!R.gradientMap,pt=!!R.alphaMap,et=R.alphaTest>0,Ze=!!R.alphaHash,me=!!R.extensions;let je=nu;R.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(je=t.toneMapping);const He={shaderID:J,shaderType:R.type,shaderName:R.name,vertexShader:H,fragmentShader:se,defines:R.defines,customVertexShaderID:re,customFragmentShaderID:ie,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:g,batching:xe,batchingColor:xe&&V._colorsTexture!==null,instancing:fe,instancingColor:fe&&V.instanceColor!==null,instancingMorph:fe&&V.morphTexture!==null,outputColorSpace:ue===null?t.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:nm,alphaToCoverage:!!R.alphaToCoverage,map:he,matcap:Te,envMap:We,envMapMode:We&&Y.mapping,envMapCubeUVHeight:K,aoMap:Se,lightMap:Le,bumpMap:pe,normalMap:Re,displacementMap:ne,emissiveMap:Xe,normalMapObjectSpace:Re&&R.normalMapType===XX,normalMapTangentSpace:Re&&R.normalMapType===gm,metalnessMap:Ae,roughnessMap:Pe,anisotropy:Ke,anisotropyMap:ke,clearcoat:oe,clearcoatMap:Be,clearcoatNormalMap:ge,clearcoatRoughnessMap:Ye,dispersion:te,iridescence:_e,iridescenceMap:Qe,iridescenceThicknessMap:Ie,sheen:ve,sheenColorMap:Fe,sheenRoughnessMap:Ge,specularMap:Me,specularColorMap:$e,specularIntensityMap:dt,transmission:ye,transmissionMap:Oe,thicknessMap:st,gradientMap:ft,opaque:R.transparent===!1&&R.blending===Wg&&R.alphaToCoverage===!1,alphaMap:pt,alphaTest:et,alphaHash:Ze,combine:R.combine,mapUv:he&&b(R.map.channel),aoMapUv:Se&&b(R.aoMap.channel),lightMapUv:Le&&b(R.lightMap.channel),bumpMapUv:pe&&b(R.bumpMap.channel),normalMapUv:Re&&b(R.normalMap.channel),displacementMapUv:ne&&b(R.displacementMap.channel),emissiveMapUv:Xe&&b(R.emissiveMap.channel),metalnessMapUv:Ae&&b(R.metalnessMap.channel),roughnessMapUv:Pe&&b(R.roughnessMap.channel),anisotropyMapUv:ke&&b(R.anisotropyMap.channel),clearcoatMapUv:Be&&b(R.clearcoatMap.channel),clearcoatNormalMapUv:ge&&b(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ye&&b(R.clearcoatRoughnessMap.channel),iridescenceMapUv:Qe&&b(R.iridescenceMap.channel),iridescenceThicknessMapUv:Ie&&b(R.iridescenceThicknessMap.channel),sheenColorMapUv:Fe&&b(R.sheenColorMap.channel),sheenRoughnessMapUv:Ge&&b(R.sheenRoughnessMap.channel),specularMapUv:Me&&b(R.specularMap.channel),specularColorMapUv:$e&&b(R.specularColorMap.channel),specularIntensityMapUv:dt&&b(R.specularIntensityMap.channel),transmissionMapUv:Oe&&b(R.transmissionMap.channel),thicknessMapUv:st&&b(R.thicknessMap.channel),alphaMapUv:pt&&b(R.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(Re||Ke),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:V.isPoints===!0&&!!Z.attributes.uv&&(he||pt),fog:!!G,useFog:R.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:R.wireframe===!1&&(R.flatShading===!0||Z.attributes.normal===void 0&&Re===!1&&(R.isMeshLambertMaterial||R.isMeshPhongMaterial||R.isMeshStandardMaterial||R.isMeshPhysicalMaterial)),sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:le,skinning:V.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:j,morphTextureStride:X,numDirLights:O.directional.length,numPointLights:O.point.length,numSpotLights:O.spot.length,numSpotLightMaps:O.spotLightMap.length,numRectAreaLights:O.rectArea.length,numHemiLights:O.hemi.length,numDirLightShadows:O.directionalShadowMap.length,numPointLightShadows:O.pointShadowMap.length,numSpotLightShadows:O.spotShadowMap.length,numSpotLightShadowsWithMaps:O.numSpotLightShadowsWithMaps,numLightProbes:O.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&W.length>0,shadowMapType:t.shadowMap.type,toneMapping:je,decodeVideoTexture:he&&R.map.isVideoTexture===!0&&ii.getTransfer(R.map.colorSpace)===ji,decodeVideoTextureEmissive:Xe&&R.emissiveMap.isVideoTexture===!0&&ii.getTransfer(R.emissiveMap.colorSpace)===ji,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===Xc,flipSided:R.side===Vl,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionClipCullDistance:me&&R.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(me&&R.extensions.multiDraw===!0||xe)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()};return He.vertexUv1s=l.has(1),He.vertexUv2s=l.has(2),He.vertexUv3s=l.has(3),l.clear(),He}function w(R){const O=[];if(R.shaderID?O.push(R.shaderID):(O.push(R.customVertexShaderID),O.push(R.customFragmentShaderID)),R.defines!==void 0)for(const W in R.defines)O.push(W),O.push(R.defines[W]);return R.isRawShaderMaterial===!1&&(S(O,R),E(O,R),O.push(t.outputColorSpace)),O.push(R.customProgramCacheKey),O.join()}function S(R,O){R.push(O.precision),R.push(O.outputColorSpace),R.push(O.envMapMode),R.push(O.envMapCubeUVHeight),R.push(O.mapUv),R.push(O.alphaMapUv),R.push(O.lightMapUv),R.push(O.aoMapUv),R.push(O.bumpMapUv),R.push(O.normalMapUv),R.push(O.displacementMapUv),R.push(O.emissiveMapUv),R.push(O.metalnessMapUv),R.push(O.roughnessMapUv),R.push(O.anisotropyMapUv),R.push(O.clearcoatMapUv),R.push(O.clearcoatNormalMapUv),R.push(O.clearcoatRoughnessMapUv),R.push(O.iridescenceMapUv),R.push(O.iridescenceThicknessMapUv),R.push(O.sheenColorMapUv),R.push(O.sheenRoughnessMapUv),R.push(O.specularMapUv),R.push(O.specularColorMapUv),R.push(O.specularIntensityMapUv),R.push(O.transmissionMapUv),R.push(O.thicknessMapUv),R.push(O.combine),R.push(O.fogExp2),R.push(O.sizeAttenuation),R.push(O.morphTargetsCount),R.push(O.morphAttributeCount),R.push(O.numDirLights),R.push(O.numPointLights),R.push(O.numSpotLights),R.push(O.numSpotLightMaps),R.push(O.numHemiLights),R.push(O.numRectAreaLights),R.push(O.numDirLightShadows),R.push(O.numPointLightShadows),R.push(O.numSpotLightShadows),R.push(O.numSpotLightShadowsWithMaps),R.push(O.numLightProbes),R.push(O.shadowMapType),R.push(O.toneMapping),R.push(O.numClippingPlanes),R.push(O.numClipIntersection),R.push(O.depthPacking)}function E(R,O){a.disableAll(),O.instancing&&a.enable(0),O.instancingColor&&a.enable(1),O.instancingMorph&&a.enable(2),O.matcap&&a.enable(3),O.envMap&&a.enable(4),O.normalMapObjectSpace&&a.enable(5),O.normalMapTangentSpace&&a.enable(6),O.clearcoat&&a.enable(7),O.iridescence&&a.enable(8),O.alphaTest&&a.enable(9),O.vertexColors&&a.enable(10),O.vertexAlphas&&a.enable(11),O.vertexUv1s&&a.enable(12),O.vertexUv2s&&a.enable(13),O.vertexUv3s&&a.enable(14),O.vertexTangents&&a.enable(15),O.anisotropy&&a.enable(16),O.alphaHash&&a.enable(17),O.batching&&a.enable(18),O.dispersion&&a.enable(19),O.batchingColor&&a.enable(20),O.gradientMap&&a.enable(21),R.push(a.mask),a.disableAll(),O.fog&&a.enable(0),O.useFog&&a.enable(1),O.flatShading&&a.enable(2),O.logarithmicDepthBuffer&&a.enable(3),O.reversedDepthBuffer&&a.enable(4),O.skinning&&a.enable(5),O.morphTargets&&a.enable(6),O.morphNormals&&a.enable(7),O.morphColors&&a.enable(8),O.premultipliedAlpha&&a.enable(9),O.shadowMapEnabled&&a.enable(10),O.doubleSided&&a.enable(11),O.flipSided&&a.enable(12),O.useDepthPacking&&a.enable(13),O.dithering&&a.enable(14),O.transmission&&a.enable(15),O.sheen&&a.enable(16),O.opaque&&a.enable(17),O.pointsUvs&&a.enable(18),O.decodeVideoTexture&&a.enable(19),O.decodeVideoTextureEmissive&&a.enable(20),O.alphaToCoverage&&a.enable(21),R.push(a.mask)}function A(R){const O=v[R.type];let W;if(O){const U=Id[O];W=CS.clone(U.uniforms)}else W=R.uniforms;return W}function N(R,O){let W=d.get(O);return W!==void 0?++W.usedTimes:(W=new oTe(t,O,R,i),c.push(W),d.set(O,W)),W}function I(R){if(--R.usedTimes===0){const O=c.indexOf(R);c[O]=c[c.length-1],c.pop(),d.delete(R.cacheKey),R.destroy()}}function P(R){o.remove(R)}function L(){o.dispose()}return{getParameters:_,getProgramCacheKey:w,getUniforms:A,acquireProgram:N,releaseProgram:I,releaseShaderCache:P,programs:c,dispose:L}}function fTe(){let t=new WeakMap;function e(a){return t.has(a)}function n(a){let o=t.get(a);return o===void 0&&(o={},t.set(a,o)),o}function r(a){t.delete(a)}function i(a,o,l){t.get(a)[o]=l}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:i,dispose:s}}function hTe(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 bj(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 _j(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function a(g){let v=0;return g.isInstancedMesh&&(v+=2),g.isSkinnedMesh&&(v+=1),v}function o(g,v,b,_,w,S){let E=t[e];return E===void 0?(E={id:g.id,object:g,geometry:v,material:b,materialVariant:a(g),groupOrder:_,renderOrder:g.renderOrder,z:w,group:S},t[e]=E):(E.id=g.id,E.object=g,E.geometry=v,E.material=b,E.materialVariant=a(g),E.groupOrder=_,E.renderOrder=g.renderOrder,E.z=w,E.group=S),e++,E}function l(g,v,b,_,w,S){const E=o(g,v,b,_,w,S);b.transmission>0?r.push(E):b.transparent===!0?i.push(E):n.push(E)}function c(g,v,b,_,w,S){const E=o(g,v,b,_,w,S);b.transmission>0?r.unshift(E):b.transparent===!0?i.unshift(E):n.unshift(E)}function d(g,v){n.length>1&&n.sort(g||hTe),r.length>1&&r.sort(v||bj),i.length>1&&i.sort(v||bj)}function h(){for(let g=e,v=t.length;g<v;g++){const b=t[g];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:h,sort:d}}function pTe(){let t=new WeakMap;function e(r,i){const s=t.get(r);let a;return s===void 0?(a=new _j,t.set(r,[a])):i>=s.length?(a=new _j,s.push(a)):a=s[i],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function mTe(){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 ze,color:new xn};break;case"SpotLight":n={position:new ze,direction:new ze,color:new xn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ze,color:new xn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ze,skyColor:new xn,groundColor:new xn};break;case"RectAreaLight":n={color:new xn,position:new ze,halfWidth:new ze,halfHeight:new ze};break}return t[e.id]=n,n}}}function gTe(){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 Lt};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Lt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Lt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let vTe=0;function xTe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function yTe(t){const e=new mTe,n=gTe(),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 ze);const i=new ze,s=new rr,a=new rr;function o(c){let d=0,h=0,g=0;for(let O=0;O<9;O++)r.probe[O].set(0,0,0);let v=0,b=0,_=0,w=0,S=0,E=0,A=0,N=0,I=0,P=0,L=0;c.sort(xTe);for(let O=0,W=c.length;O<W;O++){const U=c[O],V=U.color,G=U.intensity,Z=U.distance;let B=null;if(U.shadow&&U.shadow.map&&(U.shadow.map.texture.format===ov?B=U.shadow.map.texture:B=U.shadow.map.depthTexture||U.shadow.map.texture),U.isAmbientLight)d+=V.r*G,h+=V.g*G,g+=V.b*G;else if(U.isLightProbe){for(let q=0;q<9;q++)r.probe[q].addScaledVector(U.sh.coefficients[q],G);L++}else if(U.isDirectionalLight){const q=e.get(U);if(q.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const Y=U.shadow,K=n.get(U);K.shadowIntensity=Y.intensity,K.shadowBias=Y.bias,K.shadowNormalBias=Y.normalBias,K.shadowRadius=Y.radius,K.shadowMapSize=Y.mapSize,r.directionalShadow[v]=K,r.directionalShadowMap[v]=B,r.directionalShadowMatrix[v]=U.shadow.matrix,E++}r.directional[v]=q,v++}else if(U.isSpotLight){const q=e.get(U);q.position.setFromMatrixPosition(U.matrixWorld),q.color.copy(V).multiplyScalar(G),q.distance=Z,q.coneCos=Math.cos(U.angle),q.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),q.decay=U.decay,r.spot[_]=q;const Y=U.shadow;if(U.map&&(r.spotLightMap[I]=U.map,I++,Y.updateMatrices(U),U.castShadow&&P++),r.spotLightMatrix[_]=Y.matrix,U.castShadow){const K=n.get(U);K.shadowIntensity=Y.intensity,K.shadowBias=Y.bias,K.shadowNormalBias=Y.normalBias,K.shadowRadius=Y.radius,K.shadowMapSize=Y.mapSize,r.spotShadow[_]=K,r.spotShadowMap[_]=B,N++}_++}else if(U.isRectAreaLight){const q=e.get(U);q.color.copy(V).multiplyScalar(G),q.halfWidth.set(U.width*.5,0,0),q.halfHeight.set(0,U.height*.5,0),r.rectArea[w]=q,w++}else if(U.isPointLight){const q=e.get(U);if(q.color.copy(U.color).multiplyScalar(U.intensity),q.distance=U.distance,q.decay=U.decay,U.castShadow){const Y=U.shadow,K=n.get(U);K.shadowIntensity=Y.intensity,K.shadowBias=Y.bias,K.shadowNormalBias=Y.normalBias,K.shadowRadius=Y.radius,K.shadowMapSize=Y.mapSize,K.shadowCameraNear=Y.camera.near,K.shadowCameraFar=Y.camera.far,r.pointShadow[b]=K,r.pointShadowMap[b]=B,r.pointShadowMatrix[b]=U.shadow.matrix,A++}r.point[b]=q,b++}else if(U.isHemisphereLight){const q=e.get(U);q.skyColor.copy(U.color).multiplyScalar(G),q.groundColor.copy(U.groundColor).multiplyScalar(G),r.hemi[S]=q,S++}}w>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=hn.LTC_FLOAT_1,r.rectAreaLTC2=hn.LTC_FLOAT_2):(r.rectAreaLTC1=hn.LTC_HALF_1,r.rectAreaLTC2=hn.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=h,r.ambient[2]=g;const R=r.hash;(R.directionalLength!==v||R.pointLength!==b||R.spotLength!==_||R.rectAreaLength!==w||R.hemiLength!==S||R.numDirectionalShadows!==E||R.numPointShadows!==A||R.numSpotShadows!==N||R.numSpotMaps!==I||R.numLightProbes!==L)&&(r.directional.length=v,r.spot.length=_,r.rectArea.length=w,r.point.length=b,r.hemi.length=S,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=A,r.pointShadowMap.length=A,r.spotShadow.length=N,r.spotShadowMap.length=N,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=A,r.spotLightMatrix.length=N+I-P,r.spotLightMap.length=I,r.numSpotLightShadowsWithMaps=P,r.numLightProbes=L,R.directionalLength=v,R.pointLength=b,R.spotLength=_,R.rectAreaLength=w,R.hemiLength=S,R.numDirectionalShadows=E,R.numPointShadows=A,R.numSpotShadows=N,R.numSpotMaps=I,R.numLightProbes=L,r.version=vTe++)}function l(c,d){let h=0,g=0,v=0,b=0,_=0;const w=d.matrixWorldInverse;for(let S=0,E=c.length;S<E;S++){const A=c[S];if(A.isDirectionalLight){const N=r.directional[h];N.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(w),h++}else if(A.isSpotLight){const N=r.spot[v];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(w),N.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(w),v++}else if(A.isRectAreaLight){const N=r.rectArea[b];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(w),a.identity(),s.copy(A.matrixWorld),s.premultiply(w),a.extractRotation(s),N.halfWidth.set(A.width*.5,0,0),N.halfHeight.set(0,A.height*.5,0),N.halfWidth.applyMatrix4(a),N.halfHeight.applyMatrix4(a),b++}else if(A.isPointLight){const N=r.point[g];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(w),g++}else if(A.isHemisphereLight){const N=r.hemi[_];N.direction.setFromMatrixPosition(A.matrixWorld),N.direction.transformDirection(w),_++}}}return{setup:o,setupView:l,state:r}}function Sj(t){const e=new yTe(t),n=[],r=[];function i(d){c.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function a(d){r.push(d)}function o(){e.setup(n)}function l(d){e.setupView(n,d)}const c={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function bTe(t){let e=new WeakMap;function n(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new Sj(t),e.set(i,[o])):s>=a.length?(o=new Sj(t),a.push(o)):o=a[s],o}function r(){e=new WeakMap}return{get:n,dispose:r}}const _Te=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,STe=`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 );
}`,wTe=[new ze(1,0,0),new ze(-1,0,0),new ze(0,1,0),new ze(0,-1,0),new ze(0,0,1),new ze(0,0,-1)],MTe=[new ze(0,-1,0),new ze(0,-1,0),new ze(0,0,1),new ze(0,0,-1),new ze(0,-1,0),new ze(0,-1,0)],wj=new rr,o_=new ze,E6=new ze;function TTe(t,e,n){let r=new Ry;const i=new Lt,s=new Lt,a=new ci,o=new wE,l=new ME,c={},d=n.maxTextureSize,h={[pp]:Vl,[Vl]:pp,[Xc]:Xc},g=new au({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Lt},radius:{value:4}},vertexShader:_Te,fragmentShader:STe}),v=g.clone();v.defines.HORIZONTAL_PASS=1;const b=new br;b.setAttribute("position",new Vi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Us(b,g),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b1;let S=this.type;this.render=function(P,L,R){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||P.length===0)return;this.type===D_&&(fn("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=b1);const O=t.getRenderTarget(),W=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),V=t.state;V.setBlending(th),V.buffers.depth.getReversed()===!0?V.buffers.color.setClear(0,0,0,0):V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const G=S!==this.type;G&&L.traverse(function(Z){Z.material&&(Array.isArray(Z.material)?Z.material.forEach(B=>B.needsUpdate=!0):Z.material.needsUpdate=!0)});for(let Z=0,B=P.length;Z<B;Z++){const q=P[Z],Y=q.shadow;if(Y===void 0){fn("WebGLShadowMap:",q,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;i.copy(Y.mapSize);const K=Y.getFrameExtents();i.multiply(K),s.copy(Y.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/K.x),i.x=s.x*K.x,Y.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/K.y),i.y=s.y*K.y,Y.mapSize.y=s.y));const J=t.state.buffers.depth.getReversed();if(Y.camera._reversedDepth=J,Y.map===null||G===!0){if(Y.map!==null&&(Y.map.depthTexture!==null&&(Y.map.depthTexture.dispose(),Y.map.depthTexture=null),Y.map.dispose()),this.type===Rg){if(q.isPointLight){fn("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Y.map=new iu(i.x,i.y,{format:ov,type:ah,minFilter:rs,magFilter:rs,generateMipmaps:!1}),Y.map.texture.name=q.name+".shadowMap",Y.map.depthTexture=new iy(i.x,i.y,Bl),Y.map.depthTexture.name=q.name+".shadowMapDepth",Y.map.depthTexture.format=oh,Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=Ea,Y.map.depthTexture.magFilter=Ea}else q.isPointLight?(Y.map=new N9(i.x),Y.map.depthTexture=new gY(i.x,Ku)):(Y.map=new iu(i.x,i.y),Y.map.depthTexture=new iy(i.x,i.y,Ku)),Y.map.depthTexture.name=q.name+".shadowMap",Y.map.depthTexture.format=oh,this.type===b1?(Y.map.depthTexture.compareFunction=J?tE:eE,Y.map.depthTexture.minFilter=rs,Y.map.depthTexture.magFilter=rs):(Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=Ea,Y.map.depthTexture.magFilter=Ea);Y.camera.updateProjectionMatrix()}const F=Y.map.isWebGLCubeRenderTarget?6:1;for(let j=0;j<F;j++){if(Y.map.isWebGLCubeRenderTarget)t.setRenderTarget(Y.map,j),t.clear();else{j===0&&(t.setRenderTarget(Y.map),t.clear());const X=Y.getViewport(j);a.set(s.x*X.x,s.y*X.y,s.x*X.z,s.y*X.w),V.viewport(a)}if(q.isPointLight){const X=Y.camera,H=Y.matrix,se=q.distance||X.far;se!==X.far&&(X.far=se,X.updateProjectionMatrix()),o_.setFromMatrixPosition(q.matrixWorld),X.position.copy(o_),E6.copy(X.position),E6.add(wTe[j]),X.up.copy(MTe[j]),X.lookAt(E6),X.updateMatrixWorld(),H.makeTranslation(-o_.x,-o_.y,-o_.z),wj.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),Y._frustum.setFromProjectionMatrix(wj,X.coordinateSystem,X.reversedDepth)}else Y.updateMatrices(q);r=Y.getFrustum(),N(L,R,Y.camera,q,this.type)}Y.isPointLightShadow!==!0&&this.type===Rg&&E(Y,R),Y.needsUpdate=!1}S=this.type,w.needsUpdate=!1,t.setRenderTarget(O,W,U)};function E(P,L){const R=e.update(_);g.defines.VSM_SAMPLES!==P.blurSamples&&(g.defines.VSM_SAMPLES=P.blurSamples,v.defines.VSM_SAMPLES=P.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new iu(i.x,i.y,{format:ov,type:ah})),g.uniforms.shadow_pass.value=P.map.depthTexture,g.uniforms.resolution.value=P.mapSize,g.uniforms.radius.value=P.radius,t.setRenderTarget(P.mapPass),t.clear(),t.renderBufferDirect(L,null,R,g,_,null),v.uniforms.shadow_pass.value=P.mapPass.texture,v.uniforms.resolution.value=P.mapSize,v.uniforms.radius.value=P.radius,t.setRenderTarget(P.map),t.clear(),t.renderBufferDirect(L,null,R,v,_,null)}function A(P,L,R,O){let W=null;const U=R.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(U!==void 0)W=U;else if(W=R.isPointLight===!0?l:o,t.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){const V=W.uuid,G=L.uuid;let Z=c[V];Z===void 0&&(Z={},c[V]=Z);let B=Z[G];B===void 0&&(B=W.clone(),Z[G]=B,L.addEventListener("dispose",I)),W=B}if(W.visible=L.visible,W.wireframe=L.wireframe,O===Rg?W.side=L.shadowSide!==null?L.shadowSide:L.side:W.side=L.shadowSide!==null?L.shadowSide:h[L.side],W.alphaMap=L.alphaMap,W.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,W.map=L.map,W.clipShadows=L.clipShadows,W.clippingPlanes=L.clippingPlanes,W.clipIntersection=L.clipIntersection,W.displacementMap=L.displacementMap,W.displacementScale=L.displacementScale,W.displacementBias=L.displacementBias,W.wireframeLinewidth=L.wireframeLinewidth,W.linewidth=L.linewidth,R.isPointLight===!0&&W.isMeshDistanceMaterial===!0){const V=t.properties.get(W);V.light=R}return W}function N(P,L,R,O,W){if(P.visible===!1)return;if(P.layers.test(L.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&W===Rg)&&(!P.frustumCulled||r.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,P.matrixWorld);const G=e.update(P),Z=P.material;if(Array.isArray(Z)){const B=G.groups;for(let q=0,Y=B.length;q<Y;q++){const K=B[q],J=Z[K.materialIndex];if(J&&J.visible){const F=A(P,J,O,W);P.onBeforeShadow(t,P,L,R,G,F,K),t.renderBufferDirect(R,null,G,F,P,K),P.onAfterShadow(t,P,L,R,G,F,K)}}}else if(Z.visible){const B=A(P,Z,O,W);P.onBeforeShadow(t,P,L,R,G,B,null),t.renderBufferDirect(R,null,G,B,P,null),P.onAfterShadow(t,P,L,R,G,B,null)}}const V=P.children;for(let G=0,Z=V.length;G<Z;G++)N(V[G],L,R,O,W)}function I(P){P.target.removeEventListener("dispose",I);for(const R in c){const O=c[R],W=P.target.uuid;W in O&&(O[W].dispose(),delete O[W])}}}function ETe(t,e){function n(){let Oe=!1;const st=new ci;let ft=null;const pt=new ci(0,0,0,0);return{setMask:function(et){ft!==et&&!Oe&&(t.colorMask(et,et,et,et),ft=et)},setLocked:function(et){Oe=et},setClear:function(et,Ze,me,je,He){He===!0&&(et*=je,Ze*=je,me*=je),st.set(et,Ze,me,je),pt.equals(st)===!1&&(t.clearColor(et,Ze,me,je),pt.copy(st))},reset:function(){Oe=!1,ft=null,pt.set(-1,0,0,0)}}}function r(){let Oe=!1,st=!1,ft=null,pt=null,et=null;return{setReversed:function(Ze){if(st!==Ze){const me=e.get("EXT_clip_control");Ze?me.clipControlEXT(me.LOWER_LEFT_EXT,me.ZERO_TO_ONE_EXT):me.clipControlEXT(me.LOWER_LEFT_EXT,me.NEGATIVE_ONE_TO_ONE_EXT),st=Ze;const je=et;et=null,this.setClear(je)}},getReversed:function(){return st},setTest:function(Ze){Ze?ue(t.DEPTH_TEST):le(t.DEPTH_TEST)},setMask:function(Ze){ft!==Ze&&!Oe&&(t.depthMask(Ze),ft=Ze)},setFunc:function(Ze){if(st&&(Ze=Z_e[Ze]),pt!==Ze){switch(Ze){case P2:t.depthFunc(t.NEVER);break;case D2:t.depthFunc(t.ALWAYS);break;case I2:t.depthFunc(t.LESS);break;case av:t.depthFunc(t.LEQUAL);break;case O2:t.depthFunc(t.EQUAL);break;case L2:t.depthFunc(t.GEQUAL);break;case z2:t.depthFunc(t.GREATER);break;case j2:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}pt=Ze}},setLocked:function(Ze){Oe=Ze},setClear:function(Ze){et!==Ze&&(et=Ze,st&&(Ze=1-Ze),t.clearDepth(Ze))},reset:function(){Oe=!1,ft=null,pt=null,et=null,st=!1}}}function i(){let Oe=!1,st=null,ft=null,pt=null,et=null,Ze=null,me=null,je=null,He=null;return{setTest:function(nt){Oe||(nt?ue(t.STENCIL_TEST):le(t.STENCIL_TEST))},setMask:function(nt){st!==nt&&!Oe&&(t.stencilMask(nt),st=nt)},setFunc:function(nt,yt,lt){(ft!==nt||pt!==yt||et!==lt)&&(t.stencilFunc(nt,yt,lt),ft=nt,pt=yt,et=lt)},setOp:function(nt,yt,lt){(Ze!==nt||me!==yt||je!==lt)&&(t.stencilOp(nt,yt,lt),Ze=nt,me=yt,je=lt)},setLocked:function(nt){Oe=nt},setClear:function(nt){He!==nt&&(t.clearStencil(nt),He=nt)},reset:function(){Oe=!1,st=null,ft=null,pt=null,et=null,Ze=null,me=null,je=null,He=null}}}const s=new n,a=new r,o=new i,l=new WeakMap,c=new WeakMap;let d={},h={},g=new WeakMap,v=[],b=null,_=!1,w=null,S=null,E=null,A=null,N=null,I=null,P=null,L=new xn(0,0,0),R=0,O=!1,W=null,U=null,V=null,G=null,Z=null;const B=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,Y=0;const K=t.getParameter(t.VERSION);K.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(K)[1]),q=Y>=1):K.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),q=Y>=2);let J=null,F={};const j=t.getParameter(t.SCISSOR_BOX),X=t.getParameter(t.VIEWPORT),H=new ci().fromArray(j),se=new ci().fromArray(X);function re(Oe,st,ft,pt){const et=new Uint8Array(4),Ze=t.createTexture();t.bindTexture(Oe,Ze),t.texParameteri(Oe,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(Oe,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let me=0;me<ft;me++)Oe===t.TEXTURE_3D||Oe===t.TEXTURE_2D_ARRAY?t.texImage3D(st,0,t.RGBA,1,1,pt,0,t.RGBA,t.UNSIGNED_BYTE,et):t.texImage2D(st+me,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,et);return Ze}const ie={};ie[t.TEXTURE_2D]=re(t.TEXTURE_2D,t.TEXTURE_2D,1),ie[t.TEXTURE_CUBE_MAP]=re(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[t.TEXTURE_2D_ARRAY]=re(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),ie[t.TEXTURE_3D]=re(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ue(t.DEPTH_TEST),a.setFunc(av),pe(!1),Re(IR),ue(t.CULL_FACE),Se(th);function ue(Oe){d[Oe]!==!0&&(t.enable(Oe),d[Oe]=!0)}function le(Oe){d[Oe]!==!1&&(t.disable(Oe),d[Oe]=!1)}function fe(Oe,st){return h[Oe]!==st?(t.bindFramebuffer(Oe,st),h[Oe]=st,Oe===t.DRAW_FRAMEBUFFER&&(h[t.FRAMEBUFFER]=st),Oe===t.FRAMEBUFFER&&(h[t.DRAW_FRAMEBUFFER]=st),!0):!1}function xe(Oe,st){let ft=v,pt=!1;if(Oe){ft=g.get(st),ft===void 0&&(ft=[],g.set(st,ft));const et=Oe.textures;if(ft.length!==et.length||ft[0]!==t.COLOR_ATTACHMENT0){for(let Ze=0,me=et.length;Ze<me;Ze++)ft[Ze]=t.COLOR_ATTACHMENT0+Ze;ft.length=et.length,pt=!0}}else ft[0]!==t.BACK&&(ft[0]=t.BACK,pt=!0);pt&&t.drawBuffers(ft)}function he(Oe){return b!==Oe?(t.useProgram(Oe),b=Oe,!0):!1}const Te={[E0]:t.FUNC_ADD,[wX]:t.FUNC_SUBTRACT,[MX]:t.FUNC_REVERSE_SUBTRACT};Te[TX]=t.MIN,Te[EX]=t.MAX;const We={[CX]:t.ZERO,[AX]:t.ONE,[NX]:t.SRC_COLOR,[R2]:t.SRC_ALPHA,[OX]:t.SRC_ALPHA_SATURATE,[DX]:t.DST_COLOR,[kX]:t.DST_ALPHA,[RX]:t.ONE_MINUS_SRC_COLOR,[k2]:t.ONE_MINUS_SRC_ALPHA,[IX]:t.ONE_MINUS_DST_COLOR,[PX]:t.ONE_MINUS_DST_ALPHA,[LX]:t.CONSTANT_COLOR,[zX]:t.ONE_MINUS_CONSTANT_COLOR,[jX]:t.CONSTANT_ALPHA,[FX]:t.ONE_MINUS_CONSTANT_ALPHA};function Se(Oe,st,ft,pt,et,Ze,me,je,He,nt){if(Oe===th){_===!0&&(le(t.BLEND),_=!1);return}if(_===!1&&(ue(t.BLEND),_=!0),Oe!==SX){if(Oe!==w||nt!==O){if((S!==E0||N!==E0)&&(t.blendEquation(t.FUNC_ADD),S=E0,N=E0),nt)switch(Oe){case Wg:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case OR:t.blendFunc(t.ONE,t.ONE);break;case LR:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case zR:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:Hn("WebGLState: Invalid blending: ",Oe);break}else switch(Oe){case Wg:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case OR:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case LR:Hn("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case zR:Hn("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Hn("WebGLState: Invalid blending: ",Oe);break}E=null,A=null,I=null,P=null,L.set(0,0,0),R=0,w=Oe,O=nt}return}et=et||st,Ze=Ze||ft,me=me||pt,(st!==S||et!==N)&&(t.blendEquationSeparate(Te[st],Te[et]),S=st,N=et),(ft!==E||pt!==A||Ze!==I||me!==P)&&(t.blendFuncSeparate(We[ft],We[pt],We[Ze],We[me]),E=ft,A=pt,I=Ze,P=me),(je.equals(L)===!1||He!==R)&&(t.blendColor(je.r,je.g,je.b,He),L.copy(je),R=He),w=Oe,O=!1}function Le(Oe,st){Oe.side===Xc?le(t.CULL_FACE):ue(t.CULL_FACE);let ft=Oe.side===Vl;st&&(ft=!ft),pe(ft),Oe.blending===Wg&&Oe.transparent===!1?Se(th):Se(Oe.blending,Oe.blendEquation,Oe.blendSrc,Oe.blendDst,Oe.blendEquationAlpha,Oe.blendSrcAlpha,Oe.blendDstAlpha,Oe.blendColor,Oe.blendAlpha,Oe.premultipliedAlpha),a.setFunc(Oe.depthFunc),a.setTest(Oe.depthTest),a.setMask(Oe.depthWrite),s.setMask(Oe.colorWrite);const pt=Oe.stencilWrite;o.setTest(pt),pt&&(o.setMask(Oe.stencilWriteMask),o.setFunc(Oe.stencilFunc,Oe.stencilRef,Oe.stencilFuncMask),o.setOp(Oe.stencilFail,Oe.stencilZFail,Oe.stencilZPass)),Xe(Oe.polygonOffset,Oe.polygonOffsetFactor,Oe.polygonOffsetUnits),Oe.alphaToCoverage===!0?ue(t.SAMPLE_ALPHA_TO_COVERAGE):le(t.SAMPLE_ALPHA_TO_COVERAGE)}function pe(Oe){W!==Oe&&(Oe?t.frontFace(t.CW):t.frontFace(t.CCW),W=Oe)}function Re(Oe){Oe!==yX?(ue(t.CULL_FACE),Oe!==U&&(Oe===IR?t.cullFace(t.BACK):Oe===bX?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):le(t.CULL_FACE),U=Oe}function ne(Oe){Oe!==V&&(q&&t.lineWidth(Oe),V=Oe)}function Xe(Oe,st,ft){Oe?(ue(t.POLYGON_OFFSET_FILL),(G!==st||Z!==ft)&&(G=st,Z=ft,a.getReversed()&&(st=-st),t.polygonOffset(st,ft))):le(t.POLYGON_OFFSET_FILL)}function Ae(Oe){Oe?ue(t.SCISSOR_TEST):le(t.SCISSOR_TEST)}function Pe(Oe){Oe===void 0&&(Oe=t.TEXTURE0+B-1),J!==Oe&&(t.activeTexture(Oe),J=Oe)}function Ke(Oe,st,ft){ft===void 0&&(J===null?ft=t.TEXTURE0+B-1:ft=J);let pt=F[ft];pt===void 0&&(pt={type:void 0,texture:void 0},F[ft]=pt),(pt.type!==Oe||pt.texture!==st)&&(J!==ft&&(t.activeTexture(ft),J=ft),t.bindTexture(Oe,st||ie[Oe]),pt.type=Oe,pt.texture=st)}function oe(){const Oe=F[J];Oe!==void 0&&Oe.type!==void 0&&(t.bindTexture(Oe.type,null),Oe.type=void 0,Oe.texture=void 0)}function te(){try{t.compressedTexImage2D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function _e(){try{t.compressedTexImage3D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function ve(){try{t.texSubImage2D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function ye(){try{t.texSubImage3D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function ke(){try{t.compressedTexSubImage2D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function Be(){try{t.compressedTexSubImage3D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function ge(){try{t.texStorage2D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function Ye(){try{t.texStorage3D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function Qe(){try{t.texImage2D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function Ie(){try{t.texImage3D(...arguments)}catch(Oe){Hn("WebGLState:",Oe)}}function Fe(Oe){H.equals(Oe)===!1&&(t.scissor(Oe.x,Oe.y,Oe.z,Oe.w),H.copy(Oe))}function Ge(Oe){se.equals(Oe)===!1&&(t.viewport(Oe.x,Oe.y,Oe.z,Oe.w),se.copy(Oe))}function Me(Oe,st){let ft=c.get(st);ft===void 0&&(ft=new WeakMap,c.set(st,ft));let pt=ft.get(Oe);pt===void 0&&(pt=t.getUniformBlockIndex(st,Oe.name),ft.set(Oe,pt))}function $e(Oe,st){const pt=c.get(st).get(Oe);l.get(st)!==pt&&(t.uniformBlockBinding(st,pt,Oe.__bindingPointIndex),l.set(st,pt))}function dt(){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),a.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),d={},J=null,F={},h={},g=new WeakMap,v=[],b=null,_=!1,w=null,S=null,E=null,A=null,N=null,I=null,P=null,L=new xn(0,0,0),R=0,O=!1,W=null,U=null,V=null,G=null,Z=null,H.set(0,0,t.canvas.width,t.canvas.height),se.set(0,0,t.canvas.width,t.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ue,disable:le,bindFramebuffer:fe,drawBuffers:xe,useProgram:he,setBlending:Se,setMaterial:Le,setFlipSided:pe,setCullFace:Re,setLineWidth:ne,setPolygonOffset:Xe,setScissorTest:Ae,activeTexture:Pe,bindTexture:Ke,unbindTexture:oe,compressedTexImage2D:te,compressedTexImage3D:_e,texImage2D:Qe,texImage3D:Ie,updateUBOMapping:Me,uniformBlockBinding:$e,texStorage2D:ge,texStorage3D:Ye,texSubImage2D:ve,texSubImage3D:ye,compressedTexSubImage2D:ke,compressedTexSubImage3D:Be,scissor:Fe,viewport:Ge,reset:dt}}function CTe(t,e,n,r,i,s,a){const o=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 Lt,d=new WeakMap;let h;const g=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(oe,te){return v?new OffscreenCanvas(oe,te):_S("canvas")}function _(oe,te,_e){let ve=1;const ye=Ke(oe);if((ye.width>_e||ye.height>_e)&&(ve=_e/Math.max(ye.width,ye.height)),ve<1)if(typeof HTMLImageElement<"u"&&oe instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&oe instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&oe instanceof ImageBitmap||typeof VideoFrame<"u"&&oe instanceof VideoFrame){const ke=Math.floor(ve*ye.width),Be=Math.floor(ve*ye.height);h===void 0&&(h=b(ke,Be));const ge=te?b(ke,Be):h;return ge.width=ke,ge.height=Be,ge.getContext("2d").drawImage(oe,0,0,ke,Be),fn("WebGLRenderer: Texture has been resized from ("+ye.width+"x"+ye.height+") to ("+ke+"x"+Be+")."),ge}else return"data"in oe&&fn("WebGLRenderer: Image in DataTexture is too big ("+ye.width+"x"+ye.height+")."),oe;return oe}function w(oe){return oe.generateMipmaps}function S(oe){t.generateMipmap(oe)}function E(oe){return oe.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:oe.isWebGL3DRenderTarget?t.TEXTURE_3D:oe.isWebGLArrayRenderTarget||oe.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function A(oe,te,_e,ve,ye=!1){if(oe!==null){if(t[oe]!==void 0)return t[oe];fn("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+oe+"'")}let ke=te;if(te===t.RED&&(_e===t.FLOAT&&(ke=t.R32F),_e===t.HALF_FLOAT&&(ke=t.R16F),_e===t.UNSIGNED_BYTE&&(ke=t.R8)),te===t.RED_INTEGER&&(_e===t.UNSIGNED_BYTE&&(ke=t.R8UI),_e===t.UNSIGNED_SHORT&&(ke=t.R16UI),_e===t.UNSIGNED_INT&&(ke=t.R32UI),_e===t.BYTE&&(ke=t.R8I),_e===t.SHORT&&(ke=t.R16I),_e===t.INT&&(ke=t.R32I)),te===t.RG&&(_e===t.FLOAT&&(ke=t.RG32F),_e===t.HALF_FLOAT&&(ke=t.RG16F),_e===t.UNSIGNED_BYTE&&(ke=t.RG8)),te===t.RG_INTEGER&&(_e===t.UNSIGNED_BYTE&&(ke=t.RG8UI),_e===t.UNSIGNED_SHORT&&(ke=t.RG16UI),_e===t.UNSIGNED_INT&&(ke=t.RG32UI),_e===t.BYTE&&(ke=t.RG8I),_e===t.SHORT&&(ke=t.RG16I),_e===t.INT&&(ke=t.RG32I)),te===t.RGB_INTEGER&&(_e===t.UNSIGNED_BYTE&&(ke=t.RGB8UI),_e===t.UNSIGNED_SHORT&&(ke=t.RGB16UI),_e===t.UNSIGNED_INT&&(ke=t.RGB32UI),_e===t.BYTE&&(ke=t.RGB8I),_e===t.SHORT&&(ke=t.RGB16I),_e===t.INT&&(ke=t.RGB32I)),te===t.RGBA_INTEGER&&(_e===t.UNSIGNED_BYTE&&(ke=t.RGBA8UI),_e===t.UNSIGNED_SHORT&&(ke=t.RGBA16UI),_e===t.UNSIGNED_INT&&(ke=t.RGBA32UI),_e===t.BYTE&&(ke=t.RGBA8I),_e===t.SHORT&&(ke=t.RGBA16I),_e===t.INT&&(ke=t.RGBA32I)),te===t.RGB&&(_e===t.UNSIGNED_INT_5_9_9_9_REV&&(ke=t.RGB9_E5),_e===t.UNSIGNED_INT_10F_11F_11F_REV&&(ke=t.R11F_G11F_B10F)),te===t.RGBA){const Be=ye?yS:ii.getTransfer(ve);_e===t.FLOAT&&(ke=t.RGBA32F),_e===t.HALF_FLOAT&&(ke=t.RGBA16F),_e===t.UNSIGNED_BYTE&&(ke=Be===ji?t.SRGB8_ALPHA8:t.RGBA8),_e===t.UNSIGNED_SHORT_4_4_4_4&&(ke=t.RGBA4),_e===t.UNSIGNED_SHORT_5_5_5_1&&(ke=t.RGB5_A1)}return(ke===t.R16F||ke===t.R32F||ke===t.RG16F||ke===t.RG32F||ke===t.RGBA16F||ke===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ke}function N(oe,te){let _e;return oe?te===null||te===Ku||te===ty?_e=t.DEPTH24_STENCIL8:te===Bl?_e=t.DEPTH32F_STENCIL8:te===ey&&(_e=t.DEPTH24_STENCIL8,fn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):te===null||te===Ku||te===ty?_e=t.DEPTH_COMPONENT24:te===Bl?_e=t.DEPTH_COMPONENT32F:te===ey&&(_e=t.DEPTH_COMPONENT16),_e}function I(oe,te){return w(oe)===!0||oe.isFramebufferTexture&&oe.minFilter!==Ea&&oe.minFilter!==rs?Math.log2(Math.max(te.width,te.height))+1:oe.mipmaps!==void 0&&oe.mipmaps.length>0?oe.mipmaps.length:oe.isCompressedTexture&&Array.isArray(oe.image)?te.mipmaps.length:1}function P(oe){const te=oe.target;te.removeEventListener("dispose",P),R(te),te.isVideoTexture&&d.delete(te)}function L(oe){const te=oe.target;te.removeEventListener("dispose",L),W(te)}function R(oe){const te=r.get(oe);if(te.__webglInit===void 0)return;const _e=oe.source,ve=g.get(_e);if(ve){const ye=ve[te.__cacheKey];ye.usedTimes--,ye.usedTimes===0&&O(oe),Object.keys(ve).length===0&&g.delete(_e)}r.remove(oe)}function O(oe){const te=r.get(oe);t.deleteTexture(te.__webglTexture);const _e=oe.source,ve=g.get(_e);delete ve[te.__cacheKey],a.memory.textures--}function W(oe){const te=r.get(oe);if(oe.depthTexture&&(oe.depthTexture.dispose(),r.remove(oe.depthTexture)),oe.isWebGLCubeRenderTarget)for(let ve=0;ve<6;ve++){if(Array.isArray(te.__webglFramebuffer[ve]))for(let ye=0;ye<te.__webglFramebuffer[ve].length;ye++)t.deleteFramebuffer(te.__webglFramebuffer[ve][ye]);else t.deleteFramebuffer(te.__webglFramebuffer[ve]);te.__webglDepthbuffer&&t.deleteRenderbuffer(te.__webglDepthbuffer[ve])}else{if(Array.isArray(te.__webglFramebuffer))for(let ve=0;ve<te.__webglFramebuffer.length;ve++)t.deleteFramebuffer(te.__webglFramebuffer[ve]);else t.deleteFramebuffer(te.__webglFramebuffer);if(te.__webglDepthbuffer&&t.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&t.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer)for(let ve=0;ve<te.__webglColorRenderbuffer.length;ve++)te.__webglColorRenderbuffer[ve]&&t.deleteRenderbuffer(te.__webglColorRenderbuffer[ve]);te.__webglDepthRenderbuffer&&t.deleteRenderbuffer(te.__webglDepthRenderbuffer)}const _e=oe.textures;for(let ve=0,ye=_e.length;ve<ye;ve++){const ke=r.get(_e[ve]);ke.__webglTexture&&(t.deleteTexture(ke.__webglTexture),a.memory.textures--),r.remove(_e[ve])}r.remove(oe)}let U=0;function V(){U=0}function G(){const oe=U;return oe>=i.maxTextures&&fn("WebGLTextures: Trying to use "+oe+" texture units while this GPU supports only "+i.maxTextures),U+=1,oe}function Z(oe){const te=[];return te.push(oe.wrapS),te.push(oe.wrapT),te.push(oe.wrapR||0),te.push(oe.magFilter),te.push(oe.minFilter),te.push(oe.anisotropy),te.push(oe.internalFormat),te.push(oe.format),te.push(oe.type),te.push(oe.generateMipmaps),te.push(oe.premultiplyAlpha),te.push(oe.flipY),te.push(oe.unpackAlignment),te.push(oe.colorSpace),te.join()}function B(oe,te){const _e=r.get(oe);if(oe.isVideoTexture&&Ae(oe),oe.isRenderTargetTexture===!1&&oe.isExternalTexture!==!0&&oe.version>0&&_e.__version!==oe.version){const ve=oe.image;if(ve===null)fn("WebGLRenderer: Texture marked for update but no image data found.");else if(ve.complete===!1)fn("WebGLRenderer: Texture marked for update but image is incomplete");else{ie(_e,oe,te);return}}else oe.isExternalTexture&&(_e.__webglTexture=oe.sourceTexture?oe.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,_e.__webglTexture,t.TEXTURE0+te)}function q(oe,te){const _e=r.get(oe);if(oe.isRenderTargetTexture===!1&&oe.version>0&&_e.__version!==oe.version){ie(_e,oe,te);return}else oe.isExternalTexture&&(_e.__webglTexture=oe.sourceTexture?oe.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,_e.__webglTexture,t.TEXTURE0+te)}function Y(oe,te){const _e=r.get(oe);if(oe.isRenderTargetTexture===!1&&oe.version>0&&_e.__version!==oe.version){ie(_e,oe,te);return}n.bindTexture(t.TEXTURE_3D,_e.__webglTexture,t.TEXTURE0+te)}function K(oe,te){const _e=r.get(oe);if(oe.isCubeDepthTexture!==!0&&oe.version>0&&_e.__version!==oe.version){ue(_e,oe,te);return}n.bindTexture(t.TEXTURE_CUBE_MAP,_e.__webglTexture,t.TEXTURE0+te)}const J={[mS]:t.REPEAT,[Tc]:t.CLAMP_TO_EDGE,[gS]:t.MIRRORED_REPEAT},F={[Ea]:t.NEAREST,[Wk]:t.NEAREST_MIPMAP_NEAREST,[n1]:t.NEAREST_MIPMAP_LINEAR,[rs]:t.LINEAR,[L_]:t.LINEAR_MIPMAP_NEAREST,[Kf]:t.LINEAR_MIPMAP_LINEAR},j={[YX]:t.NEVER,[eY]:t.ALWAYS,[KX]:t.LESS,[eE]:t.LEQUAL,[ZX]:t.EQUAL,[tE]:t.GEQUAL,[QX]:t.GREATER,[JX]:t.NOTEQUAL};function X(oe,te){if(te.type===Bl&&e.has("OES_texture_float_linear")===!1&&(te.magFilter===rs||te.magFilter===L_||te.magFilter===n1||te.magFilter===Kf||te.minFilter===rs||te.minFilter===L_||te.minFilter===n1||te.minFilter===Kf)&&fn("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(oe,t.TEXTURE_WRAP_S,J[te.wrapS]),t.texParameteri(oe,t.TEXTURE_WRAP_T,J[te.wrapT]),(oe===t.TEXTURE_3D||oe===t.TEXTURE_2D_ARRAY)&&t.texParameteri(oe,t.TEXTURE_WRAP_R,J[te.wrapR]),t.texParameteri(oe,t.TEXTURE_MAG_FILTER,F[te.magFilter]),t.texParameteri(oe,t.TEXTURE_MIN_FILTER,F[te.minFilter]),te.compareFunction&&(t.texParameteri(oe,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(oe,t.TEXTURE_COMPARE_FUNC,j[te.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(te.magFilter===Ea||te.minFilter!==n1&&te.minFilter!==Kf||te.type===Bl&&e.has("OES_texture_float_linear")===!1)return;if(te.anisotropy>1||r.get(te).__currentAnisotropy){const _e=e.get("EXT_texture_filter_anisotropic");t.texParameterf(oe,_e.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(te.anisotropy,i.getMaxAnisotropy())),r.get(te).__currentAnisotropy=te.anisotropy}}}function H(oe,te){let _e=!1;oe.__webglInit===void 0&&(oe.__webglInit=!0,te.addEventListener("dispose",P));const ve=te.source;let ye=g.get(ve);ye===void 0&&(ye={},g.set(ve,ye));const ke=Z(te);if(ke!==oe.__cacheKey){ye[ke]===void 0&&(ye[ke]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,_e=!0),ye[ke].usedTimes++;const Be=ye[oe.__cacheKey];Be!==void 0&&(ye[oe.__cacheKey].usedTimes--,Be.usedTimes===0&&O(te)),oe.__cacheKey=ke,oe.__webglTexture=ye[ke].texture}return _e}function se(oe,te,_e){return Math.floor(Math.floor(oe/_e)/te)}function re(oe,te,_e,ve){const ke=oe.updateRanges;if(ke.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,te.width,te.height,_e,ve,te.data);else{ke.sort((Ie,Fe)=>Ie.start-Fe.start);let Be=0;for(let Ie=1;Ie<ke.length;Ie++){const Fe=ke[Be],Ge=ke[Ie],Me=Fe.start+Fe.count,$e=se(Ge.start,te.width,4),dt=se(Fe.start,te.width,4);Ge.start<=Me+1&&$e===dt&&se(Ge.start+Ge.count-1,te.width,4)===$e?Fe.count=Math.max(Fe.count,Ge.start+Ge.count-Fe.start):(++Be,ke[Be]=Ge)}ke.length=Be+1;const ge=t.getParameter(t.UNPACK_ROW_LENGTH),Ye=t.getParameter(t.UNPACK_SKIP_PIXELS),Qe=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,te.width);for(let Ie=0,Fe=ke.length;Ie<Fe;Ie++){const Ge=ke[Ie],Me=Math.floor(Ge.start/4),$e=Math.ceil(Ge.count/4),dt=Me%te.width,Oe=Math.floor(Me/te.width),st=$e,ft=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,dt),t.pixelStorei(t.UNPACK_SKIP_ROWS,Oe),n.texSubImage2D(t.TEXTURE_2D,0,dt,Oe,st,ft,_e,ve,te.data)}oe.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,ge),t.pixelStorei(t.UNPACK_SKIP_PIXELS,Ye),t.pixelStorei(t.UNPACK_SKIP_ROWS,Qe)}}function ie(oe,te,_e){let ve=t.TEXTURE_2D;(te.isDataArrayTexture||te.isCompressedArrayTexture)&&(ve=t.TEXTURE_2D_ARRAY),te.isData3DTexture&&(ve=t.TEXTURE_3D);const ye=H(oe,te),ke=te.source;n.bindTexture(ve,oe.__webglTexture,t.TEXTURE0+_e);const Be=r.get(ke);if(ke.version!==Be.__version||ye===!0){n.activeTexture(t.TEXTURE0+_e);const ge=ii.getPrimaries(ii.workingColorSpace),Ye=te.colorSpace===np?null:ii.getPrimaries(te.colorSpace),Qe=te.colorSpace===np||ge===Ye?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,te.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,te.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Qe);let Ie=_(te.image,!1,i.maxTextureSize);Ie=Pe(te,Ie);const Fe=s.convert(te.format,te.colorSpace),Ge=s.convert(te.type);let Me=A(te.internalFormat,Fe,Ge,te.colorSpace,te.isVideoTexture);X(ve,te);let $e;const dt=te.mipmaps,Oe=te.isVideoTexture!==!0,st=Be.__version===void 0||ye===!0,ft=ke.dataReady,pt=I(te,Ie);if(te.isDepthTexture)Me=N(te.format===F0,te.type),st&&(Oe?n.texStorage2D(t.TEXTURE_2D,1,Me,Ie.width,Ie.height):n.texImage2D(t.TEXTURE_2D,0,Me,Ie.width,Ie.height,0,Fe,Ge,null));else if(te.isDataTexture)if(dt.length>0){Oe&&st&&n.texStorage2D(t.TEXTURE_2D,pt,Me,dt[0].width,dt[0].height);for(let et=0,Ze=dt.length;et<Ze;et++)$e=dt[et],Oe?ft&&n.texSubImage2D(t.TEXTURE_2D,et,0,0,$e.width,$e.height,Fe,Ge,$e.data):n.texImage2D(t.TEXTURE_2D,et,Me,$e.width,$e.height,0,Fe,Ge,$e.data);te.generateMipmaps=!1}else Oe?(st&&n.texStorage2D(t.TEXTURE_2D,pt,Me,Ie.width,Ie.height),ft&&re(te,Ie,Fe,Ge)):n.texImage2D(t.TEXTURE_2D,0,Me,Ie.width,Ie.height,0,Fe,Ge,Ie.data);else if(te.isCompressedTexture)if(te.isCompressedArrayTexture){Oe&&st&&n.texStorage3D(t.TEXTURE_2D_ARRAY,pt,Me,dt[0].width,dt[0].height,Ie.depth);for(let et=0,Ze=dt.length;et<Ze;et++)if($e=dt[et],te.format!==ul)if(Fe!==null)if(Oe){if(ft)if(te.layerUpdates.size>0){const me=YR($e.width,$e.height,te.format,te.type);for(const je of te.layerUpdates){const He=$e.data.subarray(je*me/$e.data.BYTES_PER_ELEMENT,(je+1)*me/$e.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,et,0,0,je,$e.width,$e.height,1,Fe,He)}te.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,et,0,0,0,$e.width,$e.height,Ie.depth,Fe,$e.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,et,Me,$e.width,$e.height,Ie.depth,0,$e.data,0,0);else fn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Oe?ft&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,et,0,0,0,$e.width,$e.height,Ie.depth,Fe,Ge,$e.data):n.texImage3D(t.TEXTURE_2D_ARRAY,et,Me,$e.width,$e.height,Ie.depth,0,Fe,Ge,$e.data)}else{Oe&&st&&n.texStorage2D(t.TEXTURE_2D,pt,Me,dt[0].width,dt[0].height);for(let et=0,Ze=dt.length;et<Ze;et++)$e=dt[et],te.format!==ul?Fe!==null?Oe?ft&&n.compressedTexSubImage2D(t.TEXTURE_2D,et,0,0,$e.width,$e.height,Fe,$e.data):n.compressedTexImage2D(t.TEXTURE_2D,et,Me,$e.width,$e.height,0,$e.data):fn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Oe?ft&&n.texSubImage2D(t.TEXTURE_2D,et,0,0,$e.width,$e.height,Fe,Ge,$e.data):n.texImage2D(t.TEXTURE_2D,et,Me,$e.width,$e.height,0,Fe,Ge,$e.data)}else if(te.isDataArrayTexture)if(Oe){if(st&&n.texStorage3D(t.TEXTURE_2D_ARRAY,pt,Me,Ie.width,Ie.height,Ie.depth),ft)if(te.layerUpdates.size>0){const et=YR(Ie.width,Ie.height,te.format,te.type);for(const Ze of te.layerUpdates){const me=Ie.data.subarray(Ze*et/Ie.data.BYTES_PER_ELEMENT,(Ze+1)*et/Ie.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Ze,Ie.width,Ie.height,1,Fe,Ge,me)}te.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ie.width,Ie.height,Ie.depth,Fe,Ge,Ie.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Me,Ie.width,Ie.height,Ie.depth,0,Fe,Ge,Ie.data);else if(te.isData3DTexture)Oe?(st&&n.texStorage3D(t.TEXTURE_3D,pt,Me,Ie.width,Ie.height,Ie.depth),ft&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ie.width,Ie.height,Ie.depth,Fe,Ge,Ie.data)):n.texImage3D(t.TEXTURE_3D,0,Me,Ie.width,Ie.height,Ie.depth,0,Fe,Ge,Ie.data);else if(te.isFramebufferTexture){if(st)if(Oe)n.texStorage2D(t.TEXTURE_2D,pt,Me,Ie.width,Ie.height);else{let et=Ie.width,Ze=Ie.height;for(let me=0;me<pt;me++)n.texImage2D(t.TEXTURE_2D,me,Me,et,Ze,0,Fe,Ge,null),et>>=1,Ze>>=1}}else if(dt.length>0){if(Oe&&st){const et=Ke(dt[0]);n.texStorage2D(t.TEXTURE_2D,pt,Me,et.width,et.height)}for(let et=0,Ze=dt.length;et<Ze;et++)$e=dt[et],Oe?ft&&n.texSubImage2D(t.TEXTURE_2D,et,0,0,Fe,Ge,$e):n.texImage2D(t.TEXTURE_2D,et,Me,Fe,Ge,$e);te.generateMipmaps=!1}else if(Oe){if(st){const et=Ke(Ie);n.texStorage2D(t.TEXTURE_2D,pt,Me,et.width,et.height)}ft&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Fe,Ge,Ie)}else n.texImage2D(t.TEXTURE_2D,0,Me,Fe,Ge,Ie);w(te)&&S(ve),Be.__version=ke.version,te.onUpdate&&te.onUpdate(te)}oe.__version=te.version}function ue(oe,te,_e){if(te.image.length!==6)return;const ve=H(oe,te),ye=te.source;n.bindTexture(t.TEXTURE_CUBE_MAP,oe.__webglTexture,t.TEXTURE0+_e);const ke=r.get(ye);if(ye.version!==ke.__version||ve===!0){n.activeTexture(t.TEXTURE0+_e);const Be=ii.getPrimaries(ii.workingColorSpace),ge=te.colorSpace===np?null:ii.getPrimaries(te.colorSpace),Ye=te.colorSpace===np||Be===ge?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,te.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,te.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ye);const Qe=te.isCompressedTexture||te.image[0].isCompressedTexture,Ie=te.image[0]&&te.image[0].isDataTexture,Fe=[];for(let Ze=0;Ze<6;Ze++)!Qe&&!Ie?Fe[Ze]=_(te.image[Ze],!0,i.maxCubemapSize):Fe[Ze]=Ie?te.image[Ze].image:te.image[Ze],Fe[Ze]=Pe(te,Fe[Ze]);const Ge=Fe[0],Me=s.convert(te.format,te.colorSpace),$e=s.convert(te.type),dt=A(te.internalFormat,Me,$e,te.colorSpace),Oe=te.isVideoTexture!==!0,st=ke.__version===void 0||ve===!0,ft=ye.dataReady;let pt=I(te,Ge);X(t.TEXTURE_CUBE_MAP,te);let et;if(Qe){Oe&&st&&n.texStorage2D(t.TEXTURE_CUBE_MAP,pt,dt,Ge.width,Ge.height);for(let Ze=0;Ze<6;Ze++){et=Fe[Ze].mipmaps;for(let me=0;me<et.length;me++){const je=et[me];te.format!==ul?Me!==null?Oe?ft&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,me,0,0,je.width,je.height,Me,je.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,me,dt,je.width,je.height,0,je.data):fn("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Oe?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,me,0,0,je.width,je.height,Me,$e,je.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,me,dt,je.width,je.height,0,Me,$e,je.data)}}}else{if(et=te.mipmaps,Oe&&st){et.length>0&&pt++;const Ze=Ke(Fe[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,pt,dt,Ze.width,Ze.height)}for(let Ze=0;Ze<6;Ze++)if(Ie){Oe?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,0,0,Fe[Ze].width,Fe[Ze].height,Me,$e,Fe[Ze].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,dt,Fe[Ze].width,Fe[Ze].height,0,Me,$e,Fe[Ze].data);for(let me=0;me<et.length;me++){const He=et[me].image[Ze].image;Oe?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,me+1,0,0,He.width,He.height,Me,$e,He.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,me+1,dt,He.width,He.height,0,Me,$e,He.data)}}else{Oe?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,0,0,Me,$e,Fe[Ze]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,dt,Me,$e,Fe[Ze]);for(let me=0;me<et.length;me++){const je=et[me];Oe?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,me+1,0,0,Me,$e,je.image[Ze]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,me+1,dt,Me,$e,je.image[Ze])}}}w(te)&&S(t.TEXTURE_CUBE_MAP),ke.__version=ye.version,te.onUpdate&&te.onUpdate(te)}oe.__version=te.version}function le(oe,te,_e,ve,ye,ke){const Be=s.convert(_e.format,_e.colorSpace),ge=s.convert(_e.type),Ye=A(_e.internalFormat,Be,ge,_e.colorSpace),Qe=r.get(te),Ie=r.get(_e);if(Ie.__renderTarget=te,!Qe.__hasExternalTextures){const Fe=Math.max(1,te.width>>ke),Ge=Math.max(1,te.height>>ke);ye===t.TEXTURE_3D||ye===t.TEXTURE_2D_ARRAY?n.texImage3D(ye,ke,Ye,Fe,Ge,te.depth,0,Be,ge,null):n.texImage2D(ye,ke,Ye,Fe,Ge,0,Be,ge,null)}n.bindFramebuffer(t.FRAMEBUFFER,oe),Xe(te)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ve,ye,Ie.__webglTexture,0,ne(te)):(ye===t.TEXTURE_2D||ye>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ye<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,ve,ye,Ie.__webglTexture,ke),n.bindFramebuffer(t.FRAMEBUFFER,null)}function fe(oe,te,_e){if(t.bindRenderbuffer(t.RENDERBUFFER,oe),te.depthBuffer){const ve=te.depthTexture,ye=ve&&ve.isDepthTexture?ve.type:null,ke=N(te.stencilBuffer,ye),Be=te.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;Xe(te)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ne(te),ke,te.width,te.height):_e?t.renderbufferStorageMultisample(t.RENDERBUFFER,ne(te),ke,te.width,te.height):t.renderbufferStorage(t.RENDERBUFFER,ke,te.width,te.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Be,t.RENDERBUFFER,oe)}else{const ve=te.textures;for(let ye=0;ye<ve.length;ye++){const ke=ve[ye],Be=s.convert(ke.format,ke.colorSpace),ge=s.convert(ke.type),Ye=A(ke.internalFormat,Be,ge,ke.colorSpace);Xe(te)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ne(te),Ye,te.width,te.height):_e?t.renderbufferStorageMultisample(t.RENDERBUFFER,ne(te),Ye,te.width,te.height):t.renderbufferStorage(t.RENDERBUFFER,Ye,te.width,te.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function xe(oe,te,_e){const ve=te.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,oe),!(te.depthTexture&&te.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ye=r.get(te.depthTexture);if(ye.__renderTarget=te,(!ye.__webglTexture||te.depthTexture.image.width!==te.width||te.depthTexture.image.height!==te.height)&&(te.depthTexture.image.width=te.width,te.depthTexture.image.height=te.height,te.depthTexture.needsUpdate=!0),ve){if(ye.__webglInit===void 0&&(ye.__webglInit=!0,te.depthTexture.addEventListener("dispose",P)),ye.__webglTexture===void 0){ye.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,ye.__webglTexture),X(t.TEXTURE_CUBE_MAP,te.depthTexture);const Qe=s.convert(te.depthTexture.format),Ie=s.convert(te.depthTexture.type);let Fe;te.depthTexture.format===oh?Fe=t.DEPTH_COMPONENT24:te.depthTexture.format===F0&&(Fe=t.DEPTH24_STENCIL8);for(let Ge=0;Ge<6;Ge++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ge,0,Fe,te.width,te.height,0,Qe,Ie,null)}}else B(te.depthTexture,0);const ke=ye.__webglTexture,Be=ne(te),ge=ve?t.TEXTURE_CUBE_MAP_POSITIVE_X+_e:t.TEXTURE_2D,Ye=te.depthTexture.format===F0?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(te.depthTexture.format===oh)Xe(te)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ye,ge,ke,0,Be):t.framebufferTexture2D(t.FRAMEBUFFER,Ye,ge,ke,0);else if(te.depthTexture.format===F0)Xe(te)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ye,ge,ke,0,Be):t.framebufferTexture2D(t.FRAMEBUFFER,Ye,ge,ke,0);else throw new Error("Unknown depthTexture format")}function he(oe){const te=r.get(oe),_e=oe.isWebGLCubeRenderTarget===!0;if(te.__boundDepthTexture!==oe.depthTexture){const ve=oe.depthTexture;if(te.__depthDisposeCallback&&te.__depthDisposeCallback(),ve){const ye=()=>{delete te.__boundDepthTexture,delete te.__depthDisposeCallback,ve.removeEventListener("dispose",ye)};ve.addEventListener("dispose",ye),te.__depthDisposeCallback=ye}te.__boundDepthTexture=ve}if(oe.depthTexture&&!te.__autoAllocateDepthBuffer)if(_e)for(let ve=0;ve<6;ve++)xe(te.__webglFramebuffer[ve],oe,ve);else{const ve=oe.texture.mipmaps;ve&&ve.length>0?xe(te.__webglFramebuffer[0],oe,0):xe(te.__webglFramebuffer,oe,0)}else if(_e){te.__webglDepthbuffer=[];for(let ve=0;ve<6;ve++)if(n.bindFramebuffer(t.FRAMEBUFFER,te.__webglFramebuffer[ve]),te.__webglDepthbuffer[ve]===void 0)te.__webglDepthbuffer[ve]=t.createRenderbuffer(),fe(te.__webglDepthbuffer[ve],oe,!1);else{const ye=oe.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ke=te.__webglDepthbuffer[ve];t.bindRenderbuffer(t.RENDERBUFFER,ke),t.framebufferRenderbuffer(t.FRAMEBUFFER,ye,t.RENDERBUFFER,ke)}}else{const ve=oe.texture.mipmaps;if(ve&&ve.length>0?n.bindFramebuffer(t.FRAMEBUFFER,te.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,te.__webglFramebuffer),te.__webglDepthbuffer===void 0)te.__webglDepthbuffer=t.createRenderbuffer(),fe(te.__webglDepthbuffer,oe,!1);else{const ye=oe.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ke=te.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ke),t.framebufferRenderbuffer(t.FRAMEBUFFER,ye,t.RENDERBUFFER,ke)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Te(oe,te,_e){const ve=r.get(oe);te!==void 0&&le(ve.__webglFramebuffer,oe,oe.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),_e!==void 0&&he(oe)}function We(oe){const te=oe.texture,_e=r.get(oe),ve=r.get(te);oe.addEventListener("dispose",L);const ye=oe.textures,ke=oe.isWebGLCubeRenderTarget===!0,Be=ye.length>1;if(Be||(ve.__webglTexture===void 0&&(ve.__webglTexture=t.createTexture()),ve.__version=te.version,a.memory.textures++),ke){_e.__webglFramebuffer=[];for(let ge=0;ge<6;ge++)if(te.mipmaps&&te.mipmaps.length>0){_e.__webglFramebuffer[ge]=[];for(let Ye=0;Ye<te.mipmaps.length;Ye++)_e.__webglFramebuffer[ge][Ye]=t.createFramebuffer()}else _e.__webglFramebuffer[ge]=t.createFramebuffer()}else{if(te.mipmaps&&te.mipmaps.length>0){_e.__webglFramebuffer=[];for(let ge=0;ge<te.mipmaps.length;ge++)_e.__webglFramebuffer[ge]=t.createFramebuffer()}else _e.__webglFramebuffer=t.createFramebuffer();if(Be)for(let ge=0,Ye=ye.length;ge<Ye;ge++){const Qe=r.get(ye[ge]);Qe.__webglTexture===void 0&&(Qe.__webglTexture=t.createTexture(),a.memory.textures++)}if(oe.samples>0&&Xe(oe)===!1){_e.__webglMultisampledFramebuffer=t.createFramebuffer(),_e.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,_e.__webglMultisampledFramebuffer);for(let ge=0;ge<ye.length;ge++){const Ye=ye[ge];_e.__webglColorRenderbuffer[ge]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,_e.__webglColorRenderbuffer[ge]);const Qe=s.convert(Ye.format,Ye.colorSpace),Ie=s.convert(Ye.type),Fe=A(Ye.internalFormat,Qe,Ie,Ye.colorSpace,oe.isXRRenderTarget===!0),Ge=ne(oe);t.renderbufferStorageMultisample(t.RENDERBUFFER,Ge,Fe,oe.width,oe.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ge,t.RENDERBUFFER,_e.__webglColorRenderbuffer[ge])}t.bindRenderbuffer(t.RENDERBUFFER,null),oe.depthBuffer&&(_e.__webglDepthRenderbuffer=t.createRenderbuffer(),fe(_e.__webglDepthRenderbuffer,oe,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ke){n.bindTexture(t.TEXTURE_CUBE_MAP,ve.__webglTexture),X(t.TEXTURE_CUBE_MAP,te);for(let ge=0;ge<6;ge++)if(te.mipmaps&&te.mipmaps.length>0)for(let Ye=0;Ye<te.mipmaps.length;Ye++)le(_e.__webglFramebuffer[ge][Ye],oe,te,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,Ye);else le(_e.__webglFramebuffer[ge],oe,te,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0);w(te)&&S(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Be){for(let ge=0,Ye=ye.length;ge<Ye;ge++){const Qe=ye[ge],Ie=r.get(Qe);let Fe=t.TEXTURE_2D;(oe.isWebGL3DRenderTarget||oe.isWebGLArrayRenderTarget)&&(Fe=oe.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Fe,Ie.__webglTexture),X(Fe,Qe),le(_e.__webglFramebuffer,oe,Qe,t.COLOR_ATTACHMENT0+ge,Fe,0),w(Qe)&&S(Fe)}n.unbindTexture()}else{let ge=t.TEXTURE_2D;if((oe.isWebGL3DRenderTarget||oe.isWebGLArrayRenderTarget)&&(ge=oe.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(ge,ve.__webglTexture),X(ge,te),te.mipmaps&&te.mipmaps.length>0)for(let Ye=0;Ye<te.mipmaps.length;Ye++)le(_e.__webglFramebuffer[Ye],oe,te,t.COLOR_ATTACHMENT0,ge,Ye);else le(_e.__webglFramebuffer,oe,te,t.COLOR_ATTACHMENT0,ge,0);w(te)&&S(ge),n.unbindTexture()}oe.depthBuffer&&he(oe)}function Se(oe){const te=oe.textures;for(let _e=0,ve=te.length;_e<ve;_e++){const ye=te[_e];if(w(ye)){const ke=E(oe),Be=r.get(ye).__webglTexture;n.bindTexture(ke,Be),S(ke),n.unbindTexture()}}}const Le=[],pe=[];function Re(oe){if(oe.samples>0){if(Xe(oe)===!1){const te=oe.textures,_e=oe.width,ve=oe.height;let ye=t.COLOR_BUFFER_BIT;const ke=oe.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Be=r.get(oe),ge=te.length>1;if(ge)for(let Qe=0;Qe<te.length;Qe++)n.bindFramebuffer(t.FRAMEBUFFER,Be.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Qe,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Be.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Qe,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Be.__webglMultisampledFramebuffer);const Ye=oe.texture.mipmaps;Ye&&Ye.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Be.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Be.__webglFramebuffer);for(let Qe=0;Qe<te.length;Qe++){if(oe.resolveDepthBuffer&&(oe.depthBuffer&&(ye|=t.DEPTH_BUFFER_BIT),oe.stencilBuffer&&oe.resolveStencilBuffer&&(ye|=t.STENCIL_BUFFER_BIT)),ge){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Be.__webglColorRenderbuffer[Qe]);const Ie=r.get(te[Qe]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ie,0)}t.blitFramebuffer(0,0,_e,ve,0,0,_e,ve,ye,t.NEAREST),l===!0&&(Le.length=0,pe.length=0,Le.push(t.COLOR_ATTACHMENT0+Qe),oe.depthBuffer&&oe.resolveDepthBuffer===!1&&(Le.push(ke),pe.push(ke),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,pe)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,Le))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),ge)for(let Qe=0;Qe<te.length;Qe++){n.bindFramebuffer(t.FRAMEBUFFER,Be.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Qe,t.RENDERBUFFER,Be.__webglColorRenderbuffer[Qe]);const Ie=r.get(te[Qe]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Be.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Qe,t.TEXTURE_2D,Ie,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Be.__webglMultisampledFramebuffer)}else if(oe.depthBuffer&&oe.resolveDepthBuffer===!1&&l){const te=oe.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[te])}}}function ne(oe){return Math.min(i.maxSamples,oe.samples)}function Xe(oe){const te=r.get(oe);return oe.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&te.__useRenderToTexture!==!1}function Ae(oe){const te=a.render.frame;d.get(oe)!==te&&(d.set(oe,te),oe.update())}function Pe(oe,te){const _e=oe.colorSpace,ve=oe.format,ye=oe.type;return oe.isCompressedTexture===!0||oe.isVideoTexture===!0||_e!==nm&&_e!==np&&(ii.getTransfer(_e)===ji?(ve!==ul||ye!==zl)&&fn("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Hn("WebGLTextures: Unsupported texture color space:",_e)),te}function Ke(oe){return typeof HTMLImageElement<"u"&&oe instanceof HTMLImageElement?(c.width=oe.naturalWidth||oe.width,c.height=oe.naturalHeight||oe.height):typeof VideoFrame<"u"&&oe instanceof VideoFrame?(c.width=oe.displayWidth,c.height=oe.displayHeight):(c.width=oe.width,c.height=oe.height),c}this.allocateTextureUnit=G,this.resetTextureUnits=V,this.setTexture2D=B,this.setTexture2DArray=q,this.setTexture3D=Y,this.setTextureCube=K,this.rebindTextures=Te,this.setupRenderTarget=We,this.updateRenderTargetMipmap=Se,this.updateMultisampleRenderTarget=Re,this.setupDepthRenderbuffer=he,this.setupFrameBufferTexture=le,this.useMultisampledRTT=Xe,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function uK(t,e){function n(r,i=np){let s;const a=ii.getTransfer(i);if(r===zl)return t.UNSIGNED_BYTE;if(r===XT)return t.UNSIGNED_SHORT_4_4_4_4;if(r===YT)return t.UNSIGNED_SHORT_5_5_5_1;if(r===Xk)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===Yk)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===$k)return t.BYTE;if(r===qk)return t.SHORT;if(r===ey)return t.UNSIGNED_SHORT;if(r===qT)return t.INT;if(r===Ku)return t.UNSIGNED_INT;if(r===Bl)return t.FLOAT;if(r===ah)return t.HALF_FLOAT;if(r===Kk)return t.ALPHA;if(r===Zk)return t.RGB;if(r===ul)return t.RGBA;if(r===oh)return t.DEPTH_COMPONENT;if(r===F0)return t.DEPTH_STENCIL;if(r===KT)return t.RED;if(r===bw)return t.RED_INTEGER;if(r===ov)return t.RG;if(r===ZT)return t.RG_INTEGER;if(r===QT)return t.RGBA_INTEGER;if(r===z_||r===j_||r===F_||r===U_)if(a===ji)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===z_)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===j_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===F_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===U_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===z_)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===j_)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===F_)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===U_)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===F2||r===U2||r===B2||r===H2)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===F2)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===U2)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===B2)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===H2)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===V2||r===G2||r===W2||r===$2||r===q2||r===X2||r===Y2)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===V2||r===G2)return a===ji?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===W2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(r===$2)return s.COMPRESSED_R11_EAC;if(r===q2)return s.COMPRESSED_SIGNED_R11_EAC;if(r===X2)return s.COMPRESSED_RG11_EAC;if(r===Y2)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(r===K2||r===Z2||r===Q2||r===J2||r===e5||r===t5||r===n5||r===r5||r===i5||r===s5||r===a5||r===o5||r===l5||r===c5)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===K2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Z2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Q2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===J2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===e5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===t5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===n5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===r5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===i5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===s5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===a5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===o5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===l5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===c5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===u5||r===d5||r===f5)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===u5)return a===ji?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===d5)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===f5)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===h5||r===p5||r===m5||r===g5)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===h5)return s.COMPRESSED_RED_RGTC1_EXT;if(r===p5)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===m5)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===g5)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ty?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const ATe=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,NTe=`
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 RTe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new o9(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 au({vertexShader:ATe,fragmentShader:NTe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Us(new Sp(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class kTe extends mh{constructor(e,n){super();const r=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,h=null,g=null,v=null,b=null;const _=typeof XRWebGLBinding<"u",w=new RTe,S={},E=n.getContextAttributes();let A=null,N=null;const I=[],P=[],L=new Lt;let R=null;const O=new ea;O.viewport=new ci;const W=new ea;W.viewport=new ci;const U=[O,W],V=new KY;let G=null,Z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let ue=I[ie];return ue===void 0&&(ue=new BM,I[ie]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(ie){let ue=I[ie];return ue===void 0&&(ue=new BM,I[ie]=ue),ue.getGripSpace()},this.getHand=function(ie){let ue=I[ie];return ue===void 0&&(ue=new BM,I[ie]=ue),ue.getHandSpace()};function B(ie){const ue=P.indexOf(ie.inputSource);if(ue===-1)return;const le=I[ue];le!==void 0&&(le.update(ie.inputSource,ie.frame,c||a),le.dispatchEvent({type:ie.type,data:ie.inputSource}))}function q(){i.removeEventListener("select",B),i.removeEventListener("selectstart",B),i.removeEventListener("selectend",B),i.removeEventListener("squeeze",B),i.removeEventListener("squeezestart",B),i.removeEventListener("squeezeend",B),i.removeEventListener("end",q),i.removeEventListener("inputsourceschange",Y);for(let ie=0;ie<I.length;ie++){const ue=P[ie];ue!==null&&(P[ie]=null,I[ie].disconnect(ue))}G=null,Z=null,w.reset();for(const ie in S)delete S[ie];e.setRenderTarget(A),v=null,g=null,h=null,i=null,N=null,re.stop(),r.isPresenting=!1,e.setPixelRatio(R),e.setSize(L.width,L.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){s=ie,r.isPresenting===!0&&fn("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){o=ie,r.isPresenting===!0&&fn("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(ie){c=ie},this.getBaseLayer=function(){return g!==null?g:v},this.getBinding=function(){return h===null&&_&&(h=new XRWebGLBinding(i,n)),h},this.getFrame=function(){return b},this.getSession=function(){return i},this.setSession=async function(ie){if(i=ie,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",B),i.addEventListener("selectstart",B),i.addEventListener("selectend",B),i.addEventListener("squeeze",B),i.addEventListener("squeezestart",B),i.addEventListener("squeezeend",B),i.addEventListener("end",q),i.addEventListener("inputsourceschange",Y),E.xrCompatible!==!0&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(L),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let le=null,fe=null,xe=null;E.depth&&(xe=E.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,le=E.stencil?F0:oh,fe=E.stencil?ty:Ku);const he={colorFormat:n.RGBA8,depthFormat:xe,scaleFactor:s};h=this.getBinding(),g=h.createProjectionLayer(he),i.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),N=new iu(g.textureWidth,g.textureHeight,{format:ul,type:zl,depthTexture:new iy(g.textureWidth,g.textureHeight,fe,void 0,void 0,void 0,void 0,void 0,void 0,le),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}else{const le={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(i,n,le),i.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),N=new iu(v.framebufferWidth,v.framebufferHeight,{format:ul,type:zl,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:v.ignoreDepthValues===!1,resolveStencilBuffer:v.ignoreDepthValues===!1})}N.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),re.setContext(i),re.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return w.getDepthTexture()};function Y(ie){for(let ue=0;ue<ie.removed.length;ue++){const le=ie.removed[ue],fe=P.indexOf(le);fe>=0&&(P[fe]=null,I[fe].disconnect(le))}for(let ue=0;ue<ie.added.length;ue++){const le=ie.added[ue];let fe=P.indexOf(le);if(fe===-1){for(let he=0;he<I.length;he++)if(he>=P.length){P.push(le),fe=he;break}else if(P[he]===null){P[he]=le,fe=he;break}if(fe===-1)break}const xe=I[fe];xe&&xe.connect(le)}}const K=new ze,J=new ze;function F(ie,ue,le){K.setFromMatrixPosition(ue.matrixWorld),J.setFromMatrixPosition(le.matrixWorld);const fe=K.distanceTo(J),xe=ue.projectionMatrix.elements,he=le.projectionMatrix.elements,Te=xe[14]/(xe[10]-1),We=xe[14]/(xe[10]+1),Se=(xe[9]+1)/xe[5],Le=(xe[9]-1)/xe[5],pe=(xe[8]-1)/xe[0],Re=(he[8]+1)/he[0],ne=Te*pe,Xe=Te*Re,Ae=fe/(-pe+Re),Pe=Ae*-pe;if(ue.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(Pe),ie.translateZ(Ae),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert(),xe[10]===-1)ie.projectionMatrix.copy(ue.projectionMatrix),ie.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const Ke=Te+Ae,oe=We+Ae,te=ne-Pe,_e=Xe+(fe-Pe),ve=Se*We/oe*Ke,ye=Le*We/oe*Ke;ie.projectionMatrix.makePerspective(te,_e,ve,ye,Ke,oe),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}}function j(ie,ue){ue===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(ue.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(i===null)return;let ue=ie.near,le=ie.far;w.texture!==null&&(w.depthNear>0&&(ue=w.depthNear),w.depthFar>0&&(le=w.depthFar)),V.near=W.near=O.near=ue,V.far=W.far=O.far=le,(G!==V.near||Z!==V.far)&&(i.updateRenderState({depthNear:V.near,depthFar:V.far}),G=V.near,Z=V.far),V.layers.mask=ie.layers.mask|6,O.layers.mask=V.layers.mask&-5,W.layers.mask=V.layers.mask&-3;const fe=ie.parent,xe=V.cameras;j(V,fe);for(let he=0;he<xe.length;he++)j(xe[he],fe);xe.length===2?F(V,O,W):V.projectionMatrix.copy(O.projectionMatrix),X(ie,V,fe)};function X(ie,ue,le){le===null?ie.matrix.copy(ue.matrixWorld):(ie.matrix.copy(le.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(ue.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(ue.projectionMatrix),ie.projectionMatrixInverse.copy(ue.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=ny*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return V},this.getFoveation=function(){if(!(g===null&&v===null))return l},this.setFoveation=function(ie){l=ie,g!==null&&(g.fixedFoveation=ie),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=ie)},this.hasDepthSensing=function(){return w.texture!==null},this.getDepthSensingMesh=function(){return w.getMesh(V)},this.getCameraTexture=function(ie){return S[ie]};let H=null;function se(ie,ue){if(d=ue.getViewerPose(c||a),b=ue,d!==null){const le=d.views;v!==null&&(e.setRenderTargetFramebuffer(N,v.framebuffer),e.setRenderTarget(N));let fe=!1;le.length!==V.cameras.length&&(V.cameras.length=0,fe=!0);for(let We=0;We<le.length;We++){const Se=le[We];let Le=null;if(v!==null)Le=v.getViewport(Se);else{const Re=h.getViewSubImage(g,Se);Le=Re.viewport,We===0&&(e.setRenderTargetTextures(N,Re.colorTexture,Re.depthStencilTexture),e.setRenderTarget(N))}let pe=U[We];pe===void 0&&(pe=new ea,pe.layers.enable(We),pe.viewport=new ci,U[We]=pe),pe.matrix.fromArray(Se.transform.matrix),pe.matrix.decompose(pe.position,pe.quaternion,pe.scale),pe.projectionMatrix.fromArray(Se.projectionMatrix),pe.projectionMatrixInverse.copy(pe.projectionMatrix).invert(),pe.viewport.set(Le.x,Le.y,Le.width,Le.height),We===0&&(V.matrix.copy(pe.matrix),V.matrix.decompose(V.position,V.quaternion,V.scale)),fe===!0&&V.cameras.push(pe)}const xe=i.enabledFeatures;if(xe&&xe.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){h=r.getBinding();const We=h.getDepthInformation(le[0]);We&&We.isValid&&We.texture&&w.init(We,i.renderState)}if(xe&&xe.includes("camera-access")&&_){e.state.unbindTexture(),h=r.getBinding();for(let We=0;We<le.length;We++){const Se=le[We].camera;if(Se){let Le=S[Se];Le||(Le=new o9,S[Se]=Le);const pe=h.getCameraImage(Se);Le.sourceTexture=pe}}}}for(let le=0;le<I.length;le++){const fe=P[le],xe=I[le];fe!==null&&xe!==void 0&&xe.update(fe,ue,c||a)}H&&H(ie,ue),ue.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ue}),b=null}const re=new sK;re.setAnimationLoop(se),this.setAnimationLoop=function(ie){H=ie},this.dispose=function(){}}}const yg=new su,PTe=new rr;function DTe(t,e){function n(w,S){w.matrixAutoUpdate===!0&&w.updateMatrix(),S.value.copy(w.matrix)}function r(w,S){S.color.getRGB(w.fogColor.value,CY(t)),S.isFog?(w.fogNear.value=S.near,w.fogFar.value=S.far):S.isFogExp2&&(w.fogDensity.value=S.density)}function i(w,S,E,A,N){S.isMeshBasicMaterial?s(w,S):S.isMeshLambertMaterial?(s(w,S),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)):S.isMeshToonMaterial?(s(w,S),h(w,S)):S.isMeshPhongMaterial?(s(w,S),d(w,S),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)):S.isMeshStandardMaterial?(s(w,S),g(w,S),S.isMeshPhysicalMaterial&&v(w,S,N)):S.isMeshMatcapMaterial?(s(w,S),b(w,S)):S.isMeshDepthMaterial?s(w,S):S.isMeshDistanceMaterial?(s(w,S),_(w,S)):S.isMeshNormalMaterial?s(w,S):S.isLineBasicMaterial?(a(w,S),S.isLineDashedMaterial&&o(w,S)):S.isPointsMaterial?l(w,S,E,A):S.isSpriteMaterial?c(w,S):S.isShadowMaterial?(w.color.value.copy(S.color),w.opacity.value=S.opacity):S.isShaderMaterial&&(S.uniformsNeedUpdate=!1)}function s(w,S){w.opacity.value=S.opacity,S.color&&w.diffuse.value.copy(S.color),S.emissive&&w.emissive.value.copy(S.emissive).multiplyScalar(S.emissiveIntensity),S.map&&(w.map.value=S.map,n(S.map,w.mapTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,n(S.alphaMap,w.alphaMapTransform)),S.bumpMap&&(w.bumpMap.value=S.bumpMap,n(S.bumpMap,w.bumpMapTransform),w.bumpScale.value=S.bumpScale,S.side===Vl&&(w.bumpScale.value*=-1)),S.normalMap&&(w.normalMap.value=S.normalMap,n(S.normalMap,w.normalMapTransform),w.normalScale.value.copy(S.normalScale),S.side===Vl&&w.normalScale.value.negate()),S.displacementMap&&(w.displacementMap.value=S.displacementMap,n(S.displacementMap,w.displacementMapTransform),w.displacementScale.value=S.displacementScale,w.displacementBias.value=S.displacementBias),S.emissiveMap&&(w.emissiveMap.value=S.emissiveMap,n(S.emissiveMap,w.emissiveMapTransform)),S.specularMap&&(w.specularMap.value=S.specularMap,n(S.specularMap,w.specularMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest);const E=e.get(S),A=E.envMap,N=E.envMapRotation;A&&(w.envMap.value=A,yg.copy(N),yg.x*=-1,yg.y*=-1,yg.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(yg.y*=-1,yg.z*=-1),w.envMapRotation.value.setFromMatrix4(PTe.makeRotationFromEuler(yg)),w.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=S.reflectivity,w.ior.value=S.ior,w.refractionRatio.value=S.refractionRatio),S.lightMap&&(w.lightMap.value=S.lightMap,w.lightMapIntensity.value=S.lightMapIntensity,n(S.lightMap,w.lightMapTransform)),S.aoMap&&(w.aoMap.value=S.aoMap,w.aoMapIntensity.value=S.aoMapIntensity,n(S.aoMap,w.aoMapTransform))}function a(w,S){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,S.map&&(w.map.value=S.map,n(S.map,w.mapTransform))}function o(w,S){w.dashSize.value=S.dashSize,w.totalSize.value=S.dashSize+S.gapSize,w.scale.value=S.scale}function l(w,S,E,A){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,w.size.value=S.size*E,w.scale.value=A*.5,S.map&&(w.map.value=S.map,n(S.map,w.uvTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,n(S.alphaMap,w.alphaMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest)}function c(w,S){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,w.rotation.value=S.rotation,S.map&&(w.map.value=S.map,n(S.map,w.mapTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,n(S.alphaMap,w.alphaMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest)}function d(w,S){w.specular.value.copy(S.specular),w.shininess.value=Math.max(S.shininess,1e-4)}function h(w,S){S.gradientMap&&(w.gradientMap.value=S.gradientMap)}function g(w,S){w.metalness.value=S.metalness,S.metalnessMap&&(w.metalnessMap.value=S.metalnessMap,n(S.metalnessMap,w.metalnessMapTransform)),w.roughness.value=S.roughness,S.roughnessMap&&(w.roughnessMap.value=S.roughnessMap,n(S.roughnessMap,w.roughnessMapTransform)),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)}function v(w,S,E){w.ior.value=S.ior,S.sheen>0&&(w.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),w.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(w.sheenColorMap.value=S.sheenColorMap,n(S.sheenColorMap,w.sheenColorMapTransform)),S.sheenRoughnessMap&&(w.sheenRoughnessMap.value=S.sheenRoughnessMap,n(S.sheenRoughnessMap,w.sheenRoughnessMapTransform))),S.clearcoat>0&&(w.clearcoat.value=S.clearcoat,w.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(w.clearcoatMap.value=S.clearcoatMap,n(S.clearcoatMap,w.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,n(S.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(w.clearcoatNormalMap.value=S.clearcoatNormalMap,n(S.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),S.side===Vl&&w.clearcoatNormalScale.value.negate())),S.dispersion>0&&(w.dispersion.value=S.dispersion),S.iridescence>0&&(w.iridescence.value=S.iridescence,w.iridescenceIOR.value=S.iridescenceIOR,w.iridescenceThicknessMinimum.value=S.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=S.iridescenceThicknessRange[1],S.iridescenceMap&&(w.iridescenceMap.value=S.iridescenceMap,n(S.iridescenceMap,w.iridescenceMapTransform)),S.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=S.iridescenceThicknessMap,n(S.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),S.transmission>0&&(w.transmission.value=S.transmission,w.transmissionSamplerMap.value=E.texture,w.transmissionSamplerSize.value.set(E.width,E.height),S.transmissionMap&&(w.transmissionMap.value=S.transmissionMap,n(S.transmissionMap,w.transmissionMapTransform)),w.thickness.value=S.thickness,S.thicknessMap&&(w.thicknessMap.value=S.thicknessMap,n(S.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=S.attenuationDistance,w.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(w.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(w.anisotropyMap.value=S.anisotropyMap,n(S.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=S.specularIntensity,w.specularColor.value.copy(S.specularColor),S.specularColorMap&&(w.specularColorMap.value=S.specularColorMap,n(S.specularColorMap,w.specularColorMapTransform)),S.specularIntensityMap&&(w.specularIntensityMap.value=S.specularIntensityMap,n(S.specularIntensityMap,w.specularIntensityMapTransform))}function b(w,S){S.matcap&&(w.matcap.value=S.matcap)}function _(w,S){const E=e.get(S).light;w.referencePosition.value.setFromMatrixPosition(E.matrixWorld),w.nearDistance.value=E.shadow.camera.near,w.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function ITe(t,e,n,r){let i={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,A){const N=A.program;r.uniformBlockBinding(E,N)}function c(E,A){let N=i[E.id];N===void 0&&(b(E),N=d(E),i[E.id]=N,E.addEventListener("dispose",w));const I=A.program;r.updateUBOMapping(E,I);const P=e.render.frame;s[E.id]!==P&&(g(E),s[E.id]=P)}function d(E){const A=h();E.__bindingPointIndex=A;const N=t.createBuffer(),I=E.__size,P=E.usage;return t.bindBuffer(t.UNIFORM_BUFFER,N),t.bufferData(t.UNIFORM_BUFFER,I,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,A,N),N}function h(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return Hn("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(E){const A=i[E.id],N=E.uniforms,I=E.__cache;t.bindBuffer(t.UNIFORM_BUFFER,A);for(let P=0,L=N.length;P<L;P++){const R=Array.isArray(N[P])?N[P]:[N[P]];for(let O=0,W=R.length;O<W;O++){const U=R[O];if(v(U,P,O,I)===!0){const V=U.__offset,G=Array.isArray(U.value)?U.value:[U.value];let Z=0;for(let B=0;B<G.length;B++){const q=G[B],Y=_(q);typeof q=="number"||typeof q=="boolean"?(U.__data[0]=q,t.bufferSubData(t.UNIFORM_BUFFER,V+Z,U.__data)):q.isMatrix3?(U.__data[0]=q.elements[0],U.__data[1]=q.elements[1],U.__data[2]=q.elements[2],U.__data[3]=0,U.__data[4]=q.elements[3],U.__data[5]=q.elements[4],U.__data[6]=q.elements[5],U.__data[7]=0,U.__data[8]=q.elements[6],U.__data[9]=q.elements[7],U.__data[10]=q.elements[8],U.__data[11]=0):(q.toArray(U.__data,Z),Z+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,V,U.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function v(E,A,N,I){const P=E.value,L=A+"_"+N;if(I[L]===void 0)return typeof P=="number"||typeof P=="boolean"?I[L]=P:I[L]=P.clone(),!0;{const R=I[L];if(typeof P=="number"||typeof P=="boolean"){if(R!==P)return I[L]=P,!0}else if(R.equals(P)===!1)return R.copy(P),!0}return!1}function b(E){const A=E.uniforms;let N=0;const I=16;for(let L=0,R=A.length;L<R;L++){const O=Array.isArray(A[L])?A[L]:[A[L]];for(let W=0,U=O.length;W<U;W++){const V=O[W],G=Array.isArray(V.value)?V.value:[V.value];for(let Z=0,B=G.length;Z<B;Z++){const q=G[Z],Y=_(q),K=N%I,J=K%Y.boundary,F=K+J;N+=J,F!==0&&I-F<Y.storage&&(N+=I-F),V.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=N,N+=Y.storage}}}const P=N%I;return P>0&&(N+=I-P),E.__size=N,E.__cache={},this}function _(E){const A={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(A.boundary=4,A.storage=4):E.isVector2?(A.boundary=8,A.storage=8):E.isVector3||E.isColor?(A.boundary=16,A.storage=12):E.isVector4?(A.boundary=16,A.storage=16):E.isMatrix3?(A.boundary=48,A.storage=48):E.isMatrix4?(A.boundary=64,A.storage=64):E.isTexture?fn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):fn("WebGLRenderer: Unsupported uniform value type.",E),A}function w(E){const A=E.target;A.removeEventListener("dispose",w);const N=a.indexOf(A.__bindingPointIndex);a.splice(N,1),t.deleteBuffer(i[A.id]),delete i[A.id],delete s[A.id]}function S(){for(const E in i)t.deleteBuffer(i[E]);a=[],i={},s={}}return{bind:l,update:c,dispose:S}}const OTe=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 Rf=null;function LTe(){return Rf===null&&(Rf=new Bd(OTe,16,16,ov,ah),Rf.name="DFG_LUT",Rf.minFilter=rs,Rf.magFilter=rs,Rf.wrapS=Tc,Rf.wrapT=Tc,Rf.generateMipmaps=!1,Rf.needsUpdate=!0),Rf}class dK{constructor(e={}){const{canvas:n=nY(),context:r=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:g=!1,outputBufferType:v=zl}=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=a;const _=v,w=new Set([QT,ZT,bw]),S=new Set([zl,Ku,ey,ty,XT,YT]),E=new Uint32Array(4),A=new Int32Array(4);let N=null,I=null;const P=[],L=[];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=nu,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const O=this;let W=!1;this._outputColorSpace=cl;let U=0,V=0,G=null,Z=-1,B=null;const q=new ci,Y=new ci;let K=null;const J=new xn(0);let F=0,j=n.width,X=n.height,H=1,se=null,re=null;const ie=new ci(0,0,j,X),ue=new ci(0,0,j,X);let le=!1;const fe=new Ry;let xe=!1,he=!1;const Te=new rr,We=new ze,Se=new ci,Le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let pe=!1;function Re(){return G===null?H:1}let ne=r;function Xe(be,ot){return n.getContext(be,ot)}try{const be={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${xw}`),n.addEventListener("webglcontextlost",me,!1),n.addEventListener("webglcontextrestored",je,!1),n.addEventListener("webglcontextcreationerror",He,!1),ne===null){const ot="webgl2";if(ne=Xe(ot,be),ne===null)throw Xe(ot)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(be){throw Hn("WebGLRenderer: "+be.message),be}let Ae,Pe,Ke,oe,te,_e,ve,ye,ke,Be,ge,Ye,Qe,Ie,Fe,Ge,Me,$e,dt,Oe,st,ft,pt;function et(){Ae=new j2e(ne),Ae.init(),st=new uK(ne,Ae),Pe=new R2e(ne,Ae,e,st),Ke=new ETe(ne,Ae),Pe.reversedDepthBuffer&&g&&Ke.buffers.depth.setReversed(!0),oe=new B2e(ne),te=new fTe,_e=new CTe(ne,Ae,Ke,te,Pe,st,oe),ve=new z2e(O),ye=new $3e(ne),ft=new A2e(ne,ye),ke=new F2e(ne,ye,oe,ft),Be=new V2e(ne,ke,ye,ft,oe),$e=new H2e(ne,Pe,_e),Fe=new k2e(te),ge=new dTe(O,ve,Ae,Pe,ft,Fe),Ye=new DTe(O,te),Qe=new pTe,Ie=new bTe(Ae),Me=new C2e(O,ve,Ke,Be,b,l),Ge=new TTe(O,Be,Pe),pt=new ITe(ne,oe,Pe,Ke),dt=new N2e(ne,Ae,oe),Oe=new U2e(ne,Ae,oe),oe.programs=ge.programs,O.capabilities=Pe,O.extensions=Ae,O.properties=te,O.renderLists=Qe,O.shadowMap=Ge,O.state=Ke,O.info=oe}et(),_!==zl&&(R=new W2e(_,n.width,n.height,i,s));const Ze=new kTe(O,ne);this.xr=Ze,this.getContext=function(){return ne},this.getContextAttributes=function(){return ne.getContextAttributes()},this.forceContextLoss=function(){const be=Ae.get("WEBGL_lose_context");be&&be.loseContext()},this.forceContextRestore=function(){const be=Ae.get("WEBGL_lose_context");be&&be.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(be){be!==void 0&&(H=be,this.setSize(j,X,!1))},this.getSize=function(be){return be.set(j,X)},this.setSize=function(be,ot,_t=!0){if(Ze.isPresenting){fn("WebGLRenderer: Can't change size while VR device is presenting.");return}j=be,X=ot,n.width=Math.floor(be*H),n.height=Math.floor(ot*H),_t===!0&&(n.style.width=be+"px",n.style.height=ot+"px"),R!==null&&R.setSize(n.width,n.height),this.setViewport(0,0,be,ot)},this.getDrawingBufferSize=function(be){return be.set(j*H,X*H).floor()},this.setDrawingBufferSize=function(be,ot,_t){j=be,X=ot,H=_t,n.width=Math.floor(be*_t),n.height=Math.floor(ot*_t),this.setViewport(0,0,be,ot)},this.setEffects=function(be){if(_===zl){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(be){for(let ot=0;ot<be.length;ot++)if(be[ot].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}R.setEffects(be||[])},this.getCurrentViewport=function(be){return be.copy(q)},this.getViewport=function(be){return be.copy(ie)},this.setViewport=function(be,ot,_t,xt){be.isVector4?ie.set(be.x,be.y,be.z,be.w):ie.set(be,ot,_t,xt),Ke.viewport(q.copy(ie).multiplyScalar(H).round())},this.getScissor=function(be){return be.copy(ue)},this.setScissor=function(be,ot,_t,xt){be.isVector4?ue.set(be.x,be.y,be.z,be.w):ue.set(be,ot,_t,xt),Ke.scissor(Y.copy(ue).multiplyScalar(H).round())},this.getScissorTest=function(){return le},this.setScissorTest=function(be){Ke.setScissorTest(le=be)},this.setOpaqueSort=function(be){se=be},this.setTransparentSort=function(be){re=be},this.getClearColor=function(be){return be.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor(...arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha(...arguments)},this.clear=function(be=!0,ot=!0,_t=!0){let xt=0;if(be){let gt=!1;if(G!==null){const Yt=G.texture.format;gt=w.has(Yt)}if(gt){const Yt=G.texture.type,rn=S.has(Yt),sn=Me.getClearColor(),Zt=Me.getClearAlpha(),Mn=sn.r,Fn=sn.g,$n=sn.b;rn?(E[0]=Mn,E[1]=Fn,E[2]=$n,E[3]=Zt,ne.clearBufferuiv(ne.COLOR,0,E)):(A[0]=Mn,A[1]=Fn,A[2]=$n,A[3]=Zt,ne.clearBufferiv(ne.COLOR,0,A))}else xt|=ne.COLOR_BUFFER_BIT}ot&&(xt|=ne.DEPTH_BUFFER_BIT),_t&&(xt|=ne.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),xt!==0&&ne.clear(xt)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",me,!1),n.removeEventListener("webglcontextrestored",je,!1),n.removeEventListener("webglcontextcreationerror",He,!1),Me.dispose(),Qe.dispose(),Ie.dispose(),te.dispose(),ve.dispose(),Be.dispose(),ft.dispose(),pt.dispose(),ge.dispose(),Ze.dispose(),Ze.removeEventListener("sessionstart",Ve),Ze.removeEventListener("sessionend",wt),Et.stop()};function me(be){be.preventDefault(),SS("WebGLRenderer: Context Lost."),W=!0}function je(){SS("WebGLRenderer: Context Restored."),W=!1;const be=oe.autoReset,ot=Ge.enabled,_t=Ge.autoUpdate,xt=Ge.needsUpdate,gt=Ge.type;et(),oe.autoReset=be,Ge.enabled=ot,Ge.autoUpdate=_t,Ge.needsUpdate=xt,Ge.type=gt}function He(be){Hn("WebGLRenderer: A WebGL context could not be created. Reason: ",be.statusMessage)}function nt(be){const ot=be.target;ot.removeEventListener("dispose",nt),yt(ot)}function yt(be){lt(be),te.remove(be)}function lt(be){const ot=te.get(be).programs;ot!==void 0&&(ot.forEach(function(_t){ge.releaseProgram(_t)}),be.isShaderMaterial&&ge.releaseShaderCache(be))}this.renderBufferDirect=function(be,ot,_t,xt,gt,Yt){ot===null&&(ot=Le);const rn=gt.isMesh&&gt.matrixWorld.determinant()<0,sn=Bn(be,ot,_t,xt,gt);Ke.setMaterial(xt,rn);let Zt=_t.index,Mn=1;if(xt.wireframe===!0){if(Zt=ke.getWireframeAttribute(_t),Zt===void 0)return;Mn=2}const Fn=_t.drawRange,$n=_t.attributes.position;let on=Fn.start*Mn,ir=(Fn.start+Fn.count)*Mn;Yt!==null&&(on=Math.max(on,Yt.start*Mn),ir=Math.min(ir,(Yt.start+Yt.count)*Mn)),Zt!==null?(on=Math.max(on,0),ir=Math.min(ir,Zt.count)):$n!=null&&(on=Math.max(on,0),ir=Math.min(ir,$n.count));const qr=ir-on;if(qr<0||qr===1/0)return;ft.setup(gt,xt,sn,_t,Zt);let Jr,cr=dt;if(Zt!==null&&(Jr=ye.get(Zt),cr=Oe,cr.setIndex(Jr)),gt.isMesh)xt.wireframe===!0?(Ke.setLineWidth(xt.wireframeLinewidth*Re()),cr.setMode(ne.LINES)):cr.setMode(ne.TRIANGLES);else if(gt.isLine){let Nr=xt.linewidth;Nr===void 0&&(Nr=1),Ke.setLineWidth(Nr*Re()),gt.isLineSegments?cr.setMode(ne.LINES):gt.isLineLoop?cr.setMode(ne.LINE_LOOP):cr.setMode(ne.LINE_STRIP)}else gt.isPoints?cr.setMode(ne.POINTS):gt.isSprite&&cr.setMode(ne.TRIANGLES);if(gt.isBatchedMesh)if(gt._multiDrawInstances!==null)wS("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),cr.renderMultiDrawInstances(gt._multiDrawStarts,gt._multiDrawCounts,gt._multiDrawCount,gt._multiDrawInstances);else if(Ae.get("WEBGL_multi_draw"))cr.renderMultiDraw(gt._multiDrawStarts,gt._multiDrawCounts,gt._multiDrawCount);else{const Nr=gt._multiDrawStarts,en=gt._multiDrawCounts,ss=gt._multiDrawCount,Rn=Zt?ye.get(Zt).bytesPerElement:1,gs=te.get(xt).currentProgram.getUniforms();for(let Rs=0;Rs<ss;Rs++)gs.setValue(ne,"_gl_DrawID",Rs),cr.render(Nr[Rs]/Rn,en[Rs])}else if(gt.isInstancedMesh)cr.renderInstances(on,qr,gt.count);else if(_t.isInstancedBufferGeometry){const Nr=_t._maxInstanceCount!==void 0?_t._maxInstanceCount:1/0,en=Math.min(_t.instanceCount,Nr);cr.renderInstances(on,qr,en)}else cr.render(on,qr)};function bt(be,ot,_t){be.transparent===!0&&be.side===Xc&&be.forceSinglePass===!1?(be.side=Vl,be.needsUpdate=!0,pn(be,ot,_t),be.side=pp,be.needsUpdate=!0,pn(be,ot,_t),be.side=Xc):pn(be,ot,_t)}this.compile=function(be,ot,_t=null){_t===null&&(_t=be),I=Ie.get(_t),I.init(ot),L.push(I),_t.traverseVisible(function(gt){gt.isLight&&gt.layers.test(ot.layers)&&(I.pushLight(gt),gt.castShadow&&I.pushShadow(gt))}),be!==_t&&be.traverseVisible(function(gt){gt.isLight&&gt.layers.test(ot.layers)&&(I.pushLight(gt),gt.castShadow&&I.pushShadow(gt))}),I.setupLights();const xt=new Set;return be.traverse(function(gt){if(!(gt.isMesh||gt.isPoints||gt.isLine||gt.isSprite))return;const Yt=gt.material;if(Yt)if(Array.isArray(Yt))for(let rn=0;rn<Yt.length;rn++){const sn=Yt[rn];bt(sn,_t,gt),xt.add(sn)}else bt(Yt,_t,gt),xt.add(Yt)}),I=L.pop(),xt},this.compileAsync=function(be,ot,_t=null){const xt=this.compile(be,ot,_t);return new Promise(gt=>{function Yt(){if(xt.forEach(function(rn){te.get(rn).currentProgram.isReady()&&xt.delete(rn)}),xt.size===0){gt(be);return}setTimeout(Yt,10)}Ae.get("KHR_parallel_shader_compile")!==null?Yt():setTimeout(Yt,10)})};let Nt=null;function Pt(be){Nt&&Nt(be)}function Ve(){Et.stop()}function wt(){Et.start()}const Et=new sK;Et.setAnimationLoop(Pt),typeof self<"u"&&Et.setContext(self),this.setAnimationLoop=function(be){Nt=be,Ze.setAnimationLoop(be),be===null?Et.stop():Et.start()},Ze.addEventListener("sessionstart",Ve),Ze.addEventListener("sessionend",wt),this.render=function(be,ot){if(ot!==void 0&&ot.isCamera!==!0){Hn("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(W===!0)return;const _t=Ze.enabled===!0&&Ze.isPresenting===!0,xt=R!==null&&(G===null||_t)&&R.begin(O,G);if(be.matrixWorldAutoUpdate===!0&&be.updateMatrixWorld(),ot.parent===null&&ot.matrixWorldAutoUpdate===!0&&ot.updateMatrixWorld(),Ze.enabled===!0&&Ze.isPresenting===!0&&(R===null||R.isCompositing()===!1)&&(Ze.cameraAutoUpdate===!0&&Ze.updateCamera(ot),ot=Ze.getCamera()),be.isScene===!0&&be.onBeforeRender(O,be,ot,G),I=Ie.get(be,L.length),I.init(ot),L.push(I),Te.multiplyMatrices(ot.projectionMatrix,ot.matrixWorldInverse),fe.setFromProjectionMatrix(Te,Zc,ot.reversedDepth),he=this.localClippingEnabled,xe=Fe.init(this.clippingPlanes,he),N=Qe.get(be,P.length),N.init(),P.push(N),Ze.enabled===!0&&Ze.isPresenting===!0){const rn=O.xr.getDepthSensingMesh();rn!==null&&zt(rn,ot,-1/0,O.sortObjects)}zt(be,ot,0,O.sortObjects),N.finish(),O.sortObjects===!0&&N.sort(se,re),pe=Ze.enabled===!1||Ze.isPresenting===!1||Ze.hasDepthSensing()===!1,pe&&Me.addToRenderList(N,be),this.info.render.frame++,xe===!0&&Fe.beginShadows();const gt=I.state.shadowsArray;if(Ge.render(gt,be,ot),xe===!0&&Fe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(xt&&R.hasRenderPass())===!1){const rn=N.opaque,sn=N.transmissive;if(I.setupLights(),ot.isArrayCamera){const Zt=ot.cameras;if(sn.length>0)for(let Mn=0,Fn=Zt.length;Mn<Fn;Mn++){const $n=Zt[Mn];an(rn,sn,be,$n)}pe&&Me.render(be);for(let Mn=0,Fn=Zt.length;Mn<Fn;Mn++){const $n=Zt[Mn];Ht(N,be,$n,$n.viewport)}}else sn.length>0&&an(rn,sn,be,ot),pe&&Me.render(be),Ht(N,be,ot)}G!==null&&V===0&&(_e.updateMultisampleRenderTarget(G),_e.updateRenderTargetMipmap(G)),xt&&R.end(O),be.isScene===!0&&be.onAfterRender(O,be,ot),ft.resetDefaultState(),Z=-1,B=null,L.pop(),L.length>0?(I=L[L.length-1],xe===!0&&Fe.setGlobalState(O.clippingPlanes,I.state.camera)):I=null,P.pop(),P.length>0?N=P[P.length-1]:N=null};function zt(be,ot,_t,xt){if(be.visible===!1)return;if(be.layers.test(ot.layers)){if(be.isGroup)_t=be.renderOrder;else if(be.isLOD)be.autoUpdate===!0&&be.update(ot);else if(be.isLight)I.pushLight(be),be.castShadow&&I.pushShadow(be);else if(be.isSprite){if(!be.frustumCulled||fe.intersectsSprite(be)){xt&&Se.setFromMatrixPosition(be.matrixWorld).applyMatrix4(Te);const rn=Be.update(be),sn=be.material;sn.visible&&N.push(be,rn,sn,_t,Se.z,null)}}else if((be.isMesh||be.isLine||be.isPoints)&&(!be.frustumCulled||fe.intersectsObject(be))){const rn=Be.update(be),sn=be.material;if(xt&&(be.boundingSphere!==void 0?(be.boundingSphere===null&&be.computeBoundingSphere(),Se.copy(be.boundingSphere.center)):(rn.boundingSphere===null&&rn.computeBoundingSphere(),Se.copy(rn.boundingSphere.center)),Se.applyMatrix4(be.matrixWorld).applyMatrix4(Te)),Array.isArray(sn)){const Zt=rn.groups;for(let Mn=0,Fn=Zt.length;Mn<Fn;Mn++){const $n=Zt[Mn],on=sn[$n.materialIndex];on&&on.visible&&N.push(be,rn,on,_t,Se.z,$n)}}else sn.visible&&N.push(be,rn,sn,_t,Se.z,null)}}const Yt=be.children;for(let rn=0,sn=Yt.length;rn<sn;rn++)zt(Yt[rn],ot,_t,xt)}function Ht(be,ot,_t,xt){const{opaque:gt,transmissive:Yt,transparent:rn}=be;I.setupLightsView(_t),xe===!0&&Fe.setGlobalState(O.clippingPlanes,_t),xt&&Ke.viewport(q.copy(xt)),gt.length>0&&Dn(gt,ot,_t),Yt.length>0&&Dn(Yt,ot,_t),rn.length>0&&Dn(rn,ot,_t),Ke.buffers.depth.setTest(!0),Ke.buffers.depth.setMask(!0),Ke.buffers.color.setMask(!0),Ke.setPolygonOffset(!1)}function an(be,ot,_t,xt){if((_t.isScene===!0?_t.overrideMaterial:null)!==null)return;if(I.state.transmissionRenderTarget[xt.id]===void 0){const on=Ae.has("EXT_color_buffer_half_float")||Ae.has("EXT_color_buffer_float");I.state.transmissionRenderTarget[xt.id]=new iu(1,1,{generateMipmaps:!0,type:on?ah:zl,minFilter:Kf,samples:Pe.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ii.workingColorSpace})}const Yt=I.state.transmissionRenderTarget[xt.id],rn=xt.viewport||q;Yt.setSize(rn.z*O.transmissionResolutionScale,rn.w*O.transmissionResolutionScale);const sn=O.getRenderTarget(),Zt=O.getActiveCubeFace(),Mn=O.getActiveMipmapLevel();O.setRenderTarget(Yt),O.getClearColor(J),F=O.getClearAlpha(),F<1&&O.setClearColor(16777215,.5),O.clear(),pe&&Me.render(_t);const Fn=O.toneMapping;O.toneMapping=nu;const $n=xt.viewport;if(xt.viewport!==void 0&&(xt.viewport=void 0),I.setupLightsView(xt),xe===!0&&Fe.setGlobalState(O.clippingPlanes,xt),Dn(be,_t,xt),_e.updateMultisampleRenderTarget(Yt),_e.updateRenderTargetMipmap(Yt),Ae.has("WEBGL_multisampled_render_to_texture")===!1){let on=!1;for(let ir=0,qr=ot.length;ir<qr;ir++){const Jr=ot[ir],{object:cr,geometry:Nr,material:en,group:ss}=Jr;if(en.side===Xc&&cr.layers.test(xt.layers)){const Rn=en.side;en.side=Vl,en.needsUpdate=!0,Vt(cr,_t,xt,Nr,en,ss),en.side=Rn,en.needsUpdate=!0,on=!0}}on===!0&&(_e.updateMultisampleRenderTarget(Yt),_e.updateRenderTargetMipmap(Yt))}O.setRenderTarget(sn,Zt,Mn),O.setClearColor(J,F),$n!==void 0&&(xt.viewport=$n),O.toneMapping=Fn}function Dn(be,ot,_t){const xt=ot.isScene===!0?ot.overrideMaterial:null;for(let gt=0,Yt=be.length;gt<Yt;gt++){const rn=be[gt],{object:sn,geometry:Zt,group:Mn}=rn;let Fn=rn.material;Fn.allowOverride===!0&&xt!==null&&(Fn=xt),sn.layers.test(_t.layers)&&Vt(sn,ot,_t,Zt,Fn,Mn)}}function Vt(be,ot,_t,xt,gt,Yt){be.onBeforeRender(O,ot,_t,xt,gt,Yt),be.modelViewMatrix.multiplyMatrices(_t.matrixWorldInverse,be.matrixWorld),be.normalMatrix.getNormalMatrix(be.modelViewMatrix),gt.onBeforeRender(O,ot,_t,xt,be,Yt),gt.transparent===!0&&gt.side===Xc&&gt.forceSinglePass===!1?(gt.side=Vl,gt.needsUpdate=!0,O.renderBufferDirect(_t,ot,xt,gt,be,Yt),gt.side=pp,gt.needsUpdate=!0,O.renderBufferDirect(_t,ot,xt,gt,be,Yt),gt.side=Xc):O.renderBufferDirect(_t,ot,xt,gt,be,Yt),be.onAfterRender(O,ot,_t,xt,gt,Yt)}function pn(be,ot,_t){ot.isScene!==!0&&(ot=Le);const xt=te.get(be),gt=I.state.lights,Yt=I.state.shadowsArray,rn=gt.state.version,sn=ge.getParameters(be,gt.state,Yt,ot,_t),Zt=ge.getProgramCacheKey(sn);let Mn=xt.programs;xt.environment=be.isMeshStandardMaterial||be.isMeshLambertMaterial||be.isMeshPhongMaterial?ot.environment:null,xt.fog=ot.fog;const Fn=be.isMeshStandardMaterial||be.isMeshLambertMaterial&&!be.envMap||be.isMeshPhongMaterial&&!be.envMap;xt.envMap=ve.get(be.envMap||xt.environment,Fn),xt.envMapRotation=xt.environment!==null&&be.envMap===null?ot.environmentRotation:be.envMapRotation,Mn===void 0&&(be.addEventListener("dispose",nt),Mn=new Map,xt.programs=Mn);let $n=Mn.get(Zt);if($n!==void 0){if(xt.currentProgram===$n&&xt.lightsStateVersion===rn)return Cn(be,sn),$n}else sn.uniforms=ge.getUniforms(be),be.onBeforeCompile(sn,O),$n=ge.acquireProgram(sn,Zt),Mn.set(Zt,$n),xt.uniforms=sn.uniforms;const on=xt.uniforms;return(!be.isShaderMaterial&&!be.isRawShaderMaterial||be.clipping===!0)&&(on.clippingPlanes=Fe.uniform),Cn(be,sn),xt.needsLights=On(be),xt.lightsStateVersion=rn,xt.needsLights&&(on.ambientLightColor.value=gt.state.ambient,on.lightProbe.value=gt.state.probe,on.directionalLights.value=gt.state.directional,on.directionalLightShadows.value=gt.state.directionalShadow,on.spotLights.value=gt.state.spot,on.spotLightShadows.value=gt.state.spotShadow,on.rectAreaLights.value=gt.state.rectArea,on.ltc_1.value=gt.state.rectAreaLTC1,on.ltc_2.value=gt.state.rectAreaLTC2,on.pointLights.value=gt.state.point,on.pointLightShadows.value=gt.state.pointShadow,on.hemisphereLights.value=gt.state.hemi,on.directionalShadowMatrix.value=gt.state.directionalShadowMatrix,on.spotLightMatrix.value=gt.state.spotLightMatrix,on.spotLightMap.value=gt.state.spotLightMap,on.pointShadowMatrix.value=gt.state.pointShadowMatrix),xt.currentProgram=$n,xt.uniformsList=null,$n}function Bt(be){if(be.uniformsList===null){const ot=be.currentProgram.getUniforms();be.uniformsList=HM.seqWithValue(ot.seq,be.uniforms)}return be.uniformsList}function Cn(be,ot){const _t=te.get(be);_t.outputColorSpace=ot.outputColorSpace,_t.batching=ot.batching,_t.batchingColor=ot.batchingColor,_t.instancing=ot.instancing,_t.instancingColor=ot.instancingColor,_t.instancingMorph=ot.instancingMorph,_t.skinning=ot.skinning,_t.morphTargets=ot.morphTargets,_t.morphNormals=ot.morphNormals,_t.morphColors=ot.morphColors,_t.morphTargetsCount=ot.morphTargetsCount,_t.numClippingPlanes=ot.numClippingPlanes,_t.numIntersection=ot.numClipIntersection,_t.vertexAlphas=ot.vertexAlphas,_t.vertexTangents=ot.vertexTangents,_t.toneMapping=ot.toneMapping}function Bn(be,ot,_t,xt,gt){ot.isScene!==!0&&(ot=Le),_e.resetTextureUnits();const Yt=ot.fog,rn=xt.isMeshStandardMaterial||xt.isMeshLambertMaterial||xt.isMeshPhongMaterial?ot.environment:null,sn=G===null?O.outputColorSpace:G.isXRRenderTarget===!0?G.texture.colorSpace:nm,Zt=xt.isMeshStandardMaterial||xt.isMeshLambertMaterial&&!xt.envMap||xt.isMeshPhongMaterial&&!xt.envMap,Mn=ve.get(xt.envMap||rn,Zt),Fn=xt.vertexColors===!0&&!!_t.attributes.color&&_t.attributes.color.itemSize===4,$n=!!_t.attributes.tangent&&(!!xt.normalMap||xt.anisotropy>0),on=!!_t.morphAttributes.position,ir=!!_t.morphAttributes.normal,qr=!!_t.morphAttributes.color;let Jr=nu;xt.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&(Jr=O.toneMapping);const cr=_t.morphAttributes.position||_t.morphAttributes.normal||_t.morphAttributes.color,Nr=cr!==void 0?cr.length:0,en=te.get(xt),ss=I.state.lights;if(xe===!0&&(he===!0||be!==B)){const Di=be===B&&xt.id===Z;Fe.setState(xt,be,Di)}let Rn=!1;xt.version===en.__version?(en.needsLights&&en.lightsStateVersion!==ss.state.version||en.outputColorSpace!==sn||gt.isBatchedMesh&&en.batching===!1||!gt.isBatchedMesh&&en.batching===!0||gt.isBatchedMesh&&en.batchingColor===!0&&gt.colorTexture===null||gt.isBatchedMesh&&en.batchingColor===!1&&gt.colorTexture!==null||gt.isInstancedMesh&&en.instancing===!1||!gt.isInstancedMesh&&en.instancing===!0||gt.isSkinnedMesh&&en.skinning===!1||!gt.isSkinnedMesh&&en.skinning===!0||gt.isInstancedMesh&&en.instancingColor===!0&&gt.instanceColor===null||gt.isInstancedMesh&&en.instancingColor===!1&&gt.instanceColor!==null||gt.isInstancedMesh&&en.instancingMorph===!0&&gt.morphTexture===null||gt.isInstancedMesh&&en.instancingMorph===!1&&gt.morphTexture!==null||en.envMap!==Mn||xt.fog===!0&&en.fog!==Yt||en.numClippingPlanes!==void 0&&(en.numClippingPlanes!==Fe.numPlanes||en.numIntersection!==Fe.numIntersection)||en.vertexAlphas!==Fn||en.vertexTangents!==$n||en.morphTargets!==on||en.morphNormals!==ir||en.morphColors!==qr||en.toneMapping!==Jr||en.morphTargetsCount!==Nr)&&(Rn=!0):(Rn=!0,en.__version=xt.version);let gs=en.currentProgram;Rn===!0&&(gs=pn(xt,ot,gt));let Rs=!1,Pi=!1,vs=!1;const pr=gs.getUniforms(),di=en.uniforms;if(Ke.useProgram(gs.program)&&(Rs=!0,Pi=!0,vs=!0),xt.id!==Z&&(Z=xt.id,Pi=!0),Rs||B!==be){Ke.buffers.depth.getReversed()&&be.reversedDepth!==!0&&(be._reversedDepth=!0,be.updateProjectionMatrix()),pr.setValue(ne,"projectionMatrix",be.projectionMatrix),pr.setValue(ne,"viewMatrix",be.matrixWorldInverse);const $a=pr.map.cameraPosition;$a!==void 0&&$a.setValue(ne,We.setFromMatrixPosition(be.matrixWorld)),Pe.logarithmicDepthBuffer&&pr.setValue(ne,"logDepthBufFC",2/(Math.log(be.far+1)/Math.LN2)),(xt.isMeshPhongMaterial||xt.isMeshToonMaterial||xt.isMeshLambertMaterial||xt.isMeshBasicMaterial||xt.isMeshStandardMaterial||xt.isShaderMaterial)&&pr.setValue(ne,"isOrthographic",be.isOrthographicCamera===!0),B!==be&&(B=be,Pi=!0,vs=!0)}if(en.needsLights&&(ss.state.directionalShadowMap.length>0&&pr.setValue(ne,"directionalShadowMap",ss.state.directionalShadowMap,_e),ss.state.spotShadowMap.length>0&&pr.setValue(ne,"spotShadowMap",ss.state.spotShadowMap,_e),ss.state.pointShadowMap.length>0&&pr.setValue(ne,"pointShadowMap",ss.state.pointShadowMap,_e)),gt.isSkinnedMesh){pr.setOptional(ne,gt,"bindMatrix"),pr.setOptional(ne,gt,"bindMatrixInverse");const Di=gt.skeleton;Di&&(Di.boneTexture===null&&Di.computeBoneTexture(),pr.setValue(ne,"boneTexture",Di.boneTexture,_e))}gt.isBatchedMesh&&(pr.setOptional(ne,gt,"batchingTexture"),pr.setValue(ne,"batchingTexture",gt._matricesTexture,_e),pr.setOptional(ne,gt,"batchingIdTexture"),pr.setValue(ne,"batchingIdTexture",gt._indirectTexture,_e),pr.setOptional(ne,gt,"batchingColorTexture"),gt._colorsTexture!==null&&pr.setValue(ne,"batchingColorTexture",gt._colorsTexture,_e));const ks=_t.morphAttributes;if((ks.position!==void 0||ks.normal!==void 0||ks.color!==void 0)&&$e.update(gt,_t,gs),(Pi||en.receiveShadow!==gt.receiveShadow)&&(en.receiveShadow=gt.receiveShadow,pr.setValue(ne,"receiveShadow",gt.receiveShadow)),(xt.isMeshStandardMaterial||xt.isMeshLambertMaterial||xt.isMeshPhongMaterial)&&xt.envMap===null&&ot.environment!==null&&(di.envMapIntensity.value=ot.environmentIntensity),di.dfgLUT!==void 0&&(di.dfgLUT.value=LTe()),Pi&&(pr.setValue(ne,"toneMappingExposure",O.toneMappingExposure),en.needsLights&&wn(di,vs),Yt&&xt.fog===!0&&Ye.refreshFogUniforms(di,Yt),Ye.refreshMaterialUniforms(di,xt,H,X,I.state.transmissionRenderTarget[be.id]),HM.upload(ne,Bt(en),di,_e)),xt.isShaderMaterial&&xt.uniformsNeedUpdate===!0&&(HM.upload(ne,Bt(en),di,_e),xt.uniformsNeedUpdate=!1),xt.isSpriteMaterial&&pr.setValue(ne,"center",gt.center),pr.setValue(ne,"modelViewMatrix",gt.modelViewMatrix),pr.setValue(ne,"normalMatrix",gt.normalMatrix),pr.setValue(ne,"modelMatrix",gt.matrixWorld),xt.isShaderMaterial||xt.isRawShaderMaterial){const Di=xt.uniformsGroups;for(let $a=0,co=Di.length;$a<co;$a++){const So=Di[$a];pt.update(So,gs),pt.bind(So,gs)}}return gs}function wn(be,ot){be.ambientLightColor.needsUpdate=ot,be.lightProbe.needsUpdate=ot,be.directionalLights.needsUpdate=ot,be.directionalLightShadows.needsUpdate=ot,be.pointLights.needsUpdate=ot,be.pointLightShadows.needsUpdate=ot,be.spotLights.needsUpdate=ot,be.spotLightShadows.needsUpdate=ot,be.rectAreaLights.needsUpdate=ot,be.hemisphereLights.needsUpdate=ot}function On(be){return be.isMeshLambertMaterial||be.isMeshToonMaterial||be.isMeshPhongMaterial||be.isMeshStandardMaterial||be.isShadowMaterial||be.isShaderMaterial&&be.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return G},this.setRenderTargetTextures=function(be,ot,_t){const xt=te.get(be);xt.__autoAllocateDepthBuffer=be.resolveDepthBuffer===!1,xt.__autoAllocateDepthBuffer===!1&&(xt.__useRenderToTexture=!1),te.get(be.texture).__webglTexture=ot,te.get(be.depthTexture).__webglTexture=xt.__autoAllocateDepthBuffer?void 0:_t,xt.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(be,ot){const _t=te.get(be);_t.__webglFramebuffer=ot,_t.__useDefaultFramebuffer=ot===void 0};const jn=ne.createFramebuffer();this.setRenderTarget=function(be,ot=0,_t=0){G=be,U=ot,V=_t;let xt=null,gt=!1,Yt=!1;if(be){const sn=te.get(be);if(sn.__useDefaultFramebuffer!==void 0){Ke.bindFramebuffer(ne.FRAMEBUFFER,sn.__webglFramebuffer),q.copy(be.viewport),Y.copy(be.scissor),K=be.scissorTest,Ke.viewport(q),Ke.scissor(Y),Ke.setScissorTest(K),Z=-1;return}else if(sn.__webglFramebuffer===void 0)_e.setupRenderTarget(be);else if(sn.__hasExternalTextures)_e.rebindTextures(be,te.get(be.texture).__webglTexture,te.get(be.depthTexture).__webglTexture);else if(be.depthBuffer){const Fn=be.depthTexture;if(sn.__boundDepthTexture!==Fn){if(Fn!==null&&te.has(Fn)&&(be.width!==Fn.image.width||be.height!==Fn.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");_e.setupDepthRenderbuffer(be)}}const Zt=be.texture;(Zt.isData3DTexture||Zt.isDataArrayTexture||Zt.isCompressedArrayTexture)&&(Yt=!0);const Mn=te.get(be).__webglFramebuffer;be.isWebGLCubeRenderTarget?(Array.isArray(Mn[ot])?xt=Mn[ot][_t]:xt=Mn[ot],gt=!0):be.samples>0&&_e.useMultisampledRTT(be)===!1?xt=te.get(be).__webglMultisampledFramebuffer:Array.isArray(Mn)?xt=Mn[_t]:xt=Mn,q.copy(be.viewport),Y.copy(be.scissor),K=be.scissorTest}else q.copy(ie).multiplyScalar(H).floor(),Y.copy(ue).multiplyScalar(H).floor(),K=le;if(_t!==0&&(xt=jn),Ke.bindFramebuffer(ne.FRAMEBUFFER,xt)&&Ke.drawBuffers(be,xt),Ke.viewport(q),Ke.scissor(Y),Ke.setScissorTest(K),gt){const sn=te.get(be.texture);ne.framebufferTexture2D(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_CUBE_MAP_POSITIVE_X+ot,sn.__webglTexture,_t)}else if(Yt){const sn=ot;for(let Zt=0;Zt<be.textures.length;Zt++){const Mn=te.get(be.textures[Zt]);ne.framebufferTextureLayer(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0+Zt,Mn.__webglTexture,_t,sn)}}else if(be!==null&&_t!==0){const sn=te.get(be.texture);ne.framebufferTexture2D(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_2D,sn.__webglTexture,_t)}Z=-1},this.readRenderTargetPixels=function(be,ot,_t,xt,gt,Yt,rn,sn=0){if(!(be&&be.isWebGLRenderTarget)){Hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Zt=te.get(be).__webglFramebuffer;if(be.isWebGLCubeRenderTarget&&rn!==void 0&&(Zt=Zt[rn]),Zt){Ke.bindFramebuffer(ne.FRAMEBUFFER,Zt);try{const Mn=be.textures[sn],Fn=Mn.format,$n=Mn.type;if(be.textures.length>1&&ne.readBuffer(ne.COLOR_ATTACHMENT0+sn),!Pe.textureFormatReadable(Fn)){Hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Pe.textureTypeReadable($n)){Hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ot>=0&&ot<=be.width-xt&&_t>=0&&_t<=be.height-gt&&ne.readPixels(ot,_t,xt,gt,st.convert(Fn),st.convert($n),Yt)}finally{const Mn=G!==null?te.get(G).__webglFramebuffer:null;Ke.bindFramebuffer(ne.FRAMEBUFFER,Mn)}}},this.readRenderTargetPixelsAsync=async function(be,ot,_t,xt,gt,Yt,rn,sn=0){if(!(be&&be.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Zt=te.get(be).__webglFramebuffer;if(be.isWebGLCubeRenderTarget&&rn!==void 0&&(Zt=Zt[rn]),Zt)if(ot>=0&&ot<=be.width-xt&&_t>=0&&_t<=be.height-gt){Ke.bindFramebuffer(ne.FRAMEBUFFER,Zt);const Mn=be.textures[sn],Fn=Mn.format,$n=Mn.type;if(be.textures.length>1&&ne.readBuffer(ne.COLOR_ATTACHMENT0+sn),!Pe.textureFormatReadable(Fn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Pe.textureTypeReadable($n))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const on=ne.createBuffer();ne.bindBuffer(ne.PIXEL_PACK_BUFFER,on),ne.bufferData(ne.PIXEL_PACK_BUFFER,Yt.byteLength,ne.STREAM_READ),ne.readPixels(ot,_t,xt,gt,st.convert(Fn),st.convert($n),0);const ir=G!==null?te.get(G).__webglFramebuffer:null;Ke.bindFramebuffer(ne.FRAMEBUFFER,ir);const qr=ne.fenceSync(ne.SYNC_GPU_COMMANDS_COMPLETE,0);return ne.flush(),await K_e(ne,qr,4),ne.bindBuffer(ne.PIXEL_PACK_BUFFER,on),ne.getBufferSubData(ne.PIXEL_PACK_BUFFER,0,Yt),ne.deleteBuffer(on),ne.deleteSync(qr),Yt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(be,ot=null,_t=0){const xt=Math.pow(2,-_t),gt=Math.floor(be.image.width*xt),Yt=Math.floor(be.image.height*xt),rn=ot!==null?ot.x:0,sn=ot!==null?ot.y:0;_e.setTexture2D(be,0),ne.copyTexSubImage2D(ne.TEXTURE_2D,_t,0,0,rn,sn,gt,Yt),Ke.unbindTexture()};const Bi=ne.createFramebuffer(),ui=ne.createFramebuffer();this.copyTextureToTexture=function(be,ot,_t=null,xt=null,gt=0,Yt=0){let rn,sn,Zt,Mn,Fn,$n,on,ir,qr;const Jr=be.isCompressedTexture?be.mipmaps[Yt]:be.image;if(_t!==null)rn=_t.max.x-_t.min.x,sn=_t.max.y-_t.min.y,Zt=_t.isBox3?_t.max.z-_t.min.z:1,Mn=_t.min.x,Fn=_t.min.y,$n=_t.isBox3?_t.min.z:0;else{const di=Math.pow(2,-gt);rn=Math.floor(Jr.width*di),sn=Math.floor(Jr.height*di),be.isDataArrayTexture?Zt=Jr.depth:be.isData3DTexture?Zt=Math.floor(Jr.depth*di):Zt=1,Mn=0,Fn=0,$n=0}xt!==null?(on=xt.x,ir=xt.y,qr=xt.z):(on=0,ir=0,qr=0);const cr=st.convert(ot.format),Nr=st.convert(ot.type);let en;ot.isData3DTexture?(_e.setTexture3D(ot,0),en=ne.TEXTURE_3D):ot.isDataArrayTexture||ot.isCompressedArrayTexture?(_e.setTexture2DArray(ot,0),en=ne.TEXTURE_2D_ARRAY):(_e.setTexture2D(ot,0),en=ne.TEXTURE_2D),ne.pixelStorei(ne.UNPACK_FLIP_Y_WEBGL,ot.flipY),ne.pixelStorei(ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ot.premultiplyAlpha),ne.pixelStorei(ne.UNPACK_ALIGNMENT,ot.unpackAlignment);const ss=ne.getParameter(ne.UNPACK_ROW_LENGTH),Rn=ne.getParameter(ne.UNPACK_IMAGE_HEIGHT),gs=ne.getParameter(ne.UNPACK_SKIP_PIXELS),Rs=ne.getParameter(ne.UNPACK_SKIP_ROWS),Pi=ne.getParameter(ne.UNPACK_SKIP_IMAGES);ne.pixelStorei(ne.UNPACK_ROW_LENGTH,Jr.width),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,Jr.height),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,Mn),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,Fn),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,$n);const vs=be.isDataArrayTexture||be.isData3DTexture,pr=ot.isDataArrayTexture||ot.isData3DTexture;if(be.isDepthTexture){const di=te.get(be),ks=te.get(ot),Di=te.get(di.__renderTarget),$a=te.get(ks.__renderTarget);Ke.bindFramebuffer(ne.READ_FRAMEBUFFER,Di.__webglFramebuffer),Ke.bindFramebuffer(ne.DRAW_FRAMEBUFFER,$a.__webglFramebuffer);for(let co=0;co<Zt;co++)vs&&(ne.framebufferTextureLayer(ne.READ_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,te.get(be).__webglTexture,gt,$n+co),ne.framebufferTextureLayer(ne.DRAW_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,te.get(ot).__webglTexture,Yt,qr+co)),ne.blitFramebuffer(Mn,Fn,rn,sn,on,ir,rn,sn,ne.DEPTH_BUFFER_BIT,ne.NEAREST);Ke.bindFramebuffer(ne.READ_FRAMEBUFFER,null),Ke.bindFramebuffer(ne.DRAW_FRAMEBUFFER,null)}else if(gt!==0||be.isRenderTargetTexture||te.has(be)){const di=te.get(be),ks=te.get(ot);Ke.bindFramebuffer(ne.READ_FRAMEBUFFER,Bi),Ke.bindFramebuffer(ne.DRAW_FRAMEBUFFER,ui);for(let Di=0;Di<Zt;Di++)vs?ne.framebufferTextureLayer(ne.READ_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,di.__webglTexture,gt,$n+Di):ne.framebufferTexture2D(ne.READ_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_2D,di.__webglTexture,gt),pr?ne.framebufferTextureLayer(ne.DRAW_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ks.__webglTexture,Yt,qr+Di):ne.framebufferTexture2D(ne.DRAW_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_2D,ks.__webglTexture,Yt),gt!==0?ne.blitFramebuffer(Mn,Fn,rn,sn,on,ir,rn,sn,ne.COLOR_BUFFER_BIT,ne.NEAREST):pr?ne.copyTexSubImage3D(en,Yt,on,ir,qr+Di,Mn,Fn,rn,sn):ne.copyTexSubImage2D(en,Yt,on,ir,Mn,Fn,rn,sn);Ke.bindFramebuffer(ne.READ_FRAMEBUFFER,null),Ke.bindFramebuffer(ne.DRAW_FRAMEBUFFER,null)}else pr?be.isDataTexture||be.isData3DTexture?ne.texSubImage3D(en,Yt,on,ir,qr,rn,sn,Zt,cr,Nr,Jr.data):ot.isCompressedArrayTexture?ne.compressedTexSubImage3D(en,Yt,on,ir,qr,rn,sn,Zt,cr,Jr.data):ne.texSubImage3D(en,Yt,on,ir,qr,rn,sn,Zt,cr,Nr,Jr):be.isDataTexture?ne.texSubImage2D(ne.TEXTURE_2D,Yt,on,ir,rn,sn,cr,Nr,Jr.data):be.isCompressedTexture?ne.compressedTexSubImage2D(ne.TEXTURE_2D,Yt,on,ir,Jr.width,Jr.height,cr,Jr.data):ne.texSubImage2D(ne.TEXTURE_2D,Yt,on,ir,rn,sn,cr,Nr,Jr);ne.pixelStorei(ne.UNPACK_ROW_LENGTH,ss),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,Rn),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,gs),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,Rs),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,Pi),Yt===0&&ot.generateMipmaps&&ne.generateMipmap(en),Ke.unbindTexture()},this.initRenderTarget=function(be){te.get(be).__webglFramebuffer===void 0&&_e.setupRenderTarget(be)},this.initTexture=function(be){be.isCubeTexture?_e.setTextureCube(be,0):be.isData3DTexture?_e.setTexture3D(be,0):be.isDataArrayTexture||be.isCompressedArrayTexture?_e.setTexture2DArray(be,0):_e.setTexture2D(be,0),Ke.unbindTexture()},this.resetState=function(){U=0,V=0,G=null,Ke.reset(),ft.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Zc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=ii._getDrawingBufferColorSpace(e),n.unpackColorSpace=ii._getUnpackColorSpace()}}const zTe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:WT,AddEquation:E0,AddOperation:BX,AdditiveAnimationBlendMode:Qk,AdditiveBlending:OR,AgXToneMapping:Vk,AlphaFormat:Kk,AlwaysCompare:eY,AlwaysDepth:D2,AlwaysStencilFunc:UR,AmbientLight:WY,AnimationAction:eK,AnimationClip:RS,AnimationLoader:Uwe,AnimationMixer:g3e,AnimationObjectGroup:p3e,AnimationUtils:Lwe,ArcCurve:vY,ArrayCamera:KY,ArrowHelper:z3e,AttachedBindMode:jR,Audio:QY,AudioAnalyser:i3e,AudioContext:M9,AudioListener:t3e,AudioLoader:Zwe,AxesHelper:j3e,BackSide:Vl,BasicDepthPacking:$X,BasicShadowMap:_X,BatchedMesh:fY,BezierInterpolant:jY,Bone:s9,BooleanKeyframeTrack:Ev,Box2:S3e,Box3:Ca,Box3Helper:O3e,BoxGeometry:Tv,BoxHelper:I3e,BufferAttribute:Vi,BufferGeometry:br,BufferGeometryLoader:XY,ByteType:$k,Cache:Zf,Camera:TE,CameraHelper:D3e,CanvasTexture:nwe,CapsuleGeometry:uE,CatmullRomCurve3:xY,CineonToneMapping:Bk,CircleGeometry:dE,ClampToEdgeWrapping:Tc,Clock:nK,Color:xn,ColorKeyframeTrack:b9,ColorManagement:ii,Compatibility:W_e,CompressedArrayTexture:ewe,CompressedCubeTexture:twe,CompressedTexture:cE,CompressedTextureLoader:Bwe,ConeGeometry:ww,ConstantAlphaFactor:jX,ConstantColorFactor:LX,Controls:U3e,CubeCamera:YY,CubeDepthTexture:gY,CubeReflectionMapping:sh,CubeRefractionMapping:tm,CubeTexture:_w,CubeTextureLoader:Hwe,CubeUVReflectionMapping:Ny,CubicBezierCurve:u9,CubicBezierCurve3:yY,CubicInterpolant:LY,CullFaceBack:IR,CullFaceFront:bX,CullFaceFrontBack:i_e,CullFaceNone:yX,Curve:Zd,CurvePath:_Y,CustomBlending:SX,CustomToneMapping:Hk,CylinderGeometry:Sw,Cylindrical:_3e,Data3DTexture:rE,DataArrayTexture:nE,DataTexture:Bd,DataTextureLoader:Vwe,DataUtils:CSe,DecrementStencilOp:S_e,DecrementWrapStencilOp:M_e,DefaultLoadingManager:UY,DepthFormat:oh,DepthStencilFormat:F0,DepthTexture:iy,DetachedBindMode:HX,DirectionalLight:GY,DirectionalLightHelper:P3e,DiscreteInterpolant:zY,DodecahedronGeometry:fE,DoubleSide:Xc,DstAlphaFactor:kX,DstColorFactor:DX,DynamicCopyUsage:F_e,DynamicDrawUsage:D_e,DynamicReadUsage:L_e,EdgesGeometry:l9,EllipseCurve:hE,EqualCompare:ZX,EqualDepth:O2,EqualStencilFunc:A_e,EquirectangularReflectionMapping:I_,EquirectangularRefractionMapping:O_,Euler:su,EventDispatcher:mh,ExternalTexture:o9,ExtrudeGeometry:pE,FileLoader:mp,Float16BufferAttribute:ISe,Float32BufferAttribute:An,FloatType:Bl,Fog:sE,FogExp2:iE,FramebufferTexture:JSe,FrontSide:pp,Frustum:Ry,FrustumArray:lE,GLBufferAttribute:b3e,GLSL1:B_e,GLSL3:BR,GreaterCompare:QX,GreaterDepth:z2,GreaterEqualCompare:tE,GreaterEqualDepth:L2,GreaterEqualStencilFunc:P_e,GreaterStencilFunc:R_e,GridHelper:R3e,Group:i1,HalfFloatType:ah,HemisphereLight:BY,HemisphereLightHelper:N3e,IcosahedronGeometry:mE,ImageBitmapLoader:Kwe,ImageLoader:kS,ImageUtils:sY,IncrementStencilOp:__e,IncrementWrapStencilOp:w_e,InstancedBufferAttribute:cv,InstancedBufferGeometry:CE,InstancedInterleavedBuffer:S5,InstancedMesh:dY,Int16BufferAttribute:PSe,Int32BufferAttribute:DSe,Int8BufferAttribute:NSe,IntType:qT,InterleavedBuffer:aE,InterleavedBufferAttribute:Qc,Interpolant:ky,InterpolateBezier:FR,InterpolateDiscrete:vS,InterpolateLinear:v5,InterpolateSmooth:UM,InterpolationSamplingMode:G_e,InterpolationSamplingType:V_e,InvertStencilOp:T_e,KeepStencilOp:Tg,KeyframeTrack:td,LOD:cY,LatheGeometry:gE,Layers:ry,LessCompare:KX,LessDepth:I2,LessEqualCompare:eE,LessEqualDepth:av,LessEqualStencilFunc:N_e,LessStencilFunc:C_e,Light:xm,LightProbe:qY,Line:im,Line3:rK,LineBasicMaterial:$l,LineCurve:d9,LineCurve3:bY,LineDashedMaterial:IY,LineLoop:hY,LineSegments:gh,LinearFilter:rs,LinearInterpolant:y9,LinearMipMapLinearFilter:c_e,LinearMipMapNearestFilter:l_e,LinearMipmapLinearFilter:Kf,LinearMipmapNearestFilter:L_,LinearSRGBColorSpace:nm,LinearToneMapping:Fk,LinearTransfer:yS,Loader:Rc,LoaderUtils:$R,LoadingManager:_9,LoopOnce:VX,LoopPingPong:WX,LoopRepeat:GX,MOUSE:wg,Material:vl,MaterialBlending:s_e,MaterialLoader:EE,MathUtils:iY,Matrix2:A9,Matrix3:yr,Matrix4:rr,MaxEquation:EX,Mesh:Us,MeshBasicMaterial:_p,MeshDepthMaterial:wE,MeshDistanceMaterial:ME,MeshLambertMaterial:PY,MeshMatcapMaterial:DY,MeshNormalMaterial:kY,MeshPhongMaterial:NY,MeshPhysicalMaterial:AY,MeshStandardMaterial:v9,MeshToonMaterial:RY,MinEquation:TX,MirroredRepeatWrapping:gS,MixOperation:UX,MultiplyBlending:zR,MultiplyOperation:yw,NearestFilter:Ea,NearestMipMapLinearFilter:o_e,NearestMipMapNearestFilter:a_e,NearestMipmapLinearFilter:n1,NearestMipmapNearestFilter:Wk,NeutralToneMapping:Gk,NeverCompare:YX,NeverDepth:P2,NeverStencilFunc:E_e,NoBlending:th,NoColorSpace:np,NoNormalPacking:g_e,NoToneMapping:nu,NormalAnimationBlendMode:JT,NormalBlending:Wg,NormalGAPacking:x_e,NormalRGPacking:v_e,NotEqualCompare:JX,NotEqualDepth:j2,NotEqualStencilFunc:k_e,NumberKeyframeTrack:AS,Object3D:yi,ObjectLoader:Xwe,ObjectSpaceNormalMap:XX,OctahedronGeometry:Mw,OneFactor:AX,OneMinusConstantAlphaFactor:FX,OneMinusConstantColorFactor:zX,OneMinusDstAlphaFactor:PX,OneMinusDstColorFactor:IX,OneMinusSrcAlphaFactor:k2,OneMinusSrcColorFactor:RX,OrthographicCamera:Hd,PCFShadowMap:b1,PCFSoftShadowMap:D_,PMREMGenerator:KR,Path:_5,PerspectiveCamera:ea,Plane:Jh,PlaneGeometry:Sp,PlaneHelper:L3e,PointLight:VY,PointLightHelper:C3e,Points:pY,PointsMaterial:a9,PolarGridHelper:k3e,PolyhedronGeometry:vm,PositionalAudio:r3e,PropertyBinding:gi,PropertyMixer:JY,QuadraticBezierCurve:f9,QuadraticBezierCurve3:h9,Quaternion:Bo,QuaternionKeyframeTrack:Ew,QuaternionLinearInterpolant:FY,R11_EAC_Format:$2,RED_GREEN_RGTC2_Format:m5,RED_RGTC1_Format:h5,REVISION:xw,RG11_EAC_Format:X2,RGBADepthPacking:qX,RGBAFormat:ul,RGBAIntegerFormat:QT,RGBA_ASTC_10x10_Format:o5,RGBA_ASTC_10x5_Format:i5,RGBA_ASTC_10x6_Format:s5,RGBA_ASTC_10x8_Format:a5,RGBA_ASTC_12x10_Format:l5,RGBA_ASTC_12x12_Format:c5,RGBA_ASTC_4x4_Format:K2,RGBA_ASTC_5x4_Format:Z2,RGBA_ASTC_5x5_Format:Q2,RGBA_ASTC_6x5_Format:J2,RGBA_ASTC_6x6_Format:e5,RGBA_ASTC_8x5_Format:t5,RGBA_ASTC_8x6_Format:n5,RGBA_ASTC_8x8_Format:r5,RGBA_BPTC_Format:u5,RGBA_ETC2_EAC_Format:W2,RGBA_PVRTC_2BPPV1_Format:H2,RGBA_PVRTC_4BPPV1_Format:B2,RGBA_S3TC_DXT1_Format:j_,RGBA_S3TC_DXT3_Format:F_,RGBA_S3TC_DXT5_Format:U_,RGBDepthPacking:p_e,RGBFormat:Zk,RGBIntegerFormat:u_e,RGB_BPTC_SIGNED_Format:d5,RGB_BPTC_UNSIGNED_Format:f5,RGB_ETC1_Format:V2,RGB_ETC2_Format:G2,RGB_PVRTC_2BPPV1_Format:U2,RGB_PVRTC_4BPPV1_Format:F2,RGB_S3TC_DXT1_Format:z_,RGDepthPacking:m_e,RGFormat:ov,RGIntegerFormat:ZT,RawShaderMaterial:g9,Ray:Mv,Raycaster:tK,RectAreaLight:$Y,RedFormat:KT,RedIntegerFormat:bw,ReinhardToneMapping:Uk,RenderTarget:e9,RenderTarget3D:v3e,RepeatWrapping:mS,ReplaceStencilOp:b_e,ReverseSubtractEquation:MX,RingGeometry:vE,SIGNED_R11_EAC_Format:q2,SIGNED_RED_GREEN_RGTC2_Format:g5,SIGNED_RED_RGTC1_Format:p5,SIGNED_RG11_EAC_Format:Y2,SRGBColorSpace:cl,SRGBTransfer:ji,Scene:t9,ShaderChunk:Tr,ShaderLib:Id,ShaderMaterial:au,ShadowMaterial:EY,Shape:G0,ShapeGeometry:xE,ShapePath:F3e,ShapeUtils:Ud,ShortType:qk,Skeleton:oE,SkeletonHelper:E3e,SkinnedMesh:uY,Source:U0,Sphere:Ga,SphereGeometry:Tw,Spherical:XR,SphericalHarmonics3:w9,SplineCurve:p9,SpotLight:HY,SpotLightHelper:T3e,Sprite:lY,SpriteMaterial:i9,SrcAlphaFactor:R2,SrcAlphaSaturateFactor:OX,SrcColorFactor:NX,StaticCopyUsage:j_e,StaticDrawUsage:bS,StaticReadUsage:O_e,StereoCamera:Qwe,StreamCopyUsage:U_e,StreamDrawUsage:I_e,StreamReadUsage:z_e,StringKeyframeTrack:Cv,SubtractEquation:wX,SubtractiveBlending:LR,TOUCH:Mg,TangentSpaceNormalMap:gm,TetrahedronGeometry:yE,Texture:ra,TextureLoader:Gwe,TextureUtils:W3e,Timer:ZY,TimestampQuery:H_e,TorusGeometry:bE,TorusKnotGeometry:_E,Triangle:Mc,TriangleFanDrawMode:h_e,TriangleStripDrawMode:f_e,TrianglesDrawMode:d_e,TubeGeometry:SE,UVMapping:$T,Uint16BufferAttribute:n9,Uint32BufferAttribute:r9,Uint8BufferAttribute:RSe,Uint8ClampedBufferAttribute:kSe,Uniform:C9,UniformsGroup:y3e,UniformsLib:hn,UniformsUtils:CS,UnsignedByteType:zl,UnsignedInt101111Type:Yk,UnsignedInt248Type:ty,UnsignedInt5999Type:Xk,UnsignedIntType:Ku,UnsignedShort4444Type:XT,UnsignedShort5551Type:YT,UnsignedShortType:ey,VSMShadowMap:Rg,Vector2:Lt,Vector3:ze,Vector4:ci,VectorKeyframeTrack:NS,VideoFrameTexture:QSe,VideoTexture:mY,WebGL3DRenderTarget:xSe,WebGLArrayRenderTarget:vSe,WebGLCoordinateSystem:Zc,WebGLCubeRenderTarget:N9,WebGLRenderTarget:iu,WebGLRenderer:dK,WebGLUtils:uK,WebGPUCoordinateSystem:lv,WebXRController:BM,WireframeGeometry:m9,WrapAroundEnding:xS,ZeroCurvatureEnding:kg,ZeroFactor:CX,ZeroSlopeEnding:Pg,ZeroStencilOp:y_e,createCanvasElement:nY,error:Hn,getConsoleFunction:Y_e,log:SS,setConsoleFunction:X_e,warn:fn,warnOnce:wS},Symbol.toStringTag,{value:"Module"}));var C6={exports:{}},A6={};/**
 * @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 Mj;function jTe(){if(Mj)return A6;Mj=1;var t=GS(),e=Ine();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;return A6.useSyncExternalStoreWithSelector=function(c,d,h,g,v){var b=s(null);if(b.current===null){var _={hasValue:!1,value:null};b.current=_}else _=b.current;b=o(function(){function S(P){if(!E){if(E=!0,A=P,P=g(P),v!==void 0&&_.hasValue){var L=_.value;if(v(L,P))return N=L}return N=P}if(L=N,r(A,P))return L;var R=g(P);return v!==void 0&&v(L,R)?(A=P,L):(A=P,N=R)}var E=!1,A,N,I=h===void 0?null:h;return[function(){return S(d())},I===null?void 0:function(){return S(I())}]},[d,h,g,v]);var w=i(c,b[0],b[1]);return a(function(){_.hasValue=!0,_.value=w},[w]),l(w),w},A6}var Tj;function FTe(){return Tj||(Tj=1,C6.exports=jTe()),C6.exports}var UTe=FTe();const BTe=cy(UTe),Ej=t=>{let e;const n=new Set,r=(c,d)=>{const h=typeof c=="function"?c(e):c;if(!Object.is(h,e)){const g=e;e=d??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(v=>v(e,g))}},i=()=>e,o={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,o);return o},HTe=(t=>t?Ej(t):Ej),{useSyncExternalStoreWithSelector:VTe}=BTe,GTe=t=>t;function WTe(t,e=GTe,n){const r=VTe(t.subscribe,t.getState,t.getInitialState,e,n);return Zr.useDebugValue(r),r}const Cj=(t,e)=>{const n=HTe(t),r=(i,s=e)=>WTe(n,i,s);return Object.assign(r,n),r},$Te=((t,e)=>t?Cj(t,e):Cj),qTe=t=>typeof t=="object"&&typeof t.then=="function",vM=[];function XTe(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 YTe(t,e=null,n=!1,r={}){e===null&&(e=[t]);for(const s of vM)if(XTe(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=vM.indexOf(i);s!==-1&&vM.splice(s,1)},promise:(qTe(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(vM.push(i),!n)throw i.promise}const KTe=(t,e,n)=>YTe(t,e,!1,n);var JR=PF();const ZTe=cy(JR);function R9(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=e?t.return:t.child;for(;r;){const i=R9(r,e,n);if(i)return i;r=e?null:r.sibling}}function fK(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const k9=fK(T.createContext(null));class hK extends T.Component{render(){return T.createElement(k9.Provider,{value:this._reactInternals},this.props.children)}}function pK(){const t=T.useContext(k9);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=T.useId();return T.useMemo(()=>{for(const n of[t,t==null?void 0:t.alternate]){if(!n)continue;const r=R9(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 QTe=Symbol.for("react.context"),JTe=t=>t!==null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===QTe;function eEe(){const t=pK(),[e]=T.useState(()=>new Map);e.clear();let n=t;for(;n;){const r=n.type;JTe(r)&&r!==k9&&!e.has(r)&&e.set(r,T.use(fK(r))),n=n.return}return e}function tEe(){const t=eEe();return T.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>T.createElement(e,null,T.createElement(n.Provider,{...r,value:t.get(n)})),e=>T.createElement(hK,{...e})),[t])}function mK(t){let e=t.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const gK=t=>t&&t.isOrthographicCamera,nEe=t=>t&&t.hasOwnProperty("current"),rEe=t=>t!=null&&(typeof t=="string"||typeof t=="number"||t.isColor),Cw=((t,e)=>typeof window<"u"&&(((t=window.document)==null?void 0:t.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?T.useLayoutEffect:T.useEffect;function vK(t){const e=T.useRef(t);return Cw(()=>void(e.current=t),[t]),e}function iEe(){const t=pK(),e=tEe();return T.useMemo(()=>({children:n})=>{const i=!!R9(t,!0,s=>s.type===T.StrictMode)?T.StrictMode:T.Fragment;return p.jsx(i,{children:p.jsx(e,{children:n})})},[t,e])}function sEe({set:t}){return Cw(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const aEe=(t=>(t=class extends T.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 xK(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 Xx(t){var e;return(e=t.__r3f)==null?void 0:e.root.getState()}const Qs={obj:t=>t===Object(t)&&!Qs.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(Qs.str(t)||Qs.num(t)||Qs.boo(t))return t===e;const s=Qs.obj(t);if(s&&r==="reference")return t===e;const a=Qs.arr(t);if(a&&n==="reference")return t===e;if((a||s)&&t===e)return!0;let o;for(o in t)if(!(o in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(o in i?e:t)if(!Qs.equ(t[o],e[o],{strict:i,objects:"reference"}))return!1}else for(o in i?e:t)if(t[o]!==e[o])return!1;if(Qs.und(o)){if(a&&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 oEe(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 yK=["children","key","ref"];function lEe(t){const e={};for(const n in t)yK.includes(n)||(e[n]=t[n]);return e}function w5(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:lEe(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=s)),s}function PS(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 Aj=/-\d+$/;function M5(t,e){if(Qs.str(e.props.attach)){if(Aj.test(e.props.attach)){const i=e.props.attach.replace(Aj,""),{root:s,key:a}=PS(t.object,i);Array.isArray(s[a])||(s[a]=[])}const{root:n,key:r}=PS(t.object,e.props.attach);e.previousAttach=n[r],n[r]=e.object}else Qs.fun(e.props.attach)&&(e.previousAttach=e.props.attach(t.object,e.object))}function T5(t,e){if(Qs.str(e.props.attach)){const{root:n,key:r}=PS(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 e7=[...yK,"args","dispose","attach","object","onUpdate","dispose"],Nj=new Map;function cEe(t){let e=Nj.get(t.constructor);try{e||(e=new t.constructor,Nj.set(t.constructor,e))}catch{}return e}function uEe(t,e){const n={};for(const r in e)if(!e7.includes(r)&&!Qs.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(e7.includes(r)||e.hasOwnProperty(r))continue;const{root:i,key:s}=PS(t.object,r);if(i.constructor&&i.constructor.length===0){const a=cEe(i);Qs.und(a)||(n[s]=a[s])}else n[s]=0}return n}const dEe=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],fEe=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function C0(t,e){var n;const r=t.__r3f,i=r&&mK(r).getState(),s=r==null?void 0:r.eventCount;for(const o in e){let l=e[o];if(e7.includes(o))continue;if(r&&fEe.test(o)){typeof l=="function"?r.handlers[o]=l:delete r.handlers[o],r.eventCount=Object.keys(r.handlers).length;continue}if(l===void 0)continue;let{root:c,key:d,target:h}=PS(t,o);if(h===void 0&&(typeof c!="object"||c===null))throw Error(`R3F: Cannot set "${o}". Ensure it is an object before setting "${d}".`);if(h instanceof ry&&l instanceof ry)h.mask=l.mask;else if(h instanceof xn&&rEe(l))h.set(l);else if(h!==null&&typeof h=="object"&&typeof h.set=="function"&&typeof h.copy=="function"&&l!=null&&l.constructor&&h.constructor===l.constructor)h.copy(l);else if(h!==null&&typeof h=="object"&&typeof h.set=="function"&&Array.isArray(l))typeof h.fromArray=="function"?h.fromArray(l):h.set(...l);else if(h!==null&&typeof h=="object"&&typeof h.set=="function"&&typeof l=="number")typeof h.setScalar=="function"?h.setScalar(l):h.set(l);else{var a;c[d]=l,i&&!i.linear&&dEe.includes(d)&&(a=c[d])!=null&&a.isTexture&&c[d].format===ul&&c[d].type===zl&&(c[d].colorSpace=cl)}}if(r!=null&&r.parent&&i!=null&&i.internal&&(n=r.object)!=null&&n.isObject3D&&s!==r.eventCount){const o=r.object,l=i.internal.interaction.indexOf(o);l>-1&&i.internal.interaction.splice(l,1),r.eventCount&&o.raycast!==null&&i.internal.interaction.push(o)}return r&&r.props.attach===void 0&&(r.object.isBufferGeometry?r.props.attach="geometry":r.object.isMaterial&&(r.props.attach="material")),r&&Dy(r),t}function Dy(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 hEe(t,e){t.manual||(gK(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 Sc=t=>t==null?void 0:t.isObject3D;function xM(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function bK(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function pEe(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{bK(n.capturedMap,e,r,i)})}function mEe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+h*h))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),h=new Set,g=[],v=c?c(d.internal.interaction):d.internal.interaction;for(let S=0;S<v.length;S++){const E=Xx(v[S]);E&&(E.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(l,d);function b(S){const E=Xx(S);if(!E||!E.events.enabled||E.raycaster.camera===null)return[];if(E.raycaster.camera===void 0){var A;E.events.compute==null||E.events.compute(l,E,(A=E.previousRoot)==null?void 0:A.getState()),E.raycaster.camera===void 0&&(E.raycaster.camera=null)}return E.raycaster.camera?E.raycaster.intersectObject(S,!0):[]}let _=v.flatMap(b).sort((S,E)=>{const A=Xx(S.object),N=Xx(E.object);return!A||!N?S.distance-E.distance:N.events.priority-A.events.priority||S.distance-E.distance}).filter(S=>{const E=xM(S);return h.has(E)?!1:(h.add(E),!0)});d.events.filter&&(_=d.events.filter(_,d));for(const S of _){let E=S.object;for(;E;){var w;(w=E.__r3f)!=null&&w.eventCount&&g.push({...S,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let S of d.internal.capturedMap.get(l.pointerId).values())h.has(xM(S.intersection))||g.push(S.intersection);return g}function i(l,c,d,h){if(l.length){const g={stopped:!1};for(const v of l){let b=Xx(v.object);if(b||v.object.traverseAncestors(_=>{const w=Xx(_);if(w)return b=w,!1}),b){const{raycaster:_,pointer:w,camera:S,internal:E}=b,A=new ze(w.x,w.y,0).unproject(S),N=O=>{var W,U;return(W=(U=E.capturedMap.get(O))==null?void 0:U.has(v.eventObject))!=null?W:!1},I=O=>{const W={intersection:v,target:c.target};E.capturedMap.has(O)?E.capturedMap.get(O).set(v.eventObject,W):E.capturedMap.set(O,new Map([[v.eventObject,W]])),c.target.setPointerCapture(O)},P=O=>{const W=E.capturedMap.get(O);W&&bK(E.capturedMap,v.eventObject,W,O)};let L={};for(let O in c){let W=c[O];typeof W!="function"&&(L[O]=W)}let R={...v,...L,pointer:w,intersections:l,stopped:g.stopped,delta:d,unprojectedPoint:A,ray:_.ray,camera:S,stopPropagation(){const O="pointerId"in c&&E.capturedMap.get(c.pointerId);if((!O||O.has(v.eventObject))&&(R.stopped=g.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(W=>W.eventObject===v.eventObject))){const W=l.slice(0,l.indexOf(v));s([...W,v])}},target:{hasPointerCapture:N,setPointerCapture:I,releasePointerCapture:P},currentTarget:{hasPointerCapture:N,setPointerCapture:I,releasePointerCapture:P},nativeEvent:c};if(h(R),g.stopped===!0)break}}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(h=>h.object===d.object&&h.index===d.index&&h.instanceId===d.instanceId)){const g=d.eventObject.__r3f;if(c.hovered.delete(xM(d)),g!=null&&g.eventCount){const v=g.handlers,b={...d,intersections:l};v.onPointerOut==null||v.onPointerOut(b),v.onPointerLeave==null||v.onPointerLeave(b)}}}function a(l,c){for(let d=0;d<c.length;d++){const h=c[d].__r3f;h==null||h.handlers.onPointerMissed==null||h.handlers.onPointerMissed(l)}}function o(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:h,internal:g}=t.getState();g.lastEvent.current=d;const v=l==="onPointerMove",b=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,v?n:void 0),S=b?e(d):0;l==="onPointerDown"&&(g.initialClick=[d.offsetX,d.offsetY],g.initialHits=w.map(A=>A.eventObject)),b&&!w.length&&S<=2&&(a(d,g.interaction),h&&h(d)),v&&s(w);function E(A){const N=A.eventObject,I=N.__r3f;if(!(I!=null&&I.eventCount))return;const P=I.handlers;if(v){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const L=xM(A),R=g.hovered.get(L);R?R.stopped&&A.stopPropagation():(g.hovered.set(L,A),P.onPointerOver==null||P.onPointerOver(A),P.onPointerEnter==null||P.onPointerEnter(A))}P.onPointerMove==null||P.onPointerMove(A)}else{const L=P[l];L?(!b||g.initialHits.includes(N))&&(a(d,g.interaction.filter(R=>!g.initialHits.includes(R))),L(A)):b&&g.initialHits.includes(N)&&a(d,g.interaction.filter(R=>!g.initialHits.includes(R)))}}i(w,d,S,E)}}return{handlePointer:o}}const Rj=t=>!!(t!=null&&t.render),_K=T.createContext(null),gEe=(t,e)=>{const n=$Te((o,l)=>{const c=new ze,d=new ze,h=new ze;function g(S=l().camera,E=d,A=l().size){const{width:N,height:I,top:P,left:L}=A,R=N/I;E.isVector3?h.copy(E):h.set(...E);const O=S.getWorldPosition(c).distanceTo(h);if(gK(S))return{width:N/S.zoom,height:I/S.zoom,top:P,left:L,factor:1,distance:O,aspect:R};{const W=S.fov*Math.PI/180,U=2*Math.tan(W/2)*O,V=U*(N/I);return{width:V,height:U,top:P,left:L,factor:N/V,distance:O,aspect:R}}}let v;const b=S=>o(E=>({performance:{...E.performance,current:S}})),_=new Lt;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(S=1)=>t(l(),S),advance:(S,E)=>e(S,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new nK,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const S=l();v&&clearTimeout(v),S.performance.current!==S.performance.min&&b(S.performance.min),v=setTimeout(()=>b(l().performance.max),S.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:g},setEvents:S=>o(E=>({...E,events:{...E.events,...S}})),setSize:(S,E,A=0,N=0)=>{const I=l().camera,P={width:S,height:E,top:A,left:N};o(L=>({size:P,viewport:{...L.viewport,...g(I,d,P)}}))},setDpr:S=>o(E=>{const A=xK(S);return{viewport:{...E.viewport,dpr:A,initialDpr:E.viewport.initialDpr||A}}}),setFrameloop:(S="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,S!=="never"&&(E.start(),E.elapsedTime=0),o(()=>({frameloop:S}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:T.createRef(),active:!1,frames:0,priority:0,subscribe:(S,E,A)=>{const N=l().internal;return N.priority=N.priority+(E>0?1:0),N.subscribers.push({ref:S,priority:E,store:A}),N.subscribers=N.subscribers.sort((I,P)=>I.priority-P.priority),()=>{const I=l().internal;I!=null&&I.subscribers&&(I.priority=I.priority-(E>0?1:0),I.subscribers=I.subscribers.filter(P=>P.ref!==S))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,a=r.camera;return n.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:d,set:h}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){i=l,s=c.dpr,hEe(o,l),c.dpr>0&&d.setPixelRatio(c.dpr);const g=typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,g)}o!==a&&(a=o,h(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(o)}})))}),n.subscribe(o=>t(o)),n};function SK(){const t=T.useContext(_K);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function $c(t=n=>n,e){return SK()(t,e)}function RE(t,e=0){const n=SK(),r=n.getState().internal.subscribe,i=vK(t);return Cw(()=>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 vEe=1,xEe=8,yEe=32,bEe=2;var _Ee={version:"9.5.0"};function SEe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var kj={exports:{}},Pj={exports:{}},Dj;function wEe(){return Dj||(Dj=1,(function(t){t.exports=function(e){function n(m,x,C,k){return new zy(m,x,C,k)}function r(){}function i(m){var x="https://react.dev/errors/"+m;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)x+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+m+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(m){var x=m,C=m;if(m.alternate)for(;x.return;)x=x.return;else{m=x;do x=m,(x.flags&4098)!==0&&(C=x.return),m=x.return;while(m)}return x.tag===3?C:null}function a(m){if(s(m)!==m)throw Error(i(188))}function o(m){var x=m.alternate;if(!x){if(x=s(m),x===null)throw Error(i(188));return x!==m?null:m}for(var C=m,k=x;;){var $=C.return;if($===null)break;var ee=$.alternate;if(ee===null){if(k=$.return,k!==null){C=k;continue}break}if($.child===ee.child){for(ee=$.child;ee;){if(ee===C)return a($),m;if(ee===k)return a($),x;ee=ee.sibling}throw Error(i(188))}if(C.return!==k.return)C=$,k=ee;else{for(var Ce=!1,at=$.child;at;){if(at===C){Ce=!0,C=$,k=ee;break}if(at===k){Ce=!0,k=$,C=ee;break}at=at.sibling}if(!Ce){for(at=ee.child;at;){if(at===C){Ce=!0,C=ee,k=$;break}if(at===k){Ce=!0,k=ee,C=$;break}at=at.sibling}if(!Ce)throw Error(i(189))}}if(C.alternate!==k)throw Error(i(190))}if(C.tag!==3)throw Error(i(188));return C.stateNode.current===C?m:x}function l(m){var x=m.tag;if(x===5||x===26||x===27||x===6)return m;for(m=m.child;m!==null;){if(x=l(m),x!==null)return x;m=m.sibling}return null}function c(m){var x=m.tag;if(x===5||x===26||x===27||x===6)return m;for(m=m.child;m!==null;){if(m.tag!==4&&(x=c(m),x!==null))return x;m=m.sibling}return null}function d(m){return m===null||typeof m!="object"?null:(m=gd&&m[gd]||m["@@iterator"],typeof m=="function"?m:null)}function h(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===uf?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case Mh:return"Fragment";case Eh:return"Profiler";case Th:return"StrictMode";case Hv:return"Suspense";case md:return"SuspenseList";case Om:return"Activity"}if(typeof m=="object")switch(m.$$typeof){case wh:return"Portal";case sc:return m.displayName||"Context";case Im:return(m._context.displayName||"Context")+".Consumer";case Fp:var x=m.render;return m=m.displayName,m||(m=x.displayName||x.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case Vv:return x=m.displayName||null,x!==null?x:h(m.type)||"Memo";case Ao:x=m._payload,m=m._init;try{return h(m(x))}catch{}}return null}function g(m){return{current:m}}function v(m){0>kh||(m.current=nx[kh],nx[kh]=null,kh--)}function b(m,x){kh++,nx[kh]=m.current,m.current=x}function _(m){return m>>>=0,m===0?32:31-(rx(m)/b3|0)|0}function w(m){var x=m&42;if(x!==0)return x;switch(m&-m){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 m&261888;case 262144:case 524288:case 1048576:case 2097152:return m&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return m&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return m}}function S(m,x,C){var k=m.pendingLanes;if(k===0)return 0;var $=0,ee=m.suspendedLanes,Ce=m.pingedLanes;m=m.warmLanes;var at=k&134217727;return at!==0?(k=at&~ee,k!==0?$=w(k):(Ce&=at,Ce!==0?$=w(Ce):C||(C=at&~m,C!==0&&($=w(C))))):(at=k&~ee,at!==0?$=w(at):Ce!==0?$=w(Ce):C||(C=k&~m,C!==0&&($=w(C)))),$===0?0:x!==0&&x!==$&&(x&ee)===0&&(ee=$&-$,C=x&-x,ee>=C||ee===32&&(C&4194048)!==0)?x:$}function E(m,x){return(m.pendingLanes&~(m.suspendedLanes&~m.pingedLanes)&x)===0}function A(m,x){switch(m){case 1:case 2:case 4:case 8:case 64:return x+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 x+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 m=$p;return $p<<=1,($p&62914560)===0&&($p=4194304),m}function I(m){for(var x=[],C=0;31>C;C++)x.push(m);return x}function P(m,x){m.pendingLanes|=x,x!==268435456&&(m.suspendedLanes=0,m.pingedLanes=0,m.warmLanes=0)}function L(m,x,C,k,$,ee){var Ce=m.pendingLanes;m.pendingLanes=C,m.suspendedLanes=0,m.pingedLanes=0,m.warmLanes=0,m.expiredLanes&=C,m.entangledLanes&=C,m.errorRecoveryDisabledLanes&=C,m.shellSuspendCounter=0;var at=m.entanglements,Dt=m.expirationTimes,Wt=m.hiddenUpdates;for(C=Ce&~C;0<C;){var ln=31-Qo(C),qt=1<<ln;at[ln]=0,Dt[ln]=-1;var yn=Wt[ln];if(yn!==null)for(Wt[ln]=null,ln=0;ln<yn.length;ln++){var dr=yn[ln];dr!==null&&(dr.lane&=-536870913)}C&=~qt}k!==0&&R(m,k,0),ee!==0&&$===0&&m.tag!==0&&(m.suspendedLanes|=ee&~(Ce&~x))}function R(m,x,C){m.pendingLanes|=x,m.suspendedLanes&=~x;var k=31-Qo(x);m.entangledLanes|=x,m.entanglements[k]=m.entanglements[k]|1073741824|C&261930}function O(m,x){var C=m.entangledLanes|=x;for(m=m.entanglements;C;){var k=31-Qo(C),$=1<<k;$&x|m[k]&x&&(m[k]|=x),C&=~$}}function W(m,x){var C=x&-x;return C=(C&42)!==0?1:U(C),(C&(m.suspendedLanes|x))!==0?0:C}function U(m){switch(m){case 2:m=1;break;case 8:m=4;break;case 32:m=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:m=128;break;case 268435456:m=134217728;break;default:m=0}return m}function V(m){return m&=-m,2<m?8<m?(m&134217727)!==0?32:268435456:8:2}function G(m){if(typeof Sb=="function"&&w3(m),Jo&&typeof Jo.setStrictMode=="function")try{Jo.setStrictMode(Dh,m)}catch{}}function Z(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}function B(m){if(cx===void 0)try{throw Error()}catch(C){var x=C.stack.trim().match(/\n( *(at )?)/);cx=x&&x[1]||"",wu=-1<C.stack.indexOf(`
    at`)?" (<anonymous>)":-1<C.stack.indexOf("@")?"@unknown:0:0":""}return`
`+cx+m+wu}function q(m,x){if(!m||Gm)return"";Gm=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(x){var qt=function(){throw Error()};if(Object.defineProperty(qt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(qt,[])}catch(dr){var yn=dr}Reflect.construct(m,[],qt)}else{try{qt.call()}catch(dr){yn=dr}m.call(qt.prototype)}}else{try{throw Error()}catch(dr){yn=dr}(qt=m())&&typeof qt.catch=="function"&&qt.catch(function(){})}}catch(dr){if(dr&&yn&&typeof dr.stack=="string")return[dr.stack,yn.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var $=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");$&&$.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var ee=k.DetermineComponentFrameRoot(),Ce=ee[0],at=ee[1];if(Ce&&at){var Dt=Ce.split(`
`),Wt=at.split(`
`);for($=k=0;k<Dt.length&&!Dt[k].includes("DetermineComponentFrameRoot");)k++;for(;$<Wt.length&&!Wt[$].includes("DetermineComponentFrameRoot");)$++;if(k===Dt.length||$===Wt.length)for(k=Dt.length-1,$=Wt.length-1;1<=k&&0<=$&&Dt[k]!==Wt[$];)$--;for(;1<=k&&0<=$;k--,$--)if(Dt[k]!==Wt[$]){if(k!==1||$!==1)do if(k--,$--,0>$||Dt[k]!==Wt[$]){var ln=`
`+Dt[k].replace(" at new "," at ");return m.displayName&&ln.includes("<anonymous>")&&(ln=ln.replace("<anonymous>",m.displayName)),ln}while(1<=k&&0<=$);break}}}finally{Gm=!1,Error.prepareStackTrace=C}return(C=m?m.displayName||m.name:"")?B(C):""}function Y(m,x){switch(m.tag){case 26:case 27:case 5:return B(m.type);case 16:return B("Lazy");case 13:return m.child!==x&&x!==null?B("Suspense Fallback"):B("Suspense");case 19:return B("SuspenseList");case 0:case 15:return q(m.type,!1);case 11:return q(m.type.render,!1);case 1:return q(m.type,!0);case 31:return B("Activity");default:return""}}function K(m){try{var x="",C=null;do x+=Y(m,C),C=m,m=m.return;while(m);return x}catch(k){return`
Error generating stack: `+k.message+`
`+k.stack}}function J(m,x){if(typeof m=="object"&&m!==null){var C=wb.get(m);return C!==void 0?C:(x={value:m,source:x,stack:K(x)},wb.set(m,x),x)}return{value:m,source:x,stack:K(x)}}function F(m,x){yd[Mu++]=Wm,yd[Mu++]=Li,Li=m,Wm=x}function j(m,x,C){lc[El++]=Ka,lc[El++]=zc,lc[El++]=cc,cc=m;var k=Ka;m=zc;var $=32-Qo(k)-1;k&=~(1<<$),C+=1;var ee=32-Qo(x)+$;if(30<ee){var Ce=$-$%5;ee=(k&(1<<Ce)-1).toString(32),k>>=Ce,$-=Ce,Ka=1<<32-Qo(x)+$|C<<$|k,zc=ee+m}else Ka=1<<ee|C<<$|k,zc=m}function X(m){m.return!==null&&(F(m,1),j(m,1,0))}function H(m){for(;m===Li;)Li=yd[--Mu],yd[Mu]=null,Wm=yd[--Mu],yd[Mu]=null;for(;m===cc;)cc=lc[--El],lc[El]=null,zc=lc[--El],lc[El]=null,Ka=lc[--El],lc[El]=null}function se(m,x){lc[El++]=Ka,lc[El++]=zc,lc[El++]=cc,Ka=x.id,zc=x.overflow,cc=m}function re(m,x){b(Za,x),b(bd,m),b(La,null),m=Lw(x),v(La),b(La,m)}function ie(){v(La),v(bd),v(Za)}function ue(m){m.memoizedState!==null&&b($m,m);var x=La.current,C=Hp(x,m.type);x!==C&&(b(bd,m),b(La,C))}function le(m){bd.current===m&&(v(La),v(bd)),$m.current===m&&(v($m),Ws?Nh._currentValue=Ah:Nh._currentValue2=Ah)}function fe(m){var x=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Le(J(x,m)),ux}function xe(m,x){if(!ls)throw Error(i(175));l3(m.stateNode,m.type,m.memoizedProps,x,m)||fe(m,!0)}function he(m){for(_a=m.return;_a;)switch(_a.tag){case 5:case 31:case 13:Ro=!1;return;case 27:case 3:Ro=!0;return;default:_a=_a.return}}function Te(m){if(!ls||m!==_a)return!1;if(!Fr)return he(m),Fr=!0,!1;var x=m.tag;if(ba?x!==3&&x!==27&&(x!==5||Wp(m.type)&&!No(m.type,m.memoizedProps))&&cs&&fe(m):x!==3&&(x!==5||Wp(m.type)&&!No(m.type,m.memoizedProps))&&cs&&fe(m),he(m),x===13){if(!ls)throw Error(i(316));if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));cs=db(m)}else if(x===31){if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));cs=u3(m)}else cs=ba&&x===27?e3(m.type,cs):_a?Jw(m.stateNode):null;return!0}function We(){ls&&(cs=_a=null,Fr=!1)}function Se(){var m=Tu;return m!==null&&(nl===null?nl=m:nl.push.apply(nl,m),Tu=null),m}function Le(m){Tu===null?Tu=[m]:Tu.push(m)}function pe(m,x,C){Ws?(b(uc,x._currentValue),x._currentValue=C):(b(uc,x._currentValue2),x._currentValue2=C)}function Re(m){var x=uc.current;Ws?m._currentValue=x:m._currentValue2=x,v(uc)}function ne(m,x,C){for(;m!==null;){var k=m.alternate;if((m.childLanes&x)!==x?(m.childLanes|=x,k!==null&&(k.childLanes|=x)):k!==null&&(k.childLanes&x)!==x&&(k.childLanes|=x),m===C)break;m=m.return}}function Xe(m,x,C,k){var $=m.child;for($!==null&&($.return=m);$!==null;){var ee=$.dependencies;if(ee!==null){var Ce=$.child;ee=ee.firstContext;e:for(;ee!==null;){var at=ee;ee=$;for(var Dt=0;Dt<x.length;Dt++)if(at.context===x[Dt]){ee.lanes|=C,at=ee.alternate,at!==null&&(at.lanes|=C),ne(ee.return,C,m),k||(Ce=null);break e}ee=at.next}}else if($.tag===18){if(Ce=$.return,Ce===null)throw Error(i(341));Ce.lanes|=C,ee=Ce.alternate,ee!==null&&(ee.lanes|=C),ne(Ce,C,m),Ce=null}else Ce=$.child;if(Ce!==null)Ce.return=$;else for(Ce=$;Ce!==null;){if(Ce===m){Ce=null;break}if($=Ce.sibling,$!==null){$.return=Ce.return,Ce=$;break}Ce=Ce.return}$=Ce}}function Ae(m,x,C,k){m=null;for(var $=x,ee=!1;$!==null;){if(!ee){if(($.flags&524288)!==0)ee=!0;else if(($.flags&262144)!==0)break}if($.tag===10){var Ce=$.alternate;if(Ce===null)throw Error(i(387));if(Ce=Ce.memoizedProps,Ce!==null){var at=$.type;qs($.pendingProps.value,Ce.value)||(m!==null?m.push(at):m=[at])}}else if($===$m.current){if(Ce=$.alternate,Ce===null)throw Error(i(387));Ce.memoizedState.memoizedState!==$.memoizedState.memoizedState&&(m!==null?m.push(Nh):m=[Nh])}$=$.return}m!==null&&Xe(x,m,C,k),x.flags|=262144}function Pe(m){for(m=m.firstContext;m!==null;){var x=m.context;if(!qs(Ws?x._currentValue:x._currentValue2,m.memoizedValue))return!0;m=m.next}return!1}function Ke(m){$i=m,jc=null,m=m.dependencies,m!==null&&(m.firstContext=null)}function oe(m){return _e($i,m)}function te(m,x){return $i===null&&Ke(m),_e(m,x)}function _e(m,x){var C=Ws?x._currentValue:x._currentValue2;if(x={context:x,memoizedValue:C,next:null},jc===null){if(m===null)throw Error(i(308));jc=x,m.dependencies={lanes:0,firstContext:x},m.flags|=524288}else jc=jc.next=x;return C}function ve(){return{controller:new M3,data:new Map,refCount:0}}function ye(m){m.refCount--,m.refCount===0&&za(HE,function(){m.controller.abort()})}function ke(){}function Be(m){m!==Ei&&m.next===null&&(Ei===null?qm=Ei=m:Ei=Ei.next=m),dc=!0,po||(po=!0,Me())}function ge(m,x){if(!dx&&dc){dx=!0;do for(var C=!1,k=qm;k!==null;){if(m!==0){var $=k.pendingLanes;if($===0)var ee=0;else{var Ce=k.suspendedLanes,at=k.pingedLanes;ee=(1<<31-Qo(42|m)+1)-1,ee&=$&~(Ce&~at),ee=ee&201326741?ee&201326741|1:ee?ee|2:0}ee!==0&&(C=!0,Ge(k,ee))}else ee=Ur,ee=S(k,k===Mr?ee:0,k.cancelPendingCommit!==null||k.timeoutHandle!==Zo),(ee&3)===0||E(k,ee)||(C=!0,Ge(k,ee));k=k.next}while(C);dx=!1}}function Ye(){Qe()}function Qe(){dc=po=!1;var m=0;mf!==0&&Ch()&&(m=mf);for(var x=ho(),C=null,k=qm;k!==null;){var $=k.next,ee=Ie(k,x);ee===0?(k.next=null,C===null?qm=$:C.next=$,$===null&&(Ei=C)):(C=k,(m!==0||(ee&3)!==0)&&(dc=!0)),k=$}ua!==0&&ua!==5||ge(m),mf!==0&&(mf=0)}function Ie(m,x){for(var C=m.suspendedLanes,k=m.pingedLanes,$=m.expirationTimes,ee=m.pendingLanes&-62914561;0<ee;){var Ce=31-Qo(ee),at=1<<Ce,Dt=$[Ce];Dt===-1?((at&C)===0||(at&k)!==0)&&($[Ce]=A(at,x)):Dt<=x&&(m.expiredLanes|=at),ee&=~at}if(x=Mr,C=Ur,C=S(m,m===x?C:0,m.cancelPendingCommit!==null||m.timeoutHandle!==Zo),k=m.callbackNode,C===0||m===x&&(Ai===2||Ai===9)||m.cancelPendingCommit!==null)return k!==null&&k!==null&&sx(k),m.callbackNode=null,m.callbackPriority=0;if((C&3)===0||E(m,C)){if(x=C&-C,x===m.callbackPriority)return x;switch(k!==null&&sx(k),V(C)){case 2:case 8:C=S3;break;case 32:C=Vm;break;case 268435456:C=ox;break;default:C=Vm}return k=Fe.bind(null,m),C=Hm(C,k),m.callbackPriority=x,m.callbackNode=C,x}return k!==null&&k!==null&&sx(k),m.callbackPriority=2,m.callbackNode=null,2}function Fe(m,x){if(ua!==0&&ua!==5)return m.callbackNode=null,m.callbackPriority=0,null;var C=m.callbackNode;if(bu()&&m.callbackNode!==C)return null;var k=Ur;return k=S(m,m===Mr?k:0,m.cancelPendingCommit!==null||m.timeoutHandle!==Zo),k===0?null:(Lc(m,k,x),Ie(m,ho()),m.callbackNode!=null&&m.callbackNode===C?Fe.bind(null,m):null)}function Ge(m,x){if(bu())return null;Lc(m,x,!0)}function Me(){Yy?Ky(function(){(Dr&6)!==0?Hm(ax,Ye):Qe()}):Hm(ax,Ye)}function $e(){if(mf===0){var m=_d;m===0&&(m=ix,ix<<=1,(ix&261888)===0&&(ix=256)),mf=m}return mf}function dt(m,x){if(qp===null){var C=qp=[];Mb=0,_d=$e(),Sa={status:"pending",value:void 0,then:function(k){C.push(k)}}}return Mb++,x.then(Oe,Oe),x}function Oe(){if(--Mb===0&&qp!==null){Sa!==null&&(Sa.status="fulfilled");var m=qp;qp=null,_d=0,Sa=null;for(var x=0;x<m.length;x++)(0,m[x])()}}function st(m,x){var C=[],k={status:"pending",value:null,reason:null,then:function($){C.push($)}};return m.then(function(){k.status="fulfilled",k.value=x;for(var $=0;$<C.length;$++)(0,C[$])(x)},function($){for(k.status="rejected",k.reason=$,$=0;$<C.length;$++)(0,C[$])(void 0)}),k}function ft(){var m=gf.current;return m!==null?m:Mr.pooledCache}function pt(m,x){x===null?b(gf,gf.current):b(gf,x.pool)}function et(){var m=ft();return m===null?null:{parent:Ws?us._currentValue:us._currentValue2,pool:m}}function Ze(m,x){if(qs(m,x))return!0;if(typeof m!="object"||m===null||typeof x!="object"||x===null)return!1;var C=Object.keys(m),k=Object.keys(x);if(C.length!==k.length)return!1;for(k=0;k<C.length;k++){var $=C[k];if(!BE.call(x,$)||!qs(m[$],x[$]))return!1}return!0}function me(m){return m=m.status,m==="fulfilled"||m==="rejected"}function je(m,x,C){switch(C=m[C],C===void 0?m.push(x):C!==x&&(x.then(ke,ke),x=C),x.status){case"fulfilled":return x.value;case"rejected":throw m=x.reason,yt(m),m;default:if(typeof x.status=="string")x.then(ke,ke);else{if(m=Mr,m!==null&&100<m.shellSuspendCounter)throw Error(i(482));m=x,m.status="pending",m.then(function(k){if(x.status==="pending"){var $=x;$.status="fulfilled",$.value=k}},function(k){if(x.status==="pending"){var $=x;$.status="rejected",$.reason=k}})}switch(x.status){case"fulfilled":return x.value;case"rejected":throw m=x.reason,yt(m),m}throw ko=x,wa}}function He(m){try{var x=m._init;return x(m._payload)}catch(C){throw C!==null&&typeof C=="object"&&typeof C.then=="function"?(ko=C,wa):C}}function nt(){if(ko===null)throw Error(i(459));var m=ko;return ko=null,m}function yt(m){if(m===wa||m===hc)throw Error(i(483))}function lt(m){var x=Ih;return Ih+=1,vf===null&&(vf=[]),je(vf,m,x)}function bt(m,x){x=x.props.ref,m.ref=x!==void 0?x:null}function Nt(m,x){throw x.$$typeof===Sh?Error(i(525)):(m=Object.prototype.toString.call(x),Error(i(31,m==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":m)))}function Pt(m){function x(Ct,vt){if(m){var kt=Ct.deletions;kt===null?(Ct.deletions=[vt],Ct.flags|=16):kt.push(vt)}}function C(Ct,vt){if(!m)return null;for(;vt!==null;)x(Ct,vt),vt=vt.sibling;return null}function k(Ct){for(var vt=new Map;Ct!==null;)Ct.key!==null?vt.set(Ct.key,Ct):vt.set(Ct.index,Ct),Ct=Ct.sibling;return vt}function $(Ct,vt){return Ct=Ml(Ct,vt),Ct.index=0,Ct.sibling=null,Ct}function ee(Ct,vt,kt){return Ct.index=kt,m?(kt=Ct.alternate,kt!==null?(kt=kt.index,kt<vt?(Ct.flags|=67108866,vt):kt):(Ct.flags|=67108866,vt)):(Ct.flags|=1048576,vt)}function Ce(Ct){return m&&Ct.alternate===null&&(Ct.flags|=67108866),Ct}function at(Ct,vt,kt,tn){return vt===null||vt.tag!==6?(vt=jy(kt,Ct.mode,tn),vt.return=Ct,vt):(vt=$(vt,kt),vt.return=Ct,vt)}function Dt(Ct,vt,kt,tn){var Xn=kt.type;return Xn===Mh?ln(Ct,vt,kt.props.children,tn,kt.key):vt!==null&&(vt.elementType===Xn||typeof Xn=="object"&&Xn!==null&&Xn.$$typeof===Ao&&He(Xn)===vt.type)?(vt=$(vt,kt.props),bt(vt,kt),vt.return=Ct,vt):(vt=pd(kt.type,kt.key,kt.props,null,Ct.mode,tn),bt(vt,kt),vt.return=Ct,vt)}function Wt(Ct,vt,kt,tn){return vt===null||vt.tag!==4||vt.stateNode.containerInfo!==kt.containerInfo||vt.stateNode.implementation!==kt.implementation?(vt=Uy(kt,Ct.mode,tn),vt.return=Ct,vt):(vt=$(vt,kt.children||[]),vt.return=Ct,vt)}function ln(Ct,vt,kt,tn,Xn){return vt===null||vt.tag!==7?(vt=ic(kt,Ct.mode,tn,Xn),vt.return=Ct,vt):(vt=$(vt,kt),vt.return=Ct,vt)}function qt(Ct,vt,kt){if(typeof vt=="string"&&vt!==""||typeof vt=="number"||typeof vt=="bigint")return vt=jy(""+vt,Ct.mode,kt),vt.return=Ct,vt;if(typeof vt=="object"&&vt!==null){switch(vt.$$typeof){case _u:return kt=pd(vt.type,vt.key,vt.props,null,Ct.mode,kt),bt(kt,vt),kt.return=Ct,kt;case wh:return vt=Uy(vt,Ct.mode,kt),vt.return=Ct,vt;case Ao:return vt=He(vt),qt(Ct,vt,kt)}if(df(vt)||d(vt))return vt=ic(vt,Ct.mode,kt,null),vt.return=Ct,vt;if(typeof vt.then=="function")return qt(Ct,lt(vt),kt);if(vt.$$typeof===sc)return qt(Ct,te(Ct,vt),kt);Nt(Ct,vt)}return null}function yn(Ct,vt,kt,tn){var Xn=vt!==null?vt.key:null;if(typeof kt=="string"&&kt!==""||typeof kt=="number"||typeof kt=="bigint")return Xn!==null?null:at(Ct,vt,""+kt,tn);if(typeof kt=="object"&&kt!==null){switch(kt.$$typeof){case _u:return kt.key===Xn?Dt(Ct,vt,kt,tn):null;case wh:return kt.key===Xn?Wt(Ct,vt,kt,tn):null;case Ao:return kt=He(kt),yn(Ct,vt,kt,tn)}if(df(kt)||d(kt))return Xn!==null?null:ln(Ct,vt,kt,tn,null);if(typeof kt.then=="function")return yn(Ct,vt,lt(kt),tn);if(kt.$$typeof===sc)return yn(Ct,vt,te(Ct,kt),tn);Nt(Ct,kt)}return null}function dr(Ct,vt,kt,tn,Xn){if(typeof tn=="string"&&tn!==""||typeof tn=="number"||typeof tn=="bigint")return Ct=Ct.get(kt)||null,at(vt,Ct,""+tn,Xn);if(typeof tn=="object"&&tn!==null){switch(tn.$$typeof){case _u:return Ct=Ct.get(tn.key===null?kt:tn.key)||null,Dt(vt,Ct,tn,Xn);case wh:return Ct=Ct.get(tn.key===null?kt:tn.key)||null,Wt(vt,Ct,tn,Xn);case Ao:return tn=He(tn),dr(Ct,vt,kt,tn,Xn)}if(df(tn)||d(tn))return Ct=Ct.get(kt)||null,ln(vt,Ct,tn,Xn,null);if(typeof tn.then=="function")return dr(Ct,vt,kt,lt(tn),Xn);if(tn.$$typeof===sc)return dr(Ct,vt,kt,te(vt,tn),Xn);Nt(vt,tn)}return null}function Ks(Ct,vt,kt,tn){for(var Xn=null,Cs=null,Kn=vt,ti=vt=0,ja=null;Kn!==null&&ti<kt.length;ti++){Kn.index>ti?(ja=Kn,Kn=null):ja=Kn.sibling;var fi=yn(Ct,Kn,kt[ti],tn);if(fi===null){Kn===null&&(Kn=ja);break}m&&Kn&&fi.alternate===null&&x(Ct,Kn),vt=ee(fi,vt,ti),Cs===null?Xn=fi:Cs.sibling=fi,Cs=fi,Kn=ja}if(ti===kt.length)return C(Ct,Kn),Fr&&F(Ct,ti),Xn;if(Kn===null){for(;ti<kt.length;ti++)Kn=qt(Ct,kt[ti],tn),Kn!==null&&(vt=ee(Kn,vt,ti),Cs===null?Xn=Kn:Cs.sibling=Kn,Cs=Kn);return Fr&&F(Ct,ti),Xn}for(Kn=k(Kn);ti<kt.length;ti++)ja=dr(Kn,Ct,ti,kt[ti],tn),ja!==null&&(m&&ja.alternate!==null&&Kn.delete(ja.key===null?ti:ja.key),vt=ee(ja,vt,ti),Cs===null?Xn=ja:Cs.sibling=ja,Cs=ja);return m&&Kn.forEach(function(gc){return x(Ct,gc)}),Fr&&F(Ct,ti),Xn}function t0(Ct,vt,kt,tn){if(kt==null)throw Error(i(151));for(var Xn=null,Cs=null,Kn=vt,ti=vt=0,ja=null,fi=kt.next();Kn!==null&&!fi.done;ti++,fi=kt.next()){Kn.index>ti?(ja=Kn,Kn=null):ja=Kn.sibling;var gc=yn(Ct,Kn,fi.value,tn);if(gc===null){Kn===null&&(Kn=ja);break}m&&Kn&&gc.alternate===null&&x(Ct,Kn),vt=ee(gc,vt,ti),Cs===null?Xn=gc:Cs.sibling=gc,Cs=gc,Kn=ja}if(fi.done)return C(Ct,Kn),Fr&&F(Ct,ti),Xn;if(Kn===null){for(;!fi.done;ti++,fi=kt.next())fi=qt(Ct,fi.value,tn),fi!==null&&(vt=ee(fi,vt,ti),Cs===null?Xn=fi:Cs.sibling=fi,Cs=fi);return Fr&&F(Ct,ti),Xn}for(Kn=k(Kn);!fi.done;ti++,fi=kt.next())fi=dr(Kn,Ct,ti,fi.value,tn),fi!==null&&(m&&fi.alternate!==null&&Kn.delete(fi.key===null?ti:fi.key),vt=ee(fi,vt,ti),Cs===null?Xn=fi:Cs.sibling=fi,Cs=fi);return m&&Kn.forEach(function(VE){return x(Ct,VE)}),Fr&&F(Ct,ti),Xn}function Tf(Ct,vt,kt,tn){if(typeof kt=="object"&&kt!==null&&kt.type===Mh&&kt.key===null&&(kt=kt.props.children),typeof kt=="object"&&kt!==null){switch(kt.$$typeof){case _u:e:{for(var Xn=kt.key;vt!==null;){if(vt.key===Xn){if(Xn=kt.type,Xn===Mh){if(vt.tag===7){C(Ct,vt.sibling),tn=$(vt,kt.props.children),tn.return=Ct,Ct=tn;break e}}else if(vt.elementType===Xn||typeof Xn=="object"&&Xn!==null&&Xn.$$typeof===Ao&&He(Xn)===vt.type){C(Ct,vt.sibling),tn=$(vt,kt.props),bt(tn,kt),tn.return=Ct,Ct=tn;break e}C(Ct,vt);break}else x(Ct,vt);vt=vt.sibling}kt.type===Mh?(tn=ic(kt.props.children,Ct.mode,tn,kt.key),tn.return=Ct,Ct=tn):(tn=pd(kt.type,kt.key,kt.props,null,Ct.mode,tn),bt(tn,kt),tn.return=Ct,Ct=tn)}return Ce(Ct);case wh:e:{for(Xn=kt.key;vt!==null;){if(vt.key===Xn)if(vt.tag===4&&vt.stateNode.containerInfo===kt.containerInfo&&vt.stateNode.implementation===kt.implementation){C(Ct,vt.sibling),tn=$(vt,kt.children||[]),tn.return=Ct,Ct=tn;break e}else{C(Ct,vt);break}else x(Ct,vt);vt=vt.sibling}tn=Uy(kt,Ct.mode,tn),tn.return=Ct,Ct=tn}return Ce(Ct);case Ao:return kt=He(kt),Tf(Ct,vt,kt,tn)}if(df(kt))return Ks(Ct,vt,kt,tn);if(d(kt)){if(Xn=d(kt),typeof Xn!="function")throw Error(i(150));return kt=Xn.call(kt),t0(Ct,vt,kt,tn)}if(typeof kt.then=="function")return Tf(Ct,vt,lt(kt),tn);if(kt.$$typeof===sc)return Tf(Ct,vt,te(Ct,kt),tn);Nt(Ct,kt)}return typeof kt=="string"&&kt!==""||typeof kt=="number"||typeof kt=="bigint"?(kt=""+kt,vt!==null&&vt.tag===6?(C(Ct,vt.sibling),tn=$(vt,kt),tn.return=Ct,Ct=tn):(C(Ct,vt),tn=jy(kt,Ct.mode,tn),tn.return=Ct,Ct=tn),Ce(Ct)):C(Ct,vt)}return function(Ct,vt,kt,tn){try{Ih=0;var Xn=Tf(Ct,vt,kt,tn);return vf=null,Xn}catch(Kn){if(Kn===wa||Kn===hc)throw Kn;var Cs=n(29,Kn,null,Ct.mode);return Cs.lanes=tn,Cs.return=Ct,Cs}finally{}}}function Ve(){for(var m=Cu,x=Oh=Cu=0;x<m;){var C=Ja[x];Ja[x++]=null;var k=Ja[x];Ja[x++]=null;var $=Ja[x];Ja[x++]=null;var ee=Ja[x];if(Ja[x++]=null,k!==null&&$!==null){var Ce=k.pending;Ce===null?$.next=$:($.next=Ce.next,Ce.next=$),k.pending=$}ee!==0&&Ht(C,$,ee)}}function wt(m,x,C,k){Ja[Cu++]=m,Ja[Cu++]=x,Ja[Cu++]=C,Ja[Cu++]=k,Oh|=k,m.lanes|=k,m=m.alternate,m!==null&&(m.lanes|=k)}function Et(m,x,C,k){return wt(m,x,C,k),an(m)}function zt(m,x){return wt(m,null,null,x),an(m)}function Ht(m,x,C){m.lanes|=C;var k=m.alternate;k!==null&&(k.lanes|=C);for(var $=!1,ee=m.return;ee!==null;)ee.childLanes|=C,k=ee.alternate,k!==null&&(k.childLanes|=C),ee.tag===22&&(m=ee.stateNode,m===null||m._visibility&1||($=!0)),m=ee,ee=ee.return;return m.tag===3?(ee=m.stateNode,$&&x!==null&&($=31-Qo(C),m=ee.hiddenUpdates,k=m[$],k===null?m[$]=[x]:k.push(x),x.lane=C|536870912),ee):null}function an(m){if(50<ai)throw ai=0,Jm=null,Error(i(185));for(var x=m.return;x!==null;)m=x,x=m.return;return m.tag===3?m.stateNode:null}function Dn(m){m.updateQueue={baseState:m.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vt(m,x){m=m.updateQueue,x.updateQueue===m&&(x.updateQueue={baseState:m.baseState,firstBaseUpdate:m.firstBaseUpdate,lastBaseUpdate:m.lastBaseUpdate,shared:m.shared,callbacks:null})}function pn(m){return{lane:m,tag:0,payload:null,callback:null,next:null}}function Bt(m,x,C){var k=m.updateQueue;if(k===null)return null;if(k=k.shared,(Dr&2)!==0){var $=k.pending;return $===null?x.next=x:(x.next=$.next,$.next=x),k.pending=x,x=an(m),Ht(m,null,C),x}return wt(m,k,x,C),an(m)}function Cn(m,x,C){if(x=x.updateQueue,x!==null&&(x=x.shared,(C&4194048)!==0)){var k=x.lanes;k&=m.pendingLanes,C|=k,x.lanes=C,O(m,C)}}function Bn(m,x){var C=m.updateQueue,k=m.alternate;if(k!==null&&(k=k.updateQueue,C===k)){var $=null,ee=null;if(C=C.firstBaseUpdate,C!==null){do{var Ce={lane:C.lane,tag:C.tag,payload:C.payload,callback:null,next:null};ee===null?$=ee=Ce:ee=ee.next=Ce,C=C.next}while(C!==null);ee===null?$=ee=x:ee=ee.next=x}else $=ee=x;C={baseState:k.baseState,firstBaseUpdate:$,lastBaseUpdate:ee,shared:k.shared,callbacks:k.callbacks},m.updateQueue=C;return}m=C.lastBaseUpdate,m===null?C.firstBaseUpdate=x:m.next=x,C.lastBaseUpdate=x}function wn(){if(hx){var m=Sa;if(m!==null)throw m}}function On(m,x,C,k){hx=!1;var $=m.updateQueue;Cl=!1;var ee=$.firstBaseUpdate,Ce=$.lastBaseUpdate,at=$.shared.pending;if(at!==null){$.shared.pending=null;var Dt=at,Wt=Dt.next;Dt.next=null,Ce===null?ee=Wt:Ce.next=Wt,Ce=Dt;var ln=m.alternate;ln!==null&&(ln=ln.updateQueue,at=ln.lastBaseUpdate,at!==Ce&&(at===null?ln.firstBaseUpdate=Wt:at.next=Wt,ln.lastBaseUpdate=Dt))}if(ee!==null){var qt=$.baseState;Ce=0,ln=Wt=Dt=null,at=ee;do{var yn=at.lane&-536870913,dr=yn!==at.lane;if(dr?(Ur&yn)===yn:(k&yn)===yn){yn!==0&&yn===_d&&(hx=!0),ln!==null&&(ln=ln.next={lane:0,tag:at.tag,payload:at.payload,callback:null,next:null});e:{var Ks=m,t0=at;yn=x;var Tf=C;switch(t0.tag){case 1:if(Ks=t0.payload,typeof Ks=="function"){qt=Ks.call(Tf,qt,yn);break e}qt=Ks;break e;case 3:Ks.flags=Ks.flags&-65537|128;case 0:if(Ks=t0.payload,yn=typeof Ks=="function"?Ks.call(Tf,qt,yn):Ks,yn==null)break e;qt=Bv({},qt,yn);break e;case 2:Cl=!0}}yn=at.callback,yn!==null&&(m.flags|=64,dr&&(m.flags|=8192),dr=$.callbacks,dr===null?$.callbacks=[yn]:dr.push(yn))}else dr={lane:yn,tag:at.tag,payload:at.payload,callback:at.callback,next:null},ln===null?(Wt=ln=dr,Dt=qt):ln=ln.next=dr,Ce|=yn;if(at=at.next,at===null){if(at=$.shared.pending,at===null)break;dr=at,at=dr.next,dr.next=null,$.lastBaseUpdate=dr,$.shared.pending=null}}while(!0);ln===null&&(Dt=qt),$.baseState=Dt,$.firstBaseUpdate=Wt,$.lastBaseUpdate=ln,ee===null&&($.shared.lanes=0),wd|=Ce,m.lanes=Ce,m.memoizedState=qt}}function jn(m,x){if(typeof m!="function")throw Error(i(191,m));m.call(x)}function Bi(m,x){var C=m.callbacks;if(C!==null)for(m.callbacks=null,m=0;m<C.length;m++)jn(C[m],x)}function ui(m,x){m=Nu,b(xf,m),b(Lh,x),Nu=m|x.baseLanes}function be(){b(xf,Nu),b(Lh,Lh.current)}function ot(){Nu=xf.current,v(Lh),v(xf)}function _t(m){var x=m.alternate;b(zs,zs.current&1),b(el,m),tl===null&&(x===null||Lh.current!==null||x.memoizedState!==null)&&(tl=m)}function xt(m){b(zs,zs.current),b(el,m),tl===null&&(tl=m)}function gt(m){m.tag===22?(b(zs,zs.current),b(el,m),tl===null&&(tl=m)):Yt()}function Yt(){b(zs,zs.current),b(el,el.current)}function rn(m){v(el),tl===m&&(tl=null),v(zs)}function sn(m){for(var x=m;x!==null;){if(x.tag===13){var C=x.memoizedState;if(C!==null&&(C=C.dehydrated,C===null||hf(C)||Yv(C)))return x}else if(x.tag===19&&(x.memoizedProps.revealOrder==="forwards"||x.memoizedProps.revealOrder==="backwards"||x.memoizedProps.revealOrder==="unstable_legacy-backwards"||x.memoizedProps.revealOrder==="together")){if((x.flags&128)!==0)return x}else if(x.child!==null){x.child.return=x,x=x.child;continue}if(x===m)break;for(;x.sibling===null;){if(x.return===null||x.return===m)return null;x=x.return}x.sibling.return=x.return,x=x.sibling}return null}function Zt(){throw Error(i(321))}function Mn(m,x){if(x===null)return!1;for(var C=0;C<x.length&&C<m.length;C++)if(!qs(m[C],x[C]))return!1;return!0}function Fn(m,x,C,k,$,ee){return Sd=ee,vr=x,x.memoizedState=null,x.updateQueue=null,x.lanes=0,Gn.H=m===null||m.memoizedState===null?Ms:Au,Yr=!1,ee=C(k,$),Yr=!1,_r&&(ee=on(x,C,k,$)),$n(m),ee}function $n(m){Gn.H=Al;var x=Un!==null&&Un.next!==null;if(Sd=0,or=Un=vr=null,wr=!1,pc=0,Fc=null,x)throw Error(i(300));m===null||es||(m=m.dependencies,m!==null&&Pe(m)&&(es=!0))}function on(m,x,C,k){vr=m;var $=0;do{if(_r&&(Fc=null),pc=0,_r=!1,25<=$)throw Error(i(301));if($+=1,or=Un=null,m.updateQueue!=null){var ee=m.updateQueue;ee.lastEffect=null,ee.events=null,ee.stores=null,ee.memoCache!=null&&(ee.memoCache.index=0)}Gn.H=yf,ee=x(C,k)}while(_r);return ee}function ir(){var m=Gn.H,x=m.useState()[0];return x=typeof x.then=="function"?Rn(x):x,m=m.useState()[0],(Un!==null?Un.memoizedState:null)!==m&&(vr.flags|=1024),x}function qr(){var m=mo!==0;return mo=0,m}function Jr(m,x,C){x.updateQueue=m.updateQueue,x.flags&=-2053,m.lanes&=~C}function cr(m){if(wr){for(m=m.memoizedState;m!==null;){var x=m.queue;x!==null&&(x.pending=null),m=m.next}wr=!1}Sd=0,or=Un=vr=null,_r=!1,pc=mo=0,Fc=null}function Nr(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return or===null?vr.memoizedState=or=m:or=or.next=m,or}function en(){if(Un===null){var m=vr.alternate;m=m!==null?m.memoizedState:null}else m=Un.next;var x=or===null?vr.memoizedState:or.next;if(x!==null)or=x,Un=m;else{if(m===null)throw vr.alternate===null?Error(i(467)):Error(i(310));Un=m,m={memoizedState:Un.memoizedState,baseState:Un.baseState,baseQueue:Un.baseQueue,queue:Un.queue,next:null},or===null?vr.memoizedState=or=m:or=or.next=m}return or}function ss(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rn(m){var x=pc;return pc+=1,Fc===null&&(Fc=[]),m=je(Fc,m,x),x=vr,(or===null?x.memoizedState:or.next)===null&&(x=x.alternate,Gn.H=x===null||x.memoizedState===null?Ms:Au),m}function gs(m){if(m!==null&&typeof m=="object"){if(typeof m.then=="function")return Rn(m);if(m.$$typeof===sc)return oe(m)}throw Error(i(438,String(m)))}function Rs(m){var x=null,C=vr.updateQueue;if(C!==null&&(x=C.memoCache),x==null){var k=vr.alternate;k!==null&&(k=k.updateQueue,k!==null&&(k=k.memoCache,k!=null&&(x={data:k.data.map(function($){return $.slice()}),index:0})))}if(x==null&&(x={data:[],index:0}),C===null&&(C=ss(),vr.updateQueue=C),C.memoCache=x,C=x.data[x.index],C===void 0)for(C=x.data[x.index]=Array(m),k=0;k<m;k++)C[k]=Hy;return x.index++,C}function Pi(m,x){return typeof x=="function"?x(m):x}function vs(m){var x=en();return pr(x,Un,m)}function pr(m,x,C){var k=m.queue;if(k===null)throw Error(i(311));k.lastRenderedReducer=C;var $=m.baseQueue,ee=k.pending;if(ee!==null){if($!==null){var Ce=$.next;$.next=ee.next,ee.next=Ce}x.baseQueue=$=ee,k.pending=null}if(ee=m.baseState,$===null)m.memoizedState=ee;else{x=$.next;var at=Ce=null,Dt=null,Wt=x,ln=!1;do{var qt=Wt.lane&-536870913;if(qt!==Wt.lane?(Ur&qt)===qt:(Sd&qt)===qt){var yn=Wt.revertLane;if(yn===0)Dt!==null&&(Dt=Dt.next={lane:0,revertLane:0,gesture:null,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null}),qt===_d&&(ln=!0);else if((Sd&yn)===yn){Wt=Wt.next,yn===_d&&(ln=!0);continue}else qt={lane:0,revertLane:Wt.revertLane,gesture:null,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null},Dt===null?(at=Dt=qt,Ce=ee):Dt=Dt.next=qt,vr.lanes|=yn,wd|=yn;qt=Wt.action,Yr&&C(ee,qt),ee=Wt.hasEagerState?Wt.eagerState:C(ee,qt)}else yn={lane:qt,revertLane:Wt.revertLane,gesture:Wt.gesture,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null},Dt===null?(at=Dt=yn,Ce=ee):Dt=Dt.next=yn,vr.lanes|=qt,wd|=qt;Wt=Wt.next}while(Wt!==null&&Wt!==x);if(Dt===null?Ce=ee:Dt.next=at,!qs(ee,m.memoizedState)&&(es=!0,ln&&(C=Sa,C!==null)))throw C;m.memoizedState=ee,m.baseState=Ce,m.baseQueue=Dt,k.lastRenderedState=ee}return $===null&&(k.lanes=0),[m.memoizedState,k.dispatch]}function di(m){var x=en(),C=x.queue;if(C===null)throw Error(i(311));C.lastRenderedReducer=m;var k=C.dispatch,$=C.pending,ee=x.memoizedState;if($!==null){C.pending=null;var Ce=$=$.next;do ee=m(ee,Ce.action),Ce=Ce.next;while(Ce!==$);qs(ee,x.memoizedState)||(es=!0),x.memoizedState=ee,x.baseQueue===null&&(x.baseState=ee),C.lastRenderedState=ee}return[ee,k]}function ks(m,x,C){var k=vr,$=en(),ee=Fr;if(ee){if(C===void 0)throw Error(i(407));C=C()}else C=x();var Ce=!qs((Un||$).memoizedState,C);if(Ce&&($.memoizedState=C,es=!0),$=$.queue,zr(co.bind(null,k,$,m),[m]),$.getSnapshot!==x||Ce||or!==null&&or.memoizedState.tag&1){if(k.flags|=2048,xs(9,{destroy:void 0},$a.bind(null,k,$,C,x),null),Mr===null)throw Error(i(349));ee||(Sd&127)!==0||Di(k,x,C)}return C}function Di(m,x,C){m.flags|=16384,m={getSnapshot:x,value:C},x=vr.updateQueue,x===null?(x=ss(),vr.updateQueue=x,x.stores=[m]):(C=x.stores,C===null?x.stores=[m]:C.push(m))}function $a(m,x,C,k){x.value=C,x.getSnapshot=k,So(x)&&ql(m)}function co(m,x,C){return C(function(){So(x)&&ql(m)})}function So(m){var x=m.getSnapshot;m=m.value;try{var C=x();return!qs(m,C)}catch{return!0}}function ql(m){var x=zt(m,2);x!==null&&Ss(x,m,2)}function xl(m){var x=Nr();if(typeof m=="function"){var C=m;if(m=C(),Yr){G(!0);try{C()}finally{G(!1)}}}return x.memoizedState=x.baseState=m,x.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:m},x}function uo(m,x,C,k){return m.baseState=C,pr(m,Un,typeof k=="function"?k:Pi)}function Ps(m,x,C,k,$){if(xh(m))throw Error(i(485));if(m=x.action,m!==null){var ee={payload:$,action:m,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Ce){ee.listeners.push(Ce)}};Gn.T!==null?C(!0):ee.isTransition=!1,k(ee),C=x.pending,C===null?(ee.next=x.pending=ee,Xl(x,ee)):(ee.next=C.next,x.pending=C.next=ee)}}function Xl(m,x){var C=x.action,k=x.payload,$=m.state;if(x.isTransition){var ee=Gn.T,Ce={};Gn.T=Ce;try{var at=C($,k),Dt=Gn.S;Dt!==null&&Dt(Ce,at),Go(m,x,at)}catch(Wt){Mo(m,x,Wt)}finally{ee!==null&&Ce.types!==null&&(ee.types=Ce.types),Gn.T=ee}}else try{ee=C($,k),Go(m,x,ee)}catch(Wt){Mo(m,x,Wt)}}function Go(m,x,C){C!==null&&typeof C=="object"&&typeof C.then=="function"?C.then(function(k){wo(m,x,k)},function(k){return Mo(m,x,k)}):wo(m,x,C)}function wo(m,x,C){x.status="fulfilled",x.value=C,kc(x),m.state=C,x=m.pending,x!==null&&(C=x.next,C===x?m.pending=null:(C=C.next,x.next=C,Xl(m,C)))}function Mo(m,x,C){var k=m.pending;if(m.pending=null,k!==null){k=k.next;do x.status="rejected",x.reason=C,kc(x),x=x.next;while(x!==k)}m.action=null}function kc(m){m=m.listeners;for(var x=0;x<m.length;x++)(0,m[x])()}function Pc(m,x){return x}function Yl(m,x){if(Fr){var C=Mr.formState;if(C!==null){e:{var k=vr;if(Fr){if(cs){var $=Qw(cs,Ro);if($){cs=Jw($),k=ob($);break e}}fe(k)}k=!1}k&&(x=C[0])}}C=Nr(),C.memoizedState=C.baseState=x,k={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pc,lastRenderedState:x},C.queue=k,C=_l.bind(null,vr,k),k.dispatch=C,k=xl(!1);var ee=wp.bind(null,vr,!1,k.queue);return k=Nr(),$={state:x,dispatch:null,action:m,pending:null},k.queue=$,C=Ps.bind(null,vr,$,ee,C),$.dispatch=C,k.memoizedState=m,[x,C,!1]}function qa(m){var x=en();return ia(x,Un,m)}function ia(m,x,C){if(x=pr(m,x,Pc)[0],m=vs(Pi)[0],typeof x=="object"&&x!==null&&typeof x.then=="function")try{var k=Rn(x)}catch(Ce){throw Ce===wa?hc:Ce}else k=x;x=en();var $=x.queue,ee=$.dispatch;return C!==x.memoizedState&&(vr.flags|=2048,xs(9,{destroy:void 0},Na.bind(null,$,C),null)),[k,ee,m]}function Na(m,x){m.action=x}function yl(m){var x=en(),C=Un;if(C!==null)return ia(x,C,m);en(),x=x.memoizedState,C=en();var k=C.queue.dispatch;return C.memoizedState=m,[x,k,!1]}function xs(m,x,C,k){return m={tag:m,create:C,deps:k,inst:x,next:null},x=vr.updateQueue,x===null&&(x=ss(),vr.updateQueue=x),C=x.lastEffect,C===null?x.lastEffect=m.next=m:(k=C.next,C.next=m,m.next=k,x.lastEffect=m),m}function Wo(){return en().memoizedState}function $o(m,x,C,k){var $=Nr();vr.flags|=m,$.memoizedState=xs(1|x,{destroy:void 0},C,k===void 0?null:k)}function Dc(m,x,C,k){var $=en();k=k===void 0?null:k;var ee=$.memoizedState.inst;Un!==null&&k!==null&&Mn(k,Un.memoizedState.deps)?$.memoizedState=xs(x,ee,C,k):(vr.flags|=m,$.memoizedState=xs(1|x,ee,C,k))}function ei(m,x){$o(8390656,8,m,x)}function zr(m,x){Dc(2048,8,m,x)}function Xa(m){vr.flags|=4;var x=vr.updateQueue;if(x===null)x=ss(),vr.updateQueue=x,x.events=[m];else{var C=x.events;C===null?x.events=[m]:C.push(m)}}function mr(m){var x=en().memoizedState;return Xa({ref:x,nextImpl:m}),function(){if((Dr&2)!==0)throw Error(i(440));return x.impl.apply(void 0,arguments)}}function bi(m,x){return Dc(4,2,m,x)}function Ii(m,x){return Dc(4,4,m,x)}function Gr(m,x){if(typeof x=="function"){m=m();var C=x(m);return function(){typeof C=="function"?C():x(null)}}if(x!=null)return m=m(),x.current=m,function(){x.current=null}}function To(m,x,C){C=C!=null?C.concat([m]):null,Dc(4,4,Gr.bind(null,x,m),C)}function bl(){}function Kl(m,x){var C=en();x=x===void 0?null:x;var k=C.memoizedState;return x!==null&&Mn(x,k[1])?k[0]:(C.memoizedState=[m,x],m)}function ga(m,x){var C=en();x=x===void 0?null:x;var k=C.memoizedState;if(x!==null&&Mn(x,k[1]))return k[0];if(k=m(),Yr){G(!0);try{m()}finally{G(!1)}}return C.memoizedState=[k,x],k}function hi(m,x,C){return C===void 0||(Sd&1073741824)!==0&&(Ur&261930)===0?m.memoizedState=x:(m.memoizedState=C,m=dd(),vr.lanes|=m,wd|=m,C)}function vh(m,x,C,k){return qs(C,x)?C:Lh.current!==null?(m=hi(m,C,k),qs(m,x)||(es=!0),m):(Sd&42)===0||(Sd&1073741824)!==0&&(Ur&261930)===0?(es=!0,m.memoizedState=C):(m=dd(),vr.lanes|=m,wd|=m,x)}function nd(m,x,C,k,$){var ee=ac();jr(ee!==0&&8>ee?ee:8);var Ce=Gn.T,at={};Gn.T=at,wp(m,!1,x,C);try{var Dt=$(),Wt=Gn.S;if(Wt!==null&&Wt(at,Dt),Dt!==null&&typeof Dt=="object"&&typeof Dt.then=="function"){var ln=st(Dt,k);va(m,x,ln,os(m))}else va(m,x,k,os(m))}catch(qt){va(m,x,{then:function(){},status:"rejected",reason:qt},os())}finally{jr(ee),Ce!==null&&at.types!==null&&(Ce.types=at.types),Gn.T=Ce}}function rd(m){var x=m.memoizedState;if(x!==null)return x;x={memoizedState:Ah,baseState:Ah,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:Ah},next:null};var C={};return x.next={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:C},next:null},m.memoizedState=x,m=m.alternate,m!==null&&(m.memoizedState=x),x}function Qd(){return oe(Nh)}function fo(){return en().memoizedState}function Gi(){return en().memoizedState}function Hs(m){for(var x=m.return;x!==null;){switch(x.tag){case 24:case 3:var C=os();m=pn(C);var k=Bt(x,m,C);k!==null&&(Ss(k,x,C),Cn(k,x,C)),x={cache:ve()},m.payload=x;return}x=x.return}}function ys(m,x,C){var k=os();C={lane:k,revertLane:0,gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},xh(m)?ym(x,C):(C=Et(m,x,C,k),C!==null&&(Ss(C,m,k),Jd(C,x,k)))}function _l(m,x,C){var k=os();va(m,x,C,k)}function va(m,x,C,k){var $={lane:k,revertLane:0,gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null};if(xh(m))ym(x,$);else{var ee=m.alternate;if(m.lanes===0&&(ee===null||ee.lanes===0)&&(ee=x.lastRenderedReducer,ee!==null))try{var Ce=x.lastRenderedState,at=ee(Ce,C);if($.hasEagerState=!0,$.eagerState=at,qs(at,Ce))return wt(m,x,$,0),Mr===null&&Ve(),!1}catch{}finally{}if(C=Et(m,x,$,k),C!==null)return Ss(C,m,k),Jd(C,x,k),!0}return!1}function wp(m,x,C,k){if(k={lane:2,revertLane:$e(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},xh(m)){if(x)throw Error(i(479))}else x=Et(m,C,k,2),x!==null&&Ss(x,m,2)}function xh(m){var x=m.alternate;return m===vr||x!==null&&x===vr}function ym(m,x){_r=wr=!0;var C=m.pending;C===null?x.next=x:(x.next=C.next,C.next=x),m.pending=x}function Jd(m,x,C){if((C&4194048)!==0){var k=x.lanes;k&=m.pendingLanes,C|=k,x.lanes=C,O(m,C)}}function id(m,x,C,k){x=m.memoizedState,C=C(k,x),C=C==null?x:Bv({},x,C),m.memoizedState=C,m.lanes===0&&(m.updateQueue.baseState=C)}function Mp(m,x,C,k,$,ee,Ce){return m=m.stateNode,typeof m.shouldComponentUpdate=="function"?m.shouldComponentUpdate(k,ee,Ce):x.prototype&&x.prototype.isPureReactComponent?!Ze(C,k)||!Ze($,ee):!0}function Tp(m,x,C,k){m=x.state,typeof x.componentWillReceiveProps=="function"&&x.componentWillReceiveProps(C,k),typeof x.UNSAFE_componentWillReceiveProps=="function"&&x.UNSAFE_componentWillReceiveProps(C,k),x.state!==m&&Xm.enqueueReplaceState(x,x.state,null)}function sd(m,x){var C=x;if("ref"in x){C={};for(var k in x)k!=="ref"&&(C[k]=x[k])}if(m=m.defaultProps){C===x&&(C=Bv({},C));for(var $ in m)C[$]===void 0&&(C[$]=m[$])}return C}function Zl(m,x){try{var C=m.onUncaughtError;C(x.value,{componentStack:x.stack})}catch(k){setTimeout(function(){throw k})}}function Ql(m,x,C){try{var k=m.onCaughtError;k(C.value,{componentStack:C.stack,errorBoundary:x.tag===1?x.stateNode:null})}catch($){setTimeout(function(){throw $})}}function ad(m,x,C){return C=pn(C),C.tag=3,C.payload={element:null},C.callback=function(){Zl(m,x)},C}function bm(m){return m=pn(m),m.tag=3,m}function Ep(m,x,C,k){var $=C.type.getDerivedStateFromError;if(typeof $=="function"){var ee=k.value;m.payload=function(){return $(ee)},m.callback=function(){Ql(x,C,k)}}var Ce=C.stateNode;Ce!==null&&typeof Ce.componentDidCatch=="function"&&(m.callback=function(){Ql(x,C,k),typeof $!="function"&&(Md===null?Md=new Set([this]):Md.add(this));var at=k.stack;this.componentDidCatch(k.value,{componentStack:at!==null?at:""})})}function _m(m,x,C,k,$){if(C.flags|=32768,k!==null&&typeof k=="object"&&typeof k.then=="function"){if(x=C.alternate,x!==null&&Ae(x,C,$,!0),C=el.current,C!==null){switch(C.tag){case 31:case 13:return tl===null?Op():C.alternate===null&&Es===0&&(Es=3),C.flags&=-257,C.flags|=65536,C.lanes=$,k===Eu?C.flags|=16384:(x=C.updateQueue,x===null?C.updateQueue=new Set([k]):x.add(k),jp(m,k,$)),!1;case 22:return C.flags|=65536,k===Eu?C.flags|=16384:(x=C.updateQueue,x===null?(x={transitions:null,markerInstances:null,retryQueue:new Set([k])},C.updateQueue=x):(C=x.retryQueue,C===null?x.retryQueue=new Set([k]):C.add(k)),jp(m,k,$)),!1}throw Error(i(435,C.tag))}return jp(m,k,$),Op(),!1}if(Fr)return x=el.current,x!==null?((x.flags&65536)===0&&(x.flags|=256),x.flags|=65536,x.lanes=$,k!==ux&&(m=Error(i(422),{cause:k}),Le(J(m,C)))):(k!==ux&&(x=Error(i(423),{cause:k}),Le(J(x,C))),m=m.current.alternate,m.flags|=65536,$&=-$,m.lanes|=$,k=J(k,C),$=ad(m.stateNode,k,$),Bn(m,$),Es!==4&&(Es=2)),!1;var ee=Error(i(520),{cause:k});if(ee=J(ee,C),Km===null?Km=[ee]:Km.push(ee),Es!==4&&(Es=2),x===null)return!0;k=J(k,C),C=x;do{switch(C.tag){case 3:return C.flags|=65536,m=$&-$,C.lanes|=m,m=ad(C.stateNode,k,m),Bn(C,m),!1;case 1:if(x=C.type,ee=C.stateNode,(C.flags&128)===0&&(typeof x.getDerivedStateFromError=="function"||ee!==null&&typeof ee.componentDidCatch=="function"&&(Md===null||!Md.has(ee))))return C.flags|=65536,$&=-$,C.lanes|=$,$=bm($),Ep($,m,C,k),Bn(C,$),!1}C=C.return}while(C!==null);return!1}function Vs(m,x,C,k){x.child=m===null?Tb(x,null,C,k):Qa(x,m.child,C,k)}function Sm(m,x,C,k,$){C=C.render;var ee=x.ref;if("ref"in k){var Ce={};for(var at in k)at!=="ref"&&(Ce[at]=k[at])}else Ce=k;return Ke(x),k=Fn(m,x,C,Ce,ee,$),at=qr(),m!==null&&!es?(Jr(m,x,$),qe(m,x,$)):(Fr&&at&&X(x),x.flags|=1,Vs(m,x,k,$),x.child)}function wm(m,x,C,k,$){if(m===null){var ee=C.type;return typeof ee=="function"&&!bh(ee)&&ee.defaultProps===void 0&&C.compare===null?(x.tag=15,x.type=ee,Mm(m,x,ee,k,$)):(m=pd(C.type,null,k,x,x.mode,$),m.ref=x.ref,m.return=x,x.child=m)}if(ee=m.child,!ct(m,$)){var Ce=ee.memoizedProps;if(C=C.compare,C=C!==null?C:Ze,C(Ce,k)&&m.ref===x.ref)return qe(m,x,$)}return x.flags|=1,m=Ml(ee,k),m.ref=x.ref,m.return=x,x.child=m}function Mm(m,x,C,k,$){if(m!==null){var ee=m.memoizedProps;if(Ze(ee,k)&&m.ref===x.ref)if(es=!1,x.pendingProps=k=ee,ct(m,$))(m.flags&131072)!==0&&(es=!0);else return x.lanes=m.lanes,qe(m,x,$)}return ld(m,x,C,k,$)}function Tm(m,x,C,k){var $=k.children,ee=m!==null?m.memoizedState:null;if(m===null&&x.stateNode===null&&(x.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),k.mode==="hidden"){if((x.flags&128)!==0){if(ee=ee!==null?ee.baseLanes|C:C,m!==null){for(k=x.child=m.child,$=0;k!==null;)$=$|k.lanes|k.childLanes,k=k.sibling;k=$&~ee}else k=0,x.child=null;return od(m,x,ee,C,k)}if((C&536870912)!==0)x.memoizedState={baseLanes:0,cachePool:null},m!==null&&pt(x,ee!==null?ee.cachePool:null),ee!==null?ui(x,ee):be(),gt(x);else return k=x.lanes=536870912,od(m,x,ee!==null?ee.baseLanes|C:C,C,k)}else ee!==null?(pt(x,ee.cachePool),ui(x,ee),Yt(),x.memoizedState=null):(m!==null&&pt(x,null),be(),Yt());return Vs(m,x,$,C),x.child}function uu(m,x){return m!==null&&m.tag===22||x.stateNode!==null||(x.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),x.sibling}function od(m,x,C,k,$){var ee=ft();return ee=ee===null?null:{parent:Ws?us._currentValue:us._currentValue2,pool:ee},x.memoizedState={baseLanes:C,cachePool:ee},m!==null&&pt(x,null),be(),gt(x),m!==null&&Ae(m,x,k,!0),x.childLanes=$,null}function Cp(m,x){return x=fu({mode:x.mode,children:x.children},m.mode),x.ref=m.ref,m.child=x,x.return=m,x}function Ap(m,x,C){return Qa(x,m.child,null,C),m=Cp(x,x.pendingProps),m.flags|=2,rn(x),x.memoizedState=null,m}function Em(m,x,C){var k=x.pendingProps,$=(x.flags&128)!==0;if(x.flags&=-129,m===null){if(Fr){if(k.mode==="hidden")return m=Cp(x,k),x.lanes=536870912,uu(null,m);if(xt(x),(m=cs)?(m=cb(m,Ro),m!==null&&(x.memoizedState={dehydrated:m,treeContext:cc!==null?{id:Ka,overflow:zc}:null,retryLane:536870912,hydrationErrors:null},C=Fy(m),C.return=x,x.child=C,_a=x,cs=null)):m=null,m===null)throw fe(x);return x.lanes=536870912,null}return Cp(x,k)}var ee=m.memoizedState;if(ee!==null){var Ce=ee.dehydrated;if(xt(x),$)if(x.flags&256)x.flags&=-257,x=Ap(m,x,C);else if(x.memoizedState!==null)x.child=m.child,x.flags|=128,x=null;else throw Error(i(558));else if(es||Ae(m,x,C,!1),$=(C&m.childLanes)!==0,es||$){if(k=Mr,k!==null&&(Ce=W(k,C),Ce!==0&&Ce!==ee.retryLane))throw ee.retryLane=Ce,zt(m,Ce),Ss(k,m,Ce),Po;Op(),x=Ap(m,x,C)}else m=ee.treeContext,ls&&(cs=r3(Ce),_a=x,Fr=!0,Tu=null,Ro=!1,m!==null&&se(x,m)),x=Cp(x,k),x.flags|=4096;return x}return m=Ml(m.child,{mode:k.mode,children:k.children}),m.ref=x.ref,x.child=m,m.return=x,m}function Jl(m,x){var C=x.ref;if(C===null)m!==null&&m.ref!==null&&(x.flags|=4194816);else{if(typeof C!="function"&&typeof C!="object")throw Error(i(284));(m===null||m.ref!==C)&&(x.flags|=4194816)}}function ld(m,x,C,k,$){return Ke(x),C=Fn(m,x,C,k,void 0,$),k=qr(),m!==null&&!es?(Jr(m,x,$),qe(m,x,$)):(Fr&&k&&X(x),x.flags|=1,Vs(m,x,C,$),x.child)}function Ds(m,x,C,k,$,ee){return Ke(x),x.updateQueue=null,C=on(x,k,C,$),$n(m),k=qr(),m!==null&&!es?(Jr(m,x,ee),qe(m,x,ee)):(Fr&&k&&X(x),x.flags|=1,Vs(m,x,C,ee),x.child)}function du(m,x,C,k,$){if(Ke(x),x.stateNode===null){var ee=Su,Ce=C.contextType;typeof Ce=="object"&&Ce!==null&&(ee=oe(Ce)),ee=new C(k,ee),x.memoizedState=ee.state!==null&&ee.state!==void 0?ee.state:null,ee.updater=Xm,x.stateNode=ee,ee._reactInternals=x,ee=x.stateNode,ee.props=k,ee.state=x.memoizedState,ee.refs={},Dn(x),Ce=C.contextType,ee.context=typeof Ce=="object"&&Ce!==null?oe(Ce):Su,ee.state=x.memoizedState,Ce=C.getDerivedStateFromProps,typeof Ce=="function"&&(id(x,C,Ce,k),ee.state=x.memoizedState),typeof C.getDerivedStateFromProps=="function"||typeof ee.getSnapshotBeforeUpdate=="function"||typeof ee.UNSAFE_componentWillMount!="function"&&typeof ee.componentWillMount!="function"||(Ce=ee.state,typeof ee.componentWillMount=="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount=="function"&&ee.UNSAFE_componentWillMount(),Ce!==ee.state&&Xm.enqueueReplaceState(ee,ee.state,null),On(x,k,ee,$),wn(),ee.state=x.memoizedState),typeof ee.componentDidMount=="function"&&(x.flags|=4194308),k=!0}else if(m===null){ee=x.stateNode;var at=x.memoizedProps,Dt=sd(C,at);ee.props=Dt;var Wt=ee.context,ln=C.contextType;Ce=Su,typeof ln=="object"&&ln!==null&&(Ce=oe(ln));var qt=C.getDerivedStateFromProps;ln=typeof qt=="function"||typeof ee.getSnapshotBeforeUpdate=="function",at=x.pendingProps!==at,ln||typeof ee.UNSAFE_componentWillReceiveProps!="function"&&typeof ee.componentWillReceiveProps!="function"||(at||Wt!==Ce)&&Tp(x,ee,k,Ce),Cl=!1;var yn=x.memoizedState;ee.state=yn,On(x,k,ee,$),wn(),Wt=x.memoizedState,at||yn!==Wt||Cl?(typeof qt=="function"&&(id(x,C,qt,k),Wt=x.memoizedState),(Dt=Cl||Mp(x,C,Dt,k,yn,Wt,Ce))?(ln||typeof ee.UNSAFE_componentWillMount!="function"&&typeof ee.componentWillMount!="function"||(typeof ee.componentWillMount=="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount=="function"&&ee.UNSAFE_componentWillMount()),typeof ee.componentDidMount=="function"&&(x.flags|=4194308)):(typeof ee.componentDidMount=="function"&&(x.flags|=4194308),x.memoizedProps=k,x.memoizedState=Wt),ee.props=k,ee.state=Wt,ee.context=Ce,k=Dt):(typeof ee.componentDidMount=="function"&&(x.flags|=4194308),k=!1)}else{ee=x.stateNode,Vt(m,x),Ce=x.memoizedProps,ln=sd(C,Ce),ee.props=ln,qt=x.pendingProps,yn=ee.context,Wt=C.contextType,Dt=Su,typeof Wt=="object"&&Wt!==null&&(Dt=oe(Wt)),at=C.getDerivedStateFromProps,(Wt=typeof at=="function"||typeof ee.getSnapshotBeforeUpdate=="function")||typeof ee.UNSAFE_componentWillReceiveProps!="function"&&typeof ee.componentWillReceiveProps!="function"||(Ce!==qt||yn!==Dt)&&Tp(x,ee,k,Dt),Cl=!1,yn=x.memoizedState,ee.state=yn,On(x,k,ee,$),wn();var dr=x.memoizedState;Ce!==qt||yn!==dr||Cl||m!==null&&m.dependencies!==null&&Pe(m.dependencies)?(typeof at=="function"&&(id(x,C,at,k),dr=x.memoizedState),(ln=Cl||Mp(x,C,ln,k,yn,dr,Dt)||m!==null&&m.dependencies!==null&&Pe(m.dependencies))?(Wt||typeof ee.UNSAFE_componentWillUpdate!="function"&&typeof ee.componentWillUpdate!="function"||(typeof ee.componentWillUpdate=="function"&&ee.componentWillUpdate(k,dr,Dt),typeof ee.UNSAFE_componentWillUpdate=="function"&&ee.UNSAFE_componentWillUpdate(k,dr,Dt)),typeof ee.componentDidUpdate=="function"&&(x.flags|=4),typeof ee.getSnapshotBeforeUpdate=="function"&&(x.flags|=1024)):(typeof ee.componentDidUpdate!="function"||Ce===m.memoizedProps&&yn===m.memoizedState||(x.flags|=4),typeof ee.getSnapshotBeforeUpdate!="function"||Ce===m.memoizedProps&&yn===m.memoizedState||(x.flags|=1024),x.memoizedProps=k,x.memoizedState=dr),ee.props=k,ee.state=dr,ee.context=Dt,k=ln):(typeof ee.componentDidUpdate!="function"||Ce===m.memoizedProps&&yn===m.memoizedState||(x.flags|=4),typeof ee.getSnapshotBeforeUpdate!="function"||Ce===m.memoizedProps&&yn===m.memoizedState||(x.flags|=1024),k=!1)}return ee=k,Jl(m,x),k=(x.flags&128)!==0,ee||k?(ee=x.stateNode,C=k&&typeof C.getDerivedStateFromError!="function"?null:ee.render(),x.flags|=1,m!==null&&k?(x.child=Qa(x,m.child,null,$),x.child=Qa(x,null,C,$)):Vs(m,x,C,$),x.memoizedState=ee.state,m=x.child):m=qe(m,x,$),m}function bs(m,x,C,k){return We(),x.flags|=256,Vs(m,x,C,k),x.child}function Np(m){return{baseLanes:m,cachePool:et()}}function yh(m,x,C){return m=m!==null?m.childLanes&~C:0,x&&(m|=Do),m}function cd(m,x,C){var k=x.pendingProps,$=!1,ee=(x.flags&128)!==0,Ce;if((Ce=ee)||(Ce=m!==null&&m.memoizedState===null?!1:(zs.current&2)!==0),Ce&&($=!0,x.flags&=-129),Ce=(x.flags&32)!==0,x.flags&=-33,m===null){if(Fr){if($?_t(x):Yt(),(m=cs)?(m=o3(m,Ro),m!==null&&(x.memoizedState={dehydrated:m,treeContext:cc!==null?{id:Ka,overflow:zc}:null,retryLane:536870912,hydrationErrors:null},C=Fy(m),C.return=x,x.child=C,_a=x,cs=null)):m=null,m===null)throw fe(x);return Yv(m)?x.lanes=32:x.lanes=536870912,null}var at=k.children;return k=k.fallback,$?(Yt(),$=x.mode,at=fu({mode:"hidden",children:at},$),k=ic(k,$,C,null),at.return=x,k.return=x,at.sibling=k,x.child=at,k=x.child,k.memoizedState=Np(C),k.childLanes=yh(m,Ce,C),x.memoizedState=zh,uu(null,k)):(_t(x),Rp(x,at))}var Dt=m.memoizedState;if(Dt!==null&&(at=Dt.dehydrated,at!==null)){if(ee)x.flags&256?(_t(x),x.flags&=-257,x=Ic(m,x,C)):x.memoizedState!==null?(Yt(),x.child=m.child,x.flags|=128,x=null):(Yt(),at=k.fallback,$=x.mode,k=fu({mode:"visible",children:k.children},$),at=ic(at,$,C,null),at.flags|=2,k.return=x,at.return=x,k.sibling=at,x.child=k,Qa(x,m.child,null,C),k=x.child,k.memoizedState=Np(C),k.childLanes=yh(m,Ce,C),x.memoizedState=zh,x=uu(null,k));else if(_t(x),Yv(at))Ce=Kv(at).digest,k=Error(i(419)),k.stack="",k.digest=Ce,Le({value:k,source:null,stack:null}),x=Ic(m,x,C);else if(es||Ae(m,x,C,!1),Ce=(C&m.childLanes)!==0,es||Ce){if(Ce=Mr,Ce!==null&&(k=W(Ce,C),k!==0&&k!==Dt.retryLane))throw Dt.retryLane=k,zt(m,k),Ss(Ce,m,k),Po;hf(at)||Op(),x=Ic(m,x,C)}else hf(at)?(x.flags|=192,x.child=m.child,x=null):(m=Dt.treeContext,ls&&(cs=i3(at),_a=x,Fr=!0,Tu=null,Ro=!1,m!==null&&se(x,m)),x=Rp(x,k.children),x.flags|=4096);return x}return $?(Yt(),at=k.fallback,$=x.mode,Dt=m.child,ee=Dt.sibling,k=Ml(Dt,{mode:"hidden",children:k.children}),k.subtreeFlags=Dt.subtreeFlags&65011712,ee!==null?at=Ml(ee,at):(at=ic(at,$,C,null),at.flags|=2),at.return=x,k.return=x,k.sibling=at,x.child=k,uu(null,k),k=x.child,at=m.child.memoizedState,at===null?at=Np(C):($=at.cachePool,$!==null?(Dt=Ws?us._currentValue:us._currentValue2,$=$.parent!==Dt?{parent:Dt,pool:Dt}:$):$=et(),at={baseLanes:at.baseLanes|C,cachePool:$}),k.memoizedState=at,k.childLanes=yh(m,Ce,C),x.memoizedState=zh,uu(m.child,k)):(_t(x),C=m.child,m=C.sibling,C=Ml(C,{mode:"visible",children:k.children}),C.return=x,C.sibling=null,m!==null&&(Ce=x.deletions,Ce===null?(x.deletions=[m],x.flags|=16):Ce.push(m)),x.child=C,x.memoizedState=null,C)}function Rp(m,x){return x=fu({mode:"visible",children:x},m.mode),x.return=m,m.child=x}function fu(m,x){return m=n(22,m,null,x),m.lanes=0,m}function Ic(m,x,C){return Qa(x,m.child,null,C),m=Rp(x,x.pendingProps.children),m.flags|=2,x.memoizedState=null,m}function de(m,x,C){m.lanes|=x;var k=m.alternate;k!==null&&(k.lanes|=x),ne(m.return,x,C)}function Ee(m,x,C,k,$,ee){var Ce=m.memoizedState;Ce===null?m.memoizedState={isBackwards:x,rendering:null,renderingStartTime:0,last:k,tail:C,tailMode:$,treeForkCount:ee}:(Ce.isBackwards=x,Ce.rendering=null,Ce.renderingStartTime=0,Ce.last=k,Ce.tail=C,Ce.tailMode=$,Ce.treeForkCount=ee)}function Ue(m,x,C){var k=x.pendingProps,$=k.revealOrder,ee=k.tail;k=k.children;var Ce=zs.current,at=(Ce&2)!==0;if(at?(Ce=Ce&1|2,x.flags|=128):Ce&=1,b(zs,Ce),Vs(m,x,k,C),k=Fr?Wm:0,!at&&m!==null&&(m.flags&128)!==0)e:for(m=x.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&de(m,C,x);else if(m.tag===19)de(m,C,x);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===x)break e;for(;m.sibling===null;){if(m.return===null||m.return===x)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}switch($){case"forwards":for(C=x.child,$=null;C!==null;)m=C.alternate,m!==null&&sn(m)===null&&($=C),C=C.sibling;C=$,C===null?($=x.child,x.child=null):($=C.sibling,C.sibling=null),Ee(x,!1,$,C,ee,k);break;case"backwards":case"unstable_legacy-backwards":for(C=null,$=x.child,x.child=null;$!==null;){if(m=$.alternate,m!==null&&sn(m)===null){x.child=$;break}m=$.sibling,$.sibling=C,C=$,$=m}Ee(x,!0,C,null,ee,k);break;case"together":Ee(x,!1,null,null,void 0,k);break;default:x.memoizedState=null}return x.child}function qe(m,x,C){if(m!==null&&(x.dependencies=m.dependencies),wd|=x.lanes,(C&x.childLanes)===0)if(m!==null){if(Ae(m,x,C,!1),(C&x.childLanes)===0)return null}else return null;if(m!==null&&x.child!==m.child)throw Error(i(153));if(x.child!==null){for(m=x.child,C=Ml(m,m.pendingProps),x.child=C,C.return=x;m.sibling!==null;)m=m.sibling,C=C.sibling=Ml(m,m.pendingProps),C.return=x;C.sibling=null}return x.child}function ct(m,x){return(m.lanes&x)!==0?!0:(m=m.dependencies,!!(m!==null&&Pe(m)))}function St(m,x,C){switch(x.tag){case 3:re(x,x.stateNode.containerInfo),pe(x,us,m.memoizedState.cache),We();break;case 27:case 5:ue(x);break;case 4:re(x,x.stateNode.containerInfo);break;case 10:pe(x,x.type,x.memoizedProps.value);break;case 31:if(x.memoizedState!==null)return x.flags|=128,xt(x),null;break;case 13:var k=x.memoizedState;if(k!==null)return k.dehydrated!==null?(_t(x),x.flags|=128,null):(C&x.child.childLanes)!==0?cd(m,x,C):(_t(x),m=qe(m,x,C),m!==null?m.sibling:null);_t(x);break;case 19:var $=(m.flags&128)!==0;if(k=(C&x.childLanes)!==0,k||(Ae(m,x,C,!1),k=(C&x.childLanes)!==0),$){if(k)return Ue(m,x,C);x.flags|=128}if($=x.memoizedState,$!==null&&($.rendering=null,$.tail=null,$.lastEffect=null),b(zs,zs.current),k)break;return null;case 22:return x.lanes=0,Tm(m,x,C,x.pendingProps);case 24:pe(x,us,m.memoizedState.cache)}return qe(m,x,C)}function jt(m,x,C){if(m!==null)if(m.memoizedProps!==x.pendingProps)es=!0;else{if(!ct(m,C)&&(x.flags&128)===0)return es=!1,St(m,x,C);es=(m.flags&131072)!==0}else es=!1,Fr&&(x.flags&1048576)!==0&&j(x,Wm,x.index);switch(x.lanes=0,x.tag){case 16:e:{var k=x.pendingProps;if(m=He(x.elementType),x.type=m,typeof m=="function")bh(m)?(k=sd(m,k),x.tag=1,x=du(null,x,m,k,C)):(x.tag=0,x=ld(null,x,m,k,C));else{if(m!=null){var $=m.$$typeof;if($===Fp){x.tag=11,x=Sm(null,x,m,k,C);break e}else if($===Vv){x.tag=14,x=wm(null,x,m,k,C);break e}}throw x=h(m)||m,Error(i(306,x,""))}}return x;case 0:return ld(m,x,x.type,x.pendingProps,C);case 1:return k=x.type,$=sd(k,x.pendingProps),du(m,x,k,$,C);case 3:e:{if(re(x,x.stateNode.containerInfo),m===null)throw Error(i(387));var ee=x.pendingProps;$=x.memoizedState,k=$.element,Vt(m,x),On(x,ee,null,C);var Ce=x.memoizedState;if(ee=Ce.cache,pe(x,us,ee),ee!==$.cache&&Xe(x,[us],C,!0),wn(),ee=Ce.element,ls&&$.isDehydrated)if($={element:ee,isDehydrated:!1,cache:Ce.cache},x.updateQueue.baseState=$,x.memoizedState=$,x.flags&256){x=bs(m,x,ee,C);break e}else if(ee!==k){k=J(Error(i(424)),x),Le(k),x=bs(m,x,ee,C);break e}else for(ls&&(cs=n3(x.stateNode.containerInfo),_a=x,Fr=!0,Tu=null,Ro=!0),C=Tb(x,null,ee,C),x.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(We(),ee===k){x=qe(m,x,C);break e}Vs(m,x,ee,C)}x=x.child}return x;case 26:if(oc)return Jl(m,x),m===null?(C=pb(x.type,null,x.pendingProps,null))?x.memoizedState=C:Fr||(x.stateNode=ex(x.type,x.pendingProps,Za.current,x)):x.memoizedState=pb(x.type,m.memoizedProps,x.pendingProps,m.memoizedState),null;case 27:if(ba)return ue(x),m===null&&ba&&Fr&&(k=x.stateNode=tx(x.type,x.pendingProps,Za.current,La.current,!1),_a=x,Ro=!0,cs=lb(x.type,k,cs)),Vs(m,x,x.pendingProps.children,C),Jl(m,x),m===null&&(x.flags|=4194304),x.child;case 5:return m===null&&Fr&&(g3(x.type,x.pendingProps,La.current),($=k=cs)&&(k=s3(k,x.type,x.pendingProps,Ro),k!==null?(x.stateNode=k,_a=x,cs=t3(k),Ro=!1,$=!0):$=!1),$||fe(x)),ue(x),$=x.type,ee=x.pendingProps,Ce=m!==null?m.memoizedProps:null,k=ee.children,No($,ee)?k=null:Ce!==null&&No($,Ce)&&(x.flags|=32),x.memoizedState!==null&&($=Fn(m,x,ir,null,null,C),Ws?Nh._currentValue=$:Nh._currentValue2=$),Jl(m,x),Vs(m,x,k,C),x.child;case 6:return m===null&&Fr&&(hb(x.pendingProps,La.current),(m=C=cs)&&(C=a3(C,x.pendingProps,Ro),C!==null?(x.stateNode=C,_a=x,cs=null,m=!0):m=!1),m||fe(x)),null;case 13:return cd(m,x,C);case 4:return re(x,x.stateNode.containerInfo),k=x.pendingProps,m===null?x.child=Qa(x,null,k,C):Vs(m,x,k,C),x.child;case 11:return Sm(m,x,x.type,x.pendingProps,C);case 7:return Vs(m,x,x.pendingProps,C),x.child;case 8:return Vs(m,x,x.pendingProps.children,C),x.child;case 12:return Vs(m,x,x.pendingProps.children,C),x.child;case 10:return k=x.pendingProps,pe(x,x.type,k.value),Vs(m,x,k.children,C),x.child;case 9:return $=x.type._context,k=x.pendingProps.children,Ke(x),$=oe($),k=k($),x.flags|=1,Vs(m,x,k,C),x.child;case 14:return wm(m,x,x.type,x.pendingProps,C);case 15:return Mm(m,x,x.type,x.pendingProps,C);case 19:return Ue(m,x,C);case 31:return Em(m,x,C);case 22:return Tm(m,x,C,x.pendingProps);case 24:return Ke(x),k=oe(us),m===null?($=ft(),$===null&&($=Mr,ee=ve(),$.pooledCache=ee,ee.refCount++,ee!==null&&($.pooledCacheLanes|=C),$=ee),x.memoizedState={parent:k,cache:$},Dn(x),pe(x,us,$)):((m.lanes&C)!==0&&(Vt(m,x),On(x,null,null,C),wn()),$=m.memoizedState,ee=x.memoizedState,$.parent!==k?($={parent:k,cache:k},x.memoizedState=$,x.lanes===0&&(x.memoizedState=x.updateQueue.baseState=$),pe(x,us,k)):(k=ee.cache,pe(x,us,k),k!==$.cache&&Xe(x,[us],C,!0))),Vs(m,x,x.pendingProps.children,C),x.child;case 29:throw x.pendingProps}throw Error(i(156,x.tag))}function Gt(m){m.flags|=4}function Kt(m){Tl&&(m.flags|=8)}function mn(m,x){if(m!==null&&m.child===x.child)return!1;if((x.flags&16)!==0)return!0;for(m=x.child;m!==null;){if((m.flags&8218)!==0||(m.subtreeFlags&8218)!==0)return!0;m=m.sibling}return!1}function vn(m,x,C,k){if($r)for(C=x.child;C!==null;){if(C.tag===5||C.tag===6)zm(m,C.stateNode);else if(!(C.tag===4||ba&&C.tag===27)&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===x)break;for(;C.sibling===null;){if(C.return===null||C.return===x)return;C=C.return}C.sibling.return=C.return,C=C.sibling}else if(Tl)for(var $=x.child;$!==null;){if($.tag===5){var ee=$.stateNode;C&&k&&(ee=Zw(ee,$.type,$.memoizedProps)),zm(m,ee)}else if($.tag===6)ee=$.stateNode,C&&k&&(ee=ab(ee,$.memoizedProps)),zm(m,ee);else if($.tag!==4){if($.tag===22&&$.memoizedState!==null)ee=$.child,ee!==null&&(ee.return=$),vn(m,$,!0,!0);else if($.child!==null){$.child.return=$,$=$.child;continue}}if($===x)break;for(;$.sibling===null;){if($.return===null||$.return===x)return;$=$.return}$.sibling.return=$.return,$=$.sibling}}function _n(m,x,C,k){var $=!1;if(Tl)for(var ee=x.child;ee!==null;){if(ee.tag===5){var Ce=ee.stateNode;C&&k&&(Ce=Zw(Ce,ee.type,ee.memoizedProps)),ib(m,Ce)}else if(ee.tag===6)Ce=ee.stateNode,C&&k&&(Ce=ab(Ce,ee.memoizedProps)),ib(m,Ce);else if(ee.tag!==4){if(ee.tag===22&&ee.memoizedState!==null)$=ee.child,$!==null&&($.return=ee),_n(m,ee,!0,!0),$=!0;else if(ee.child!==null){ee.child.return=ee,ee=ee.child;continue}}if(ee===x)break;for(;ee.sibling===null;){if(ee.return===null||ee.return===x)return $;ee=ee.return}ee.sibling.return=ee.return,ee=ee.sibling}return $}function er(m,x){if(Tl&&mn(m,x)){m=x.stateNode;var C=m.containerInfo,k=rb();_n(k,x,!1,!1),m.pendingChildren=k,Gt(x),Kw(C,k)}}function Xr(m,x,C,k){if($r)m.memoizedProps!==k&&Gt(x);else if(Tl){var $=m.stateNode,ee=m.memoizedProps;if((m=mn(m,x))||ee!==k){var Ce=La.current;ee=Yw($,C,ee,k,!m,null),ee===$?x.stateNode=$:(Kt(x),Ko(ee,C,k,Ce)&&Gt(x),x.stateNode=ee,m&&vn(ee,x,!1,!1))}else x.stateNode=$}}function tr(m,x,C,k,$){if((m.mode&32)!==0&&(C===null?jm(x,k):Gp(x,C,k))){if(m.flags|=16777216,($&335544128)===$||$y(x,k))if(ws(m.stateNode,x,k))m.flags|=8192;else if(Wr())m.flags|=8192;else throw ko=Eu,fx}else m.flags&=-16777217}function ur(m,x){if(xb(x)){if(m.flags|=16777216,!yb(x))if(Wr())m.flags|=8192;else throw ko=Eu,fx}else m.flags&=-16777217}function Vn(m,x){x!==null&&(m.flags|=4),m.flags&16384&&(x=m.tag!==22?N():536870912,m.lanes|=x,Jp|=x)}function Nn(m,x){if(!Fr)switch(m.tailMode){case"hidden":x=m.tail;for(var C=null;x!==null;)x.alternate!==null&&(C=x),x=x.sibling;C===null?m.tail=null:C.sibling=null;break;case"collapsed":C=m.tail;for(var k=null;C!==null;)C.alternate!==null&&(k=C),C=C.sibling;k===null?x||m.tail===null?m.tail=null:m.tail.sibling=null:k.sibling=null}}function qn(m){var x=m.alternate!==null&&m.alternate.child===m.child,C=0,k=0;if(x)for(var $=m.child;$!==null;)C|=$.lanes|$.childLanes,k|=$.subtreeFlags&65011712,k|=$.flags&65011712,$.return=m,$=$.sibling;else for($=m.child;$!==null;)C|=$.lanes|$.childLanes,k|=$.subtreeFlags,k|=$.flags,$.return=m,$=$.sibling;return m.subtreeFlags|=k,m.childLanes=C,x}function Ji(m,x,C){var k=x.pendingProps;switch(H(x),x.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qn(x),null;case 1:return qn(x),null;case 3:return C=x.stateNode,k=null,m!==null&&(k=m.memoizedState.cache),x.memoizedState.cache!==k&&(x.flags|=2048),Re(us),ie(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(m===null||m.child===null)&&(Te(x)?Gt(x):m===null||m.memoizedState.isDehydrated&&(x.flags&256)===0||(x.flags|=1024,Se())),er(m,x),qn(x),null;case 26:if(oc){var $=x.type,ee=x.memoizedState;return m===null?(Gt(x),ee!==null?(qn(x),ur(x,ee)):(qn(x),tr(x,$,null,k,C))):ee?ee!==m.memoizedState?(Gt(x),qn(x),ur(x,ee)):(qn(x),x.flags&=-16777217):(ee=m.memoizedProps,$r?ee!==k&&Gt(x):Xr(m,x,$,k),qn(x),tr(x,$,ee,k,C)),null}case 27:if(ba){if(le(x),C=Za.current,$=x.type,m!==null&&x.stateNode!=null)$r?m.memoizedProps!==k&&Gt(x):Xr(m,x,$,k);else{if(!k){if(x.stateNode===null)throw Error(i(166));return qn(x),null}m=La.current,Te(x)?xe(x,m):(m=tx($,k,C,m,!0),x.stateNode=m,Gt(x))}return qn(x),null}case 5:if(le(x),$=x.type,m!==null&&x.stateNode!=null)Xr(m,x,$,k);else{if(!k){if(x.stateNode===null)throw Error(i(166));return qn(x),null}if(ee=La.current,Te(x))xe(x,ee),h3(x.stateNode,$,k,ee)&&(x.flags|=64);else{var Ce=Gy($,k,Za.current,ee,x);Kt(x),vn(Ce,x,!1,!1),x.stateNode=Ce,Ko(Ce,$,k,ee)&&Gt(x)}}return qn(x),tr(x,x.type,m===null?null:m.memoizedProps,x.pendingProps,C),null;case 6:if(m&&x.stateNode!=null)C=m.memoizedProps,$r?C!==k&&Gt(x):Tl&&(C!==k?(m=Za.current,C=La.current,Kt(x),x.stateNode=vd(k,m,C,x)):x.stateNode=m.stateNode);else{if(typeof k!="string"&&x.stateNode===null)throw Error(i(166));if(m=Za.current,C=La.current,Te(x)){if(!ls)throw Error(i(176));if(m=x.stateNode,C=x.memoizedProps,k=null,$=_a,$!==null)switch($.tag){case 27:case 5:k=$.memoizedProps}jE(m,C,x,k)||fe(x,!0)}else Kt(x),x.stateNode=vd(k,m,C,x)}return qn(x),null;case 31:if(C=x.memoizedState,m===null||m.memoizedState!==null){if(k=Te(x),C!==null){if(m===null){if(!k)throw Error(i(318));if(!ls)throw Error(i(556));if(m=x.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(557));ub(m,x)}else We(),(x.flags&128)===0&&(x.memoizedState=null),x.flags|=4;qn(x),m=!1}else C=Se(),m!==null&&m.memoizedState!==null&&(m.memoizedState.hydrationErrors=C),m=!0;if(!m)return x.flags&256?(rn(x),x):(rn(x),null);if((x.flags&128)!==0)throw Error(i(558))}return qn(x),null;case 13:if(k=x.memoizedState,m===null||m.memoizedState!==null&&m.memoizedState.dehydrated!==null){if($=Te(x),k!==null&&k.dehydrated!==null){if(m===null){if(!$)throw Error(i(318));if(!ls)throw Error(i(344));if($=x.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(i(317));c3($,x)}else We(),(x.flags&128)===0&&(x.memoizedState=null),x.flags|=4;qn(x),$=!1}else $=Se(),m!==null&&m.memoizedState!==null&&(m.memoizedState.hydrationErrors=$),$=!0;if(!$)return x.flags&256?(rn(x),x):(rn(x),null)}return rn(x),(x.flags&128)!==0?(x.lanes=C,x):(C=k!==null,m=m!==null&&m.memoizedState!==null,C&&(k=x.child,$=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&($=k.alternate.memoizedState.cachePool.pool),ee=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(ee=k.memoizedState.cachePool.pool),ee!==$&&(k.flags|=2048)),C!==m&&C&&(x.child.flags|=8192),Vn(x,x.updateQueue),qn(x),null);case 4:return ie(),er(m,x),m===null&&Oi(x.stateNode.containerInfo),qn(x),null;case 10:return Re(x.type),qn(x),null;case 19:if(v(zs),k=x.memoizedState,k===null)return qn(x),null;if($=(x.flags&128)!==0,ee=k.rendering,ee===null)if($)Nn(k,!1);else{if(Es!==0||m!==null&&(m.flags&128)!==0)for(m=x.child;m!==null;){if(ee=sn(m),ee!==null){for(x.flags|=128,Nn(k,!1),m=ee.updateQueue,x.updateQueue=m,Vn(x,m),x.subtreeFlags=0,m=C,C=x.child;C!==null;)jv(C,m),C=C.sibling;return b(zs,zs.current&1|2),Fr&&F(x,k.treeForkCount),x.child}m=m.sibling}k.tail!==null&&ho()>Mf&&(x.flags|=128,$=!0,Nn(k,!1),x.lanes=4194304)}else{if(!$)if(m=sn(ee),m!==null){if(x.flags|=128,$=!0,m=m.updateQueue,x.updateQueue=m,Vn(x,m),Nn(k,!0),k.tail===null&&k.tailMode==="hidden"&&!ee.alternate&&!Fr)return qn(x),null}else 2*ho()-k.renderingStartTime>Mf&&C!==536870912&&(x.flags|=128,$=!0,Nn(k,!1),x.lanes=4194304);k.isBackwards?(ee.sibling=x.child,x.child=ee):(m=k.last,m!==null?m.sibling=ee:x.child=ee,k.last=ee)}return k.tail!==null?(m=k.tail,k.rendering=m,k.tail=m.sibling,k.renderingStartTime=ho(),m.sibling=null,C=zs.current,b(zs,$?C&1|2:C&1),Fr&&F(x,k.treeForkCount),m):(qn(x),null);case 22:case 23:return rn(x),ot(),k=x.memoizedState!==null,m!==null?m.memoizedState!==null!==k&&(x.flags|=8192):k&&(x.flags|=8192),k?(C&536870912)!==0&&(x.flags&128)===0&&(qn(x),x.subtreeFlags&6&&(x.flags|=8192)):qn(x),C=x.updateQueue,C!==null&&Vn(x,C.retryQueue),C=null,m!==null&&m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(C=m.memoizedState.cachePool.pool),k=null,x.memoizedState!==null&&x.memoizedState.cachePool!==null&&(k=x.memoizedState.cachePool.pool),k!==C&&(x.flags|=2048),m!==null&&v(gf),null;case 24:return C=null,m!==null&&(C=m.memoizedState.cache),x.memoizedState.cache!==C&&(x.flags|=2048),Re(us),qn(x),null;case 25:return null;case 30:return null}throw Error(i(156,x.tag))}function Is(m,x){switch(H(x),x.tag){case 1:return m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 3:return Re(us),ie(),m=x.flags,(m&65536)!==0&&(m&128)===0?(x.flags=m&-65537|128,x):null;case 26:case 27:case 5:return le(x),null;case 31:if(x.memoizedState!==null){if(rn(x),x.alternate===null)throw Error(i(340));We()}return m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 13:if(rn(x),m=x.memoizedState,m!==null&&m.dehydrated!==null){if(x.alternate===null)throw Error(i(340));We()}return m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 19:return v(zs),null;case 4:return ie(),null;case 10:return Re(x.type),null;case 22:case 23:return rn(x),ot(),m!==null&&v(gf),m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 24:return Re(us),null;case 25:return null;default:return null}}function pi(m,x){switch(H(x),x.tag){case 3:Re(us),ie();break;case 26:case 27:case 5:le(x);break;case 4:ie();break;case 31:x.memoizedState!==null&&rn(x);break;case 13:rn(x);break;case 19:v(zs);break;case 10:Re(x.type);break;case 22:case 23:rn(x),ot(),m!==null&&v(gf);break;case 24:Re(us)}}function si(m,x){try{var C=x.updateQueue,k=C!==null?C.lastEffect:null;if(k!==null){var $=k.next;C=$;do{if((C.tag&m)===m){k=void 0;var ee=C.create,Ce=C.inst;k=ee(),Ce.destroy=k}C=C.next}while(C!==$)}}catch(at){nr(x,x.return,at)}}function as(m,x,C){try{var k=x.updateQueue,$=k!==null?k.lastEffect:null;if($!==null){var ee=$.next;k=ee;do{if((k.tag&m)===m){var Ce=k.inst,at=Ce.destroy;if(at!==void 0){Ce.destroy=void 0,$=x;var Dt=C,Wt=at;try{Wt()}catch(ln){nr($,Dt,ln)}}}k=k.next}while(k!==ee)}}catch(ln){nr(x,x.return,ln)}}function Os(m){var x=m.updateQueue;if(x!==null){var C=m.stateNode;try{Bi(x,C)}catch(k){nr(m,m.return,k)}}}function Ya(m,x,C){C.props=sd(m.type,m.memoizedProps),C.state=m.memoizedState;try{C.componentWillUnmount()}catch(k){nr(m,x,k)}}function Ra(m,x){try{var C=m.ref;if(C!==null){switch(m.tag){case 26:case 27:case 5:var k=Bp(m.stateNode);break;case 30:k=m.stateNode;break;default:k=m.stateNode}typeof C=="function"?m.refCleanup=C(k):C.current=k}}catch($){nr(m,x,$)}}function Hi(m,x){var C=m.ref,k=m.refCleanup;if(C!==null)if(typeof k=="function")try{k()}catch($){nr(m,x,$)}finally{m.refCleanup=null,m=m.alternate,m!=null&&(m.refCleanup=null)}else if(typeof C=="function")try{C(null)}catch($){nr(m,x,$)}else C.current=null}function Gs(m){var x=m.type,C=m.memoizedProps,k=m.stateNode;try{Bw(k,x,C,m)}catch($){nr(m,m.return,$)}}function ka(m,x,C){try{Hw(m.stateNode,m.type,C,x,m)}catch(k){nr(m,m.return,k)}}function Eo(m){return m.tag===5||m.tag===3||(oc?m.tag===26:!1)||(ba?m.tag===27&&Rh(m.type):!1)||m.tag===4}function sa(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||Eo(m.return))return null;m=m.return}for(m.sibling.return=m.return,m=m.sibling;m.tag!==5&&m.tag!==6&&m.tag!==18;){if(ba&&m.tag===27&&Rh(m.type)||m.flags&2||m.child===null||m.tag===4)continue e;m.child.return=m,m=m.child}if(!(m.flags&2))return m.stateNode}}function aa(m,x,C){var k=m.tag;if(k===5||k===6)m=m.stateNode,x?Gw(C,m,x):Jy(C,m);else if(k!==4&&(ba&&k===27&&Rh(m.type)&&(C=m.stateNode,x=null),m=m.child,m!==null))for(aa(m,x,C),m=m.sibling;m!==null;)aa(m,x,C),m=m.sibling}function xa(m,x,C){var k=m.tag;if(k===5||k===6)m=m.stateNode,x?Vw(C,m,x):Qy(C,m);else if(k!==4&&(ba&&k===27&&Rh(m.type)&&(C=m.stateNode),m=m.child,m!==null))for(xa(m,x,C),m=m.sibling;m!==null;)xa(m,x,C),m=m.sibling}function Oc(m,x,C){m=m.containerInfo;try{sb(m,C)}catch(k){nr(x,x.return,k)}}function Pa(m){var x=m.stateNode,C=m.memoizedProps;try{la(m.type,C,x,m)}catch(k){nr(m,m.return,k)}}function Av(m,x){for(Gv(m.containerInfo),Xs=x;Xs!==null;)if(m=Xs,x=m.child,(m.subtreeFlags&1028)!==0&&x!==null)x.return=m,Xs=x;else for(;Xs!==null;){m=Xs;var C=m.alternate;switch(x=m.flags,m.tag){case 0:if((x&4)!==0&&(x=m.updateQueue,x=x!==null?x.events:null,x!==null))for(var k=0;k<x.length;k++){var $=x[k];$.ref.impl=$.nextImpl}break;case 11:case 15:break;case 1:if((x&1024)!==0&&C!==null){x=void 0,k=m,$=C.memoizedProps,C=C.memoizedState;var ee=k.stateNode;try{var Ce=sd(k.type,$);x=ee.getSnapshotBeforeUpdate(Ce,C),ee.__reactInternalSnapshotBeforeUpdate=x}catch(at){nr(k,k.return,at)}}break;case 3:(x&1024)!==0&&$r&&nb(m.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((x&1024)!==0)throw Error(i(163))}if(x=m.sibling,x!==null){x.return=m.return,Xs=x;break}Xs=m.return}}function Nw(m,x,C){var k=C.flags;switch(C.tag){case 0:case 11:case 15:Co(m,C),k&4&&si(5,C);break;case 1:if(Co(m,C),k&4)if(m=C.stateNode,x===null)try{m.componentDidMount()}catch(Ce){nr(C,C.return,Ce)}else{var $=sd(C.type,x.memoizedProps);x=x.memoizedState;try{m.componentDidUpdate($,x,m.__reactInternalSnapshotBeforeUpdate)}catch(Ce){nr(C,C.return,Ce)}}k&64&&Os(C),k&512&&Ra(C,C.return);break;case 3:if(Co(m,C),k&64&&(k=C.updateQueue,k!==null)){if(m=null,C.child!==null)switch(C.child.tag){case 27:case 5:m=Bp(C.child.stateNode);break;case 1:m=C.child.stateNode}try{Bi(k,m)}catch(Ce){nr(C,C.return,Ce)}}break;case 27:ba&&x===null&&k&4&&Pa(C);case 26:case 5:if(Co(m,C),x===null){if(k&4)Gs(C);else if(k&64){m=C.type,x=C.memoizedProps,$=C.stateNode;try{d3($,m,x,C)}catch(Ce){nr(C,C.return,Ce)}}}k&512&&Ra(C,C.return);break;case 12:Co(m,C);break;case 31:Co(m,C),k&4&&tc(m,C);break;case 13:Co(m,C),k&4&&Am(m,C),k&64&&(k=C.memoizedState,k!==null&&(k=k.dehydrated,k!==null&&(C=OE.bind(null,C),Zv(k,C))));break;case 22:if(k=C.memoizedState!==null||js,!k){x=x!==null&&x.memoizedState!==null||Fs,$=js;var ee=Fs;js=k,(Fs=x)&&!ee?rc(m,C,(C.subtreeFlags&8772)!==0):Co(m,C),js=$,Fs=ee}break;case 30:break;default:Co(m,C)}}function Oy(m){var x=m.alternate;x!==null&&(m.alternate=null,Oy(x)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(x=m.stateNode,x!==null&&Wv(x)),m.stateNode=null,m.return=null,m.dependencies=null,m.memoizedProps=null,m.memoizedState=null,m.pendingProps=null,m.stateNode=null,m.updateQueue=null}function ec(m,x,C){for(C=C.child;C!==null;)Cm(m,x,C),C=C.sibling}function Cm(m,x,C){if(Jo&&typeof Jo.onCommitFiberUnmount=="function")try{Jo.onCommitFiberUnmount(Dh,C)}catch{}switch(C.tag){case 26:if(oc){Fs||Hi(C,x),ec(m,x,C),C.memoizedState?pf(C.memoizedState):C.stateNode&&vb(C.stateNode);break}case 27:if(ba){Fs||Hi(C,x);var k=Ts,$=Ys;Rh(C.type)&&(Ts=C.stateNode,Ys=!1),ec(m,x,C),Oa(C.stateNode),Ts=k,Ys=$;break}case 5:Fs||Hi(C,x);case 6:if($r){if(k=Ts,$=Ys,Ts=null,ec(m,x,C),Ts=k,Ys=$,Ts!==null)if(Ys)try{eb(Ts,C.stateNode)}catch(ee){nr(C,x,ee)}else try{Ww(Ts,C.stateNode)}catch(ee){nr(C,x,ee)}}else ec(m,x,C);break;case 18:$r&&Ts!==null&&(Ys?Qv(Ts,C.stateNode):fb(Ts,C.stateNode));break;case 4:$r?(k=Ts,$=Ys,Ts=C.stateNode.containerInfo,Ys=!0,ec(m,x,C),Ts=k,Ys=$):(Tl&&Oc(C.stateNode,C,rb()),ec(m,x,C));break;case 0:case 11:case 14:case 15:as(2,C,x),Fs||as(4,C,x),ec(m,x,C);break;case 1:Fs||(Hi(C,x),k=C.stateNode,typeof k.componentWillUnmount=="function"&&Ya(C,x,k)),ec(m,x,C);break;case 21:ec(m,x,C);break;case 22:Fs=(k=Fs)||C.memoizedState!==null,ec(m,x,C),Fs=k;break;default:ec(m,x,C)}}function tc(m,x){if(ls&&x.memoizedState===null&&(m=x.alternate,m!==null&&(m=m.memoizedState,m!==null))){m=m.dehydrated;try{FE(m)}catch(C){nr(x,x.return,C)}}}function Am(m,x){if(ls&&x.memoizedState===null&&(m=x.alternate,m!==null&&(m=m.memoizedState,m!==null&&(m=m.dehydrated,m!==null))))try{UE(m)}catch(C){nr(x,x.return,C)}}function nc(m){switch(m.tag){case 31:case 13:case 19:var x=m.stateNode;return x===null&&(x=m.stateNode=new Cb),x;case 22:return m=m.stateNode,x=m._retryCache,x===null&&(x=m._retryCache=new Cb),x;default:throw Error(i(435,m.tag))}}function ud(m,x){var C=nc(m);x.forEach(function(k){if(!C.has(k)){C.add(k);var $=LE.bind(null,m,k);k.then($,$)}})}function Da(m,x){var C=x.deletions;if(C!==null)for(var k=0;k<C.length;k++){var $=C[k],ee=m,Ce=x;if($r){var at=Ce;e:for(;at!==null;){switch(at.tag){case 27:if(ba){if(Rh(at.type)){Ts=at.stateNode,Ys=!1;break e}break}case 5:Ts=at.stateNode,Ys=!1;break e;case 3:case 4:Ts=at.stateNode.containerInfo,Ys=!0;break e}at=at.return}if(Ts===null)throw Error(i(160));Cm(ee,Ce,$),Ts=null,Ys=!1}else Cm(ee,Ce,$);ee=$.alternate,ee!==null&&(ee.return=null),$.return=null}if(x.subtreeFlags&13886)for(x=x.child;x!==null;)Nm(x,m),x=x.sibling}function Nm(m,x){var C=m.alternate,k=m.flags;switch(m.tag){case 0:case 11:case 14:case 15:Da(x,m),Ia(m),k&4&&(as(3,m,m.return),si(3,m),as(5,m,m.return));break;case 1:Da(x,m),Ia(m),k&512&&(Fs||C===null||Hi(C,C.return)),k&64&&js&&(m=m.updateQueue,m!==null&&(k=m.callbacks,k!==null&&(C=m.shared.hiddenCallbacks,m.shared.hiddenCallbacks=C===null?k:C.concat(k))));break;case 26:if(oc){var $=Ci;if(Da(x,m),Ia(m),k&512&&(Fs||C===null||Hi(C,C.return)),k&4){k=C!==null?C.memoizedState:null;var ee=m.memoizedState;C===null?ee===null?m.stateNode===null?m.stateNode=v3($,m.type,m.memoizedProps,m):gb($,m.type,m.stateNode):m.stateNode=mb($,ee,m.memoizedProps):k!==ee?(k===null?C.stateNode!==null&&vb(C.stateNode):pf(k),ee===null?gb($,m.type,m.stateNode):mb($,ee,m.memoizedProps)):ee===null&&m.stateNode!==null&&ka(m,m.memoizedProps,C.memoizedProps)}break}case 27:if(ba){Da(x,m),Ia(m),k&512&&(Fs||C===null||Hi(C,C.return)),C!==null&&k&4&&ka(m,m.memoizedProps,C.memoizedProps);break}case 5:if(Da(x,m),Ia(m),k&512&&(Fs||C===null||Hi(C,C.return)),$r){if(m.flags&32){$=m.stateNode;try{tb($)}catch(qt){nr(m,m.return,qt)}}k&4&&m.stateNode!=null&&($=m.memoizedProps,ka(m,$,C!==null?C.memoizedProps:$)),k&1024&&(Xp=!0)}else Tl&&m.alternate!==null&&(m.alternate.stateNode=m.stateNode);break;case 6:if(Da(x,m),Ia(m),k&4&&$r){if(m.stateNode===null)throw Error(i(162));k=m.memoizedProps,C=C!==null?C.memoizedProps:k,$=m.stateNode;try{Uw($,C,k)}catch(qt){nr(m,m.return,qt)}}break;case 3:if(oc?(x3(),$=Ci,Ci=Bm(x.containerInfo),Da(x,m),Ci=$):Da(x,m),Ia(m),k&4){if($r&&ls&&C!==null&&C.memoizedState.isDehydrated)try{f3(x.containerInfo)}catch(qt){nr(m,m.return,qt)}if(Tl){k=x.containerInfo,C=x.pendingChildren;try{sb(k,C)}catch(qt){nr(m,m.return,qt)}}}Xp&&(Xp=!1,Nv(m));break;case 4:oc?(C=Ci,Ci=Bm(m.stateNode.containerInfo),Da(x,m),Ia(m),Ci=C):(Da(x,m),Ia(m)),k&4&&Tl&&Oc(m.stateNode,m,m.stateNode.pendingChildren);break;case 12:Da(x,m),Ia(m);break;case 31:Da(x,m),Ia(m),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,ud(m,k)));break;case 13:Da(x,m),Ia(m),m.child.flags&8192&&m.memoizedState!==null!=(C!==null&&C.memoizedState!==null)&&(Zm=ho()),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,ud(m,k)));break;case 22:$=m.memoizedState!==null;var Ce=C!==null&&C.memoizedState!==null,at=js,Dt=Fs;if(js=at||$,Fs=Dt||Ce,Da(x,m),Fs=Dt,js=at,Ia(m),k&8192&&(x=m.stateNode,x._visibility=$?x._visibility&-2:x._visibility|1,$&&(C===null||Ce||js||Fs||ef(m)),$r)){e:if(C=null,$r)for(x=m;;){if(x.tag===5||oc&&x.tag===26){if(C===null){Ce=C=x;try{ee=Ce.stateNode,$?zE(ee):qw(Ce.stateNode,Ce.memoizedProps)}catch(qt){nr(Ce,Ce.return,qt)}}}else if(x.tag===6){if(C===null){Ce=x;try{var Wt=Ce.stateNode;$?$w(Wt):Xw(Wt,Ce.memoizedProps)}catch(qt){nr(Ce,Ce.return,qt)}}}else if(x.tag===18){if(C===null){Ce=x;try{var ln=Ce.stateNode;$?p3(ln):m3(Ce.stateNode)}catch(qt){nr(Ce,Ce.return,qt)}}}else if((x.tag!==22&&x.tag!==23||x.memoizedState===null||x===m)&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===m)break e;for(;x.sibling===null;){if(x.return===null||x.return===m)break e;C===x&&(C=null),x=x.return}C===x&&(C=null),x.sibling.return=x.return,x=x.sibling}}k&4&&(k=m.updateQueue,k!==null&&(C=k.retryQueue,C!==null&&(k.retryQueue=null,ud(m,C))));break;case 19:Da(x,m),Ia(m),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,ud(m,k)));break;case 30:break;case 21:break;default:Da(x,m),Ia(m)}}function Ia(m){var x=m.flags;if(x&2){try{for(var C,k=m.return;k!==null;){if(Eo(k)){C=k;break}k=k.return}if($r){if(C==null)throw Error(i(160));switch(C.tag){case 27:if(ba){var $=C.stateNode,ee=sa(m);xa(m,ee,$);break}case 5:var Ce=C.stateNode;C.flags&32&&(tb(Ce),C.flags&=-33);var at=sa(m);xa(m,at,Ce);break;case 3:case 4:var Dt=C.stateNode.containerInfo,Wt=sa(m);aa(m,Wt,Dt);break;default:throw Error(i(161))}}}catch(ln){nr(m,m.return,ln)}m.flags&=-3}x&4096&&(m.flags&=-4097)}function Nv(m){if(m.subtreeFlags&1024)for(m=m.child;m!==null;){var x=m;Nv(x),x.tag===5&&x.flags&1024&&Xy(x.stateNode),m=m.sibling}}function Co(m,x){if(x.subtreeFlags&8772)for(x=x.child;x!==null;)Nw(m,x.alternate,x),x=x.sibling}function ef(m){for(m=m.child;m!==null;){var x=m;switch(x.tag){case 0:case 11:case 14:case 15:as(4,x,x.return),ef(x);break;case 1:Hi(x,x.return);var C=x.stateNode;typeof C.componentWillUnmount=="function"&&Ya(x,x.return,C),ef(x);break;case 27:ba&&Oa(x.stateNode);case 26:case 5:Hi(x,x.return),ef(x);break;case 22:x.memoizedState===null&&ef(x);break;case 30:ef(x);break;default:ef(x)}m=m.sibling}}function rc(m,x,C){for(C=C&&(x.subtreeFlags&8772)!==0,x=x.child;x!==null;){var k=x.alternate,$=m,ee=x,Ce=ee.flags;switch(ee.tag){case 0:case 11:case 15:rc($,ee,C),si(4,ee);break;case 1:if(rc($,ee,C),k=ee,$=k.stateNode,typeof $.componentDidMount=="function")try{$.componentDidMount()}catch(Wt){nr(k,k.return,Wt)}if(k=ee,$=k.updateQueue,$!==null){var at=k.stateNode;try{var Dt=$.shared.hiddenCallbacks;if(Dt!==null)for($.shared.hiddenCallbacks=null,$=0;$<Dt.length;$++)jn(Dt[$],at)}catch(Wt){nr(k,k.return,Wt)}}C&&Ce&64&&Os(ee),Ra(ee,ee.return);break;case 27:ba&&Pa(ee);case 26:case 5:rc($,ee,C),C&&k===null&&Ce&4&&Gs(ee),Ra(ee,ee.return);break;case 12:rc($,ee,C);break;case 31:rc($,ee,C),C&&Ce&4&&tc($,ee);break;case 13:rc($,ee,C),C&&Ce&4&&Am($,ee);break;case 22:ee.memoizedState===null&&rc($,ee,C),Ra(ee,ee.return);break;case 30:break;default:rc($,ee,C)}x=x.sibling}}function tf(m,x){var C=null;m!==null&&m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(C=m.memoizedState.cachePool.pool),m=null,x.memoizedState!==null&&x.memoizedState.cachePool!==null&&(m=x.memoizedState.cachePool.pool),m!==C&&(m!=null&&m.refCount++,C!=null&&ye(C))}function Ly(m,x){m=null,x.alternate!==null&&(m=x.alternate.memoizedState.cache),x=x.memoizedState.cache,x!==m&&(x.refCount++,m!=null&&ye(m))}function _s(m,x,C,k){if(x.subtreeFlags&10256)for(x=x.child;x!==null;)Rv(m,x,C,k),x=x.sibling}function Rv(m,x,C,k){var $=x.flags;switch(x.tag){case 0:case 11:case 15:_s(m,x,C,k),$&2048&&si(9,x);break;case 1:_s(m,x,C,k);break;case 3:_s(m,x,C,k),$&2048&&(m=null,x.alternate!==null&&(m=x.alternate.memoizedState.cache),x=x.memoizedState.cache,x!==m&&(x.refCount++,m!=null&&ye(m)));break;case 12:if($&2048){_s(m,x,C,k),m=x.stateNode;try{var ee=x.memoizedProps,Ce=ee.id,at=ee.onPostCommit;typeof at=="function"&&at(Ce,x.alternate===null?"mount":"update",m.passiveEffectDuration,-0)}catch(Dt){nr(x,x.return,Dt)}}else _s(m,x,C,k);break;case 31:_s(m,x,C,k);break;case 13:_s(m,x,C,k);break;case 23:break;case 22:ee=x.stateNode,Ce=x.alternate,x.memoizedState!==null?ee._visibility&2?_s(m,x,C,k):kp(m,x):ee._visibility&2?_s(m,x,C,k):(ee._visibility|=2,qo(m,x,C,k,(x.subtreeFlags&10256)!==0||!1)),$&2048&&tf(Ce,x);break;case 24:_s(m,x,C,k),$&2048&&Ly(x.alternate,x);break;default:_s(m,x,C,k)}}function qo(m,x,C,k,$){for($=$&&((x.subtreeFlags&10256)!==0||!1),x=x.child;x!==null;){var ee=m,Ce=x,at=C,Dt=k,Wt=Ce.flags;switch(Ce.tag){case 0:case 11:case 15:qo(ee,Ce,at,Dt,$),si(8,Ce);break;case 23:break;case 22:var ln=Ce.stateNode;Ce.memoizedState!==null?ln._visibility&2?qo(ee,Ce,at,Dt,$):kp(ee,Ce):(ln._visibility|=2,qo(ee,Ce,at,Dt,$)),$&&Wt&2048&&tf(Ce.alternate,Ce);break;case 24:qo(ee,Ce,at,Dt,$),$&&Wt&2048&&Ly(Ce.alternate,Ce);break;default:qo(ee,Ce,at,Dt,$)}x=x.sibling}}function kp(m,x){if(x.subtreeFlags&10256)for(x=x.child;x!==null;){var C=m,k=x,$=k.flags;switch(k.tag){case 22:kp(C,k),$&2048&&tf(k.alternate,k);break;case 24:kp(C,k),$&2048&&Ly(k.alternate,k);break;default:kp(C,k)}x=x.sibling}}function hu(m,x,C){if(m.subtreeFlags&Nl)for(m=m.child;m!==null;)nf(m,x,C),m=m.sibling}function nf(m,x,C){switch(m.tag){case 26:if(hu(m,x,C),m.flags&Nl)if(m.memoizedState!==null)y3(C,Ci,m.memoizedState,m.memoizedProps);else{var k=m.stateNode,$=m.type;m=m.memoizedProps,((x&335544128)===x||$y($,m))&&$v(C,k,$,m)}break;case 5:hu(m,x,C),m.flags&Nl&&(k=m.stateNode,$=m.type,m=m.memoizedProps,((x&335544128)===x||$y($,m))&&$v(C,k,$,m));break;case 3:case 4:oc?(k=Ci,Ci=Bm(m.stateNode.containerInfo),hu(m,x,C),Ci=k):hu(m,x,C);break;case 22:m.memoizedState===null&&(k=m.alternate,k!==null&&k.memoizedState!==null?(k=Nl,Nl=16777216,hu(m,x,C),Nl=k):hu(m,x,C));break;default:hu(m,x,C)}}function kv(m){var x=m.alternate;if(x!==null&&(m=x.child,m!==null)){x.child=null;do x=m.sibling,m.sibling=null,m=x;while(m!==null)}}function Pp(m){var x=m.deletions;if((m.flags&16)!==0){if(x!==null)for(var C=0;C<x.length;C++){var k=x[C];Xs=k,Sl(k,m)}kv(m)}if(m.subtreeFlags&10256)for(m=m.child;m!==null;)Pv(m),m=m.sibling}function Pv(m){switch(m.tag){case 0:case 11:case 15:Pp(m),m.flags&2048&&as(9,m,m.return);break;case 3:Pp(m);break;case 12:Pp(m);break;case 22:var x=m.stateNode;m.memoizedState!==null&&x._visibility&2&&(m.return===null||m.return.tag!==13)?(x._visibility&=-3,Rm(m)):Pp(m);break;default:Pp(m)}}function Rm(m){var x=m.deletions;if((m.flags&16)!==0){if(x!==null)for(var C=0;C<x.length;C++){var k=x[C];Xs=k,Sl(k,m)}kv(m)}for(m=m.child;m!==null;){switch(x=m,x.tag){case 0:case 11:case 15:as(8,x,x.return),Rm(x);break;case 22:C=x.stateNode,C._visibility&2&&(C._visibility&=-3,Rm(x));break;default:Rm(x)}m=m.sibling}}function Sl(m,x){for(;Xs!==null;){var C=Xs;switch(C.tag){case 0:case 11:case 15:as(8,C,x);break;case 23:case 22:if(C.memoizedState!==null&&C.memoizedState.cachePool!==null){var k=C.memoizedState.cachePool.pool;k!=null&&k.refCount++}break;case 24:ye(C.memoizedState.cache)}if(k=C.child,k!==null)k.return=C,Xs=k;else e:for(C=m;Xs!==null;){k=Xs;var $=k.sibling,ee=k.return;if(Oy(k),k===C){Xs=null;break e}if($!==null){$.return=ee,Xs=$;break e}Xs=ee}}}function rf(m){var x=gr(m);if(x!=null){if(typeof x.memoizedProps["data-testname"]!="string")throw Error(i(364));return x}if(m=$s(m),m===null)throw Error(i(362));return m.stateNode.current}function sf(m,x){var C=m.tag;switch(x.$$typeof){case mc:if(m.type===x.value)return!0;break;case Kp:e:{for(x=x.value,m=[m,0],C=0;C<m.length;){var k=m[C++],$=k.tag,ee=m[C++],Ce=x[ee];if($!==5&&$!==26&&$!==27||!ff(k)){for(;Ce!=null&&sf(k,Ce);)ee++,Ce=x[ee];if(ee===x.length){x=!0;break e}else for(k=k.child;k!==null;)m.push(k,ee),k=k.sibling}}x=!1}return x;case Zp:if((C===5||C===26||C===27)&&Zy(m.stateNode,x.value))return!0;break;case bf:if((C===5||C===6||C===26||C===27)&&(m=Fm(m),m!==null&&0<=m.indexOf(x.value)))return!0;break;case Ym:if((C===5||C===26||C===27)&&(m=m.memoizedProps["data-testname"],typeof m=="string"&&m.toLowerCase()===x.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function Dp(m){switch(m.$$typeof){case mc:return"<"+(h(m.value)||"Unknown")+">";case Kp:return":has("+(Dp(m)||"")+")";case Zp:return'[role="'+m.value+'"]';case bf:return'"'+m.value+'"';case Ym:return'[data-testname="'+m.value+'"]';default:throw Error(i(365))}}function Ip(m,x){var C=[];m=[m,0];for(var k=0;k<m.length;){var $=m[k++],ee=$.tag,Ce=m[k++],at=x[Ce];if(ee!==5&&ee!==26&&ee!==27||!ff($)){for(;at!=null&&sf($,at);)Ce++,at=x[Ce];if(Ce===x.length)C.push($);else for($=$.child;$!==null;)m.push($,Ce),$=$.sibling}}return C}function Xo(m,x){if(!ya)throw Error(i(363));m=rf(m),m=Ip(m,x),x=[],m=Array.from(m);for(var C=0;C<m.length;){var k=m[C++],$=k.tag;if($===5||$===26||$===27)ff(k)||x.push(k.stateNode);else for(k=k.child;k!==null;)m.push(k),k=k.sibling}return x}function os(){return(Dr&2)!==0&&Ur!==0?Ur&-Ur:Gn.T!==null?$e():Vp()}function dd(){if(Do===0)if((Ur&536870912)===0||Fr){var m=Ph;Ph<<=1,(Ph&3932160)===0&&(Ph=262144),Do=m}else Do=536870912;return m=el.current,m!==null&&(m.flags|=32),Do}function Ss(m,x,C){(m===Mr&&(Ai===2||Ai===9)||m.cancelPendingCommit!==null)&&(Ls(m,0),mu(m,Ur,Do,!1)),P(m,C),((Dr&2)===0||m!==Mr)&&(m===Mr&&((Dr&2)===0&&(wf|=C),Es===4&&mu(m,Ur,Do,!1)),Be(m))}function Lc(m,x,C){if((Dr&6)!==0)throw Error(i(327));var k=!C&&(x&127)===0&&(x&m.expiredLanes)===0||E(m,x),$=k?Pw(m,x):gu(m,x,!0),ee=k;do{if($===0){_f&&!k&&mu(m,x,0,!1);break}else{if(C=m.current.alternate,ee&&!Rw(C)){$=gu(m,x,!1),ee=!1;continue}if($===2){if(ee=x,m.errorRecoveryDisabledLanes&ee)var Ce=0;else Ce=m.pendingLanes&-536870913,Ce=Ce!==0?Ce:Ce&536870912?536870912:0;if(Ce!==0){x=Ce;e:{var at=m;$=Km;var Dt=ls&&at.current.memoizedState.isDehydrated;if(Dt&&(Ls(at,Ce).flags|=256),Ce=gu(at,Ce,!1),Ce!==2){if(Sf&&!Dt){at.errorRecoveryDisabledLanes|=ee,wf|=ee,$=4;break e}ee=nl,nl=$,ee!==null&&(nl===null?nl=ee:nl.push.apply(nl,ee))}$=Ce}if(ee=!1,$!==2)continue}}if($===1){Ls(m,0),mu(m,x,0,!0);break}e:{switch(k=m,ee=$,ee){case 0:case 1:throw Error(i(345));case 4:if((x&4194048)!==x)break;case 6:mu(k,x,Do,!Uc);break e;case 2:nl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((x&62914560)===x&&($=Zm+300-ho(),10<$)){if(mu(k,x,Do,!Uc),S(k,0,!0)!==0)break e;Ru=x,k.timeoutHandle=Wy(pu.bind(null,k,C,nl,Qm,px,x,Do,wf,Jp,Uc,ee,"Throttled",-0,0),$);break e}pu(k,C,nl,Qm,px,x,Do,wf,Jp,Uc,ee,null,-0,0)}}break}while(!0);Be(m)}function pu(m,x,C,k,$,ee,Ce,at,Dt,Wt,ln,qt,yn,dr){if(m.timeoutHandle=Zo,qt=x.subtreeFlags,qt&8192||(qt&16785408)===16785408){qt=qy(),nf(x,ee,qt);var Ks=(ee&62914560)===ee?Zm-ho():(ee&4194048)===ee?Fh-ho():0;if(Ks=Fw(qt,Ks),Ks!==null){Ru=ee,m.cancelPendingCommit=Ks(xu.bind(null,m,x,ee,C,k,$,Ce,at,Dt,ln,qt,null,yn,dr)),mu(m,ee,Ce,!Wt);return}}xu(m,x,ee,C,k,$,Ce,at,Dt)}function Rw(m){for(var x=m;;){var C=x.tag;if((C===0||C===11||C===15)&&x.flags&16384&&(C=x.updateQueue,C!==null&&(C=C.stores,C!==null)))for(var k=0;k<C.length;k++){var $=C[k],ee=$.getSnapshot;$=$.value;try{if(!qs(ee(),$))return!1}catch{return!1}}if(C=x.child,x.subtreeFlags&16384&&C!==null)C.return=x,x=C;else{if(x===m)break;for(;x.sibling===null;){if(x.return===null||x.return===m)return!0;x=x.return}x.sibling.return=x.return,x=x.sibling}}return!0}function mu(m,x,C,k){x&=~Qp,x&=~wf,m.suspendedLanes|=x,m.pingedLanes&=~x,k&&(m.warmLanes|=x),k=m.expirationTimes;for(var $=x;0<$;){var ee=31-Qo($),Ce=1<<ee;k[ee]=-1,$&=~Ce}C!==0&&R(m,C,x)}function Dv(){return(Dr&6)===0?(ge(0),!1):!0}function Iv(){if(Ir!==null){if(Ai===0)var m=Ir.return;else m=Ir,jc=$i=null,cr(m),vf=null,Ih=0,m=Ir;for(;m!==null;)pi(m.alternate,m),m=m.return;Ir=null}}function Ls(m,x){var C=m.timeoutHandle;C!==Zo&&(m.timeoutHandle=Zo,jw(C)),C=m.cancelPendingCommit,C!==null&&(m.cancelPendingCommit=null,C()),Ru=0,Iv(),Mr=m,Ir=C=Ml(m.current,null),Ur=x,Ai=0,ca=null,Uc=!1,_f=E(m,x),Sf=!1,Jp=Do=Qp=wf=wd=Es=0,nl=Km=null,px=!1,(x&8)!==0&&(x|=x&32);var k=m.entangledLanes;if(k!==0)for(m=m.entanglements,k&=x;0<k;){var $=31-Qo(k),ee=1<<$;x|=m[$],k&=~ee}return Nu=x,Ve(),C}function Wi(m,x){vr=null,Gn.H=Al,x===wa||x===hc?(x=nt(),Ai=3):x===fx?(x=nt(),Ai=4):Ai=x===Po?8:x!==null&&typeof x=="object"&&typeof x.then=="function"?6:1,ca=x,Ir===null&&(Es=1,Zl(m,J(x,m.current)))}function Wr(){var m=el.current;return m===null?!0:(Ur&4194048)===Ur?tl===null:(Ur&62914560)===Ur||(Ur&536870912)!==0?m===tl:!1}function fd(){var m=Gn.H;return Gn.H=Al,m===null?Al:m}function wl(){var m=Gn.A;return Gn.A=Yp,m}function Op(){Es=4,Uc||(Ur&4194048)!==Ur&&el.current!==null||(_f=!0),(wd&134217727)===0&&(wf&134217727)===0||Mr===null||mu(Mr,Ur,Do,!1)}function gu(m,x,C){var k=Dr;Dr|=2;var $=fd(),ee=wl();(Mr!==m||Ur!==x)&&(Qm=null,Ls(m,x)),x=!1;var Ce=Es;e:do try{if(Ai!==0&&Ir!==null){var at=Ir,Dt=ca;switch(Ai){case 8:Iv(),Ce=6;break e;case 3:case 2:case 9:case 6:el.current===null&&(x=!0);var Wt=Ai;if(Ai=0,ca=null,vu(m,at,Dt,Wt),C&&_f){Ce=0;break e}break;default:Wt=Ai,Ai=0,ca=null,vu(m,at,Dt,Wt)}}kw(),Ce=Es;break}catch(ln){Wi(m,ln)}while(!0);return x&&m.shellSuspendCounter++,jc=$i=null,Dr=k,Gn.H=$,Gn.A=ee,Ir===null&&(Mr=null,Ur=0,Ve()),Ce}function kw(){for(;Ir!==null;)af(Ir)}function Pw(m,x){var C=Dr;Dr|=2;var k=fd(),$=wl();Mr!==m||Ur!==x?(Qm=null,Mf=ho()+500,Ls(m,x)):_f=E(m,x);e:do try{if(Ai!==0&&Ir!==null){x=Ir;var ee=ca;t:switch(Ai){case 1:Ai=0,ca=null,vu(m,x,ee,1);break;case 2:case 9:if(me(ee)){Ai=0,ca=null,Ov(x);break}x=function(){Ai!==2&&Ai!==9||Mr!==m||(Ai=7),Be(m)},ee.then(x,x);break e;case 3:Ai=7;break e;case 4:Ai=5;break e;case 7:me(ee)?(Ai=0,ca=null,Ov(x)):(Ai=0,ca=null,vu(m,x,ee,7));break;case 5:var Ce=null;switch(Ir.tag){case 26:Ce=Ir.memoizedState;case 5:case 27:var at=Ir,Dt=at.type,Wt=at.pendingProps;if(Ce?yb(Ce):ws(at.stateNode,Dt,Wt)){Ai=0,ca=null;var ln=at.sibling;if(ln!==null)Ir=ln;else{var qt=at.return;qt!==null?(Ir=qt,zp(qt)):Ir=null}break t}}Ai=0,ca=null,vu(m,x,ee,5);break;case 6:Ai=0,ca=null,vu(m,x,ee,6);break;case 8:Iv(),Es=6;break e;default:throw Error(i(462))}}Lp();break}catch(yn){Wi(m,yn)}while(!0);return jc=$i=null,Gn.H=k,Gn.A=$,Dr=C,Ir!==null?0:(Mr=null,Ur=0,Ve(),Es)}function Lp(){for(;Ir!==null&&!_3();)af(Ir)}function af(m){var x=jt(m.alternate,m,Nu);m.memoizedProps=m.pendingProps,x===null?zp(m):Ir=x}function Ov(m){var x=m,C=x.alternate;switch(x.tag){case 15:case 0:x=Ds(C,x,x.pendingProps,x.type,void 0,Ur);break;case 11:x=Ds(C,x,x.pendingProps,x.type.render,x.ref,Ur);break;case 5:cr(x);default:pi(C,x),x=Ir=jv(x,Nu),x=jt(C,x,Nu)}m.memoizedProps=m.pendingProps,x===null?zp(m):Ir=x}function vu(m,x,C,k){jc=$i=null,cr(x),vf=null,Ih=0;var $=x.return;try{if(_m(m,$,x,C,Ur)){Es=1,Zl(m,J(C,m.current)),Ir=null;return}}catch(ee){if($!==null)throw Ir=$,ee;Es=1,Zl(m,J(C,m.current)),Ir=null;return}x.flags&32768?(Fr||k===1?m=!0:_f||(Ur&536870912)!==0?m=!1:(Uc=m=!0,(k===2||k===9||k===3||k===6)&&(k=el.current,k!==null&&k.tag===13&&(k.flags|=16384))),of(x,m)):zp(x)}function zp(m){var x=m;do{if((x.flags&32768)!==0){of(x,Uc);return}m=x.return;var C=Ji(x.alternate,x,Nu);if(C!==null){Ir=C;return}if(x=x.sibling,x!==null){Ir=x;return}Ir=x=m}while(x!==null);Es===0&&(Es=5)}function of(m,x){do{var C=Is(m.alternate,m);if(C!==null){C.flags&=32767,Ir=C;return}if(C=m.return,C!==null&&(C.flags|=32768,C.subtreeFlags=0,C.deletions=null),!x&&(m=m.sibling,m!==null)){Ir=m;return}Ir=m=C}while(m!==null);Es=6,Ir=null}function xu(m,x,C,k,$,ee,Ce,at,Dt){m.cancelPendingCommit=null;do bu();while(ua!==0);if((Dr&6)!==0)throw Error(i(327));if(x!==null){if(x===m.current)throw Error(i(177));if(ee=x.lanes|x.childLanes,ee|=Oh,L(m,C,ee,Ce,at,Dt),m===Mr&&(Ir=Mr=null,Ur=0),Uh=x,Td=m,Ru=C,e0=ee,mx=$,Ab=k,(x.subtreeFlags&10256)!==0||(x.flags&10256)!==0?(m.callbackNode=null,m.callbackPriority=0,oa(Vm,function(){return km(),null})):(m.callbackNode=null,m.callbackPriority=0),k=(x.flags&13878)!==0,(x.subtreeFlags&13878)!==0||k){k=Gn.T,Gn.T=null,$=ac(),jr(2),Ce=Dr,Dr|=4;try{Av(m,x,C)}finally{Dr=Ce,jr($),Gn.T=k}}ua=1,hd(),yu(),Lv()}}function hd(){if(ua===1){ua=0;var m=Td,x=Uh,C=(x.flags&13878)!==0;if((x.subtreeFlags&13878)!==0||C){C=Gn.T,Gn.T=null;var k=ac();jr(2);var $=Dr;Dr|=4;try{Nm(x,m),zw(m.containerInfo)}finally{Dr=$,jr(k),Gn.T=C}}m.current=x,ua=2}}function yu(){if(ua===2){ua=0;var m=Td,x=Uh,C=(x.flags&8772)!==0;if((x.subtreeFlags&8772)!==0||C){C=Gn.T,Gn.T=null;var k=ac();jr(2);var $=Dr;Dr|=4;try{Nw(m,x.alternate,x)}finally{Dr=$,jr(k),Gn.T=C}}ua=3}}function Lv(){if(ua===4||ua===3){ua=0,_b();var m=Td,x=Uh,C=Ru,k=Ab;(x.subtreeFlags&10256)!==0||(x.flags&10256)!==0?ua=5:(ua=0,Uh=Td=null,zv(m,m.pendingLanes));var $=m.pendingLanes;if($===0&&(Md=null),V(C),x=x.stateNode,Jo&&typeof Jo.onCommitFiberRoot=="function")try{Jo.onCommitFiberRoot(Dh,x,void 0,(x.current.flags&128)===128)}catch{}if(k!==null){x=Gn.T,$=ac(),jr(2),Gn.T=null;try{for(var ee=m.onRecoverableError,Ce=0;Ce<k.length;Ce++){var at=k[Ce];ee(at.value,{componentStack:at.stack})}}finally{Gn.T=x,jr($)}}(Ru&3)!==0&&bu(),Be(m),$=m.pendingLanes,(C&261930)!==0&&($&42)!==0?m===Jm?ai++:(ai=0,Jm=m):ai=0,ls&&Um(),ge(0)}}function zv(m,x){(m.pooledCacheLanes&=x)===0&&(x=m.pooledCache,x!=null&&(m.pooledCache=null,ye(x)))}function bu(){return hd(),yu(),Lv(),km()}function km(){if(ua!==5)return!1;var m=Td,x=e0;e0=0;var C=V(Ru),k=32>C?32:C;C=Gn.T;var $=ac();try{jr(k),Gn.T=null,k=mx,mx=null;var ee=Td,Ce=Ru;if(ua=0,Uh=Td=null,Ru=0,(Dr&6)!==0)throw Error(i(331));var at=Dr;if(Dr|=4,Pv(ee.current),Rv(ee,ee.current,Ce,k),Dr=at,ge(0,!1),Jo&&typeof Jo.onPostCommitFiberRoot=="function")try{Jo.onPostCommitFiberRoot(Dh,ee)}catch{}return!0}finally{jr($),Gn.T=C,zv(m,x)}}function lf(m,x,C){x=J(C,x),x=ad(m.stateNode,x,2),m=Bt(m,x,2),m!==null&&(P(m,2),Be(m))}function nr(m,x,C){if(m.tag===3)lf(m,m,C);else for(;x!==null;){if(x.tag===3){lf(x,m,C);break}else if(x.tag===1){var k=x.stateNode;if(typeof x.type.getDerivedStateFromError=="function"||typeof k.componentDidCatch=="function"&&(Md===null||!Md.has(k))){m=J(C,m),C=bm(2),k=Bt(x,C,2),k!==null&&(Ep(C,k,x,m),P(k,2),Be(k));break}}x=x.return}}function jp(m,x,C){var k=m.pingCache;if(k===null){k=m.pingCache=new Rl;var $=new Set;k.set(x,$)}else $=k.get(x),$===void 0&&($=new Set,k.set(x,$));$.has(C)||(Sf=!0,$.add(C),m=Dw.bind(null,m,x,C),x.then(m,m))}function Dw(m,x,C){var k=m.pingCache;k!==null&&k.delete(x),m.pingedLanes|=m.suspendedLanes&C,m.warmLanes&=~C,Mr===m&&(Ur&C)===C&&(Es===4||Es===3&&(Ur&62914560)===Ur&&300>ho()-Zm?(Dr&2)===0&&Ls(m,0):Qp|=C,Jp===Ur&&(Jp=0)),Be(m)}function Iw(m,x){x===0&&(x=N()),m=zt(m,x),m!==null&&(P(m,x),Be(m))}function OE(m){var x=m.memoizedState,C=0;x!==null&&(C=x.retryLane),Iw(m,C)}function LE(m,x){var C=0;switch(m.tag){case 31:case 13:var k=m.stateNode,$=m.memoizedState;$!==null&&(C=$.retryLane);break;case 19:k=m.stateNode;break;case 22:k=m.stateNode._retryCache;break;default:throw Error(i(314))}k!==null&&k.delete(x),Iw(m,C)}function oa(m,x){return Hm(m,x)}function zy(m,x,C,k){this.tag=m,this.key=C,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=x,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bh(m){return m=m.prototype,!(!m||!m.isReactComponent)}function Ml(m,x){var C=m.alternate;return C===null?(C=n(m.tag,x,m.key,m.mode),C.elementType=m.elementType,C.type=m.type,C.stateNode=m.stateNode,C.alternate=m,m.alternate=C):(C.pendingProps=x,C.type=m.type,C.flags=0,C.subtreeFlags=0,C.deletions=null),C.flags=m.flags&65011712,C.childLanes=m.childLanes,C.lanes=m.lanes,C.child=m.child,C.memoizedProps=m.memoizedProps,C.memoizedState=m.memoizedState,C.updateQueue=m.updateQueue,x=m.dependencies,C.dependencies=x===null?null:{lanes:x.lanes,firstContext:x.firstContext},C.sibling=m.sibling,C.index=m.index,C.ref=m.ref,C.refCleanup=m.refCleanup,C}function jv(m,x){m.flags&=65011714;var C=m.alternate;return C===null?(m.childLanes=0,m.lanes=x,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=C.childLanes,m.lanes=C.lanes,m.child=C.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=C.memoizedProps,m.memoizedState=C.memoizedState,m.updateQueue=C.updateQueue,m.type=C.type,x=C.dependencies,m.dependencies=x===null?null:{lanes:x.lanes,firstContext:x.firstContext}),m}function pd(m,x,C,k,$,ee){var Ce=0;if(k=m,typeof m=="function")bh(m)&&(Ce=1);else if(typeof m=="string")Ce=oc&&ba?Jv(m,C,La.current)?26:bb(m)?27:5:oc?Jv(m,C,La.current)?26:5:ba&&bb(m)?27:5;else e:switch(m){case Om:return m=n(31,C,x,$),m.elementType=Om,m.lanes=ee,m;case Mh:return ic(C.children,$,ee,x);case Th:Ce=8,$|=24;break;case Eh:return m=n(12,C,x,$|2),m.elementType=Eh,m.lanes=ee,m;case Hv:return m=n(13,C,x,$),m.elementType=Hv,m.lanes=ee,m;case md:return m=n(19,C,x,$),m.elementType=md,m.lanes=ee,m;default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case sc:Ce=10;break e;case Im:Ce=9;break e;case Fp:Ce=11;break e;case Vv:Ce=14;break e;case Ao:Ce=16,k=null;break e}Ce=29,C=Error(i(130,m===null?"null":typeof m,"")),k=null}return x=n(Ce,C,x,$),x.elementType=m,x.type=k,x.lanes=ee,x}function ic(m,x,C,k){return m=n(7,m,k,x),m.lanes=C,m}function jy(m,x,C){return m=n(6,m,null,x),m.lanes=C,m}function Fy(m){var x=n(18,null,null,0);return x.stateNode=m,x}function Uy(m,x,C){return x=n(4,m.children!==null?m.children:[],m.key,x),x.lanes=C,x.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},x}function Ow(m,x,C,k,$,ee,Ce,at,Dt){this.tag=1,this.containerInfo=m,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Zo,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=I(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=I(0),this.hiddenUpdates=I(null),this.identifierPrefix=k,this.onUncaughtError=$,this.onCaughtError=ee,this.onRecoverableError=Ce,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Dt,this.incompleteTransitions=new Map}function cf(m,x,C,k,$,ee,Ce,at,Dt,Wt,ln,qt){return m=new Ow(m,x,C,Ce,Dt,Wt,ln,qt,at),x=1,ee===!0&&(x|=24),ee=n(3,null,null,x),m.current=ee,ee.stateNode=m,x=ve(),x.refCount++,m.pooledCache=x,x.refCount++,ee.memoizedState={element:k,isDehydrated:C,cache:x},Dn(ee),m}function Fv(m){return m?(m=Su,m):Su}function Pm(m){var x=m._reactInternals;if(x===void 0)throw typeof m.render=="function"?Error(i(188)):(m=Object.keys(m).join(","),Error(i(268,m)));return m=o(x),m=m!==null?l(m):null,m===null?null:Bp(m.stateNode)}function By(m,x,C,k,$,ee){$=Fv($),k.context===null?k.context=$:k.pendingContext=$,k=pn(x),k.payload={element:C},ee=ee===void 0?null:ee,ee!==null&&(k.callback=ee),C=Bt(m,k,x),C!==null&&(Ss(C,m,x),Cn(C,m,x))}function _h(m,x){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var C=m.retryLane;m.retryLane=C!==0&&C<x?C:x}}function Dm(m,x){_h(m,x),(m=m.alternate)&&_h(m,x)}var Sr={},Uv=Zr,Yo=ZTe,Bv=Object.assign,Sh=Symbol.for("react.element"),_u=Symbol.for("react.transitional.element"),wh=Symbol.for("react.portal"),Mh=Symbol.for("react.fragment"),Th=Symbol.for("react.strict_mode"),Eh=Symbol.for("react.profiler"),Im=Symbol.for("react.consumer"),sc=Symbol.for("react.context"),Fp=Symbol.for("react.forward_ref"),Hv=Symbol.for("react.suspense"),md=Symbol.for("react.suspense_list"),Vv=Symbol.for("react.memo"),Ao=Symbol.for("react.lazy"),Om=Symbol.for("react.activity"),Hy=Symbol.for("react.memo_cache_sentinel"),gd=Symbol.iterator,uf=Symbol.for("react.client.reference"),df=Array.isArray,Gn=Uv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Vy=e.rendererVersion,Lm=e.rendererPackageName,Up=e.extraDevToolsConfig,Bp=e.getPublicInstance,Lw=e.getRootHostContext,Hp=e.getChildHostContext,Gv=e.prepareForCommit,zw=e.resetAfterCommit,Gy=e.createInstance;e.cloneMutableInstance;var zm=e.appendInitialChild,Ko=e.finalizeInitialChildren,No=e.shouldSetTextContent,vd=e.createTextInstance;e.cloneMutableTextInstance;var Wy=e.scheduleTimeout,jw=e.cancelTimeout,Zo=e.noTimeout,Ws=e.isPrimaryRenderer;e.warnsIfNotActing;var $r=e.supportsMutation,Tl=e.supportsPersistence,ls=e.supportsHydration,gr=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Oi=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var jr=e.setCurrentUpdatePriority,ac=e.getCurrentUpdatePriority,Vp=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var Ch=e.shouldAttemptEagerTransition,Wv=e.detachDeletedInstance;e.requestPostPaintCallback;var jm=e.maySuspendCommit,Gp=e.maySuspendCommitOnUpdate,$y=e.maySuspendCommitInSyncRender,ws=e.preloadInstance,qy=e.startSuspendingCommit,$v=e.suspendInstance;e.suspendOnActiveViewTransition;var Fw=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Ah=e.NotPendingTransition,Nh=e.HostTransitionContext,Xy=e.resetFormInstance;e.bindToConsole;var Yy=e.supportsMicrotasks,Ky=e.scheduleMicrotask,ya=e.supportsTestSelectors,$s=e.findFiberRoot,qv=e.getBoundingRect,Fm=e.getTextContent,ff=e.isHiddenSubtree,Zy=e.matchAccessibilityRole,xd=e.setFocusIfFocusable,Xv=e.setupIntersectionObserver,Qy=e.appendChild,Jy=e.appendChildToContainer,Uw=e.commitTextUpdate,Bw=e.commitMount,Hw=e.commitUpdate,Vw=e.insertBefore,Gw=e.insertInContainerBefore,Ww=e.removeChild,eb=e.removeChildFromContainer,tb=e.resetTextContent,zE=e.hideInstance,$w=e.hideTextInstance,qw=e.unhideInstance,Xw=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 nb=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var Yw=e.cloneInstance,rb=e.createContainerChildSet,ib=e.appendChildToContainerChildSet,Kw=e.finalizeContainerChildren,sb=e.replaceContainerChildren,Zw=e.cloneHiddenInstance,ab=e.cloneHiddenTextInstance,hf=e.isSuspenseInstancePending,Yv=e.isSuspenseInstanceFallback,Kv=e.getSuspenseInstanceFallbackErrorDetails,Zv=e.registerSuspenseInstanceRetry,Qw=e.canHydrateFormStateMarker,ob=e.isFormStateMarkerMatching,Jw=e.getNextHydratableSibling,e3=e.getNextHydratableSiblingAfterSingleton,t3=e.getFirstHydratableChild,n3=e.getFirstHydratableChildWithinContainer,r3=e.getFirstHydratableChildWithinActivityInstance,i3=e.getFirstHydratableChildWithinSuspenseInstance,lb=e.getFirstHydratableChildWithinSingleton,s3=e.canHydrateInstance,a3=e.canHydrateTextInstance,cb=e.canHydrateActivityInstance,o3=e.canHydrateSuspenseInstance,l3=e.hydrateInstance,jE=e.hydrateTextInstance,ub=e.hydrateActivityInstance,c3=e.hydrateSuspenseInstance,u3=e.getNextHydratableInstanceAfterActivityInstance,db=e.getNextHydratableInstanceAfterSuspenseInstance,d3=e.commitHydratedInstance,f3=e.commitHydratedContainer,FE=e.commitHydratedActivityInstance,UE=e.commitHydratedSuspenseInstance,h3=e.finalizeHydratedChildren,Um=e.flushHydrationEvents;e.clearActivityBoundary;var fb=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Qv=e.clearSuspenseBoundaryFromContainer,p3=e.hideDehydratedBoundary,m3=e.unhideDehydratedBoundary,Wp=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var g3=e.validateHydratableInstance,hb=e.validateHydratableTextInstance,oc=e.supportsResources,Jv=e.isHostHoistableType,Bm=e.getHoistableRoot,pb=e.getResource,mb=e.acquireResource,pf=e.releaseResource,v3=e.hydrateHoistable,gb=e.mountHoistable,vb=e.unmountHoistable,ex=e.createHoistableInstance,x3=e.prepareToCommitHoistables,xb=e.mayResourceSuspendCommit,yb=e.preloadResource,y3=e.suspendResource,ba=e.supportsSingletons,tx=e.resolveSingletonInstance,la=e.acquireSingletonInstance,Oa=e.releaseSingletonInstance,bb=e.isHostSingletonType,Rh=e.isSingletonScope,nx=[],kh=-1,Su={},Qo=Math.clz32?Math.clz32:_,rx=Math.log,b3=Math.LN2,ix=256,Ph=262144,$p=4194304,Hm=Yo.unstable_scheduleCallback,sx=Yo.unstable_cancelCallback,_3=Yo.unstable_shouldYield,_b=Yo.unstable_requestPaint,ho=Yo.unstable_now,ax=Yo.unstable_ImmediatePriority,S3=Yo.unstable_UserBlockingPriority,Vm=Yo.unstable_NormalPriority,ox=Yo.unstable_IdlePriority,Sb=Yo.log,w3=Yo.unstable_setDisableYieldValue,Dh=null,Jo=null,qs=typeof Object.is=="function"?Object.is:Z,lx=typeof reportError=="function"?reportError:function(m){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var x=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof m=="object"&&m!==null&&typeof m.message=="string"?String(m.message):String(m),error:m});if(!window.dispatchEvent(x))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",m);return}console.error(m)},BE=Object.prototype.hasOwnProperty,cx,wu,Gm=!1,wb=new WeakMap,yd=[],Mu=0,Li=null,Wm=0,lc=[],El=0,cc=null,Ka=1,zc="",La=g(null),bd=g(null),Za=g(null),$m=g(null),_a=null,cs=null,Fr=!1,Tu=null,Ro=!1,ux=Error(i(519)),uc=g(null),$i=null,jc=null,M3=typeof AbortController<"u"?AbortController:function(){var m=[],x=this.signal={aborted:!1,addEventListener:function(C,k){m.push(k)}};this.abort=function(){x.aborted=!0,m.forEach(function(C){return C()})}},za=Yo.unstable_scheduleCallback,HE=Yo.unstable_NormalPriority,us={$$typeof:sc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},qm=null,Ei=null,po=!1,dc=!1,dx=!1,mf=0,qp=null,Mb=0,_d=0,Sa=null,fc=Gn.S;Gn.S=function(m,x){Fh=ho(),typeof x=="object"&&x!==null&&typeof x.then=="function"&&dt(m,x),fc!==null&&fc(m,x)};var gf=g(null),wa=Error(i(460)),fx=Error(i(474)),hc=Error(i(542)),Eu={then:function(){}},ko=null,vf=null,Ih=0,Qa=Pt(!0),Tb=Pt(!1),Ja=[],Cu=0,Oh=0,Cl=!1,hx=!1,Lh=g(null),xf=g(0),el=g(null),tl=null,zs=g(0),Sd=0,vr=null,Un=null,or=null,wr=!1,_r=!1,Yr=!1,mo=0,pc=0,Fc=null,Eb=0,Al={readContext:oe,use:gs,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};Al.useEffectEvent=Zt;var Ms={readContext:oe,use:gs,useCallback:function(m,x){return Nr().memoizedState=[m,x===void 0?null:x],m},useContext:oe,useEffect:ei,useImperativeHandle:function(m,x,C){C=C!=null?C.concat([m]):null,$o(4194308,4,Gr.bind(null,x,m),C)},useLayoutEffect:function(m,x){return $o(4194308,4,m,x)},useInsertionEffect:function(m,x){$o(4,2,m,x)},useMemo:function(m,x){var C=Nr();x=x===void 0?null:x;var k=m();if(Yr){G(!0);try{m()}finally{G(!1)}}return C.memoizedState=[k,x],k},useReducer:function(m,x,C){var k=Nr();if(C!==void 0){var $=C(x);if(Yr){G(!0);try{C(x)}finally{G(!1)}}}else $=x;return k.memoizedState=k.baseState=$,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:$},k.queue=m,m=m.dispatch=ys.bind(null,vr,m),[k.memoizedState,m]},useRef:function(m){var x=Nr();return m={current:m},x.memoizedState=m},useState:function(m){m=xl(m);var x=m.queue,C=_l.bind(null,vr,x);return x.dispatch=C,[m.memoizedState,C]},useDebugValue:bl,useDeferredValue:function(m,x){var C=Nr();return hi(C,m,x)},useTransition:function(){var m=xl(!1);return m=nd.bind(null,vr,m.queue,!0,!1),Nr().memoizedState=m,[!1,m]},useSyncExternalStore:function(m,x,C){var k=vr,$=Nr();if(Fr){if(C===void 0)throw Error(i(407));C=C()}else{if(C=x(),Mr===null)throw Error(i(349));(Ur&127)!==0||Di(k,x,C)}$.memoizedState=C;var ee={value:C,getSnapshot:x};return $.queue=ee,ei(co.bind(null,k,ee,m),[m]),k.flags|=2048,xs(9,{destroy:void 0},$a.bind(null,k,ee,C,x),null),C},useId:function(){var m=Nr(),x=Mr.identifierPrefix;if(Fr){var C=zc,k=Ka;C=(k&~(1<<32-Qo(k)-1)).toString(32)+C,x="_"+x+"R_"+C,C=mo++,0<C&&(x+="H"+C.toString(32)),x+="_"}else C=Eb++,x="_"+x+"r_"+C.toString(32)+"_";return m.memoizedState=x},useHostTransitionStatus:Qd,useFormState:Yl,useActionState:Yl,useOptimistic:function(m){var x=Nr();x.memoizedState=x.baseState=m;var C={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return x.queue=C,x=wp.bind(null,vr,!0,C),C.dispatch=x,[m,x]},useMemoCache:Rs,useCacheRefresh:function(){return Nr().memoizedState=Hs.bind(null,vr)},useEffectEvent:function(m){var x=Nr(),C={impl:m};return x.memoizedState=C,function(){if((Dr&2)!==0)throw Error(i(440));return C.impl.apply(void 0,arguments)}}},Au={readContext:oe,use:gs,useCallback:Kl,useContext:oe,useEffect:zr,useImperativeHandle:To,useInsertionEffect:bi,useLayoutEffect:Ii,useMemo:ga,useReducer:vs,useRef:Wo,useState:function(){return vs(Pi)},useDebugValue:bl,useDeferredValue:function(m,x){var C=en();return vh(C,Un.memoizedState,m,x)},useTransition:function(){var m=vs(Pi)[0],x=en().memoizedState;return[typeof m=="boolean"?m:Rn(m),x]},useSyncExternalStore:ks,useId:fo,useHostTransitionStatus:Qd,useFormState:qa,useActionState:qa,useOptimistic:function(m,x){var C=en();return uo(C,Un,m,x)},useMemoCache:Rs,useCacheRefresh:Gi};Au.useEffectEvent=mr;var yf={readContext:oe,use:gs,useCallback:Kl,useContext:oe,useEffect:zr,useImperativeHandle:To,useInsertionEffect:bi,useLayoutEffect:Ii,useMemo:ga,useReducer:di,useRef:Wo,useState:function(){return di(Pi)},useDebugValue:bl,useDeferredValue:function(m,x){var C=en();return Un===null?hi(C,m,x):vh(C,Un.memoizedState,m,x)},useTransition:function(){var m=di(Pi)[0],x=en().memoizedState;return[typeof m=="boolean"?m:Rn(m),x]},useSyncExternalStore:ks,useId:fo,useHostTransitionStatus:Qd,useFormState:yl,useActionState:yl,useOptimistic:function(m,x){var C=en();return Un!==null?uo(C,Un,m,x):(C.baseState=m,[m,C.queue.dispatch])},useMemoCache:Rs,useCacheRefresh:Gi};yf.useEffectEvent=mr;var Xm={enqueueSetState:function(m,x,C){m=m._reactInternals;var k=os(),$=pn(k);$.payload=x,C!=null&&($.callback=C),x=Bt(m,$,k),x!==null&&(Ss(x,m,k),Cn(x,m,k))},enqueueReplaceState:function(m,x,C){m=m._reactInternals;var k=os(),$=pn(k);$.tag=1,$.payload=x,C!=null&&($.callback=C),x=Bt(m,$,k),x!==null&&(Ss(x,m,k),Cn(x,m,k))},enqueueForceUpdate:function(m,x){m=m._reactInternals;var C=os(),k=pn(C);k.tag=2,x!=null&&(k.callback=x),x=Bt(m,k,C),x!==null&&(Ss(x,m,C),Cn(x,m,C))}},Po=Error(i(461)),es=!1,zh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},js=!1,Fs=!1,Xp=!1,Cb=typeof WeakSet=="function"?WeakSet:Set,Xs=null,Ts=null,Ys=!1,Ci=null,Nl=8192,Yp={getCacheForType:function(m){var x=oe(us),C=x.data.get(m);return C===void 0&&(C=m(),x.data.set(m,C)),C},cacheSignal:function(){return oe(us).controller.signal}},mc=0,Kp=1,Zp=2,Ym=3,bf=4;if(typeof Symbol=="function"&&Symbol.for){var jh=Symbol.for;mc=jh("selector.component"),Kp=jh("selector.has_pseudo_class"),Zp=jh("selector.role"),Ym=jh("selector.test_id"),bf=jh("selector.text")}var Rl=typeof WeakMap=="function"?WeakMap:Map,Dr=0,Mr=null,Ir=null,Ur=0,Ai=0,ca=null,Uc=!1,_f=!1,Sf=!1,Nu=0,Es=0,wd=0,wf=0,Qp=0,Do=0,Jp=0,Km=null,nl=null,px=!1,Zm=0,Fh=0,Mf=1/0,Qm=null,Md=null,ua=0,Td=null,Uh=null,Ru=0,e0=0,mx=null,Ab=null,ai=0,Jm=null;return Sr.attemptContinuousHydration=function(m){if(m.tag===13||m.tag===31){var x=zt(m,67108864);x!==null&&Ss(x,m,67108864),Dm(m,67108864)}},Sr.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13||m.tag===31){var x=os();x=U(x);var C=zt(m,x);C!==null&&Ss(C,m,x),Dm(m,x)}},Sr.attemptSynchronousHydration=function(m){switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var x=w(m.pendingLanes);if(x!==0){for(m.pendingLanes|=2,m.entangledLanes|=2;x;){var C=1<<31-Qo(x);m.entanglements[1]|=C,x&=~C}Be(m),(Dr&6)===0&&(Mf=ho()+500,ge(0))}}break;case 31:case 13:x=zt(m,2),x!==null&&Ss(x,m,2),Dv(),Dm(m,2)}},Sr.batchedUpdates=function(m,x){return m(x)},Sr.createComponentSelector=function(m){return{$$typeof:mc,value:m}},Sr.createContainer=function(m,x,C,k,$,ee,Ce,at,Dt,Wt){return cf(m,x,!1,null,C,k,ee,null,Ce,at,Dt,Wt)},Sr.createHasPseudoClassSelector=function(m){return{$$typeof:Kp,value:m}},Sr.createHydrationContainer=function(m,x,C,k,$,ee,Ce,at,Dt,Wt,ln,qt,yn,dr){var Ks;return m=cf(C,k,!0,m,$,ee,at,dr,Dt,Wt,ln,qt),m.context=Fv(null),C=m.current,k=os(),k=U(k),$=pn(k),$.callback=(Ks=x)!=null?Ks:null,Bt(C,$,k),x=k,m.current.lanes=x,P(m,x),Be(m),m},Sr.createPortal=function(m,x,C){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:wh,key:k==null?null:""+k,children:m,containerInfo:x,implementation:C}},Sr.createRoleSelector=function(m){return{$$typeof:Zp,value:m}},Sr.createTestNameSelector=function(m){return{$$typeof:Ym,value:m}},Sr.createTextSelector=function(m){return{$$typeof:bf,value:m}},Sr.defaultOnCaughtError=function(m){console.error(m)},Sr.defaultOnRecoverableError=function(m){lx(m)},Sr.defaultOnUncaughtError=function(m){lx(m)},Sr.deferredUpdates=function(m){var x=Gn.T,C=ac();try{return jr(32),Gn.T=null,m()}finally{jr(C),Gn.T=x}},Sr.discreteUpdates=function(m,x,C,k,$){var ee=Gn.T,Ce=ac();try{return jr(2),Gn.T=null,m(x,C,k,$)}finally{jr(Ce),Gn.T=ee,Dr===0&&(Mf=ho()+500)}},Sr.findAllNodes=Xo,Sr.findBoundingRects=function(m,x){if(!ya)throw Error(i(363));x=Xo(m,x),m=[];for(var C=0;C<x.length;C++)m.push(qv(x[C]));for(x=m.length-1;0<x;x--){C=m[x];for(var k=C.x,$=k+C.width,ee=C.y,Ce=ee+C.height,at=x-1;0<=at;at--)if(x!==at){var Dt=m[at],Wt=Dt.x,ln=Wt+Dt.width,qt=Dt.y,yn=qt+Dt.height;if(k>=Wt&&ee>=qt&&$<=ln&&Ce<=yn){m.splice(x,1);break}else if(k!==Wt||C.width!==Dt.width||yn<ee||qt>Ce){if(!(ee!==qt||C.height!==Dt.height||ln<k||Wt>$)){Wt>k&&(Dt.width+=Wt-k,Dt.x=k),ln<$&&(Dt.width=$-Wt),m.splice(x,1);break}}else{qt>ee&&(Dt.height+=qt-ee,Dt.y=ee),yn<Ce&&(Dt.height=Ce-qt),m.splice(x,1);break}}}return m},Sr.findHostInstance=Pm,Sr.findHostInstanceWithNoPortals=function(m){return m=o(m),m=m!==null?c(m):null,m===null?null:Bp(m.stateNode)},Sr.findHostInstanceWithWarning=function(m){return Pm(m)},Sr.flushPassiveEffects=bu,Sr.flushSyncFromReconciler=function(m){var x=Dr;Dr|=1;var C=Gn.T,k=ac();try{if(jr(2),Gn.T=null,m)return m()}finally{jr(k),Gn.T=C,Dr=x,(Dr&6)===0&&ge(0)}},Sr.flushSyncWork=Dv,Sr.focusWithin=function(m,x){if(!ya)throw Error(i(363));for(m=rf(m),x=Ip(m,x),x=Array.from(x),m=0;m<x.length;){var C=x[m++],k=C.tag;if(!ff(C)){if((k===5||k===26||k===27)&&xd(C.stateNode))return!0;for(C=C.child;C!==null;)x.push(C),C=C.sibling}}return!1},Sr.getFindAllNodesFailureDescription=function(m,x){if(!ya)throw Error(i(363));var C=0,k=[];m=[rf(m),0];for(var $=0;$<m.length;){var ee=m[$++],Ce=ee.tag,at=m[$++],Dt=x[at];if((Ce!==5&&Ce!==26&&Ce!==27||!ff(ee))&&(sf(ee,Dt)&&(k.push(Dp(Dt)),at++,at>C&&(C=at)),at<x.length))for(ee=ee.child;ee!==null;)m.push(ee,at),ee=ee.sibling}if(C<x.length){for(m=[];C<x.length;C++)m.push(Dp(x[C]));return`findAllNodes was able to match part of the selector:
  `+(k.join(" > ")+`

No matching component was found for:
  `)+m.join(" > ")}return null},Sr.getPublicRootInstance=function(m){if(m=m.current,!m.child)return null;switch(m.child.tag){case 27:case 5:return Bp(m.child.stateNode);default:return m.child.stateNode}},Sr.injectIntoDevTools=function(){var m={bundleType:0,version:Vy,rendererPackageName:Lm,currentDispatcherRef:Gn,reconcilerVersion:"19.2.0"};if(Up!==null&&(m.rendererConfig=Up),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")m=!1;else{var x=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(x.isDisabled||!x.supportsFiber)m=!0;else{try{Dh=x.inject(m),Jo=x}catch{}m=!!x.checkDCE}}return m},Sr.isAlreadyRendering=function(){return(Dr&6)!==0},Sr.observeVisibleRects=function(m,x,C,k){if(!ya)throw Error(i(363));m=Xo(m,x);var $=Xv(m,C,k).disconnect;return{disconnect:function(){$()}}},Sr.shouldError=function(){return null},Sr.shouldSuspend=function(){return!1},Sr.startHostTransition=function(m,x,C,k){if(m.tag!==5)throw Error(i(476));var $=rd(m).queue;nd(m,$,x,Ah,C===null?r:function(){var ee=rd(m);return ee.next===null&&(ee=m.alternate.memoizedState),va(m,ee.next.queue,{},os()),C(k)})},Sr.updateContainer=function(m,x,C,k){var $=x.current,ee=os();return By($,ee,m,x,C,k),ee},Sr.updateContainerSync=function(m,x,C,k){return By(x.current,2,m,x,C,k),2},Sr},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})(Pj)),Pj.exports}var Ij;function MEe(){return Ij||(Ij=1,kj.exports=wEe()),kj.exports}var TEe=MEe();const EEe=SEe(TEe);function CEe(t){const e=EEe(t);return e.injectIntoDevTools(),e}const wK=0,oy={},AEe=/^three(?=[A-Z])/,kE=t=>`${t[0].toUpperCase()}${t.slice(1)}`;let NEe=0;const REe=t=>typeof t=="function";function kEe(t){if(REe(t)){const e=`${NEe++}`;return oy[e]=t,e}else Object.assign(oy,t)}function MK(t,e){const n=kE(t),r=oy[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 PEe(t,e,n){var r;return t=kE(t)in oy?t:t.replace(AEe,""),MK(t,e),t==="primitive"&&(r=e.object)!=null&&r.__r3f&&delete e.object.__r3f,w5(e.object,n,t,e)}function DEe(t){if(!t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?T5(t.parent,t):Sc(t.object)&&(t.object.visible=!1),t.isHidden=!0,Dy(t)}}function TK(t){if(t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?M5(t.parent,t):Sc(t.object)&&t.props.visible!==!1&&(t.object.visible=!0),t.isHidden=!1,Dy(t)}}function P9(t,e,n){const r=e.root.getState();if(!(!t.parent&&t.object!==r.scene)){if(!e.object){var i,s;const a=oy[kE(e.type)];e.object=(i=e.props.object)!=null?i:new a(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(C0(e.object,e.props),e.props.attach)M5(t,e);else if(Sc(e.object)&&Sc(t.object)){const a=t.object.children.indexOf(n==null?void 0:n.object);if(n&&a!==-1){const o=t.object.children.indexOf(e.object);if(o!==-1){t.object.children.splice(o,1);const l=o<a?a-1:a;t.object.children.splice(l,0,e.object)}else e.object.parent=t.object,t.object.children.splice(a,0,e.object),e.object.dispatchEvent({type:"added"}),t.object.dispatchEvent({type:"childadded",child:e.object})}else t.object.add(e.object)}for(const a of e.children)P9(e,a);Dy(e)}}function N6(t,e){e&&(e.parent=t,t.children.push(e),P9(t,e))}function Oj(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),P9(t,e,n)}function EK(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 t7(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?T5(t,e):Sc(e.object)&&Sc(t.object)&&(t.object.remove(e.object),pEe(mK(e),e.object));const i=e.props.dispose!==null&&n!==!1;for(let s=e.children.length-1;s>=0;s--){const a=e.children[s];t7(e,a,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&EK(e.object),n===void 0&&Dy(e)}function IEe(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 VM=[];function OEe(){for(const[n]of VM){const r=n.parent;if(r){n.props.attach?T5(r,n):Sc(n.object)&&Sc(r.object)&&r.object.remove(n.object);for(const i of n.children)i.props.attach?T5(n,i):Sc(i.object)&&Sc(n.object)&&n.object.remove(i.object)}n.isHidden&&TK(n),n.object.__r3f&&delete n.object.__r3f,n.type!=="primitive"&&EK(n.object)}for(const[n,r,i]of VM){n.props=r;const s=n.parent;if(s){var t,e;const a=oy[kE(n.type)];n.object=(t=n.props.object)!=null?t:new a(...(e=n.props.args)!=null?e:[]),n.object.__r3f=n,IEe(i,n.object),C0(n.object,n.props),n.props.attach?M5(s,n):Sc(n.object)&&Sc(s.object)&&s.object.add(n.object);for(const o of n.children)o.props.attach?M5(n,o):Sc(o.object)&&Sc(n.object)&&n.object.add(o.object);Dy(n)}}VM.length=0}const R6=()=>{},Lj={};let yM=wK;const LEe=0,zEe=4,n7=CEe({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:PEe,removeChild:t7,appendChild:N6,appendInitialChild:N6,insertBefore:Oj,appendChildToContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||N6(n,e)},removeChildFromContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||t7(n,e)},insertInContainerBefore(t,e,n){const r=t.getState().scene.__r3f;!e||!n||!r||Oj(r,e,n)},getRootHostContext:()=>Lj,getChildHostContext:()=>Lj,commitUpdate(t,e,n,r,i){var s,a,o;MK(e,r);let l=!1;if((t.type==="primitive"&&n.object!==r.object||((s=r.args)==null?void 0:s.length)!==((a=n.args)==null?void 0:a.length)||(o=r.args)!=null&&o.some((d,h)=>{var g;return d!==((g=n.args)==null?void 0:g[h])}))&&(l=!0),l)VM.push([t,{...r},i]);else{const d=uEe(t,r);Object.keys(d).length&&(Object.assign(t.props,d),C0(t.object,d))}(i.sibling===null||(i.flags&zEe)===LEe)&&OEe()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:t=>t==null?void 0:t.object,prepareForCommit:()=>null,preparePortalMount:t=>w5(t.getState().scene,t,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:DEe,unhideInstance:TK,createTextInstance:R6,hideTextInstance:R6,unhideTextInstance:R6,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:T.createContext(null),setCurrentUpdatePriority(t){yM=t},getCurrentUpdatePriority(){return yM},resolveUpdatePriority(){var t;if(yM!==wK)return yM;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 bEe;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return xEe;default:return yEe}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:_Ee.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}),dv=new Map,Yx={objects:"shallow",strict:!1};function jEe(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 FEe(t){const e=dv.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||gEe(s7,jj),a=n||n7.createContainer(s,vEe,null,!1,null,"",i,i,i,null);e||dv.set(t,{fiber:a,store:s});let o,l,c=!1,d=null;return{async configure(h={}){let g;d=new Promise(j=>g=j);let{gl:v,size:b,scene:_,events:w,onCreated:S,shadows:E=!1,linear:A=!1,flat:N=!1,legacy:I=!1,orthographic:P=!1,frameloop:L="always",dpr:R=[1,2],performance:O,raycaster:W,camera:U,onPointerMissed:V}=h,G=s.getState(),Z=G.gl;if(!G.gl){const j={canvas:t,powerPreference:"high-performance",antialias:!0,alpha:!0},X=typeof v=="function"?await v(j):v;Rj(X)?Z=X:Z=new dK({...j,...v}),G.set({gl:Z})}let B=G.raycaster;B||G.set({raycaster:B=new tK});const{params:q,...Y}=W||{};if(Qs.equ(Y,B,Yx)||C0(B,{...Y}),Qs.equ(q,B.params,Yx)||C0(B,{params:{...B.params,...q}}),!G.camera||G.camera===l&&!Qs.equ(l,U,Yx)){l=U;const j=U==null?void 0:U.isCamera,X=j?U:P?new Hd(0,0,0,0,.1,1e3):new ea(75,0,.1,1e3);j||(X.position.z=5,U&&(C0(X,U),X.manual||("aspect"in U||"left"in U||"right"in U||"bottom"in U||"top"in U)&&(X.manual=!0,X.updateProjectionMatrix())),!G.camera&&!(U!=null&&U.rotation)&&X.lookAt(0,0,0)),G.set({camera:X}),B.camera=X}if(!G.scene){let j;_!=null&&_.isScene?(j=_,w5(j,s,"",{})):(j=new t9,w5(j,s,"",{}),_&&C0(j,_)),G.set({scene:j})}w&&!G.events.handlers&&G.set({events:w(s)});const K=jEe(t,b);if(Qs.equ(K,G.size,Yx)||G.setSize(K.width,K.height,K.top,K.left),R&&G.viewport.dpr!==xK(R)&&G.setDpr(R),G.frameloop!==L&&G.setFrameloop(L),G.onPointerMissed||G.set({onPointerMissed:V}),O&&!Qs.equ(O,G.performance,Yx)&&G.set(j=>({performance:{...j.performance,...O}})),!G.xr){var J;const j=(se,re)=>{const ie=s.getState();ie.frameloop!=="never"&&jj(se,!0,ie,re)},X=()=>{const se=s.getState();se.gl.xr.enabled=se.gl.xr.isPresenting,se.gl.xr.setAnimationLoop(se.gl.xr.isPresenting?j:null),se.gl.xr.isPresenting||s7(se)},H={connect(){const se=s.getState().gl;se.xr.addEventListener("sessionstart",X),se.xr.addEventListener("sessionend",X)},disconnect(){const se=s.getState().gl;se.xr.removeEventListener("sessionstart",X),se.xr.removeEventListener("sessionend",X)}};typeof((J=Z.xr)==null?void 0:J.addEventListener)=="function"&&H.connect(),G.set({xr:H})}if(Z.shadowMap){const j=Z.shadowMap.enabled,X=Z.shadowMap.type;if(Z.shadowMap.enabled=!!E,Qs.boo(E))Z.shadowMap.type=D_;else if(Qs.str(E)){var F;const H={basic:_X,percentage:b1,soft:D_,variance:Rg};Z.shadowMap.type=(F=H[E])!=null?F:D_}else Qs.obj(E)&&Object.assign(Z.shadowMap,E);(j!==Z.shadowMap.enabled||X!==Z.shadowMap.type)&&(Z.shadowMap.needsUpdate=!0)}return ii.enabled=!I,c||(Z.outputColorSpace=A?nm:cl,Z.toneMapping=N?nu:WT),G.legacy!==I&&G.set(()=>({legacy:I})),G.linear!==A&&G.set(()=>({linear:A})),G.flat!==N&&G.set(()=>({flat:N})),v&&!Qs.fun(v)&&!Rj(v)&&!Qs.equ(v,Z,Yx)&&C0(Z,v),o=S,c=!0,g(),this},render(h){return!c&&!d&&this.configure(),d.then(()=>{n7.updateContainer(p.jsx(UEe,{store:s,children:h,onCreated:o,rootElement:t}),a,null,()=>{})}),s},unmount(){CK(t)}}}function UEe({store:t,children:e,onCreated:n,rootElement:r}){return Cw(()=>{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)},[]),p.jsx(_K.Provider,{value:t,children:e})}function CK(t,e){const n=dv.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),n7.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,a,o,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=i.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),oEe(i.scene),dv.delete(t)}catch{}},500)})}}const BEe=new Set,HEe=new Set,VEe=new Set;function k6(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function G_(t,e){switch(t){case"before":return k6(BEe,e);case"after":return k6(HEe,e);case"tail":return k6(VEe,e)}}let P6,D6;function r7(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),P6=e.internal.subscribers;for(let i=0;i<P6.length;i++)D6=P6[i],D6.ref.current(D6.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 E5=!1,i7=!1,I6,zj,Kx;function AK(t){zj=requestAnimationFrame(AK),E5=!0,I6=0,G_("before",t),i7=!0;for(const n of dv.values()){var e;Kx=n.store.getState(),Kx.internal.active&&(Kx.frameloop==="always"||Kx.internal.frames>0)&&!((e=Kx.gl.xr)!=null&&e.isPresenting)&&(I6+=r7(t,Kx))}if(i7=!1,G_("after",t),I6===0)return G_("tail",t),E5=!1,cancelAnimationFrame(zj)}function s7(t,e=1){var n;if(!t)return dv.forEach(r=>s7(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):i7?t.internal.frames=2:t.internal.frames=1,E5||(E5=!0,requestAnimationFrame(AK)))}function jj(t,e=!0,n,r){if(e&&G_("before",t),n)r7(t,n,r);else for(const i of dv.values())r7(t,i.store.getState());e&&G_("after",t)}const O6={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 GEe(t){const{handlePointer:e}=mEe(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(O6).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 a=i.handlers[s],[o,l]=O6[s];n.addEventListener(o,a,{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],[a]=O6[i];r.connected.removeEventListener(a,s)}n(i=>({events:{...i.events,connected:void 0}}))}}}}function Fj(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function WEe({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,a]=T.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=T.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=T.useRef(!1);T.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[h,g,v]=T.useMemo(()=>{const S=()=>{if(!o.current.element)return;const{left:E,top:A,width:N,height:I,bottom:P,right:L,x:R,y:O}=o.current.element.getBoundingClientRect(),W={left:E,top:A,width:N,height:I,bottom:P,right:L,x:R,y:O};o.current.element instanceof HTMLElement&&r&&(W.height=o.current.element.offsetHeight,W.width=o.current.element.offsetWidth),Object.freeze(W),d.current&&!YEe(o.current.lastBounds,W)&&a(o.current.lastBounds=W)};return[S,c?Fj(S,c):S,l?Fj(S,l):S]},[a,r,l,c]);function b(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(S=>S.removeEventListener("scroll",v,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function _(){o.current.element&&(o.current.resizeObserver=new i(v),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(S=>S.addEventListener("scroll",v,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const w=S=>{!S||S===o.current.element||(b(),o.current.element=S,o.current.scrollContainers=NK(S),_())};return qEe(v,!!e),$Ee(g),T.useEffect(()=>{b(),_()},[e,v,g]),T.useEffect(()=>b,[]),[w,s,h]}function $Ee(t){T.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function qEe(t,e){T.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function NK(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,...NK(t.parentElement)]}const XEe=["x","y","top","bottom","left","right","width","height"],YEe=(t,e)=>XEe.every(n=>t[n]===e[n]);function KEe({ref:t,children:e,fallback:n,resize:r,style:i,gl:s,events:a=GEe,eventSource:o,eventPrefix:l,shadows:c,linear:d,flat:h,legacy:g,orthographic:v,frameloop:b,dpr:_,performance:w,raycaster:S,camera:E,scene:A,onPointerMissed:N,onCreated:I,...P}){T.useMemo(()=>kEe(zTe),[]);const L=iEe(),[R,O]=WEe({scroll:!0,debounce:{scroll:50,resize:0},...r}),W=T.useRef(null),U=T.useRef(null);T.useImperativeHandle(t,()=>W.current);const V=vK(N),[G,Z]=T.useState(!1),[B,q]=T.useState(!1);if(G)throw G;if(B)throw B;const Y=T.useRef(null);Cw(()=>{const J=W.current;if(O.width>0&&O.height>0&&J){Y.current||(Y.current=FEe(J));async function F(){await Y.current.configure({gl:s,scene:A,events:a,shadows:c,linear:d,flat:h,legacy:g,orthographic:v,frameloop:b,dpr:_,performance:w,raycaster:S,camera:E,size:O,onPointerMissed:(...j)=>V.current==null?void 0:V.current(...j),onCreated:j=>{j.events.connect==null||j.events.connect(o?nEe(o)?o.current:o:U.current),l&&j.setEvents({compute:(X,H)=>{const se=X[l+"X"],re=X[l+"Y"];H.pointer.set(se/H.size.width*2-1,-(re/H.size.height)*2+1),H.raycaster.setFromCamera(H.pointer,H.camera)}}),I==null||I(j)}}),Y.current.render(p.jsx(L,{children:p.jsx(aEe,{set:q,children:p.jsx(T.Suspense,{fallback:p.jsx(sEe,{set:Z}),children:e??null})})}))}F()}}),T.useEffect(()=>{const J=W.current;if(J)return()=>CK(J)},[]);const K=o?"none":"auto";return p.jsx("div",{ref:U,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:K,...i},...P,children:p.jsx("div",{ref:R,style:{width:"100%",height:"100%"},children:p.jsx("canvas",{ref:W,style:{display:"block"},children:n})})})}function ZEe(t){return p.jsx(hK,{children:p.jsx(KEe,{...t})})}function lh(){return lh=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},lh.apply(null,arguments)}const Aw=new ze,D9=new ze,QEe=new ze,Uj=new Lt;function JEe(t,e,n){const r=Aw.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 eCe(t,e){const n=Aw.setFromMatrixPosition(t.matrixWorld),r=D9.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),s=e.getWorldDirection(QEe);return i.angleTo(s)>Math.PI/2}function tCe(t,e,n,r){const i=Aw.setFromMatrixPosition(t.matrixWorld),s=i.clone();s.project(e),Uj.set(s.x,s.y),n.setFromCamera(Uj,e);const a=n.intersectObjects(r,!0);if(a.length){const o=a[0].distance;return i.distanceTo(n.ray.origin)<o}return!0}function nCe(t,e){if(e instanceof Hd)return e.zoom;if(e instanceof ea){const n=Aw.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 rCe(t,e,n){if(e instanceof ea||e instanceof Hd){const r=Aw.setFromMatrixPosition(t.matrixWorld),i=D9.setFromMatrixPosition(e.matrixWorld),s=r.distanceTo(i),a=(n[1]-n[0])/(e.far-e.near),o=n[1]-a*e.far;return Math.round(a*s+o)}}const a7=t=>Math.abs(t)<1e-10?0:t;function RK(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=a7(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const iCe=(t=>e=>RK(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),sCe=(t=>(e,n)=>RK(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 aCe(t){return t&&typeof t=="object"&&"current"in t}const I9=T.forwardRef(({children:t,eps:e=.001,style:n,className:r,prepend:i,center:s,fullscreen:a,portal:o,distanceFactor:l,sprite:c=!1,transform:d=!1,occlude:h,onOcclude:g,castShadow:v,receiveShadow:b,material:_,geometry:w,zIndexRange:S=[16777271,0],calculatePosition:E=JEe,as:A="div",wrapperClass:N,pointerEvents:I="auto",...P},L)=>{const{gl:R,camera:O,scene:W,size:U,raycaster:V,events:G,viewport:Z}=$c(),[B]=T.useState(()=>document.createElement(A)),q=T.useRef(null),Y=T.useRef(null),K=T.useRef(0),J=T.useRef([0,0]),F=T.useRef(null),j=T.useRef(null),X=(o==null?void 0:o.current)||G.connected||R.domElement.parentNode,H=T.useRef(null),se=T.useRef(!1),re=T.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&aCe(h[0]),[h]);T.useLayoutEffect(()=>{const xe=R.domElement;h&&h==="blending"?(xe.style.zIndex=`${Math.floor(S[0]/2)}`,xe.style.position="absolute",xe.style.pointerEvents="none"):(xe.style.zIndex=null,xe.style.position=null,xe.style.pointerEvents=null)},[h]),T.useLayoutEffect(()=>{if(Y.current){const xe=q.current=IF.createRoot(B);if(W.updateMatrixWorld(),d)B.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const he=E(Y.current,O,U);B.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${he[0]}px,${he[1]}px,0);transform-origin:0 0;`}return X&&(i?X.prepend(B):X.appendChild(B)),()=>{X&&X.removeChild(B),xe.unmount()}}},[X,d]),T.useLayoutEffect(()=>{N&&(B.className=N)},[N]);const ie=T.useMemo(()=>d?{position:"absolute",top:0,left:0,width:U.width,height:U.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...a&&{top:-U.height/2,left:-U.width/2,width:U.width,height:U.height},...n},[n,s,a,U,d]),ue=T.useMemo(()=>({position:"absolute",pointerEvents:I}),[I]);T.useLayoutEffect(()=>{if(se.current=!1,d){var xe;(xe=q.current)==null||xe.render(T.createElement("div",{ref:F,style:ie},T.createElement("div",{ref:j,style:ue},T.createElement("div",{ref:L,className:r,style:n,children:t}))))}else{var he;(he=q.current)==null||he.render(T.createElement("div",{ref:L,style:ie,className:r,children:t}))}});const le=T.useRef(!0);RE(xe=>{if(Y.current){O.updateMatrixWorld(),Y.current.updateWorldMatrix(!0,!1);const he=d?J.current:E(Y.current,O,U);if(d||Math.abs(K.current-O.zoom)>e||Math.abs(J.current[0]-he[0])>e||Math.abs(J.current[1]-he[1])>e){const Te=eCe(Y.current,O);let We=!1;re&&(Array.isArray(h)?We=h.map(Re=>Re.current):h!=="blending"&&(We=[W]));const Se=le.current;if(We){const Re=tCe(Y.current,O,V,We);le.current=Re&&!Te}else le.current=!Te;Se!==le.current&&(g?g(!le.current):B.style.display=le.current?"block":"none");const Le=Math.floor(S[0]/2),pe=h?re?[S[0],Le]:[Le-1,0]:S;if(B.style.zIndex=`${rCe(Y.current,O,pe)}`,d){const[Re,ne]=[U.width/2,U.height/2],Xe=O.projectionMatrix.elements[5]*ne,{isOrthographicCamera:Ae,top:Pe,left:Ke,bottom:oe,right:te}=O,_e=iCe(O.matrixWorldInverse),ve=Ae?`scale(${Xe})translate(${a7(-(te+Ke)/2)}px,${a7((Pe+oe)/2)}px)`:`translateZ(${Xe}px)`;let ye=Y.current.matrixWorld;c&&(ye=O.matrixWorldInverse.clone().transpose().copyPosition(ye).scale(Y.current.scale),ye.elements[3]=ye.elements[7]=ye.elements[11]=0,ye.elements[15]=1),B.style.width=U.width+"px",B.style.height=U.height+"px",B.style.perspective=Ae?"":`${Xe}px`,F.current&&j.current&&(F.current.style.transform=`${ve}${_e}translate(${Re}px,${ne}px)`,j.current.style.transform=sCe(ye,1/((l||10)/400)))}else{const Re=l===void 0?1:nCe(Y.current,O)*l;B.style.transform=`translate3d(${he[0]}px,${he[1]}px,0) scale(${Re})`}J.current=he,K.current=O.zoom}}if(!re&&H.current&&!se.current)if(d){if(F.current){const he=F.current.children[0];if(he!=null&&he.clientWidth&&he!=null&&he.clientHeight){const{isOrthographicCamera:Te}=O;if(Te||w)P.scale&&(Array.isArray(P.scale)?P.scale instanceof ze?H.current.scale.copy(P.scale.clone().divideScalar(1)):H.current.scale.set(1/P.scale[0],1/P.scale[1],1/P.scale[2]):H.current.scale.setScalar(1/P.scale));else{const We=(l||10)/400,Se=he.clientWidth*We,Le=he.clientHeight*We;H.current.scale.set(Se,Le,1)}se.current=!0}}}else{const he=B.children[0];if(he!=null&&he.clientWidth&&he!=null&&he.clientHeight){const Te=1/Z.factor,We=he.clientWidth*Te,Se=he.clientHeight*Te;H.current.scale.set(We,Se,1),se.current=!0}H.current.lookAt(xe.camera.position)}});const fe=T.useMemo(()=>({vertexShader:d?void 0:`
          /*
            This shader is from the THREE's SpriteMaterial.
            We need to turn the backing plane into a Sprite
            (make it always face the camera) if "transfrom"
            is false.
          */
          #include <common>

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

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

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

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

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

            gl_Position = projectionMatrix * mvPosition;
          }
      `,fragmentShader:`
        void main() {
          gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
        }
      `}),[d]);return T.createElement("group",lh({},P,{ref:Y}),h&&!re&&T.createElement("mesh",{castShadow:v,receiveShadow:b,ref:H},w||T.createElement("planeGeometry",null),_||T.createElement("shaderMaterial",{side:Xc,vertexShader:fe.vertexShader,fragmentShader:fe.fragmentShader})))}),kK=parseInt(xw.replace(/\D+/g,"")),PK=kK>=125?"uv1":"uv2";function oCe(t,e=Math.PI/3){const n=Math.cos(e),r=(1+1e-10)*100,i=[new ze,new ze,new ze],s=new ze,a=new ze,o=new ze,l=new ze;function c(_){const w=~~(_.x*r),S=~~(_.y*r),E=~~(_.z*r);return`${w},${S},${E}`}const d=t.index?t.toNonIndexed():t,h=d.attributes.position,g={};for(let _=0,w=h.count/3;_<w;_++){const S=3*_,E=i[0].fromBufferAttribute(h,S+0),A=i[1].fromBufferAttribute(h,S+1),N=i[2].fromBufferAttribute(h,S+2);s.subVectors(N,A),a.subVectors(E,A);const I=new ze().crossVectors(s,a).normalize();for(let P=0;P<3;P++){const L=i[P],R=c(L);R in g||(g[R]=[]),g[R].push(I)}}const v=new Float32Array(h.count*3),b=new Vi(v,3,!1);for(let _=0,w=h.count/3;_<w;_++){const S=3*_,E=i[0].fromBufferAttribute(h,S+0),A=i[1].fromBufferAttribute(h,S+1),N=i[2].fromBufferAttribute(h,S+2);s.subVectors(N,A),a.subVectors(E,A),o.crossVectors(s,a).normalize();for(let I=0;I<3;I++){const P=i[I],L=c(P),R=g[L];l.set(0,0,0);for(let O=0,W=R.length;O<W;O++){const U=R[O];o.dot(U)>n&&l.add(U)}l.normalize(),b.setXYZ(S+I,l.x,l.y,l.z)}}return d.setAttribute("normal",b),d}var lCe=Object.defineProperty,cCe=(t,e,n)=>e in t?lCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,uCe=(t,e,n)=>(cCe(t,e+"",n),n);class dCe{constructor(){uCe(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,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}var fCe=Object.defineProperty,hCe=(t,e,n)=>e in t?fCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zn=(t,e,n)=>(hCe(t,typeof e!="symbol"?e+"":e,n),n);const bM=new Mv,Bj=new Jh,pCe=Math.cos(70*(Math.PI/180)),Hj=(t,e)=>(t%e+e)%e;let mCe=class extends dCe{constructor(e,n){super(),Zn(this,"object"),Zn(this,"domElement"),Zn(this,"enabled",!0),Zn(this,"target",new ze),Zn(this,"minDistance",0),Zn(this,"maxDistance",1/0),Zn(this,"minZoom",0),Zn(this,"maxZoom",1/0),Zn(this,"minPolarAngle",0),Zn(this,"maxPolarAngle",Math.PI),Zn(this,"minAzimuthAngle",-1/0),Zn(this,"maxAzimuthAngle",1/0),Zn(this,"enableDamping",!1),Zn(this,"dampingFactor",.05),Zn(this,"enableZoom",!0),Zn(this,"zoomSpeed",1),Zn(this,"enableRotate",!0),Zn(this,"rotateSpeed",1),Zn(this,"enablePan",!0),Zn(this,"panSpeed",1),Zn(this,"screenSpacePanning",!0),Zn(this,"keyPanSpeed",7),Zn(this,"zoomToCursor",!1),Zn(this,"autoRotate",!1),Zn(this,"autoRotateSpeed",2),Zn(this,"reverseOrbit",!1),Zn(this,"reverseHorizontalOrbit",!1),Zn(this,"reverseVerticalOrbit",!1),Zn(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Zn(this,"mouseButtons",{LEFT:wg.ROTATE,MIDDLE:wg.DOLLY,RIGHT:wg.PAN}),Zn(this,"touches",{ONE:Mg.ROTATE,TWO:Mg.DOLLY_PAN}),Zn(this,"target0"),Zn(this,"position0"),Zn(this,"zoom0"),Zn(this,"_domElementKeyEvents",null),Zn(this,"getPolarAngle"),Zn(this,"getAzimuthalAngle"),Zn(this,"setPolarAngle"),Zn(this,"setAzimuthalAngle"),Zn(this,"getDistance"),Zn(this,"getZoomScale"),Zn(this,"listenToKeyEvents"),Zn(this,"stopListenToKeyEvents"),Zn(this,"saveState"),Zn(this,"reset"),Zn(this,"update"),Zn(this,"connect"),Zn(this,"dispose"),Zn(this,"dollyIn"),Zn(this,"dollyOut"),Zn(this,"getScale"),Zn(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=Me=>{let $e=Hj(Me,2*Math.PI),dt=d.phi;dt<0&&(dt+=2*Math.PI),$e<0&&($e+=2*Math.PI);let Oe=Math.abs($e-dt);2*Math.PI-Oe<Oe&&($e<dt?$e+=2*Math.PI:dt+=2*Math.PI),h.phi=$e-dt,r.update()},this.setAzimuthalAngle=Me=>{let $e=Hj(Me,2*Math.PI),dt=d.theta;dt<0&&(dt+=2*Math.PI),$e<0&&($e+=2*Math.PI);let Oe=Math.abs($e-dt);2*Math.PI-Oe<Oe&&($e<dt?$e+=2*Math.PI:dt+=2*Math.PI),h.theta=$e-dt,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=Me=>{Me.addEventListener("keydown",ke),this._domElementKeyEvents=Me},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ke),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=o.NONE},this.update=(()=>{const Me=new ze,$e=new ze(0,1,0),dt=new Bo().setFromUnitVectors(e.up,$e),Oe=dt.clone().invert(),st=new ze,ft=new Bo,pt=2*Math.PI;return function(){const Ze=r.object.position;dt.setFromUnitVectors(e.up,$e),Oe.copy(dt).invert(),Me.copy(Ze).sub(r.target),Me.applyQuaternion(dt),d.setFromVector3(Me),r.autoRotate&&l===o.NONE&&Z(V()),r.enableDamping?(d.theta+=h.theta*r.dampingFactor,d.phi+=h.phi*r.dampingFactor):(d.theta+=h.theta,d.phi+=h.phi);let me=r.minAzimuthAngle,je=r.maxAzimuthAngle;isFinite(me)&&isFinite(je)&&(me<-Math.PI?me+=pt:me>Math.PI&&(me-=pt),je<-Math.PI?je+=pt:je>Math.PI&&(je-=pt),me<=je?d.theta=Math.max(me,Math.min(je,d.theta)):d.theta=d.theta>(me+je)/2?Math.max(me,d.theta):Math.min(je,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(v,r.dampingFactor):r.target.add(v),r.zoomToCursor&&O||r.object.isOrthographicCamera?d.radius=H(d.radius):d.radius=H(d.radius*g),Me.setFromSpherical(d),Me.applyQuaternion(Oe),Ze.copy(r.target).add(Me),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(h.theta*=1-r.dampingFactor,h.phi*=1-r.dampingFactor,v.multiplyScalar(1-r.dampingFactor)):(h.set(0,0,0),v.set(0,0,0));let He=!1;if(r.zoomToCursor&&O){let nt=null;if(r.object instanceof ea&&r.object.isPerspectiveCamera){const yt=Me.length();nt=H(yt*g);const lt=yt-nt;r.object.position.addScaledVector(L,lt),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const yt=new ze(R.x,R.y,0);yt.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/g)),r.object.updateProjectionMatrix(),He=!0;const lt=new ze(R.x,R.y,0);lt.unproject(r.object),r.object.position.sub(lt).add(yt),r.object.updateMatrixWorld(),nt=Me.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;nt!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(nt).add(r.object.position):(bM.origin.copy(r.object.position),bM.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(bM.direction))<pCe?e.lookAt(r.target):(Bj.setFromNormalAndCoplanarPoint(r.object.up,r.target),bM.intersectPlane(Bj,r.target))))}else r.object instanceof Hd&&r.object.isOrthographicCamera&&(He=g!==1,He&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/g)),r.object.updateProjectionMatrix()));return g=1,O=!1,He||st.distanceToSquared(r.object.position)>c||8*(1-ft.dot(r.object.quaternion))>c?(r.dispatchEvent(i),st.copy(r.object.position),ft.copy(r.object.quaternion),He=!1,!0):!1}})(),this.connect=Me=>{r.domElement=Me,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",Ye),r.domElement.addEventListener("pointerdown",Ke),r.domElement.addEventListener("pointercancel",te),r.domElement.addEventListener("wheel",ye)},this.dispose=()=>{var Me,$e,dt,Oe,st,ft;r.domElement&&(r.domElement.style.touchAction="auto"),(Me=r.domElement)==null||Me.removeEventListener("contextmenu",Ye),($e=r.domElement)==null||$e.removeEventListener("pointerdown",Ke),(dt=r.domElement)==null||dt.removeEventListener("pointercancel",te),(Oe=r.domElement)==null||Oe.removeEventListener("wheel",ye),(st=r.domElement)==null||st.ownerDocument.removeEventListener("pointermove",oe),(ft=r.domElement)==null||ft.ownerDocument.removeEventListener("pointerup",te),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ke)};const r=this,i={type:"change"},s={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=o.NONE;const c=1e-6,d=new XR,h=new XR;let g=1;const v=new ze,b=new Lt,_=new Lt,w=new Lt,S=new Lt,E=new Lt,A=new Lt,N=new Lt,I=new Lt,P=new Lt,L=new ze,R=new Lt;let O=!1;const W=[],U={};function V(){return 2*Math.PI/60/60*r.autoRotateSpeed}function G(){return Math.pow(.95,r.zoomSpeed)}function Z(Me){r.reverseOrbit||r.reverseHorizontalOrbit?h.theta+=Me:h.theta-=Me}function B(Me){r.reverseOrbit||r.reverseVerticalOrbit?h.phi+=Me:h.phi-=Me}const q=(()=>{const Me=new ze;return function(dt,Oe){Me.setFromMatrixColumn(Oe,0),Me.multiplyScalar(-dt),v.add(Me)}})(),Y=(()=>{const Me=new ze;return function(dt,Oe){r.screenSpacePanning===!0?Me.setFromMatrixColumn(Oe,1):(Me.setFromMatrixColumn(Oe,0),Me.crossVectors(r.object.up,Me)),Me.multiplyScalar(dt),v.add(Me)}})(),K=(()=>{const Me=new ze;return function(dt,Oe){const st=r.domElement;if(st&&r.object instanceof ea&&r.object.isPerspectiveCamera){const ft=r.object.position;Me.copy(ft).sub(r.target);let pt=Me.length();pt*=Math.tan(r.object.fov/2*Math.PI/180),q(2*dt*pt/st.clientHeight,r.object.matrix),Y(2*Oe*pt/st.clientHeight,r.object.matrix)}else st&&r.object instanceof Hd&&r.object.isOrthographicCamera?(q(dt*(r.object.right-r.object.left)/r.object.zoom/st.clientWidth,r.object.matrix),Y(Oe*(r.object.top-r.object.bottom)/r.object.zoom/st.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function J(Me){r.object instanceof ea&&r.object.isPerspectiveCamera||r.object instanceof Hd&&r.object.isOrthographicCamera?g=Me:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function F(Me){J(g/Me)}function j(Me){J(g*Me)}function X(Me){if(!r.zoomToCursor||!r.domElement)return;O=!0;const $e=r.domElement.getBoundingClientRect(),dt=Me.clientX-$e.left,Oe=Me.clientY-$e.top,st=$e.width,ft=$e.height;R.x=dt/st*2-1,R.y=-(Oe/ft)*2+1,L.set(R.x,R.y,1).unproject(r.object).sub(r.object.position).normalize()}function H(Me){return Math.max(r.minDistance,Math.min(r.maxDistance,Me))}function se(Me){b.set(Me.clientX,Me.clientY)}function re(Me){X(Me),N.set(Me.clientX,Me.clientY)}function ie(Me){S.set(Me.clientX,Me.clientY)}function ue(Me){_.set(Me.clientX,Me.clientY),w.subVectors(_,b).multiplyScalar(r.rotateSpeed);const $e=r.domElement;$e&&(Z(2*Math.PI*w.x/$e.clientHeight),B(2*Math.PI*w.y/$e.clientHeight)),b.copy(_),r.update()}function le(Me){I.set(Me.clientX,Me.clientY),P.subVectors(I,N),P.y>0?F(G()):P.y<0&&j(G()),N.copy(I),r.update()}function fe(Me){E.set(Me.clientX,Me.clientY),A.subVectors(E,S).multiplyScalar(r.panSpeed),K(A.x,A.y),S.copy(E),r.update()}function xe(Me){X(Me),Me.deltaY<0?j(G()):Me.deltaY>0&&F(G()),r.update()}function he(Me){let $e=!1;switch(Me.code){case r.keys.UP:K(0,r.keyPanSpeed),$e=!0;break;case r.keys.BOTTOM:K(0,-r.keyPanSpeed),$e=!0;break;case r.keys.LEFT:K(r.keyPanSpeed,0),$e=!0;break;case r.keys.RIGHT:K(-r.keyPanSpeed,0),$e=!0;break}$e&&(Me.preventDefault(),r.update())}function Te(){if(W.length==1)b.set(W[0].pageX,W[0].pageY);else{const Me=.5*(W[0].pageX+W[1].pageX),$e=.5*(W[0].pageY+W[1].pageY);b.set(Me,$e)}}function We(){if(W.length==1)S.set(W[0].pageX,W[0].pageY);else{const Me=.5*(W[0].pageX+W[1].pageX),$e=.5*(W[0].pageY+W[1].pageY);S.set(Me,$e)}}function Se(){const Me=W[0].pageX-W[1].pageX,$e=W[0].pageY-W[1].pageY,dt=Math.sqrt(Me*Me+$e*$e);N.set(0,dt)}function Le(){r.enableZoom&&Se(),r.enablePan&&We()}function pe(){r.enableZoom&&Se(),r.enableRotate&&Te()}function Re(Me){if(W.length==1)_.set(Me.pageX,Me.pageY);else{const dt=Ge(Me),Oe=.5*(Me.pageX+dt.x),st=.5*(Me.pageY+dt.y);_.set(Oe,st)}w.subVectors(_,b).multiplyScalar(r.rotateSpeed);const $e=r.domElement;$e&&(Z(2*Math.PI*w.x/$e.clientHeight),B(2*Math.PI*w.y/$e.clientHeight)),b.copy(_)}function ne(Me){if(W.length==1)E.set(Me.pageX,Me.pageY);else{const $e=Ge(Me),dt=.5*(Me.pageX+$e.x),Oe=.5*(Me.pageY+$e.y);E.set(dt,Oe)}A.subVectors(E,S).multiplyScalar(r.panSpeed),K(A.x,A.y),S.copy(E)}function Xe(Me){const $e=Ge(Me),dt=Me.pageX-$e.x,Oe=Me.pageY-$e.y,st=Math.sqrt(dt*dt+Oe*Oe);I.set(0,st),P.set(0,Math.pow(I.y/N.y,r.zoomSpeed)),F(P.y),N.copy(I)}function Ae(Me){r.enableZoom&&Xe(Me),r.enablePan&&ne(Me)}function Pe(Me){r.enableZoom&&Xe(Me),r.enableRotate&&Re(Me)}function Ke(Me){var $e,dt;r.enabled!==!1&&(W.length===0&&(($e=r.domElement)==null||$e.ownerDocument.addEventListener("pointermove",oe),(dt=r.domElement)==null||dt.ownerDocument.addEventListener("pointerup",te)),Qe(Me),Me.pointerType==="touch"?Be(Me):_e(Me))}function oe(Me){r.enabled!==!1&&(Me.pointerType==="touch"?ge(Me):ve(Me))}function te(Me){var $e,dt,Oe;Ie(Me),W.length===0&&(($e=r.domElement)==null||$e.releasePointerCapture(Me.pointerId),(dt=r.domElement)==null||dt.ownerDocument.removeEventListener("pointermove",oe),(Oe=r.domElement)==null||Oe.ownerDocument.removeEventListener("pointerup",te)),r.dispatchEvent(a),l=o.NONE}function _e(Me){let $e;switch(Me.button){case 0:$e=r.mouseButtons.LEFT;break;case 1:$e=r.mouseButtons.MIDDLE;break;case 2:$e=r.mouseButtons.RIGHT;break;default:$e=-1}switch($e){case wg.DOLLY:if(r.enableZoom===!1)return;re(Me),l=o.DOLLY;break;case wg.ROTATE:if(Me.ctrlKey||Me.metaKey||Me.shiftKey){if(r.enablePan===!1)return;ie(Me),l=o.PAN}else{if(r.enableRotate===!1)return;se(Me),l=o.ROTATE}break;case wg.PAN:if(Me.ctrlKey||Me.metaKey||Me.shiftKey){if(r.enableRotate===!1)return;se(Me),l=o.ROTATE}else{if(r.enablePan===!1)return;ie(Me),l=o.PAN}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function ve(Me){if(r.enabled!==!1)switch(l){case o.ROTATE:if(r.enableRotate===!1)return;ue(Me);break;case o.DOLLY:if(r.enableZoom===!1)return;le(Me);break;case o.PAN:if(r.enablePan===!1)return;fe(Me);break}}function ye(Me){r.enabled===!1||r.enableZoom===!1||l!==o.NONE&&l!==o.ROTATE||(Me.preventDefault(),r.dispatchEvent(s),xe(Me),r.dispatchEvent(a))}function ke(Me){r.enabled===!1||r.enablePan===!1||he(Me)}function Be(Me){switch(Fe(Me),W.length){case 1:switch(r.touches.ONE){case Mg.ROTATE:if(r.enableRotate===!1)return;Te(),l=o.TOUCH_ROTATE;break;case Mg.PAN:if(r.enablePan===!1)return;We(),l=o.TOUCH_PAN;break;default:l=o.NONE}break;case 2:switch(r.touches.TWO){case Mg.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Le(),l=o.TOUCH_DOLLY_PAN;break;case Mg.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;pe(),l=o.TOUCH_DOLLY_ROTATE;break;default:l=o.NONE}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function ge(Me){switch(Fe(Me),l){case o.TOUCH_ROTATE:if(r.enableRotate===!1)return;Re(Me),r.update();break;case o.TOUCH_PAN:if(r.enablePan===!1)return;ne(Me),r.update();break;case o.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ae(Me),r.update();break;case o.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Pe(Me),r.update();break;default:l=o.NONE}}function Ye(Me){r.enabled!==!1&&Me.preventDefault()}function Qe(Me){W.push(Me)}function Ie(Me){delete U[Me.pointerId];for(let $e=0;$e<W.length;$e++)if(W[$e].pointerId==Me.pointerId){W.splice($e,1);return}}function Fe(Me){let $e=U[Me.pointerId];$e===void 0&&($e=new Lt,U[Me.pointerId]=$e),$e.set(Me.pageX,Me.pageY)}function Ge(Me){const $e=Me.pointerId===W[0].pointerId?W[1]:W[0];return U[$e.pointerId]}this.dollyIn=(Me=G())=>{j(Me),r.update()},this.dollyOut=(Me=G())=>{F(Me),r.update()},this.getScale=()=>g,this.setScale=Me=>{J(Me),r.update()},this.getZoomScale=()=>G(),n!==void 0&&this.connect(n),this.update()}};const Vj=new Ca,_M=new ze;class O9 extends CE{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 An(e,3)),this.setAttribute("uv",new An(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 S5(n,6,1);return this.setAttribute("instanceStart",new Qc(r,3,0)),this.setAttribute("instanceEnd",new Qc(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 S5(r,n*2,1);return this.setAttribute("instanceColorStart",new Qc(i,n,0)),this.setAttribute("instanceColorEnd",new Qc(i,n,n)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new m9(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ca);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Vj.setFromBufferAttribute(n),this.boundingBox.union(Vj))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ga),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,a=e.count;s<a;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 DK extends O9{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 L9 extends au{constructor(e){super({type:"LineMaterial",uniforms:CS.clone(CS.merge([hn.common,hn.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Lt(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 <${kK>=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 L6=new ci,Gj=new ze,Wj=new ze,Oo=new ci,Lo=new ci,kf=new ci,z6=new ze,j6=new rr,jo=new rK,$j=new ze,SM=new Ca,wM=new Ga,Pf=new ci;let Gf,qg;function qj(t,e,n){return Pf.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Pf.multiplyScalar(1/Pf.w),Pf.x=qg/n.width,Pf.y=qg/n.height,Pf.applyMatrix4(t.projectionMatrixInverse),Pf.multiplyScalar(1/Pf.w),Math.abs(Math.max(Pf.x,Pf.y))}function gCe(t,e){const n=t.matrixWorld,r=t.geometry,i=r.attributes.instanceStart,s=r.attributes.instanceEnd,a=Math.min(r.instanceCount,i.count);for(let o=0,l=a;o<l;o++){jo.start.fromBufferAttribute(i,o),jo.end.fromBufferAttribute(s,o),jo.applyMatrix4(n);const c=new ze,d=new ze;Gf.distanceSqToSegment(jo.start,jo.end,d,c),d.distanceTo(c)<qg*.5&&e.push({point:d,pointOnLine:c,distance:Gf.origin.distanceTo(d),object:t,face:null,faceIndex:o,uv:null,[PK]:null})}}function vCe(t,e,n){const r=e.projectionMatrix,s=t.material.resolution,a=t.matrixWorld,o=t.geometry,l=o.attributes.instanceStart,c=o.attributes.instanceEnd,d=Math.min(o.instanceCount,l.count),h=-e.near;Gf.at(1,kf),kf.w=1,kf.applyMatrix4(e.matrixWorldInverse),kf.applyMatrix4(r),kf.multiplyScalar(1/kf.w),kf.x*=s.x/2,kf.y*=s.y/2,kf.z=0,z6.copy(kf),j6.multiplyMatrices(e.matrixWorldInverse,a);for(let g=0,v=d;g<v;g++){if(Oo.fromBufferAttribute(l,g),Lo.fromBufferAttribute(c,g),Oo.w=1,Lo.w=1,Oo.applyMatrix4(j6),Lo.applyMatrix4(j6),Oo.z>h&&Lo.z>h)continue;if(Oo.z>h){const A=Oo.z-Lo.z,N=(Oo.z-h)/A;Oo.lerp(Lo,N)}else if(Lo.z>h){const A=Lo.z-Oo.z,N=(Lo.z-h)/A;Lo.lerp(Oo,N)}Oo.applyMatrix4(r),Lo.applyMatrix4(r),Oo.multiplyScalar(1/Oo.w),Lo.multiplyScalar(1/Lo.w),Oo.x*=s.x/2,Oo.y*=s.y/2,Lo.x*=s.x/2,Lo.y*=s.y/2,jo.start.copy(Oo),jo.start.z=0,jo.end.copy(Lo),jo.end.z=0;const _=jo.closestPointToPointParameter(z6,!0);jo.at(_,$j);const w=iY.lerp(Oo.z,Lo.z,_),S=w>=-1&&w<=1,E=z6.distanceTo($j)<qg*.5;if(S&&E){jo.start.fromBufferAttribute(l,g),jo.end.fromBufferAttribute(c,g),jo.start.applyMatrix4(a),jo.end.applyMatrix4(a);const A=new ze,N=new ze;Gf.distanceSqToSegment(jo.start,jo.end,N,A),n.push({point:N,pointOnLine:A,distance:Gf.origin.distanceTo(N),object:t,face:null,faceIndex:g,uv:null,[PK]:null})}}}class IK extends Us{constructor(e=new O9,n=new L9({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 a=0,o=0,l=n.count;a<l;a++,o+=2)Gj.fromBufferAttribute(n,a),Wj.fromBufferAttribute(r,a),i[o]=o===0?0:i[o-1],i[o+1]=i[o]+Gj.distanceTo(Wj);const s=new S5(i,2,1);return e.setAttribute("instanceDistanceStart",new Qc(s,1,0)),e.setAttribute("instanceDistanceEnd",new Qc(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;Gf=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;qg=l.linewidth+s,o.boundingSphere===null&&o.computeBoundingSphere(),wM.copy(o.boundingSphere).applyMatrix4(a);let c;if(r)c=qg*.5;else{const h=Math.max(i.near,wM.distanceToPoint(Gf.origin));c=qj(i,h,l.resolution)}if(wM.radius+=c,Gf.intersectsSphere(wM)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),SM.copy(o.boundingBox).applyMatrix4(a);let d;if(r)d=qg*.5;else{const h=Math.max(i.near,SM.distanceToPoint(Gf.origin));d=qj(i,h,l.resolution)}SM.expandByScalar(d),Gf.intersectsBox(SM)!==!1&&(r?gCe(this,n):vCe(this,i,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(L6),this.material.uniforms.resolution.value.set(L6.z,L6.w))}}class xCe extends IK{constructor(e=new DK,n=new L9({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const yCe=T.forwardRef(function({points:e,color:n=16777215,vertexColors:r,linewidth:i,lineWidth:s,segments:a,dashed:o,...l},c){var d,h;const g=$c(S=>S.size),v=T.useMemo(()=>a?new IK:new xCe,[a]),[b]=T.useState(()=>new L9),_=(r==null||(d=r[0])==null?void 0:d.length)===4?4:3,w=T.useMemo(()=>{const S=a?new O9:new DK,E=e.map(A=>{const N=Array.isArray(A);return A instanceof ze||A instanceof ci?[A.x,A.y,A.z]:A instanceof Lt?[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(S.setPositions(E.flat()),r){n=16777215;const A=r.map(N=>N instanceof xn?N.toArray():N);S.setColors(A.flat(),_)}return S},[e,a,r,_]);return T.useLayoutEffect(()=>{v.computeLineDistances()},[e,v]),T.useLayoutEffect(()=>{o?b.defines.USE_DASH="":delete b.defines.USE_DASH,b.needsUpdate=!0},[o,b]),T.useEffect(()=>()=>{w.dispose(),b.dispose()},[w]),T.createElement("primitive",lh({object:v,ref:c},l),T.createElement("primitive",{object:w,attach:"geometry"}),T.createElement("primitive",lh({object:b,attach:"material",color:n,vertexColors:!!r,resolution:[g.width,g.height],linewidth:(h=i??s)!==null&&h!==void 0?h:1,dashed:o,transparent:_===4},l)))});function bCe(){var t=Object.create(null);function e(i,s){var a=i.id,o=i.name,l=i.dependencies;l===void 0&&(l=[]);var c=i.init;c===void 0&&(c=function(){});var d=i.getTransferables;if(d===void 0&&(d=null),!t[a])try{l=l.map(function(g){return g&&g.isWorkerModule&&(e(g,function(v){if(v instanceof Error)throw v}),g=t[g.id].value),g}),c=r("<"+o+">.init",c),d&&(d=r("<"+o+">.getTransferables",d));var h=null;typeof c=="function"?h=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),t[a]={id:a,value:h,getTransferables:d},s(h)}catch(g){g&&g.noLog||console.error(g),s(g)}}function n(i,s){var a,o=i.id,l=i.args;(!t[o]||typeof t[o].value!="function")&&s(new Error("Worker module "+o+": not found or its 'init' did not return a function"));try{var c=(a=t[o]).value.apply(a,l);c&&typeof c.then=="function"?c.then(d,function(h){return s(h instanceof Error?h:new Error(""+h))}):d(c)}catch(h){s(h)}function d(h){try{var g=t[o].getTransferables&&t[o].getTransferables(h);(!g||!Array.isArray(g)||!g.length)&&(g=void 0),s(h,g)}catch(v){console.error(v),s(v)}}}function r(i,s){var a=void 0;self.troikaDefine=function(l){return a=l};var o=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/

troikaDefine(
`+s+`
)`],{type:"application/javascript"}));try{importScripts(o)}catch(l){console.error(l)}return URL.revokeObjectURL(o),delete self.troikaDefine,a}self.addEventListener("message",function(i){var s=i.data,a=s.messageId,o=s.action,l=s.data;try{o==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:a,success:!1,error:c.message}):postMessage({messageId:a,success:!0,result:{isCallable:typeof c=="function"}})}),o==="callModule"&&n(l,function(c,d){c instanceof Error?postMessage({messageId:a,success:!1,error:c.message}):postMessage({messageId:a,success:!0,result:c},d||void 0)})}catch(c){postMessage({messageId:a,success:!1,error:c.stack})}})}function _Ce(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 OK=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 OK=function(){return t},t},SCe=0,wCe=0,F6=!1,W_=Object.create(null),$_=Object.create(null),o7=Object.create(null);function Iy(t){if((!t||typeof t.init!="function")&&!F6)throw new Error("requires `options.init` function");var e=t.dependencies,n=t.init,r=t.getTransferables,i=t.workerId,s=_Ce(t);i==null&&(i="#default");var a="workerModule"+ ++SCe,o=t.name||a,l=null;e=e&&e.map(function(d){return typeof d=="function"&&!d.workerModuleData&&(F6=!0,d=Iy({workerId:i,name:"<"+o+"> function dependency: "+d.name,init:`function(){return (
`+GM(d)+`
)}`}),F6=!1),d&&d.workerModuleData&&(d=d.workerModuleData),d});function c(){for(var d=[],h=arguments.length;h--;)d[h]=arguments[h];if(!OK())return s.apply(void 0,d);if(!l){l=Xj(i,"registerModule",c.workerModuleData);var g=function(){l=null,$_[i].delete(g)};($_[i]||($_[i]=new Set)).add(g)}return l.then(function(v){var b=v.isCallable;if(b)return Xj(i,"callModule",{id:a,args:d});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c.workerModuleData={isWorkerModule:!0,id:a,name:o,dependencies:e,init:GM(n),getTransferables:r&&GM(r)},c.onMainThread=s,c}function MCe(t){$_[t]&&$_[t].forEach(function(e){e()}),W_[t]&&(W_[t].terminate(),delete W_[t])}function GM(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function TCe(t){var e=W_[t];if(!e){var n=GM(bCe);e=W_[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,a=o7[s];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete o7[s],a(i)}}return e}function Xj(t,e,n){return new Promise(function(r,i){var s=++wCe;o7[s]=function(a){a.success?r(a.result):i(new Error("Error in worker "+e+" call: "+a.error))},TCe(t).postMessage({messageId:s,action:e,data:n})})}function LK(){var t=(function(e){function n(J,F,j,X,H,se,re,ie){var ue=1-re;ie.x=ue*ue*J+2*ue*re*j+re*re*H,ie.y=ue*ue*F+2*ue*re*X+re*re*se}function r(J,F,j,X,H,se,re,ie,ue,le){var fe=1-ue;le.x=fe*fe*fe*J+3*fe*fe*ue*j+3*fe*ue*ue*H+ue*ue*ue*re,le.y=fe*fe*fe*F+3*fe*fe*ue*X+3*fe*ue*ue*se+ue*ue*ue*ie}function i(J,F){for(var j=/([MLQCZ])([^MLQCZ]*)/g,X,H,se,re,ie;X=j.exec(J);){var ue=X[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(le){return parseFloat(le)});switch(X[1]){case"M":re=H=ue[0],ie=se=ue[1];break;case"L":(ue[0]!==re||ue[1]!==ie)&&F("L",re,ie,re=ue[0],ie=ue[1]);break;case"Q":{F("Q",re,ie,re=ue[2],ie=ue[3],ue[0],ue[1]);break}case"C":{F("C",re,ie,re=ue[4],ie=ue[5],ue[0],ue[1],ue[2],ue[3]);break}case"Z":(re!==H||ie!==se)&&F("L",re,ie,H,se);break}}}function s(J,F,j){j===void 0&&(j=16);var X={x:0,y:0};i(J,function(H,se,re,ie,ue,le,fe,xe,he){switch(H){case"L":F(se,re,ie,ue);break;case"Q":{for(var Te=se,We=re,Se=1;Se<j;Se++)n(se,re,le,fe,ie,ue,Se/(j-1),X),F(Te,We,X.x,X.y),Te=X.x,We=X.y;break}case"C":{for(var Le=se,pe=re,Re=1;Re<j;Re++)r(se,re,le,fe,xe,he,ie,ue,Re/(j-1),X),F(Le,pe,X.x,X.y),Le=X.x,pe=X.y;break}}})}var a="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);}",o="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",l=new WeakMap,c={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function d(J,F){var j=J.getContext?J.getContext("webgl",c):J,X=l.get(j);if(!X){let Le=function(Pe){var Ke=se[Pe];if(!Ke&&(Ke=se[Pe]=j.getExtension(Pe),!Ke))throw new Error(Pe+" not supported");return Ke},pe=function(Pe,Ke){var oe=j.createShader(Ke);return j.shaderSource(oe,Pe),j.compileShader(oe),oe},Re=function(Pe,Ke,oe,te){if(!re[Pe]){var _e={},ve={},ye=j.createProgram();j.attachShader(ye,pe(Ke,j.VERTEX_SHADER)),j.attachShader(ye,pe(oe,j.FRAGMENT_SHADER)),j.linkProgram(ye),re[Pe]={program:ye,transaction:function(Be){j.useProgram(ye),Be({setUniform:function(Ye,Qe){for(var Ie=[],Fe=arguments.length-2;Fe-- >0;)Ie[Fe]=arguments[Fe+2];var Ge=ve[Qe]||(ve[Qe]=j.getUniformLocation(ye,Qe));j["uniform"+Ye].apply(j,[Ge].concat(Ie))},setAttribute:function(Ye,Qe,Ie,Fe,Ge){var Me=_e[Ye];Me||(Me=_e[Ye]={buf:j.createBuffer(),loc:j.getAttribLocation(ye,Ye),data:null}),j.bindBuffer(j.ARRAY_BUFFER,Me.buf),j.vertexAttribPointer(Me.loc,Qe,j.FLOAT,!1,0,0),j.enableVertexAttribArray(Me.loc),H?j.vertexAttribDivisor(Me.loc,Fe):Le("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Me.loc,Fe),Ge!==Me.data&&(j.bufferData(j.ARRAY_BUFFER,Ge,Ie),Me.data=Ge)}})}}}re[Pe].transaction(te)},ne=function(Pe,Ke){ue++;try{j.activeTexture(j.TEXTURE0+ue);var oe=ie[Pe];oe||(oe=ie[Pe]=j.createTexture(),j.bindTexture(j.TEXTURE_2D,oe),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST)),j.bindTexture(j.TEXTURE_2D,oe),Ke(oe,ue)}finally{ue--}},Xe=function(Pe,Ke,oe){var te=j.createFramebuffer();le.push(te),j.bindFramebuffer(j.FRAMEBUFFER,te),j.activeTexture(j.TEXTURE0+Ke),j.bindTexture(j.TEXTURE_2D,Pe),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,Pe,0);try{oe(te)}finally{j.deleteFramebuffer(te),j.bindFramebuffer(j.FRAMEBUFFER,le[--le.length-1]||null)}},Ae=function(){se={},re={},ie={},ue=-1,le.length=0};var fe=Le,xe=pe,he=Re,Te=ne,We=Xe,Se=Ae,H=typeof WebGL2RenderingContext<"u"&&j instanceof WebGL2RenderingContext,se={},re={},ie={},ue=-1,le=[];j.canvas.addEventListener("webglcontextlost",function(Pe){Ae(),Pe.preventDefault()},!1),l.set(j,X={gl:j,isWebGL2:H,getExtension:Le,withProgram:Re,withTexture:ne,withTextureFramebuffer:Xe,handleContextLoss:Ae})}F(X)}function h(J,F,j,X,H,se,re,ie){re===void 0&&(re=15),ie===void 0&&(ie=null),d(J,function(ue){var le=ue.gl,fe=ue.withProgram,xe=ue.withTexture;xe("copy",function(he,Te){le.texImage2D(le.TEXTURE_2D,0,le.RGBA,H,se,0,le.RGBA,le.UNSIGNED_BYTE,F),fe("copy",a,o,function(We){var Se=We.setUniform,Le=We.setAttribute;Le("aUV",2,le.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),Se("1i","image",Te),le.bindFramebuffer(le.FRAMEBUFFER,ie||null),le.disable(le.BLEND),le.colorMask(re&8,re&4,re&2,re&1),le.viewport(j,X,H,se),le.scissor(j,X,H,se),le.drawArrays(le.TRIANGLES,0,3)})})})}function g(J,F,j){var X=J.width,H=J.height;d(J,function(se){var re=se.gl,ie=new Uint8Array(X*H*4);re.readPixels(0,0,X,H,re.RGBA,re.UNSIGNED_BYTE,ie),J.width=F,J.height=j,h(re,ie,0,0,X,H)})}var v=Object.freeze({__proto__:null,withWebGLContext:d,renderImageData:h,resizeWebGLCanvasWithoutClearing:g});function b(J,F,j,X,H,se){se===void 0&&(se=1);var re=new Uint8Array(J*F),ie=X[2]-X[0],ue=X[3]-X[1],le=[];s(j,function(Le,pe,Re,ne){le.push({x1:Le,y1:pe,x2:Re,y2:ne,minX:Math.min(Le,Re),minY:Math.min(pe,ne),maxX:Math.max(Le,Re),maxY:Math.max(pe,ne)})}),le.sort(function(Le,pe){return Le.maxX-pe.maxX});for(var fe=0;fe<J;fe++)for(var xe=0;xe<F;xe++){var he=We(X[0]+ie*(fe+.5)/J,X[1]+ue*(xe+.5)/F),Te=Math.pow(1-Math.abs(he)/H,se)/2;he<0&&(Te=1-Te),Te=Math.max(0,Math.min(255,Math.round(Te*255))),re[xe*J+fe]=Te}return re;function We(Le,pe){for(var Re=1/0,ne=1/0,Xe=le.length;Xe--;){var Ae=le[Xe];if(Ae.maxX+ne<=Le)break;if(Le+ne>Ae.minX&&pe-ne<Ae.maxY&&pe+ne>Ae.minY){var Pe=S(Le,pe,Ae.x1,Ae.y1,Ae.x2,Ae.y2);Pe<Re&&(Re=Pe,ne=Math.sqrt(Re))}}return Se(Le,pe)&&(ne=-ne),ne}function Se(Le,pe){for(var Re=0,ne=le.length;ne--;){var Xe=le[ne];if(Xe.maxX<=Le)break;var Ae=Xe.y1>pe!=Xe.y2>pe&&Le<(Xe.x2-Xe.x1)*(pe-Xe.y1)/(Xe.y2-Xe.y1)+Xe.x1;Ae&&(Re+=Xe.y1<Xe.y2?1:-1)}return Re!==0}}function _(J,F,j,X,H,se,re,ie,ue,le){se===void 0&&(se=1),ie===void 0&&(ie=0),ue===void 0&&(ue=0),le===void 0&&(le=0),w(J,F,j,X,H,se,re,null,ie,ue,le)}function w(J,F,j,X,H,se,re,ie,ue,le,fe){se===void 0&&(se=1),ue===void 0&&(ue=0),le===void 0&&(le=0),fe===void 0&&(fe=0);for(var xe=b(J,F,j,X,H,se),he=new Uint8Array(xe.length*4),Te=0;Te<xe.length;Te++)he[Te*4+fe]=xe[Te];h(re,he,ue,le,J,F,1<<3-fe,ie)}function S(J,F,j,X,H,se){var re=H-j,ie=se-X,ue=re*re+ie*ie,le=ue?Math.max(0,Math.min(1,((J-j)*re+(F-X)*ie)/ue)):0,fe=J-(j+le*re),xe=F-(X+le*ie);return fe*fe+xe*xe}var E=Object.freeze({__proto__:null,generate:b,generateIntoCanvas:_,generateIntoFramebuffer:w}),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);}",I="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",P=new Float32Array([0,0,2,0,0,2]),L=null,R=!1,O={},W=new WeakMap;function U(J){if(!R&&!B(J))throw new Error("WebGL generation not supported")}function V(J,F,j,X,H,se,re){if(se===void 0&&(se=1),re===void 0&&(re=null),!re&&(re=L,!re)){var ie=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!ie)throw new Error("OffscreenCanvas or DOM canvas not supported");re=L=ie.getContext("webgl",{depth:!1})}U(re);var ue=new Uint8Array(J*F*4);d(re,function(he){var Te=he.gl,We=he.withTexture,Se=he.withTextureFramebuffer;We("readable",function(Le,pe){Te.texImage2D(Te.TEXTURE_2D,0,Te.RGBA,J,F,0,Te.RGBA,Te.UNSIGNED_BYTE,null),Se(Le,pe,function(Re){Z(J,F,j,X,H,se,Te,Re,0,0,0),Te.readPixels(0,0,J,F,Te.RGBA,Te.UNSIGNED_BYTE,ue)})})});for(var le=new Uint8Array(J*F),fe=0,xe=0;fe<ue.length;fe+=4)le[xe++]=ue[fe];return le}function G(J,F,j,X,H,se,re,ie,ue,le){se===void 0&&(se=1),ie===void 0&&(ie=0),ue===void 0&&(ue=0),le===void 0&&(le=0),Z(J,F,j,X,H,se,re,null,ie,ue,le)}function Z(J,F,j,X,H,se,re,ie,ue,le,fe){se===void 0&&(se=1),ue===void 0&&(ue=0),le===void 0&&(le=0),fe===void 0&&(fe=0),U(re);var xe=[];s(j,function(he,Te,We,Se){xe.push(he,Te,We,Se)}),xe=new Float32Array(xe),d(re,function(he){var Te=he.gl,We=he.isWebGL2,Se=he.getExtension,Le=he.withProgram,pe=he.withTexture,Re=he.withTextureFramebuffer,ne=he.handleContextLoss;if(pe("rawDistances",function(Xe,Ae){(J!==Xe._lastWidth||F!==Xe._lastHeight)&&Te.texImage2D(Te.TEXTURE_2D,0,Te.RGBA,Xe._lastWidth=J,Xe._lastHeight=F,0,Te.RGBA,Te.UNSIGNED_BYTE,null),Le("main",A,N,function(Pe){var Ke=Pe.setAttribute,oe=Pe.setUniform,te=!We&&Se("ANGLE_instanced_arrays"),_e=!We&&Se("EXT_blend_minmax");Ke("aUV",2,Te.STATIC_DRAW,0,P),Ke("aLineSegment",4,Te.DYNAMIC_DRAW,1,xe),oe.apply(void 0,["4f","uGlyphBounds"].concat(X)),oe("1f","uMaxDistance",H),oe("1f","uExponent",se),Re(Xe,Ae,function(ve){Te.enable(Te.BLEND),Te.colorMask(!0,!0,!0,!0),Te.viewport(0,0,J,F),Te.scissor(0,0,J,F),Te.blendFunc(Te.ONE,Te.ONE),Te.blendEquationSeparate(Te.FUNC_ADD,We?Te.MAX:_e.MAX_EXT),Te.clear(Te.COLOR_BUFFER_BIT),We?Te.drawArraysInstanced(Te.TRIANGLES,0,3,xe.length/4):te.drawArraysInstancedANGLE(Te.TRIANGLES,0,3,xe.length/4)})}),Le("post",a,I,function(Pe){Pe.setAttribute("aUV",2,Te.STATIC_DRAW,0,P),Pe.setUniform("1i","tex",Ae),Te.bindFramebuffer(Te.FRAMEBUFFER,ie),Te.disable(Te.BLEND),Te.colorMask(fe===0,fe===1,fe===2,fe===3),Te.viewport(ue,le,J,F),Te.scissor(ue,le,J,F),Te.drawArrays(Te.TRIANGLES,0,3)})}),Te.isContextLost())throw ne(),new Error("webgl context lost")})}function B(J){var F=!J||J===L?O:J.canvas||J,j=W.get(F);if(j===void 0){R=!0;var X=null;try{var H=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],se=V(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,J);j=se&&H.length===se.length&&se.every(function(re,ie){return re===H[ie]}),j||(X="bad trial run results",console.info(H,se))}catch(re){j=!1,X=re.message}X&&console.warn("WebGL SDF generation not supported:",X),R=!1,W.set(F,j)}return j}var q=Object.freeze({__proto__:null,generate:V,generateIntoCanvas:G,generateIntoFramebuffer:Z,isSupported:B});function Y(J,F,j,X,H,se){H===void 0&&(H=Math.max(X[2]-X[0],X[3]-X[1])/2),se===void 0&&(se=1);try{return V.apply(q,arguments)}catch(re){return console.info("WebGL SDF generation failed, falling back to JS",re),b.apply(E,arguments)}}function K(J,F,j,X,H,se,re,ie,ue,le){H===void 0&&(H=Math.max(X[2]-X[0],X[3]-X[1])/2),se===void 0&&(se=1),ie===void 0&&(ie=0),ue===void 0&&(ue=0),le===void 0&&(le=0);try{return G.apply(q,arguments)}catch(fe){return console.info("WebGL SDF generation failed, falling back to JS",fe),_.apply(E,arguments)}}return e.forEachPathCommand=i,e.generate=Y,e.generateIntoCanvas=K,e.javascript=E,e.pathToLineSegments=s,e.webgl=q,e.webglUtils=v,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}function ECe(){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(ne,Xe){r[ne]=1<<Xe+1,i[r[ne]]=ne}),Object.freeze(r);var s=r.LRI|r.RLI|r.FSI,a=r.L|r.R|r.AL,o=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,l=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,c=r.S|r.WS|r.B|s|r.PDI|l,d=null;function h(){if(!d){d=new Map;var ne=function(Ae){if(n.hasOwnProperty(Ae)){var Pe=0;n[Ae].split(",").forEach(function(Ke){var oe=Ke.split("+"),te=oe[0],_e=oe[1];te=parseInt(te,36),_e=_e?parseInt(_e,36):0,d.set(Pe+=te,r[Ae]);for(var ve=0;ve<_e;ve++)d.set(++Pe,r[Ae])})}};for(var Xe in n)ne(Xe)}}function g(ne){return h(),d.get(ne.codePointAt(0))||r.L}function v(ne){return i[g(ne)]}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 _(ne,Xe){var Ae=36,Pe=0,Ke=new Map,oe=Xe&&new Map,te;return ne.split(",").forEach(function _e(ve){if(ve.indexOf("+")!==-1)for(var ye=+ve;ye--;)_e(te);else{te=ve;var ke=ve.split(">"),Be=ke[0],ge=ke[1];Be=String.fromCodePoint(Pe+=parseInt(Be,Ae)),ge=String.fromCodePoint(Pe+=parseInt(ge,Ae)),Ke.set(Be,ge),Xe&&oe.set(ge,Be)}}),{map:Ke,reverseMap:oe}}var w,S,E;function A(){if(!w){var ne=_(b.pairs,!0),Xe=ne.map,Ae=ne.reverseMap;w=Xe,S=Ae,E=_(b.canonical,!1).map}}function N(ne){return A(),w.get(ne)||null}function I(ne){return A(),S.get(ne)||null}function P(ne){return A(),E.get(ne)||null}var L=r.L,R=r.R,O=r.EN,W=r.ES,U=r.ET,V=r.AN,G=r.CS,Z=r.B,B=r.S,q=r.ON,Y=r.BN,K=r.NSM,J=r.AL,F=r.LRO,j=r.RLO,X=r.LRE,H=r.RLE,se=r.PDF,re=r.LRI,ie=r.RLI,ue=r.FSI,le=r.PDI;function fe(ne,Xe){for(var Ae=125,Pe=new Uint32Array(ne.length),Ke=0;Ke<ne.length;Ke++)Pe[Ke]=g(ne[Ke]);var oe=new Map;function te(Gi,Hs){var ys=Pe[Gi];Pe[Gi]=Hs,oe.set(ys,oe.get(ys)-1),ys&o&&oe.set(o,oe.get(o)-1),oe.set(Hs,(oe.get(Hs)||0)+1),Hs&o&&oe.set(o,(oe.get(o)||0)+1)}for(var _e=new Uint8Array(ne.length),ve=new Map,ye=[],ke=null,Be=0;Be<ne.length;Be++)ke||ye.push(ke={start:Be,end:ne.length-1,level:Xe==="rtl"?1:Xe==="ltr"?0:Qd(Be,!1)}),Pe[Be]&Z&&(ke.end=Be,ke=null);for(var ge=H|X|j|F|s|le|se|Z,Ye=function(Gi){return Gi+(Gi&1?1:2)},Qe=function(Gi){return Gi+(Gi&1?2:1)},Ie=0;Ie<ye.length;Ie++){ke=ye[Ie];var Fe=[{_level:ke.level,_override:0,_isolate:0}],Ge=void 0,Me=0,$e=0,dt=0;oe.clear();for(var Oe=ke.start;Oe<=ke.end;Oe++){var st=Pe[Oe];if(Ge=Fe[Fe.length-1],oe.set(st,(oe.get(st)||0)+1),st&o&&oe.set(o,(oe.get(o)||0)+1),st&ge)if(st&(H|X)){_e[Oe]=Ge._level;var ft=(st===H?Qe:Ye)(Ge._level);ft<=Ae&&!Me&&!$e?Fe.push({_level:ft,_override:0,_isolate:0}):Me||$e++}else if(st&(j|F)){_e[Oe]=Ge._level;var pt=(st===j?Qe:Ye)(Ge._level);pt<=Ae&&!Me&&!$e?Fe.push({_level:pt,_override:st&j?R:L,_isolate:0}):Me||$e++}else if(st&s){st&ue&&(st=Qd(Oe+1,!0)===1?ie:re),_e[Oe]=Ge._level,Ge._override&&te(Oe,Ge._override);var et=(st===ie?Qe:Ye)(Ge._level);et<=Ae&&Me===0&&$e===0?(dt++,Fe.push({_level:et,_override:0,_isolate:1,_isolInitIndex:Oe})):Me++}else if(st&le){if(Me>0)Me--;else if(dt>0){for($e=0;!Fe[Fe.length-1]._isolate;)Fe.pop();var Ze=Fe[Fe.length-1]._isolInitIndex;Ze!=null&&(ve.set(Ze,Oe),ve.set(Oe,Ze)),Fe.pop(),dt--}Ge=Fe[Fe.length-1],_e[Oe]=Ge._level,Ge._override&&te(Oe,Ge._override)}else st&se?(Me===0&&($e>0?$e--:!Ge._isolate&&Fe.length>1&&(Fe.pop(),Ge=Fe[Fe.length-1])),_e[Oe]=Ge._level):st&Z&&(_e[Oe]=ke.level);else _e[Oe]=Ge._level,Ge._override&&st!==Y&&te(Oe,Ge._override)}for(var me=[],je=null,He=ke.start;He<=ke.end;He++){var nt=Pe[He];if(!(nt&l)){var yt=_e[He],lt=nt&s,bt=nt===le;je&&yt===je._level?(je._end=He,je._endsWithIsolInit=lt):me.push(je={_start:He,_end:He,_level:yt,_startsWithPDI:bt,_endsWithIsolInit:lt})}}for(var Nt=[],Pt=0;Pt<me.length;Pt++){var Ve=me[Pt];if(!Ve._startsWithPDI||Ve._startsWithPDI&&!ve.has(Ve._start)){for(var wt=[je=Ve],Et=void 0;je&&je._endsWithIsolInit&&(Et=ve.get(je._end))!=null;)for(var zt=Pt+1;zt<me.length;zt++)if(me[zt]._start===Et){wt.push(je=me[zt]);break}for(var Ht=[],an=0;an<wt.length;an++)for(var Dn=wt[an],Vt=Dn._start;Vt<=Dn._end;Vt++)Ht.push(Vt);for(var pn=_e[Ht[0]],Bt=ke.level,Cn=Ht[0]-1;Cn>=0;Cn--)if(!(Pe[Cn]&l)){Bt=_e[Cn];break}var Bn=Ht[Ht.length-1],wn=_e[Bn],On=ke.level;if(!(Pe[Bn]&s)){for(var jn=Bn+1;jn<=ke.end;jn++)if(!(Pe[jn]&l)){On=_e[jn];break}}Nt.push({_seqIndices:Ht,_sosType:Math.max(Bt,pn)%2?R:L,_eosType:Math.max(On,wn)%2?R:L})}}for(var Bi=0;Bi<Nt.length;Bi++){var ui=Nt[Bi],be=ui._seqIndices,ot=ui._sosType,_t=ui._eosType,xt=_e[be[0]]&1?R:L;if(oe.get(K))for(var gt=0;gt<be.length;gt++){var Yt=be[gt];if(Pe[Yt]&K){for(var rn=ot,sn=gt-1;sn>=0;sn--)if(!(Pe[be[sn]]&l)){rn=Pe[be[sn]];break}te(Yt,rn&(s|le)?q:rn)}}if(oe.get(O))for(var Zt=0;Zt<be.length;Zt++){var Mn=be[Zt];if(Pe[Mn]&O)for(var Fn=Zt-1;Fn>=-1;Fn--){var $n=Fn===-1?ot:Pe[be[Fn]];if($n&a){$n===J&&te(Mn,V);break}}}if(oe.get(J))for(var on=0;on<be.length;on++){var ir=be[on];Pe[ir]&J&&te(ir,R)}if(oe.get(W)||oe.get(G))for(var qr=1;qr<be.length-1;qr++){var Jr=be[qr];if(Pe[Jr]&(W|G)){for(var cr=0,Nr=0,en=qr-1;en>=0&&(cr=Pe[be[en]],!!(cr&l));en--);for(var ss=qr+1;ss<be.length&&(Nr=Pe[be[ss]],!!(Nr&l));ss++);cr===Nr&&(Pe[Jr]===W?cr===O:cr&(O|V))&&te(Jr,cr)}}if(oe.get(O))for(var Rn=0;Rn<be.length;Rn++){var gs=be[Rn];if(Pe[gs]&O){for(var Rs=Rn-1;Rs>=0&&Pe[be[Rs]]&(U|l);Rs--)te(be[Rs],O);for(Rn++;Rn<be.length&&Pe[be[Rn]]&(U|l|O);Rn++)Pe[be[Rn]]!==O&&te(be[Rn],O)}}if(oe.get(U)||oe.get(W)||oe.get(G))for(var Pi=0;Pi<be.length;Pi++){var vs=be[Pi];if(Pe[vs]&(U|W|G)){te(vs,q);for(var pr=Pi-1;pr>=0&&Pe[be[pr]]&l;pr--)te(be[pr],q);for(var di=Pi+1;di<be.length&&Pe[be[di]]&l;di++)te(be[di],q)}}if(oe.get(O))for(var ks=0,Di=ot;ks<be.length;ks++){var $a=be[ks],co=Pe[$a];co&O?Di===L&&te($a,L):co&a&&(Di=co)}if(oe.get(o)){var So=R|O|V,ql=So|L,xl=[];{for(var uo=[],Ps=0;Ps<be.length;Ps++)if(Pe[be[Ps]]&o){var Xl=ne[be[Ps]],Go=void 0;if(N(Xl)!==null)if(uo.length<63)uo.push({char:Xl,seqIndex:Ps});else break;else if((Go=I(Xl))!==null)for(var wo=uo.length-1;wo>=0;wo--){var Mo=uo[wo].char;if(Mo===Go||Mo===I(P(Xl))||N(P(Mo))===Xl){xl.push([uo[wo].seqIndex,Ps]),uo.length=wo;break}}}xl.sort(function(Gi,Hs){return Gi[0]-Hs[0]})}for(var kc=0;kc<xl.length;kc++){for(var Pc=xl[kc],Yl=Pc[0],qa=Pc[1],ia=!1,Na=0,yl=Yl+1;yl<qa;yl++){var xs=be[yl];if(Pe[xs]&ql){ia=!0;var Wo=Pe[xs]&So?R:L;if(Wo===xt){Na=Wo;break}}}if(ia&&!Na){Na=ot;for(var $o=Yl-1;$o>=0;$o--){var Dc=be[$o];if(Pe[Dc]&ql){var ei=Pe[Dc]&So?R:L;ei!==xt?Na=ei:Na=xt;break}}}if(Na){if(Pe[be[Yl]]=Pe[be[qa]]=Na,Na!==xt){for(var zr=Yl+1;zr<be.length;zr++)if(!(Pe[be[zr]]&l)){g(ne[be[zr]])&K&&(Pe[be[zr]]=Na);break}}if(Na!==xt){for(var Xa=qa+1;Xa<be.length;Xa++)if(!(Pe[be[Xa]]&l)){g(ne[be[Xa]])&K&&(Pe[be[Xa]]=Na);break}}}}for(var mr=0;mr<be.length;mr++)if(Pe[be[mr]]&o){for(var bi=mr,Ii=mr,Gr=ot,To=mr-1;To>=0;To--)if(Pe[be[To]]&l)bi=To;else{Gr=Pe[be[To]]&So?R:L;break}for(var bl=_t,Kl=mr+1;Kl<be.length;Kl++)if(Pe[be[Kl]]&(o|l))Ii=Kl;else{bl=Pe[be[Kl]]&So?R:L;break}for(var ga=bi;ga<=Ii;ga++)Pe[be[ga]]=Gr===bl?Gr:xt;mr=Ii}}}for(var hi=ke.start;hi<=ke.end;hi++){var vh=_e[hi],nd=Pe[hi];if(vh&1?nd&(L|O|V)&&_e[hi]++:nd&R?_e[hi]++:nd&(V|O)&&(_e[hi]+=2),nd&l&&(_e[hi]=hi===0?ke.level:_e[hi-1]),hi===ke.end||g(ne[hi])&(B|Z))for(var rd=hi;rd>=0&&g(ne[rd])&c;rd--)_e[rd]=ke.level}}return{levels:_e,paragraphs:ye};function Qd(Gi,Hs){for(var ys=Gi;ys<ne.length;ys++){var _l=Pe[ys];if(_l&(R|J))return 1;if(_l&(Z|L)||Hs&&_l===le)return 0;if(_l&s){var va=fo(ys);ys=va===-1?ne.length:va}}return 0}function fo(Gi){for(var Hs=1,ys=Gi+1;ys<ne.length;ys++){var _l=Pe[ys];if(_l&Z)break;if(_l&le){if(--Hs===0)return ys}else _l&s&&Hs++}return-1}}var xe="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 Te(){if(!he){var ne=_(xe,!0),Xe=ne.map,Ae=ne.reverseMap;Ae.forEach(function(Pe,Ke){Xe.set(Ke,Pe)}),he=Xe}}function We(ne){return Te(),he.get(ne)||null}function Se(ne,Xe,Ae,Pe){var Ke=ne.length;Ae=Math.max(0,Ae==null?0:+Ae),Pe=Math.min(Ke-1,Pe==null?Ke-1:+Pe);for(var oe=new Map,te=Ae;te<=Pe;te++)if(Xe[te]&1){var _e=We(ne[te]);_e!==null&&oe.set(te,_e)}return oe}function Le(ne,Xe,Ae,Pe){var Ke=ne.length;Ae=Math.max(0,Ae==null?0:+Ae),Pe=Math.min(Ke-1,Pe==null?Ke-1:+Pe);var oe=[];return Xe.paragraphs.forEach(function(te){var _e=Math.max(Ae,te.start),ve=Math.min(Pe,te.end);if(_e<ve){for(var ye=Xe.levels.slice(_e,ve+1),ke=ve;ke>=_e&&g(ne[ke])&c;ke--)ye[ke]=te.level;for(var Be=te.level,ge=1/0,Ye=0;Ye<ye.length;Ye++){var Qe=ye[Ye];Qe>Be&&(Be=Qe),Qe<ge&&(ge=Qe|1)}for(var Ie=Be;Ie>=ge;Ie--)for(var Fe=0;Fe<ye.length;Fe++)if(ye[Fe]>=Ie){for(var Ge=Fe;Fe+1<ye.length&&ye[Fe+1]>=Ie;)Fe++;Fe>Ge&&oe.push([Ge+_e,Fe+_e])}}}),oe}function pe(ne,Xe,Ae,Pe){var Ke=Re(ne,Xe,Ae,Pe),oe=[].concat(ne);return Ke.forEach(function(te,_e){oe[_e]=(Xe.levels[te]&1?We(ne[te]):null)||ne[te]}),oe.join("")}function Re(ne,Xe,Ae,Pe){for(var Ke=Le(ne,Xe,Ae,Pe),oe=[],te=0;te<ne.length;te++)oe[te]=te;return Ke.forEach(function(_e){for(var ve=_e[0],ye=_e[1],ke=oe.slice(ve,ye+1),Be=ke.length;Be--;)oe[ye-Be]=ke[Be]}),oe}return e.closingToOpeningBracket=I,e.getBidiCharType=g,e.getBidiCharTypeName=v,e.getCanonicalBracket=P,e.getEmbeddingLevels=fe,e.getMirroredCharacter=We,e.getMirroredCharactersMap=Se,e.getReorderSegments=Le,e.getReorderedIndices=Re,e.getReorderedString=pe,e.openingToClosingBracket=N,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}const zK=/\bvoid\s+main\s*\(\s*\)\s*{/g;function l7(t){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function n(r,i){let s=Tr[i];return s?l7(s):r}return t.replace(e,n)}const zo=[];for(let t=0;t<256;t++)zo[t]=(t<16?"0":"")+t.toString(16);function CCe(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(zo[t&255]+zo[t>>8&255]+zo[t>>16&255]+zo[t>>24&255]+"-"+zo[e&255]+zo[e>>8&255]+"-"+zo[e>>16&15|64]+zo[e>>24&255]+"-"+zo[n&63|128]+zo[n>>8&255]+"-"+zo[n>>16&255]+zo[n>>24&255]+zo[r&255]+zo[r>>8&255]+zo[r>>16&255]+zo[r>>24&255]).toUpperCase()}const bg=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},ACe=Date.now(),Yj=new WeakMap,Kj=new Map;let NCe=1e10;function c7(t,e){const n=DCe(e);let r=Yj.get(t);if(r||Yj.set(t,r=Object.create(null)),r[n])return new r[n];const i=`_onBeforeCompile${n}`,s=function(c,d){t.onBeforeCompile.call(this,c,d);const h=this.customProgramCacheKey()+"|"+c.vertexShader+"|"+c.fragmentShader;let g=Kj[h];if(!g){const v=RCe(this,c,e,n);g=Kj[h]=v}c.vertexShader=g.vertexShader,c.fragmentShader=g.fragmentShader,bg(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-ACe}}),this[i]&&this[i](c)},a=function(){return o(e.chained?t:t.clone())},o=function(c){const d=Object.create(c,l);return Object.defineProperty(d,"baseMaterial",{value:t}),Object.defineProperty(d,"id",{value:NCe++}),d.uuid=CCe(),d.uniforms=bg({},c.uniforms,e.uniforms),d.defines=bg({},c.defines,e.defines),d.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",d.extensions=bg({},c.extensions,e.extensions),d._listeners=void 0,d},l={constructor:{value:a},isDerivedMaterial:{value:!0},type:{get:()=>t.type,set:c=>{t.type=c}},isDerivedFrom:{writable:!0,configurable:!0,value:function(c){const d=this.baseMaterial;return c===d||d.isDerivedMaterial&&d.isDerivedFrom(c)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return t.customProgramCacheKey()+"|"+n}},onBeforeCompile:{get(){return s},set(c){this[i]=c}},copy:{writable:!0,configurable:!0,value:function(c){return t.copy.call(this,c),!t.isShaderMaterial&&!t.isDerivedMaterial&&(bg(this.extensions,c.extensions),bg(this.defines,c.defines),bg(this.uniforms,CS.clone(c.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const c=new t.constructor;return o(c).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let c=this._depthMaterial;return c||(c=this._depthMaterial=c7(t.isDerivedMaterial?t.getDepthMaterial():new wE({depthPacking:qX}),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=c7(t.isDerivedMaterial?t.getDistanceMaterial():new ME,e),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms),c}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:c,_distanceMaterial:d}=this;c&&c.dispose(),d&&d.dispose(),t.dispose.call(this)}}};return r[n]=a,new a}function RCe(t,{vertexShader:e,fragmentShader:n},r,i){let{vertexDefs:s,vertexMainIntro:a,vertexMainOutro:o,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:d,fragmentMainOutro:h,fragmentColorTransform:g,customRewriter:v,timeUniform:b}=r;if(s=s||"",a=a||"",o=o||"",c=c||"",d=d||"",h=h||"",(l||v)&&(e=l7(e)),(g||v)&&(n=n.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
//!BEGIN_POST_CHUNK $1
$&
//!END_POST_CHUNK
`),n=l7(n)),v){let _=v({vertexShader:e,fragmentShader:n});e=_.vertexShader,n=_.fragmentShader}if(g){let _=[];n=n.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,w=>(_.push(w),"")),h=`${g}
${_.join(`
`)}
${h}`}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}
}
`,a=`
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});
${a}
`,e=e.replace(/\b(position|normal|uv)\b/g,(_,w,S,E)=>/\battribute\s+vec[23]\s+$/.test(E.substr(0,S))?w:`troika_${w}_${i}`),t.map&&t.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=Zj(e,i,s,a,o),n=Zj(n,i,c,d,h),{vertexShader:e,fragmentShader:n}}function Zj(t,e,n,r,i){return(r||i||n)&&(t=t.replace(zK,`
${n}
void troikaOrigMain${e}() {`),t+=`
void main() {
  ${r}
  troikaOrigMain${e}();
  ${i}
}`),t}function kCe(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let PCe=0;const Qj=new Map;function DCe(t){const e=JSON.stringify(t,kCe);let n=Qj.get(e);return n==null&&Qj.set(e,n=++PCe),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 ICe(){return typeof window>"u"&&(self.window=self),(function(t){var e={parse:function(i){var s=e._bin,a=new Uint8Array(i);if(s.readASCII(a,0,4)=="ttcf"){var o=4;s.readUshort(a,o),o+=2,s.readUshort(a,o),o+=2;var l=s.readUint(a,o);o+=4;for(var c=[],d=0;d<l;d++){var h=s.readUint(a,o);o+=4,c.push(e._readFont(a,h))}return c}return[e._readFont(a,0)]},_readFont:function(i,s){var a=e._bin,o=s;a.readFixed(i,s),s+=4;var l=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 c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],d={_data:i,_offset:o},h={},g=0;g<l;g++){var v=a.readASCII(i,s,4);s+=4,a.readUint(i,s),s+=4;var b=a.readUint(i,s);s+=4;var _=a.readUint(i,s);s+=4,h[v]={offset:b,length:_}}for(g=0;g<c.length;g++){var w=c[g];h[w]&&(d[w.trim()]=e[w.trim()].parse(i,h[w].offset,h[w].length,d))}return d},_tabOffset:function(i,s,a){for(var o=e._bin,l=o.readUshort(i,a+4),c=a+12,d=0;d<l;d++){var h=o.readASCII(i,c,4);c+=4,o.readUint(i,c),c+=4;var g=o.readUint(i,c);if(c+=4,o.readUint(i,c),c+=4,h==s)return g}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,a){for(var o=[],l=0;l<a;l++)o.push(e._bin.readUshort(i,s+2*l));return o},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,a){for(var o="",l=0;l<a;l++)o+=String.fromCharCode(i[s+l]);return o},readUnicode:function(i,s,a){for(var o="",l=0;l<a;l++){var c=i[s++]<<8|i[s++];o+=String.fromCharCode(c)}return o},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(i,s,a){var o=e._bin._tdec;return o&&s==0&&a==i.length?o.decode(i):e._bin.readASCII(i,s,a)},readBytes:function(i,s,a){for(var o=[],l=0;l<a;l++)o.push(i[s+l]);return o},readASCIIArray:function(i,s,a){for(var o=[],l=0;l<a;l++)o.push(String.fromCharCode(i[s+l]));return o},_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,a,o,l){var c=e._bin,d={},h=s;c.readFixed(i,s),s+=4;var g=c.readUshort(i,s);s+=2;var v=c.readUshort(i,s);s+=2;var b=c.readUshort(i,s);return s+=2,d.scriptList=e._lctf.readScriptList(i,h+g),d.featureList=e._lctf.readFeatureList(i,h+v),d.lookupList=e._lctf.readLookupList(i,h+b,l),d},e._lctf.readLookupList=function(i,s,a){var o=e._bin,l=s,c=[],d=o.readUshort(i,s);s+=2;for(var h=0;h<d;h++){var g=o.readUshort(i,s);s+=2;var v=e._lctf.readLookupTable(i,l+g,a);c.push(v)}return c},e._lctf.readLookupTable=function(i,s,a){var o=e._bin,l=s,c={tabs:[]};c.ltype=o.readUshort(i,s),s+=2,c.flag=o.readUshort(i,s),s+=2;var d=o.readUshort(i,s);s+=2;for(var h=c.ltype,g=0;g<d;g++){var v=o.readUshort(i,s);s+=2;var b=a(i,h,l+v,c);c.tabs.push(b)}return c},e._lctf.numOfOnes=function(i){for(var s=0,a=0;a<32;a++)(i>>>a&1)!=0&&s++;return s},e._lctf.readClassDef=function(i,s){var a=e._bin,o=[],l=a.readUshort(i,s);if(s+=2,l==1){var c=a.readUshort(i,s);s+=2;var d=a.readUshort(i,s);s+=2;for(var h=0;h<d;h++)o.push(c+h),o.push(c+h),o.push(a.readUshort(i,s)),s+=2}if(l==2){var g=a.readUshort(i,s);for(s+=2,h=0;h<g;h++)o.push(a.readUshort(i,s)),s+=2,o.push(a.readUshort(i,s)),s+=2,o.push(a.readUshort(i,s)),s+=2}return o},e._lctf.getInterval=function(i,s){for(var a=0;a<i.length;a+=3){var o=i[a],l=i[a+1];if(i[a+2],o<=s&&s<=l)return a}return-1},e._lctf.readCoverage=function(i,s){var a=e._bin,o={};o.fmt=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);return s+=2,o.fmt==1&&(o.tab=a.readUshorts(i,s,l)),o.fmt==2&&(o.tab=a.readUshorts(i,s,3*l)),o},e._lctf.coverageIndex=function(i,s){var a=i.tab;if(i.fmt==1)return a.indexOf(s);if(i.fmt==2){var o=e._lctf.getInterval(a,s);if(o!=-1)return a[o+2]+(s-a[o])}return-1},e._lctf.readFeatureList=function(i,s){var a=e._bin,o=s,l=[],c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=a.readASCII(i,s,4);s+=4;var g=a.readUshort(i,s);s+=2;var v=e._lctf.readFeatureTable(i,o+g);v.tag=h.trim(),l.push(v)}return l},e._lctf.readFeatureTable=function(i,s){var a=e._bin,o=s,l={},c=a.readUshort(i,s);s+=2,c>0&&(l.featureParams=o+c);var d=a.readUshort(i,s);s+=2,l.tab=[];for(var h=0;h<d;h++)l.tab.push(a.readUshort(i,s+2*h));return l},e._lctf.readScriptList=function(i,s){var a=e._bin,o=s,l={},c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=a.readASCII(i,s,4);s+=4;var g=a.readUshort(i,s);s+=2,l[h.trim()]=e._lctf.readScriptTable(i,o+g)}return l},e._lctf.readScriptTable=function(i,s){var a=e._bin,o=s,l={},c=a.readUshort(i,s);s+=2,c>0&&(l.default=e._lctf.readLangSysTable(i,o+c));var d=a.readUshort(i,s);s+=2;for(var h=0;h<d;h++){var g=a.readASCII(i,s,4);s+=4;var v=a.readUshort(i,s);s+=2,l[g.trim()]=e._lctf.readLangSysTable(i,o+v)}return l},e._lctf.readLangSysTable=function(i,s){var a=e._bin,o={};a.readUshort(i,s),s+=2,o.reqFeature=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);return s+=2,o.features=a.readUshorts(i,s,l),o},e.CFF={},e.CFF.parse=function(i,s,a){var o=e._bin;(i=new Uint8Array(i.buffer,s,a))[s=0],i[++s],i[++s],i[++s],s++;var l=[];s=e.CFF.readIndex(i,s,l);for(var c=[],d=0;d<l.length-1;d++)c.push(o.readASCII(i,s+l[d],l[d+1]-l[d]));s+=l[l.length-1];var h=[];s=e.CFF.readIndex(i,s,h);var g=[];for(d=0;d<h.length-1;d++)g.push(e.CFF.readDict(i,s+h[d],s+h[d+1]));s+=h[h.length-1];var v=g[0],b=[];s=e.CFF.readIndex(i,s,b);var _=[];for(d=0;d<b.length-1;d++)_.push(o.readASCII(i,s+b[d],b[d+1]-b[d]));if(s+=b[b.length-1],e.CFF.readSubrs(i,s,v),v.CharStrings){s=v.CharStrings,b=[],s=e.CFF.readIndex(i,s,b);var w=[];for(d=0;d<b.length-1;d++)w.push(o.readBytes(i,s+b[d],b[d+1]-b[d]));v.CharStrings=w}if(v.ROS){s=v.FDArray;var S=[];for(s=e.CFF.readIndex(i,s,S),v.FDArray=[],d=0;d<S.length-1;d++){var E=e.CFF.readDict(i,s+S[d],s+S[d+1]);e.CFF._readFDict(i,E,_),v.FDArray.push(E)}s+=S[S.length-1],s=v.FDSelect,v.FDSelect=[];var A=i[s];if(s++,A!=3)throw A;var N=o.readUshort(i,s);for(s+=2,d=0;d<N+1;d++)v.FDSelect.push(o.readUshort(i,s),i[s+2]),s+=3}return v.Encoding&&(v.Encoding=e.CFF.readEncoding(i,v.Encoding,v.CharStrings.length)),v.charset&&(v.charset=e.CFF.readCharset(i,v.charset,v.CharStrings.length)),e.CFF._readFDict(i,v,_),v},e.CFF._readFDict=function(i,s,a){var o;for(var l in s.Private&&(o=s.Private[1],s.Private=e.CFF.readDict(i,o,o+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(i,o+s.Private.Subrs,s.Private)),s)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(s[l]=a[s[l]-426+35])},e.CFF.readSubrs=function(i,s,a){var o=e._bin,l=[];s=e.CFF.readIndex(i,s,l);var c,d=l.length;c=d<1240?107:d<33900?1131:32768,a.Bias=c,a.Subrs=[];for(var h=0;h<l.length-1;h++)a.Subrs.push(o.readBytes(i,s+l[h],l[h+1]-l[h]))},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 a=0;a<i.charset.length;a++)if(i.charset[a]==s)return a;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,a){e._bin;var o=[".notdef"],l=i[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=i[s];s++;for(var d=0;d<c;d++)o.push(i[s+d]);return o},e.CFF.readCharset=function(i,s,a){var o=e._bin,l=[".notdef"],c=i[s];if(s++,c==0)for(var d=0;d<a;d++){var h=o.readUshort(i,s);s+=2,l.push(h)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<a;){h=o.readUshort(i,s),s+=2;var g=0;for(c==1?(g=i[s],s++):(g=o.readUshort(i,s),s+=2),d=0;d<=g;d++)l.push(h),h++}}return l},e.CFF.readIndex=function(i,s,a){var o=e._bin,l=o.readUshort(i,s)+1,c=i[s+=2];if(s++,c==1)for(var d=0;d<l;d++)a.push(i[s+d]);else if(c==2)for(d=0;d<l;d++)a.push(o.readUshort(i,s+2*d));else if(c==3)for(d=0;d<l;d++)a.push(16777215&o.readUint(i,s+3*d-1));else if(l!=1)throw"unsupported offset size: "+c+", count: "+l;return(s+=l*c)-1},e.CFF.getCharString=function(i,s,a){var o=e._bin,l=i[s],c=i[s+1];i[s+2],i[s+3],i[s+4];var d=1,h=null,g=null;l<=20&&(h=l,d=1),l==12&&(h=100*l+c,d=2),21<=l&&l<=27&&(h=l,d=1),l==28&&(g=o.readShort(i,s+1),d=3),29<=l&&l<=31&&(h=l,d=1),32<=l&&l<=246&&(g=l-139,d=1),247<=l&&l<=250&&(g=256*(l-247)+c+108,d=2),251<=l&&l<=254&&(g=256*-(l-251)-c-108,d=2),l==255&&(g=o.readInt(i,s+1)/65535,d=5),a.val=g??"o"+h,a.size=d},e.CFF.readCharString=function(i,s,a){for(var o=s+a,l=e._bin,c=[];s<o;){var d=i[s],h=i[s+1];i[s+2],i[s+3],i[s+4];var g=1,v=null,b=null;d<=20&&(v=d,g=1),d==12&&(v=100*d+h,g=2),d!=19&&d!=20||(v=d,g=2),21<=d&&d<=27&&(v=d,g=1),d==28&&(b=l.readShort(i,s+1),g=3),29<=d&&d<=31&&(v=d,g=1),32<=d&&d<=246&&(b=d-139,g=1),247<=d&&d<=250&&(b=256*(d-247)+h+108,g=2),251<=d&&d<=254&&(b=256*-(d-251)-h-108,g=2),d==255&&(b=l.readInt(i,s+1)/65535,g=5),c.push(b??"o"+v),s+=g}return c},e.CFF.readDict=function(i,s,a){for(var o=e._bin,l={},c=[];s<a;){var d=i[s],h=i[s+1];i[s+2],i[s+3],i[s+4];var g=1,v=null,b=null;if(d==28&&(b=o.readShort(i,s+1),g=3),d==29&&(b=o.readInt(i,s+1),g=5),32<=d&&d<=246&&(b=d-139,g=1),247<=d&&d<=250&&(b=256*(d-247)+h+108,g=2),251<=d&&d<=254&&(b=256*-(d-251)-h-108,g=2),d==255)throw b=o.readInt(i,s+1)/65535,g=5,"unknown number";if(d==30){var _=[];for(g=1;;){var w=i[s+g];g++;var S=w>>4,E=15&w;if(S!=15&&_.push(S),E!=15&&_.push(E),E==15)break}for(var A="",N=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],I=0;I<_.length;I++)A+=N[_[I]];b=parseFloat(A)}d<=21&&(v=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][d],g=1,d==12&&(v=["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"][h],g=2)),v!=null?(l[v]=c.length==1?c[0]:c,c=[]):c.push(b),s+=g}return l},e.cmap={},e.cmap.parse=function(i,s,a){i=new Uint8Array(i.buffer,s,a),s=0;var o=e._bin,l={};o.readUshort(i,s),s+=2;var c=o.readUshort(i,s);s+=2;var d=[];l.tables=[];for(var h=0;h<c;h++){var g=o.readUshort(i,s);s+=2;var v=o.readUshort(i,s);s+=2;var b=o.readUint(i,s);s+=4;var _="p"+g+"e"+v,w=d.indexOf(b);if(w==-1){var S;w=l.tables.length,d.push(b);var E=o.readUshort(i,b);E==0?S=e.cmap.parse0(i,b):E==4?S=e.cmap.parse4(i,b):E==6?S=e.cmap.parse6(i,b):E==12?S=e.cmap.parse12(i,b):console.debug("unknown format: "+E,g,v,b),l.tables.push(S)}if(l[_]!=null)throw"multiple tables for one platform+encoding";l[_]=w}return l},e.cmap.parse0=function(i,s){var a=e._bin,o={};o.format=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,o.map=[];for(var c=0;c<l-6;c++)o.map.push(i[s+c]);return o},e.cmap.parse4=function(i,s){var a=e._bin,o=s,l={};l.format=a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2;var d=a.readUshort(i,s);s+=2;var h=d/2;l.searchRange=a.readUshort(i,s),s+=2,l.entrySelector=a.readUshort(i,s),s+=2,l.rangeShift=a.readUshort(i,s),s+=2,l.endCount=a.readUshorts(i,s,h),s+=2*h,s+=2,l.startCount=a.readUshorts(i,s,h),s+=2*h,l.idDelta=[];for(var g=0;g<h;g++)l.idDelta.push(a.readShort(i,s)),s+=2;for(l.idRangeOffset=a.readUshorts(i,s,h),s+=2*h,l.glyphIdArray=[];s<o+c;)l.glyphIdArray.push(a.readUshort(i,s)),s+=2;return l},e.cmap.parse6=function(i,s){var a=e._bin,o={};o.format=a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,o.firstCode=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);s+=2,o.glyphIdArray=[];for(var c=0;c<l;c++)o.glyphIdArray.push(a.readUshort(i,s)),s+=2;return o},e.cmap.parse12=function(i,s){var a=e._bin,o={};o.format=a.readUshort(i,s),s+=2,s+=2,a.readUint(i,s),s+=4,a.readUint(i,s),s+=4;var l=a.readUint(i,s);s+=4,o.groups=[];for(var c=0;c<l;c++){var d=s+12*c,h=a.readUint(i,d+0),g=a.readUint(i,d+4),v=a.readUint(i,d+8);o.groups.push([h,g,v])}return o},e.glyf={},e.glyf.parse=function(i,s,a,o){for(var l=[],c=0;c<o.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(i,s){var a=e._bin,o=i._data,l=e._tabOffset(o,"glyf",i._offset)+i.loca[s];if(i.loca[s]==i.loca[s+1])return null;var c={};if(c.noc=a.readShort(o,l),l+=2,c.xMin=a.readShort(o,l),l+=2,c.yMin=a.readShort(o,l),l+=2,c.xMax=a.readShort(o,l),l+=2,c.yMax=a.readShort(o,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var d=0;d<c.noc;d++)c.endPts.push(a.readUshort(o,l)),l+=2;var h=a.readUshort(o,l);if(l+=2,o.length-l<h)return null;c.instructions=a.readBytes(o,l,h),l+=h;var g=c.endPts[c.noc-1]+1;for(c.flags=[],d=0;d<g;d++){var v=o[l];if(l++,c.flags.push(v),(8&v)!=0){var b=o[l];l++;for(var _=0;_<b;_++)c.flags.push(v),d++}}for(c.xs=[],d=0;d<g;d++){var w=(2&c.flags[d])!=0,S=(16&c.flags[d])!=0;w?(c.xs.push(S?o[l]:-o[l]),l++):S?c.xs.push(0):(c.xs.push(a.readShort(o,l)),l+=2)}for(c.ys=[],d=0;d<g;d++)w=(4&c.flags[d])!=0,S=(32&c.flags[d])!=0,w?(c.ys.push(S?o[l]:-o[l]),l++):S?c.ys.push(0):(c.ys.push(a.readShort(o,l)),l+=2);var E=0,A=0;for(d=0;d<g;d++)E+=c.xs[d],A+=c.ys[d],c.xs[d]=E,c.ys[d]=A}else{var N;c.parts=[];do{N=a.readUshort(o,l),l+=2;var I={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(I),I.glyphIndex=a.readUshort(o,l),l+=2,1&N){var P=a.readShort(o,l);l+=2;var L=a.readShort(o,l);l+=2}else P=a.readInt8(o,l),l++,L=a.readInt8(o,l),l++;2&N?(I.m.tx=P,I.m.ty=L):(I.p1=P,I.p2=L),8&N?(I.m.a=I.m.d=a.readF2dot14(o,l),l+=2):64&N?(I.m.a=a.readF2dot14(o,l),l+=2,I.m.d=a.readF2dot14(o,l),l+=2):128&N&&(I.m.a=a.readF2dot14(o,l),l+=2,I.m.b=a.readF2dot14(o,l),l+=2,I.m.c=a.readF2dot14(o,l),l+=2,I.m.d=a.readF2dot14(o,l),l+=2)}while(32&N);if(256&N){var R=a.readUshort(o,l);for(l+=2,c.instr=[],d=0;d<R;d++)c.instr.push(o[l]),l++}}return c},e.GDEF={},e.GDEF.parse=function(i,s,a,o){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,a,o){return e._lctf.parse(i,s,a,o,e.GPOS.subt)},e.GPOS.subt=function(i,s,a,o){var l=e._bin,c=a,d={};if(d.fmt=l.readUshort(i,a),a+=2,s==1||s==2||s==3||s==7||s==8&&d.fmt<=2){var h=l.readUshort(i,a);a+=2,d.coverage=e._lctf.readCoverage(i,h+c)}if(s==1&&d.fmt==1){var g=l.readUshort(i,a);a+=2,g!=0&&(d.pos=e.GPOS.readValueRecord(i,a,g))}else if(s==2&&d.fmt>=1&&d.fmt<=2){g=l.readUshort(i,a),a+=2;var v=l.readUshort(i,a);a+=2;var b=e._lctf.numOfOnes(g),_=e._lctf.numOfOnes(v);if(d.fmt==1){d.pairsets=[];var w=l.readUshort(i,a);a+=2;for(var S=0;S<w;S++){var E=c+l.readUshort(i,a);a+=2;var A=l.readUshort(i,E);E+=2;for(var N=[],I=0;I<A;I++){var P=l.readUshort(i,E);E+=2,g!=0&&(V=e.GPOS.readValueRecord(i,E,g),E+=2*b),v!=0&&(G=e.GPOS.readValueRecord(i,E,v),E+=2*_),N.push({gid2:P,val1:V,val2:G})}d.pairsets.push(N)}}if(d.fmt==2){var L=l.readUshort(i,a);a+=2;var R=l.readUshort(i,a);a+=2;var O=l.readUshort(i,a);a+=2;var W=l.readUshort(i,a);for(a+=2,d.classDef1=e._lctf.readClassDef(i,c+L),d.classDef2=e._lctf.readClassDef(i,c+R),d.matrix=[],S=0;S<O;S++){var U=[];for(I=0;I<W;I++){var V=null,G=null;g!=0&&(V=e.GPOS.readValueRecord(i,a,g),a+=2*b),v!=0&&(G=e.GPOS.readValueRecord(i,a,v),a+=2*_),U.push({val1:V,val2:G})}d.matrix.push(U)}}}else if(s==4&&d.fmt==1)d.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,a)+c),d.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,a+2)+c),d.markClassCount=l.readUshort(i,a+4),d.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,a+6)+c),d.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,a+8)+c,d.markClassCount);else if(s==6&&d.fmt==1)d.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,a)+c),d.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,a+2)+c),d.markClassCount=l.readUshort(i,a+4),d.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,a+6)+c),d.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,a+8)+c,d.markClassCount);else{if(s==9&&d.fmt==1){var Z=l.readUshort(i,a);a+=2;var B=l.readUint(i,a);if(a+=4,o.ltype==9)o.ltype=Z;else if(o.ltype!=Z)throw"invalid extension substitution";return e.GPOS.subt(i,o.ltype,c+B)}console.debug("unsupported GPOS table LookupType",s,"format",d.fmt)}return d},e.GPOS.readValueRecord=function(i,s,a){var o=e._bin,l=[];return l.push(1&a?o.readShort(i,s):0),s+=1&a?2:0,l.push(2&a?o.readShort(i,s):0),s+=2&a?2:0,l.push(4&a?o.readShort(i,s):0),s+=4&a?2:0,l.push(8&a?o.readShort(i,s):0),s+=8&a?2:0,l},e.GPOS.readBaseArray=function(i,s,a){var o=e._bin,l=[],c=s,d=o.readUshort(i,s);s+=2;for(var h=0;h<d;h++){for(var g=[],v=0;v<a;v++)g.push(e.GPOS.readAnchorRecord(i,c+o.readUshort(i,s))),s+=2;l.push(g)}return l},e.GPOS.readMarkArray=function(i,s){var a=e._bin,o=[],l=s,c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=e.GPOS.readAnchorRecord(i,a.readUshort(i,s+2)+l);h.markClass=a.readUshort(i,s),o.push(h),s+=4}return o},e.GPOS.readAnchorRecord=function(i,s){var a=e._bin,o={};return o.fmt=a.readUshort(i,s),o.x=a.readShort(i,s+2),o.y=a.readShort(i,s+4),o},e.GSUB={},e.GSUB.parse=function(i,s,a,o){return e._lctf.parse(i,s,a,o,e.GSUB.subt)},e.GSUB.subt=function(i,s,a,o){var l=e._bin,c=a,d={};if(d.fmt=l.readUshort(i,a),a+=2,s!=1&&s!=2&&s!=4&&s!=5&&s!=6)return null;if(s==1||s==2||s==4||s==5&&d.fmt<=2||s==6&&d.fmt<=2){var h=l.readUshort(i,a);a+=2,d.coverage=e._lctf.readCoverage(i,c+h)}if(s==1&&d.fmt>=1&&d.fmt<=2){if(d.fmt==1)d.delta=l.readShort(i,a),a+=2;else if(d.fmt==2){var g=l.readUshort(i,a);a+=2,d.newg=l.readUshorts(i,a,g),a+=2*d.newg.length}}else if(s==2&&d.fmt==1){g=l.readUshort(i,a),a+=2,d.seqs=[];for(var v=0;v<g;v++){var b=l.readUshort(i,a)+c;a+=2;var _=l.readUshort(i,b);d.seqs.push(l.readUshorts(i,b+2,_))}}else if(s==4)for(d.vals=[],g=l.readUshort(i,a),a+=2,v=0;v<g;v++){var w=l.readUshort(i,a);a+=2,d.vals.push(e.GSUB.readLigatureSet(i,c+w))}else if(s==5&&d.fmt==2){if(d.fmt==2){var S=l.readUshort(i,a);a+=2,d.cDef=e._lctf.readClassDef(i,c+S),d.scset=[];var E=l.readUshort(i,a);for(a+=2,v=0;v<E;v++){var A=l.readUshort(i,a);a+=2,d.scset.push(A==0?null:e.GSUB.readSubClassSet(i,c+A))}}}else if(s==6&&d.fmt==3){if(d.fmt==3){for(v=0;v<3;v++){g=l.readUshort(i,a),a+=2;for(var N=[],I=0;I<g;I++)N.push(e._lctf.readCoverage(i,c+l.readUshort(i,a+2*I)));a+=2*g,v==0&&(d.backCvg=N),v==1&&(d.inptCvg=N),v==2&&(d.ahedCvg=N)}g=l.readUshort(i,a),a+=2,d.lookupRec=e.GSUB.readSubstLookupRecords(i,a,g)}}else{if(s==7&&d.fmt==1){var P=l.readUshort(i,a);a+=2;var L=l.readUint(i,a);if(a+=4,o.ltype==9)o.ltype=P;else if(o.ltype!=P)throw"invalid extension substitution";return e.GSUB.subt(i,o.ltype,c+L)}console.debug("unsupported GSUB table LookupType",s,"format",d.fmt)}return d},e.GSUB.readSubClassSet=function(i,s){var a=e._bin.readUshort,o=s,l=[],c=a(i,s);s+=2;for(var d=0;d<c;d++){var h=a(i,s);s+=2,l.push(e.GSUB.readSubClassRule(i,o+h))}return l},e.GSUB.readSubClassRule=function(i,s){var a=e._bin.readUshort,o={},l=a(i,s),c=a(i,s+=2);s+=2,o.input=[];for(var d=0;d<l-1;d++)o.input.push(a(i,s)),s+=2;return o.substLookupRecords=e.GSUB.readSubstLookupRecords(i,s,c),o},e.GSUB.readSubstLookupRecords=function(i,s,a){for(var o=e._bin.readUshort,l=[],c=0;c<a;c++)l.push(o(i,s),o(i,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(i,s){var a=e._bin,o=s,l=[],c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=a.readUshort(i,s);s+=2,l.push(e.GSUB.readChainSubClassRule(i,o+h))}return l},e.GSUB.readChainSubClassRule=function(i,s){for(var a=e._bin,o={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var d=a.readUshort(i,s);s+=2,c==1&&d--,o[l[c]]=a.readUshorts(i,s,d),s+=2*o[l[c]].length}return d=a.readUshort(i,s),s+=2,o.subst=a.readUshorts(i,s,2*d),s+=2*o.subst.length,o},e.GSUB.readLigatureSet=function(i,s){var a=e._bin,o=s,l=[],c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=a.readUshort(i,s);s+=2,l.push(e.GSUB.readLigature(i,o+h))}return l},e.GSUB.readLigature=function(i,s){var a=e._bin,o={chain:[]};o.nglyph=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);s+=2;for(var c=0;c<l-1;c++)o.chain.push(a.readUshort(i,s)),s+=2;return o},e.head={},e.head.parse=function(i,s,a){var o=e._bin,l={};return o.readFixed(i,s),s+=4,l.fontRevision=o.readFixed(i,s),s+=4,o.readUint(i,s),s+=4,o.readUint(i,s),s+=4,l.flags=o.readUshort(i,s),s+=2,l.unitsPerEm=o.readUshort(i,s),s+=2,l.created=o.readUint64(i,s),s+=8,l.modified=o.readUint64(i,s),s+=8,l.xMin=o.readShort(i,s),s+=2,l.yMin=o.readShort(i,s),s+=2,l.xMax=o.readShort(i,s),s+=2,l.yMax=o.readShort(i,s),s+=2,l.macStyle=o.readUshort(i,s),s+=2,l.lowestRecPPEM=o.readUshort(i,s),s+=2,l.fontDirectionHint=o.readShort(i,s),s+=2,l.indexToLocFormat=o.readShort(i,s),s+=2,l.glyphDataFormat=o.readShort(i,s),s+=2,l},e.hhea={},e.hhea.parse=function(i,s,a){var o=e._bin,l={};return o.readFixed(i,s),s+=4,l.ascender=o.readShort(i,s),s+=2,l.descender=o.readShort(i,s),s+=2,l.lineGap=o.readShort(i,s),s+=2,l.advanceWidthMax=o.readUshort(i,s),s+=2,l.minLeftSideBearing=o.readShort(i,s),s+=2,l.minRightSideBearing=o.readShort(i,s),s+=2,l.xMaxExtent=o.readShort(i,s),s+=2,l.caretSlopeRise=o.readShort(i,s),s+=2,l.caretSlopeRun=o.readShort(i,s),s+=2,l.caretOffset=o.readShort(i,s),s+=2,s+=8,l.metricDataFormat=o.readShort(i,s),s+=2,l.numberOfHMetrics=o.readUshort(i,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(i,s,a,o){for(var l=e._bin,c={aWidth:[],lsBearing:[]},d=0,h=0,g=0;g<o.maxp.numGlyphs;g++)g<o.hhea.numberOfHMetrics&&(d=l.readUshort(i,s),s+=2,h=l.readShort(i,s),s+=2),c.aWidth.push(d),c.lsBearing.push(h);return c},e.kern={},e.kern.parse=function(i,s,a,o){var l=e._bin,c=l.readUshort(i,s);if(s+=2,c==1)return e.kern.parseV1(i,s-2,a,o);var d=l.readUshort(i,s);s+=2;for(var h={glyph1:[],rval:[]},g=0;g<d;g++){s+=2,a=l.readUshort(i,s),s+=2;var v=l.readUshort(i,s);s+=2;var b=v>>>8;if((b&=15)!=0)throw"unknown kern table format: "+b;s=e.kern.readFormat0(i,s,h)}return h},e.kern.parseV1=function(i,s,a,o){var l=e._bin;l.readFixed(i,s),s+=4;var c=l.readUint(i,s);s+=4;for(var d={glyph1:[],rval:[]},h=0;h<c;h++){l.readUint(i,s),s+=4;var g=l.readUshort(i,s);s+=2,l.readUshort(i,s),s+=2;var v=g>>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;s=e.kern.readFormat0(i,s,d)}return d},e.kern.readFormat0=function(i,s,a){var o=e._bin,l=-1,c=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 d=0;d<c;d++){var h=o.readUshort(i,s);s+=2;var g=o.readUshort(i,s);s+=2;var v=o.readShort(i,s);s+=2,h!=l&&(a.glyph1.push(h),a.rval.push({glyph2:[],vals:[]}));var b=a.rval[a.rval.length-1];b.glyph2.push(g),b.vals.push(v),l=h}return s},e.loca={},e.loca.parse=function(i,s,a,o){var l=e._bin,c=[],d=o.head.indexToLocFormat,h=o.maxp.numGlyphs+1;if(d==0)for(var g=0;g<h;g++)c.push(l.readUshort(i,s+(g<<1))<<1);if(d==1)for(g=0;g<h;g++)c.push(l.readUint(i,s+(g<<2)));return c},e.maxp={},e.maxp.parse=function(i,s,a){var o=e._bin,l={},c=o.readUint(i,s);return s+=4,l.numGlyphs=o.readUshort(i,s),s+=2,c==65536&&(l.maxPoints=o.readUshort(i,s),s+=2,l.maxContours=o.readUshort(i,s),s+=2,l.maxCompositePoints=o.readUshort(i,s),s+=2,l.maxCompositeContours=o.readUshort(i,s),s+=2,l.maxZones=o.readUshort(i,s),s+=2,l.maxTwilightPoints=o.readUshort(i,s),s+=2,l.maxStorage=o.readUshort(i,s),s+=2,l.maxFunctionDefs=o.readUshort(i,s),s+=2,l.maxInstructionDefs=o.readUshort(i,s),s+=2,l.maxStackElements=o.readUshort(i,s),s+=2,l.maxSizeOfInstructions=o.readUshort(i,s),s+=2,l.maxComponentElements=o.readUshort(i,s),s+=2,l.maxComponentDepth=o.readUshort(i,s),s+=2),l},e.name={},e.name.parse=function(i,s,a){var o=e._bin,l={};o.readUshort(i,s),s+=2;var c=o.readUshort(i,s);s+=2,o.readUshort(i,s);for(var d,h=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],g=s+=2,v=0;v<c;v++){var b=o.readUshort(i,s);s+=2;var _=o.readUshort(i,s);s+=2;var w=o.readUshort(i,s);s+=2;var S=o.readUshort(i,s);s+=2;var E=o.readUshort(i,s);s+=2;var A=o.readUshort(i,s);s+=2;var N,I=h[S],P=g+12*c+A;if(b==0)N=o.readUnicode(i,P,E/2);else if(b==3&&_==0)N=o.readUnicode(i,P,E/2);else if(_==0)N=o.readASCII(i,P,E);else if(_==1)N=o.readUnicode(i,P,E/2);else if(_==3)N=o.readUnicode(i,P,E/2);else{if(b!=1)throw"unknown encoding "+_+", platformID: "+b;N=o.readASCII(i,P,E),console.debug("reading unknown MAC encoding "+_+" as ASCII")}var L="p"+b+","+w.toString(16);l[L]==null&&(l[L]={}),l[L][I!==void 0?I:S]=N,l[L]._lang=w}for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==1033)return l[R];for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==0)return l[R];for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==3084)return l[R];for(var R in l)if(l[R].postScriptName!=null)return l[R];for(var R in l){d=R;break}return console.debug("returning name table with languageID "+l[d]._lang),l[d]},e["OS/2"]={},e["OS/2"].parse=function(i,s,a){var o=e._bin.readUshort(i,s);s+=2;var l={};if(o==0)e["OS/2"].version0(i,s,l);else if(o==1)e["OS/2"].version1(i,s,l);else if(o==2||o==3||o==4)e["OS/2"].version2(i,s,l);else{if(o!=5)throw"unknown OS/2 table version: "+o;e["OS/2"].version5(i,s,l)}return l},e["OS/2"].version0=function(i,s,a){var o=e._bin;return a.xAvgCharWidth=o.readShort(i,s),s+=2,a.usWeightClass=o.readUshort(i,s),s+=2,a.usWidthClass=o.readUshort(i,s),s+=2,a.fsType=o.readUshort(i,s),s+=2,a.ySubscriptXSize=o.readShort(i,s),s+=2,a.ySubscriptYSize=o.readShort(i,s),s+=2,a.ySubscriptXOffset=o.readShort(i,s),s+=2,a.ySubscriptYOffset=o.readShort(i,s),s+=2,a.ySuperscriptXSize=o.readShort(i,s),s+=2,a.ySuperscriptYSize=o.readShort(i,s),s+=2,a.ySuperscriptXOffset=o.readShort(i,s),s+=2,a.ySuperscriptYOffset=o.readShort(i,s),s+=2,a.yStrikeoutSize=o.readShort(i,s),s+=2,a.yStrikeoutPosition=o.readShort(i,s),s+=2,a.sFamilyClass=o.readShort(i,s),s+=2,a.panose=o.readBytes(i,s,10),s+=10,a.ulUnicodeRange1=o.readUint(i,s),s+=4,a.ulUnicodeRange2=o.readUint(i,s),s+=4,a.ulUnicodeRange3=o.readUint(i,s),s+=4,a.ulUnicodeRange4=o.readUint(i,s),s+=4,a.achVendID=[o.readInt8(i,s),o.readInt8(i,s+1),o.readInt8(i,s+2),o.readInt8(i,s+3)],s+=4,a.fsSelection=o.readUshort(i,s),s+=2,a.usFirstCharIndex=o.readUshort(i,s),s+=2,a.usLastCharIndex=o.readUshort(i,s),s+=2,a.sTypoAscender=o.readShort(i,s),s+=2,a.sTypoDescender=o.readShort(i,s),s+=2,a.sTypoLineGap=o.readShort(i,s),s+=2,a.usWinAscent=o.readUshort(i,s),s+=2,a.usWinDescent=o.readUshort(i,s),s+=2},e["OS/2"].version1=function(i,s,a){var o=e._bin;return s=e["OS/2"].version0(i,s,a),a.ulCodePageRange1=o.readUint(i,s),s+=4,a.ulCodePageRange2=o.readUint(i,s),s+=4},e["OS/2"].version2=function(i,s,a){var o=e._bin;return s=e["OS/2"].version1(i,s,a),a.sxHeight=o.readShort(i,s),s+=2,a.sCapHeight=o.readShort(i,s),s+=2,a.usDefault=o.readUshort(i,s),s+=2,a.usBreak=o.readUshort(i,s),s+=2,a.usMaxContext=o.readUshort(i,s),s+=2},e["OS/2"].version5=function(i,s,a){var o=e._bin;return s=e["OS/2"].version2(i,s,a),a.usLowerOpticalPointSize=o.readUshort(i,s),s+=2,a.usUpperOpticalPointSize=o.readUshort(i,s),s+=2},e.post={},e.post.parse=function(i,s,a){var o=e._bin,l={};return l.version=o.readFixed(i,s),s+=4,l.italicAngle=o.readFixed(i,s),s+=4,l.underlinePosition=o.readShort(i,s),s+=2,l.underlineThickness=o.readShort(i,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(i,s){var a=i.cmap,o=-1;if(a.p0e4!=null?o=a.p0e4:a.p3e1!=null?o=a.p3e1:a.p1e0!=null?o=a.p1e0:a.p0e3!=null&&(o=a.p0e3),o==-1)throw"no familiar platform and encoding!";var l=a.tables[o];if(l.format==0)return s>=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,d=0;d<l.endCount.length;d++)if(s<=l.endCount[d]){c=d;break}return c==-1||l.startCount[c]>s?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(d=0;d<l.groups.length;d++){var h=l.groups[d];if(h[0]<=s&&s<=h[1])return h[2]+(s-h[0])}return 0}throw"unknown cmap table format "+l.format},e.U.glyphToPath=function(i,s){var a={cmds:[],crds:[]};if(i.SVG&&i.SVG.entries[s]){var o=i.SVG.entries[s];return o==null?a:(typeof o=="string"&&(o=e.SVG.toPath(o),i.SVG.entries[s]=o),o)}if(i.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:i.CFF.Private?i.CFF.Private.defaultWidthX:0,open:!1},c=i.CFF,d=i.CFF.Private;if(c.ROS){for(var h=0;c.FDSelect[h+2]<=s;)h+=2;d=c.FDArray[c.FDSelect[h+1]].Private}e.U._drawCFF(i.CFF.CharStrings[s],l,c,d,a)}else i.glyf&&e.U._drawGlyf(s,i,a);return a},e.U._drawGlyf=function(i,s,a){var o=s.glyf[i];o==null&&(o=s.glyf[i]=e.glyf._parseGlyf(s,i)),o!=null&&(o.noc>-1?e.U._simpleGlyph(o,a):e.U._compoGlyph(o,s,a))},e.U._simpleGlyph=function(i,s){for(var a=0;a<i.noc;a++){for(var o=a==0?0:i.endPts[a-1]+1,l=i.endPts[a],c=o;c<=l;c++){var d=c==o?l:c-1,h=c==l?o:c+1,g=1&i.flags[c],v=1&i.flags[d],b=1&i.flags[h],_=i.xs[c],w=i.ys[c];if(c==o)if(g){if(!v){e.U.P.moveTo(s,_,w);continue}e.U.P.moveTo(s,i.xs[d],i.ys[d])}else v?e.U.P.moveTo(s,i.xs[d],i.ys[d]):e.U.P.moveTo(s,(i.xs[d]+_)/2,(i.ys[d]+w)/2);g?v&&e.U.P.lineTo(s,_,w):b?e.U.P.qcurveTo(s,_,w,i.xs[h],i.ys[h]):e.U.P.qcurveTo(s,_,w,(_+i.xs[h])/2,(w+i.ys[h])/2)}e.U.P.closePath(s)}},e.U._compoGlyph=function(i,s,a){for(var o=0;o<i.parts.length;o++){var l={cmds:[],crds:[]},c=i.parts[o];e.U._drawGlyf(c.glyphIndex,s,l);for(var d=c.m,h=0;h<l.crds.length;h+=2){var g=l.crds[h],v=l.crds[h+1];a.crds.push(g*d.a+v*d.b+d.tx),a.crds.push(g*d.c+v*d.d+d.ty)}for(h=0;h<l.cmds.length;h++)a.cmds.push(l.cmds[h])}},e.U._getGlyphClass=function(i,s){var a=e._lctf.getInterval(s,i);return a==-1?0:s[a+2]},e.U._applySubs=function(i,s,a,o){for(var l=i.length-s-1,c=0;c<a.tabs.length;c++)if(a.tabs[c]!=null){var d,h=a.tabs[c];if(!h.coverage||(d=e._lctf.coverageIndex(h.coverage,i[s]))!=-1){if(a.ltype==1)i[s],h.fmt==1?i[s]=i[s]+h.delta:i[s]=h.newg[d];else if(a.ltype==4)for(var g=h.vals[d],v=0;v<g.length;v++){var b=g[v],_=b.chain.length;if(!(_>l)){for(var w=!0,S=0,E=0;E<_;E++){for(;i[s+S+(1+E)]==-1;)S++;b.chain[E]!=i[s+S+(1+E)]&&(w=!1)}if(w){for(i[s]=b.nglyph,E=0;E<_+S;E++)i[s+E+1]=-1;break}}}else if(a.ltype==5&&h.fmt==2)for(var A=e._lctf.getInterval(h.cDef,i[s]),N=h.cDef[A+2],I=h.scset[N],P=0;P<I.length;P++){var L=I[P],R=L.input;if(!(R.length>l)){for(w=!0,E=0;E<R.length;E++){var O=e._lctf.getInterval(h.cDef,i[s+1+E]);if(A==-1&&h.cDef[O+2]!=R[E]){w=!1;break}}if(w){var W=L.substLookupRecords;for(v=0;v<W.length;v+=2)W[v],W[v+1]}}}else if(a.ltype==6&&h.fmt==3){if(!e.U._glsCovered(i,h.backCvg,s-h.backCvg.length)||!e.U._glsCovered(i,h.inptCvg,s)||!e.U._glsCovered(i,h.ahedCvg,s+h.inptCvg.length))continue;var U=h.lookupRec;for(P=0;P<U.length;P+=2){A=U[P];var V=o[U[P+1]];e.U._applySubs(i,s+A,V,o)}}}}},e.U._glsCovered=function(i,s,a){for(var o=0;o<s.length;o++)if(e._lctf.coverageIndex(s[o],i[a+o])==-1)return!1;return!0},e.U.glyphsToPath=function(i,s,a){for(var o={cmds:[],crds:[]},l=0,c=0;c<s.length;c++){var d=s[c];if(d!=-1){for(var h=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,g=e.U.glyphToPath(i,d),v=0;v<g.crds.length;v+=2)o.crds.push(g.crds[v]+l),o.crds.push(g.crds[v+1]);for(a&&o.cmds.push(a),v=0;v<g.cmds.length;v++)o.cmds.push(g.cmds[v]);a&&o.cmds.push("X"),l+=i.hmtx.aWidth[d],c<s.length-1&&(l+=e.U.getPairAdjustment(i,d,h))}}return o},e.U.P={},e.U.P.moveTo=function(i,s,a){i.cmds.push("M"),i.crds.push(s,a)},e.U.P.lineTo=function(i,s,a){i.cmds.push("L"),i.crds.push(s,a)},e.U.P.curveTo=function(i,s,a,o,l,c,d){i.cmds.push("C"),i.crds.push(s,a,o,l,c,d)},e.U.P.qcurveTo=function(i,s,a,o,l){i.cmds.push("Q"),i.crds.push(s,a,o,l)},e.U.P.closePath=function(i){i.cmds.push("Z")},e.U._drawCFF=function(i,s,a,o,l){for(var c=s.stack,d=s.nStems,h=s.haveWidth,g=s.width,v=s.open,b=0,_=s.x,w=s.y,S=0,E=0,A=0,N=0,I=0,P=0,L=0,R=0,O=0,W=0,U={val:0,size:0};b<i.length;){e.CFF.getCharString(i,b,U);var V=U.val;if(b+=U.size,V=="o1"||V=="o18")c.length%2!=0&&!h&&(g=c.shift()+o.nominalWidthX),d+=c.length>>1,c.length=0,h=!0;else if(V=="o3"||V=="o23")c.length%2!=0&&!h&&(g=c.shift()+o.nominalWidthX),d+=c.length>>1,c.length=0,h=!0;else if(V=="o4")c.length>1&&!h&&(g=c.shift()+o.nominalWidthX,h=!0),v&&e.U.P.closePath(l),w+=c.pop(),e.U.P.moveTo(l,_,w),v=!0;else if(V=="o5")for(;c.length>0;)_+=c.shift(),w+=c.shift(),e.U.P.lineTo(l,_,w);else if(V=="o6"||V=="o7")for(var G=c.length,Z=V=="o6",B=0;B<G;B++){var q=c.shift();Z?_+=q:w+=q,Z=!Z,e.U.P.lineTo(l,_,w)}else if(V=="o8"||V=="o24"){G=c.length;for(var Y=0;Y+6<=G;)S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),_=A+c.shift(),w=N+c.shift(),e.U.P.curveTo(l,S,E,A,N,_,w),Y+=6;V=="o24"&&(_+=c.shift(),w+=c.shift(),e.U.P.lineTo(l,_,w))}else{if(V=="o11")break;if(V=="o1234"||V=="o1235"||V=="o1236"||V=="o1237")V=="o1234"&&(E=w,A=(S=_+c.shift())+c.shift(),W=N=E+c.shift(),P=N,R=w,_=(L=(I=(O=A+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,S,E,A,N,O,W),e.U.P.curveTo(l,I,P,L,R,_,w)),V=="o1235"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),O=A+c.shift(),W=N+c.shift(),I=O+c.shift(),P=W+c.shift(),L=I+c.shift(),R=P+c.shift(),_=L+c.shift(),w=R+c.shift(),c.shift(),e.U.P.curveTo(l,S,E,A,N,O,W),e.U.P.curveTo(l,I,P,L,R,_,w)),V=="o1236"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),W=N=E+c.shift(),P=N,L=(I=(O=A+c.shift())+c.shift())+c.shift(),R=P+c.shift(),_=L+c.shift(),e.U.P.curveTo(l,S,E,A,N,O,W),e.U.P.curveTo(l,I,P,L,R,_,w)),V=="o1237"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),O=A+c.shift(),W=N+c.shift(),I=O+c.shift(),P=W+c.shift(),L=I+c.shift(),R=P+c.shift(),Math.abs(L-_)>Math.abs(R-w)?_=L+c.shift():w=R+c.shift(),e.U.P.curveTo(l,S,E,A,N,O,W),e.U.P.curveTo(l,I,P,L,R,_,w));else if(V=="o14"){if(c.length>0&&!h&&(g=c.shift()+a.nominalWidthX,h=!0),c.length==4){var K=c.shift(),J=c.shift(),F=c.shift(),j=c.shift(),X=e.CFF.glyphBySE(a,F),H=e.CFF.glyphBySE(a,j);e.U._drawCFF(a.CharStrings[X],s,a,o,l),s.x=K,s.y=J,e.U._drawCFF(a.CharStrings[H],s,a,o,l)}v&&(e.U.P.closePath(l),v=!1)}else if(V=="o19"||V=="o20")c.length%2!=0&&!h&&(g=c.shift()+o.nominalWidthX),d+=c.length>>1,c.length=0,h=!0,b+=d+7>>3;else if(V=="o21")c.length>2&&!h&&(g=c.shift()+o.nominalWidthX,h=!0),w+=c.pop(),_+=c.pop(),v&&e.U.P.closePath(l),e.U.P.moveTo(l,_,w),v=!0;else if(V=="o22")c.length>1&&!h&&(g=c.shift()+o.nominalWidthX,h=!0),_+=c.pop(),v&&e.U.P.closePath(l),e.U.P.moveTo(l,_,w),v=!0;else if(V=="o25"){for(;c.length>6;)_+=c.shift(),w+=c.shift(),e.U.P.lineTo(l,_,w);S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),_=A+c.shift(),w=N+c.shift(),e.U.P.curveTo(l,S,E,A,N,_,w)}else if(V=="o26")for(c.length%2&&(_+=c.shift());c.length>0;)S=_,E=w+c.shift(),_=A=S+c.shift(),w=(N=E+c.shift())+c.shift(),e.U.P.curveTo(l,S,E,A,N,_,w);else if(V=="o27")for(c.length%2&&(w+=c.shift());c.length>0;)E=w,A=(S=_+c.shift())+c.shift(),N=E+c.shift(),_=A+c.shift(),w=N,e.U.P.curveTo(l,S,E,A,N,_,w);else if(V=="o10"||V=="o29"){var se=V=="o10"?o:a;if(c.length==0)console.debug("error: empty stack");else{var re=c.pop(),ie=se.Subrs[re+se.Bias];s.x=_,s.y=w,s.nStems=d,s.haveWidth=h,s.width=g,s.open=v,e.U._drawCFF(ie,s,a,o,l),_=s.x,w=s.y,d=s.nStems,h=s.haveWidth,g=s.width,v=s.open}}else if(V=="o30"||V=="o31"){var ue=c.length,le=(Y=0,V=="o31");for(Y+=ue-(G=-3&ue);Y<G;)le?(E=w,A=(S=_+c.shift())+c.shift(),w=(N=E+c.shift())+c.shift(),G-Y==5?(_=A+c.shift(),Y++):_=A,le=!1):(S=_,E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),_=A+c.shift(),G-Y==5?(w=N+c.shift(),Y++):w=N,le=!0),e.U.P.curveTo(l,S,E,A,N,_,w),Y+=4}else{if((V+"").charAt(0)=="o")throw console.debug("Unknown operation: "+V,i),V;c.push(V)}}}s.x=_,s.y=w,s.nStems=d,s.haveWidth=h,s.width=g,s.open=v};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 OCe(){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]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(V,G){for(var Z=new n(31),B=0;B<31;++B)Z[B]=G+=1<<V[B-1];var q=new r(Z[30]);for(B=1;B<30;++B)for(var Y=Z[B];Y<Z[B+1];++Y)q[Y]=Y-Z[B]<<5|B;return[Z,q]},l=o(i,2),c=l[0],d=l[1];c[28]=258,d[258]=28;for(var h=o(s,0)[0],g=new n(32768),v=0;v<32768;++v){var b=(43690&v)>>>1|(21845&v)<<1;b=(61680&(b=(52428&b)>>>2|(13107&b)<<2))>>>4|(3855&b)<<4,g[v]=((65280&b)>>>8|(255&b)<<8)>>>1}var _=function(V,G,Z){for(var B=V.length,q=0,Y=new n(G);q<B;++q)++Y[V[q]-1];var K,J=new n(G);for(q=0;q<G;++q)J[q]=J[q-1]+Y[q-1]<<1;{K=new n(1<<G);var F=15-G;for(q=0;q<B;++q)if(V[q])for(var j=q<<4|V[q],X=G-V[q],H=J[V[q]-1]++<<X,se=H|(1<<X)-1;H<=se;++H)K[g[H]>>>F]=j}return K},w=new e(288);for(v=0;v<144;++v)w[v]=8;for(v=144;v<256;++v)w[v]=9;for(v=256;v<280;++v)w[v]=7;for(v=280;v<288;++v)w[v]=8;var S=new e(32);for(v=0;v<32;++v)S[v]=5;var E=_(w,9),A=_(S,5),N=function(V){for(var G=V[0],Z=1;Z<V.length;++Z)V[Z]>G&&(G=V[Z]);return G},I=function(V,G,Z){var B=G/8|0;return(V[B]|V[B+1]<<8)>>(7&G)&Z},P=function(V,G){var Z=G/8|0;return(V[Z]|V[Z+1]<<8|V[Z+2]<<16)>>(7&G)},L=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],R=function(V,G,Z){var B=new Error(G||L[V]);if(B.code=V,Error.captureStackTrace&&Error.captureStackTrace(B,R),!Z)throw B;return B},O=function(V,G,Z){var B=V.length;if(!B||Z&&!Z.l&&B<5)return G||new e(0);var q=!G||Z,Y=!Z||Z.i;Z||(Z={}),G||(G=new e(3*B));var K,J=function(Ge){var Me=G.length;if(Ge>Me){var $e=new e(Math.max(2*Me,Ge));$e.set(G),G=$e}},F=Z.f||0,j=Z.p||0,X=Z.b||0,H=Z.l,se=Z.d,re=Z.m,ie=Z.n,ue=8*B;do{if(!H){Z.f=F=I(V,j,1);var le=I(V,j+1,3);if(j+=3,!le){var fe=V[(Ae=((K=j)/8|0)+(7&K&&1)+4)-4]|V[Ae-3]<<8,xe=Ae+fe;if(xe>B){Y&&R(0);break}q&&J(X+fe),G.set(V.subarray(Ae,xe),X),Z.b=X+=fe,Z.p=j=8*xe;continue}if(le==1)H=E,se=A,re=9,ie=5;else if(le==2){var he=I(V,j,31)+257,Te=I(V,j+10,15)+4,We=he+I(V,j+5,31)+1;j+=14;for(var Se=new e(We),Le=new e(19),pe=0;pe<Te;++pe)Le[a[pe]]=I(V,j+3*pe,7);j+=3*Te;var Re=N(Le),ne=(1<<Re)-1,Xe=_(Le,Re);for(pe=0;pe<We;){var Ae,Pe=Xe[I(V,j,ne)];if(j+=15&Pe,(Ae=Pe>>>4)<16)Se[pe++]=Ae;else{var Ke=0,oe=0;for(Ae==16?(oe=3+I(V,j,3),j+=2,Ke=Se[pe-1]):Ae==17?(oe=3+I(V,j,7),j+=3):Ae==18&&(oe=11+I(V,j,127),j+=7);oe--;)Se[pe++]=Ke}}var te=Se.subarray(0,he),_e=Se.subarray(he);re=N(te),ie=N(_e),H=_(te,re),se=_(_e,ie)}else R(1);if(j>ue){Y&&R(0);break}}q&&J(X+131072);for(var ve=(1<<re)-1,ye=(1<<ie)-1,ke=j;;ke=j){var Be=(Ke=H[P(V,j)&ve])>>>4;if((j+=15&Ke)>ue){Y&&R(0);break}if(Ke||R(2),Be<256)G[X++]=Be;else{if(Be==256){ke=j,H=null;break}var ge=Be-254;if(Be>264){var Ye=i[pe=Be-257];ge=I(V,j,(1<<Ye)-1)+c[pe],j+=Ye}var Qe=se[P(V,j)&ye],Ie=Qe>>>4;if(Qe||R(3),j+=15&Qe,_e=h[Ie],Ie>3&&(Ye=s[Ie],_e+=P(V,j)&(1<<Ye)-1,j+=Ye),j>ue){Y&&R(0);break}q&&J(X+131072);for(var Fe=X+ge;X<Fe;X+=4)G[X]=G[X-_e],G[X+1]=G[X+1-_e],G[X+2]=G[X+2-_e],G[X+3]=G[X+3-_e];X=Fe}}Z.l=H,Z.p=ke,Z.b=X,H&&(F=1,Z.m=re,Z.d=se,Z.n=ie)}while(!F);return X==G.length?G:(function(Ge,Me,$e){($e==null||$e>Ge.length)&&($e=Ge.length);var dt=new(Ge instanceof n?n:Ge instanceof r?r:e)($e-Me);return dt.set(Ge.subarray(Me,$e)),dt})(G,0,X)},W=new e(0),U=typeof TextDecoder<"u"&&new TextDecoder;try{U.decode(W,{stream:!0})}catch{}return t.convert_streams=function(V){var G=new DataView(V),Z=0;function B(){var he=G.getUint16(Z);return Z+=2,he}function q(){var he=G.getUint32(Z);return Z+=4,he}function Y(he){fe.setUint16(xe,he),xe+=2}function K(he){fe.setUint32(xe,he),xe+=4}for(var J={signature:q(),flavor:q(),length:q(),numTables:B(),reserved:B(),totalSfntSize:q(),majorVersion:B(),minorVersion:B(),metaOffset:q(),metaLength:q(),metaOrigLength:q(),privOffset:q(),privLength:q()},F=0;Math.pow(2,F)<=J.numTables;)F++;F--;for(var j=16*Math.pow(2,F),X=16*J.numTables-j,H=12,se=[],re=0;re<J.numTables;re++)se.push({tag:q(),offset:q(),compLength:q(),origLength:q(),origChecksum:q()}),H+=16;var ie,ue=new Uint8Array(12+16*se.length+se.reduce((function(he,Te){return he+Te.origLength+4}),0)),le=ue.buffer,fe=new DataView(le),xe=0;return K(J.flavor),Y(J.numTables),Y(j),Y(F),Y(X),se.forEach((function(he){K(he.tag),K(he.origChecksum),K(H),K(he.origLength),he.outOffset=H,(H+=he.origLength)%4!=0&&(H+=4-H%4)})),se.forEach((function(he){var Te,We=V.slice(he.offset,he.offset+he.compLength);if(he.compLength!=he.origLength){var Se=new Uint8Array(he.origLength);Te=new Uint8Array(We,2),O(Te,Se)}else Se=new Uint8Array(We);ue.set(Se,he.outOffset);var Le=0;(H=he.outOffset+he.origLength)%4!=0&&(Le=4-H%4),ue.set(new Uint8Array(Le).buffer,he.outOffset+he.origLength),ie=H+Le})),le.slice(0,ie)},Object.defineProperty(t,"__esModule",{value:!0}),t})({}).convert_streams}function LCe(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,a=4,o=8,l=16,c=32;let d;function h(L){if(!d){const R={R:s,L:i,D:a,C:l,U:c,T:o};d=new Map;for(let O in r){let W=0;r[O].split(",").forEach(U=>{let[V,G]=U.split("+");V=parseInt(V,36),G=G?parseInt(G,36):0,d.set(W+=V,R[O]);for(let Z=G;Z--;)d.set(++W,R[O])})}}return d.get(L)||c}const g=1,v=2,b=3,_=4,w=[null,"isol","init","fina","medi"];function S(L){const R=new Uint8Array(L.length);let O=c,W=g,U=-1;for(let V=0;V<L.length;V++){const G=L.codePointAt(V);let Z=h(G)|0,B=g;Z&o||(O&(i|a|l)?Z&(s|a|l)?(B=b,(W===g||W===b)&&R[U]++):Z&(i|c)&&(W===v||W===_)&&R[U]--:O&(s|c)&&(W===v||W===_)&&R[U]--,W=R[V]=B,O=Z,U=V,G>65535&&V++)}return R}function E(L,R){const O=[];for(let U=0;U<R.length;U++){const V=R.codePointAt(U);V>65535&&U++,O.push(t.U.codeToGlyph(L,V))}const W=L.GSUB;if(W){const{lookupList:U,featureList:V}=W;let G;const Z=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,B=[];V.forEach(q=>{if(Z.test(q.tag))for(let Y=0;Y<q.tab.length;Y++){if(B[q.tab[Y]])continue;B[q.tab[Y]]=!0;const K=U[q.tab[Y]],J=/^(isol|init|fina|medi)$/.test(q.tag);J&&!G&&(G=S(R));for(let F=0;F<O.length;F++)(!G||!J||w[G[F]]===q.tag)&&t.U._applySubs(O,F,K,U)}})}return O}function A(L,R){const O=new Int16Array(R.length*3);let W=0;for(;W<R.length;W++){const Z=R[W];if(Z===-1)continue;O[W*3+2]=L.hmtx.aWidth[Z];const B=L.GPOS;if(B){const q=B.lookupList;for(let Y=0;Y<q.length;Y++){const K=q[Y];for(let J=0;J<K.tabs.length;J++){const F=K.tabs[J];if(K.ltype===1){if(t._lctf.coverageIndex(F.coverage,Z)!==-1&&F.pos){G(F.pos,W);break}}else if(K.ltype===2){let j=null,X=U();if(X!==-1){const H=t._lctf.coverageIndex(F.coverage,R[X]);if(H!==-1){if(F.fmt===1){const se=F.pairsets[H];for(let re=0;re<se.length;re++)se[re].gid2===Z&&(j=se[re])}else if(F.fmt===2){const se=t.U._getGlyphClass(R[X],F.classDef1),re=t.U._getGlyphClass(Z,F.classDef2);j=F.matrix[se][re]}if(j){j.val1&&G(j.val1,X),j.val2&&G(j.val2,W);break}}}}else if(K.ltype===4){const j=t._lctf.coverageIndex(F.markCoverage,Z);if(j!==-1){const X=U(V),H=X===-1?-1:t._lctf.coverageIndex(F.baseCoverage,R[X]);if(H!==-1){const se=F.markArray[j],re=F.baseArray[H][se.markClass];O[W*3]=re.x-se.x+O[X*3]-O[X*3+2],O[W*3+1]=re.y-se.y+O[X*3+1];break}}}else if(K.ltype===6){const j=t._lctf.coverageIndex(F.mark1Coverage,Z);if(j!==-1){const X=U();if(X!==-1){const H=R[X];if(N(L,H)===3){const se=t._lctf.coverageIndex(F.mark2Coverage,H);if(se!==-1){const re=F.mark1Array[j],ie=F.mark2Array[se][re.markClass];O[W*3]=ie.x-re.x+O[X*3]-O[X*3+2],O[W*3+1]=ie.y-re.y+O[X*3+1];break}}}}}}}}else if(L.kern&&!L.cff){const q=U();if(q!==-1){const Y=L.kern.glyph1.indexOf(R[q]);if(Y!==-1){const K=L.kern.rval[Y].glyph2.indexOf(Z);K!==-1&&(O[q*3+2]+=L.kern.rval[Y].vals[K])}}}}return O;function U(Z){for(let B=W-1;B>=0;B--)if(R[B]!==-1&&(!Z||Z(R[B])))return B;return-1}function V(Z){return N(L,Z)===1}function G(Z,B){for(let q=0;q<3;q++)O[B*3+q]+=Z[q]||0}}function N(L,R){const O=L.GDEF&&L.GDEF.glyphClassDef;return O?t.U._getGlyphClass(R,O):0}function I(...L){for(let R=0;R<L.length;R++)if(typeof L[R]=="number")return L[R]}function P(L){const R=Object.create(null),O=L["OS/2"],W=L.hhea,U=L.head.unitsPerEm,V=I(O&&O.sTypoAscender,W&&W.ascender,U),G={unitsPerEm:U,ascender:V,descender:I(O&&O.sTypoDescender,W&&W.descender,0),capHeight:I(O&&O.sCapHeight,V),xHeight:I(O&&O.sxHeight,V),lineGap:I(O&&O.sTypoLineGap,W&&W.lineGap),supportsCodePoint(Z){return t.U.codeToGlyph(L,Z)>0},forEachGlyph(Z,B,q,Y){let K=0;const J=1/G.unitsPerEm*B,F=E(L,Z);let j=0;const X=A(L,F);return F.forEach((H,se)=>{if(H!==-1){let re=R[H];if(!re){const{cmds:ie,crds:ue}=t.U.glyphToPath(L,H);let le="",fe=0;for(let Se=0,Le=ie.length;Se<Le;Se++){const pe=n[ie[Se]];le+=ie[Se];for(let Re=1;Re<=pe;Re++)le+=(Re>1?",":"")+ue[fe++]}let xe,he,Te,We;if(ue.length){xe=he=1/0,Te=We=-1/0;for(let Se=0,Le=ue.length;Se<Le;Se+=2){let pe=ue[Se],Re=ue[Se+1];pe<xe&&(xe=pe),Re<he&&(he=Re),pe>Te&&(Te=pe),Re>We&&(We=Re)}}else xe=Te=he=We=0;re=R[H]={index:H,advanceWidth:L.hmtx.aWidth[H],xMin:xe,yMin:he,xMax:Te,yMax:We,path:le}}Y.call(null,re,K+X[se*3]*J,X[se*3+1]*J,j),K+=X[se*3+2]*J,q&&(K+=q*B)}j+=Z.codePointAt(j)>65535?2:1}),K}};return G}return function(R){const O=new Uint8Array(R,0,4),W=t._bin.readASCII(O,0,4);if(W==="wOFF")R=e(R);else if(W==="wOF2")throw new Error("woff2 fonts not supported");return P(t.parse(R)[0])}}const zCe=Iy({name:"Typr Font Parser",dependencies:[ICe,OCe,LCe],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 jCe(){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,I){A.push((+I).toString(36)+":"+N.toString(36))})),A.join(",")},e.prototype.deserialize=function(A){var N=this;this.buckets.clear(),A.split(",").forEach((function(I){var P=I.split(":");N.buckets.set(parseInt(P[0],36),parseInt(P[1],36))}))};var n=Math.pow(2,8),r=n-1,i=~r;function s(A){var N=(function(P){return P&i})(A).toString(16),I=(function(P){return(P&i)+n-1})(A).toString(16);return"codepoint-index/plane"+(A>>16)+"/"+N+"-"+I+".json"}function a(A,N){var I=A&r,P=N.codePointAt(I/6|0);return((P=(P||48)-48)&1<<I%6)!=0}function o(A,N){var I;(I=A,I.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(P){return P.split("-").map((function(L){return parseInt(L.trim(),16)}))}))).forEach((function(P){var L=P[0],R=P[1];R===void 0&&(R=L),N(L,R)}))}function l(A,N){o(A,(function(I,P){for(var L=I;L<=P;L++)N(L)}))}var c={},d={},h=new WeakMap,g="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function v(A){var N=h.get(A);return N||(N=new e,l(A.ranges,(function(I){return N.add(I)})),h.set(A,N)),N}var b,_=new Map;function w(A,N,I){return A[N]?N:A[I]?I:(function(P){for(var L in P)return L})(A)}function S(A,N){var I=N;if(!A.includes(I)){I=1/0;for(var P=0;P<A.length;P++)Math.abs(A[P]-N)<Math.abs(I-N)&&(I=A[P])}return I}function E(A){return b||(b=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(N){b.add(N)}))),b.has(A)}return t.CodePointSet=e,t.clearCache=function(){c={},d={}},t.getFontsForString=function(A,N){N===void 0&&(N={});var I,P=N.lang;P===void 0&&(P=new RegExp("\\p{Script=Hangul}","u").test(I=A)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(I)?"ja":"en");var L=N.category;L===void 0&&(L="sans-serif");var R=N.style;R===void 0&&(R="normal");var O=N.weight;O===void 0&&(O=400);var W=(N.dataUrl||g).replace(/\/$/g,""),U=new Map,V=new Uint8Array(A.length),G={},Z={},B=new Array(A.length),q=new Map,Y=!1;function K(j){var X=_.get(j);return X||(X=fetch(W+"/"+j).then((function(H){if(!H.ok)throw new Error(H.statusText);return H.json().then((function(se){if(!Array.isArray(se)||se[0]!==1)throw new Error("Incorrect schema version; need 1, got "+se[0]);return se[1]}))})).catch((function(H){if(W!==g)return Y||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+W+'", trying default CDN. '+H.message),Y=!0),W=g,_.delete(j),K(j);throw H})),_.set(j,X)),X}for(var J=function(j){var X=A.codePointAt(j),H=s(X);B[j]=H,c[H]||q.has(H)||q.set(H,K(H).then((function(se){c[H]=se}))),X>65535&&(j++,F=j)},F=0;F<A.length;F++)J(F);return Promise.all(q.values()).then((function(){q.clear();for(var j=function(H){var se=A.codePointAt(H),re=null,ie=c[B[H]],ue=void 0;for(var le in ie){var fe=Z[le];if(fe===void 0&&(fe=Z[le]=new RegExp(le).test(P||"en")),fe){for(var xe in ue=le,ie[le])if(a(se,ie[le][xe])){re=xe;break}break}}if(!re){e:for(var he in ie)if(he!==ue){for(var Te in ie[he])if(a(se,ie[he][Te])){re=Te;break e}}}re||(console.debug("No font coverage for U+"+se.toString(16)),re="latin"),B[H]=re,d[re]||q.has(re)||q.set(re,K("font-meta/"+re+".json").then((function(We){d[re]=We}))),se>65535&&(H++,X=H)},X=0;X<A.length;X++)j(X);return Promise.all(q.values())})).then((function(){for(var j,X=null,H=0;H<A.length;H++){var se=A.codePointAt(H);if(X&&(E(se)||v(X).has(se)))V[H]=V[H-1];else{X=d[B[H]];var re=G[X.id];if(!re){var ie=X.typeforms,ue=w(ie,L,"sans-serif"),le=w(ie[ue],R,"normal"),fe=S((j=ie[ue])===null||j===void 0?void 0:j[le],O);re=G[X.id]=W+"/font-files/"+X.id+"/"+ue+"."+le+"."+fe+".woff"}var xe=U.get(re);xe==null&&(xe=U.size,U.set(re,xe)),V[H]=xe}se>65535&&(H++,V[H]=V[H-1])}return{fontUrls:Array.from(U.keys()),chars:V}}))},Object.defineProperty(t,"__esModule",{value:!0}),t})({})}function FCe(t,e){const n=Object.create(null),r=Object.create(null);function i(a,o){const l=c=>{console.error(`Failure loading font ${a}`,c)};try{const c=new XMLHttpRequest;c.open("get",a,!0),c.responseType="arraybuffer",c.onload=function(){if(c.status>=400)l(new Error(c.statusText));else if(c.status>0)try{const d=t(c.response);d.src=a,o(d)}catch(d){l(d)}},c.onerror=l,c.send()}catch(c){l(c)}}function s(a,o){let l=n[a];l?o(l):r[a]?r[a].push(o):(r[a]=[o],i(a,c=>{c.src=a,n[a]=c,r[a].forEach(d=>d(c)),delete r[a]}))}return function(a,o,{lang:l,fonts:c=[],style:d="normal",weight:h="normal",unicodeFontsURL:g}={}){const v=new Uint8Array(a.length),b=[];a.length||E();const _=new Map,w=[];if(d!=="italic"&&(d="normal"),typeof h!="number"&&(h=h==="bold"?700:400),c&&!Array.isArray(c)&&(c=[c]),c=c.slice().filter(N=>!N.lang||N.lang.test(l)).reverse(),c.length){let L=0;(function R(O=0){for(let W=O,U=a.length;W<U;W++){const V=a.codePointAt(W);if(L===1&&b[v[W-1]].supportsCodePoint(V)||W>0&&/\s/.test(a[W]))v[W]=v[W-1],L===2&&(w[w.length-1][1]=W);else for(let G=v[W],Z=c.length;G<=Z;G++)if(G===Z){const B=L===2?w[w.length-1]:w[w.length]=[W,W];B[1]=W,L=2}else{v[W]=G;const{src:B,unicodeRange:q}=c[G];if(!q||A(V,q)){const Y=n[B];if(!Y){s(B,()=>{R(W)});return}if(Y.supportsCodePoint(V)){let K=_.get(Y);typeof K!="number"&&(K=b.length,b.push(Y),_.set(Y,K)),v[W]=K,L=1;break}}}V>65535&&W+1<U&&(v[W+1]=v[W],W++,L===2&&(w[w.length-1][1]=W))}S()})()}else w.push([0,a.length-1]),S();function S(){if(w.length){const N=w.map(I=>a.substring(I[0],I[1]+1)).join(`
`);e.getFontsForString(N,{lang:l||void 0,style:d,weight:h,dataUrl:g}).then(({fontUrls:I,chars:P})=>{const L=b.length;let R=0;w.forEach(W=>{for(let U=0,V=W[1]-W[0];U<=V;U++)v[W[0]+U]=P[R++]+L;R++});let O=0;I.forEach((W,U)=>{s(W,V=>{b[U+L]=V,++O===I.length&&E()})})})}else E()}function E(){o({chars:v,fonts:b})}function A(N,I){for(let P=0;P<I.length;P++){const[L,R=L]=I[P];if(L<=N&&N<=R)return!0}return!1}}}const UCe=Iy({name:"FontResolver",dependencies:[FCe,zCe,jCe],init(t,e,n){return t(e,n())}});function BCe(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 a({text:b,lang:_,fonts:w,style:S,weight:E,preResolvedFonts:A,unicodeFontsURL:N},I){const P=({chars:L,fonts:R})=>{let O,W;const U=[];for(let V=0;V<L.length;V++)L[V]!==W?(W=L[V],U.push(O={start:V,end:V,fontObj:R[L[V]]})):O.end=V;I(U)};A?P(A):t(b,P,{lang:_,fonts:w,style:S,weight:E,unicodeFontsURL:N})}function o({text:b="",font:_,lang:w,sdfGlyphSize:S=64,fontSize:E=400,fontWeight:A=1,fontStyle:N="normal",letterSpacing:I=0,lineHeight:P="normal",maxWidth:L=1/0,direction:R,textAlign:O="left",textIndent:W=0,whiteSpace:U="normal",overflowWrap:V="normal",anchorX:G=0,anchorY:Z=0,metricsOnly:B=!1,unicodeFontsURL:q,preResolvedFonts:Y=null,includeCaretPositions:K=!1,chunkedBoundsSize:J=8192,colorRanges:F=null},j){const X=h(),H={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,`
`)),E=+E,I=+I,L=+L,P=P||"normal",W=+W,a({text:b,lang:w,style:N,weight:A,fonts:typeof _=="string"?[{src:_}]:_,unicodeFontsURL:q,preResolvedFonts:Y},se=>{H.fontLoad=h()-X;const re=isFinite(L);let ie=null,ue=null,le=null,fe=null,xe=null,he=null,Te=null,We=null,Se=0,Le=0,pe=U!=="nowrap";const Re=new Map,ne=h();let Xe=W,Ae=0,Pe=new g;const Ke=[Pe];se.forEach(ye=>{const{fontObj:ke}=ye,{ascender:Be,descender:ge,unitsPerEm:Ye,lineGap:Qe,capHeight:Ie,xHeight:Fe}=ke;let Ge=Re.get(ke);if(!Ge){const st=E/Ye,ft=P==="normal"?(Be-ge+Qe)*st:P*E,pt=(ft-(Be-ge)*st)/2,et=Math.min(ft,(Be-ge)*st),Ze=(Be+ge)/2*st+et/2;Ge={index:Re.size,src:ke.src,fontObj:ke,fontSizeMult:st,unitsPerEm:Ye,ascender:Be*st,descender:ge*st,capHeight:Ie*st,xHeight:Fe*st,lineHeight:ft,baseline:-pt-Be*st,caretTop:Ze,caretBottom:Ze-et},Re.set(ke,Ge)}const{fontSizeMult:Me}=Ge,$e=b.slice(ye.start,ye.end+1);let dt,Oe;ke.forEachGlyph($e,E,I,(st,ft,pt,et)=>{ft+=Ae,et+=ye.start,dt=ft,Oe=st;const Ze=b.charAt(et),me=st.advanceWidth*Me,je=Pe.count;let He;if("isEmpty"in st||(st.isWhitespace=!!Ze&&new RegExp(i).test(Ze),st.canBreakAfter=!!Ze&&s.test(Ze),st.isEmpty=st.xMin===st.xMax||st.yMin===st.yMax||r.test(Ze)),!st.isWhitespace&&!st.isEmpty&&Le++,pe&&re&&!st.isWhitespace&&ft+me+Xe>L&&je){if(Pe.glyphAt(je-1).glyphObj.canBreakAfter)He=new g,Xe=-ft;else for(let yt=je;yt--;)if(yt===0&&V==="break-word"){He=new g,Xe=-ft;break}else if(Pe.glyphAt(yt).glyphObj.canBreakAfter){He=Pe.splitAt(yt+1);const lt=He.glyphAt(0).x;Xe-=lt;for(let bt=He.count;bt--;)He.glyphAt(bt).x-=lt;break}He&&(Pe.isSoftWrapped=!0,Pe=He,Ke.push(Pe),Se=L)}let nt=Pe.glyphAt(Pe.count);nt.glyphObj=st,nt.x=ft+Xe,nt.y=pt,nt.width=me,nt.charIndex=et,nt.fontData=Ge,Ze===`
`&&(Pe=new g,Ke.push(Pe),Xe=-(ft+me+I*E)+W)}),Ae=dt+Oe.advanceWidth*Me+I*E});let oe=0;Ke.forEach(ye=>{let ke=!0;for(let Be=ye.count;Be--;){const ge=ye.glyphAt(Be);ke&&!ge.glyphObj.isWhitespace&&(ye.width=ge.x+ge.width,ye.width>Se&&(Se=ye.width),ke=!1);let{lineHeight:Ye,capHeight:Qe,xHeight:Ie,baseline:Fe}=ge.fontData;Ye>ye.lineHeight&&(ye.lineHeight=Ye);const Ge=Fe-ye.baseline;Ge<0&&(ye.baseline+=Ge,ye.cap+=Ge,ye.ex+=Ge),ye.cap=Math.max(ye.cap,ye.baseline+Qe),ye.ex=Math.max(ye.ex,ye.baseline+Ie)}ye.baseline-=oe,ye.cap-=oe,ye.ex-=oe,oe+=ye.lineHeight});let te=0,_e=0;if(G&&(typeof G=="number"?te=-G:typeof G=="string"&&(te=-Se*(G==="left"?0:G==="center"?.5:G==="right"?1:c(G)))),Z&&(typeof Z=="number"?_e=-Z:typeof Z=="string"&&(_e=Z==="top"?0:Z==="top-baseline"?-Ke[0].baseline:Z==="top-cap"?-Ke[0].cap:Z==="top-ex"?-Ke[0].ex:Z==="middle"?oe/2:Z==="bottom"?oe:Z==="bottom-baseline"?-Ke[Ke.length-1].baseline:c(Z)*oe)),!B){const ye=e.getEmbeddingLevels(b,R);ie=new Uint16Array(Le),ue=new Uint8Array(Le),le=new Float32Array(Le*2),fe={},Te=[1/0,1/0,-1/0,-1/0],We=[],K&&(he=new Float32Array(b.length*4)),F&&(xe=new Uint8Array(Le*3));let ke=0,Be=-1,ge=-1,Ye,Qe;if(Ke.forEach((Ie,Fe)=>{let{count:Ge,width:Me}=Ie;if(Ge>0){let $e=0;for(let et=Ge;et--&&Ie.glyphAt(et).glyphObj.isWhitespace;)$e++;let dt=0,Oe=0;if(O==="center")dt=(Se-Me)/2;else if(O==="right")dt=Se-Me;else if(O==="justify"&&Ie.isSoftWrapped){let et=0;for(let Ze=Ge-$e;Ze--;)Ie.glyphAt(Ze).glyphObj.isWhitespace&&et++;Oe=(Se-Me)/et}if(Oe||dt){let et=0;for(let Ze=0;Ze<Ge;Ze++){let me=Ie.glyphAt(Ze);const je=me.glyphObj;me.x+=dt+et,Oe!==0&&je.isWhitespace&&Ze<Ge-$e&&(et+=Oe,me.width+=Oe)}}const st=e.getReorderSegments(b,ye,Ie.glyphAt(0).charIndex,Ie.glyphAt(Ie.count-1).charIndex);for(let et=0;et<st.length;et++){const[Ze,me]=st[et];let je=1/0,He=-1/0;for(let nt=0;nt<Ge;nt++)if(Ie.glyphAt(nt).charIndex>=Ze){let yt=nt,lt=nt;for(;lt<Ge;lt++){let bt=Ie.glyphAt(lt);if(bt.charIndex>me)break;lt<Ge-$e&&(je=Math.min(je,bt.x),He=Math.max(He,bt.x+bt.width))}for(let bt=yt;bt<lt;bt++){const Nt=Ie.glyphAt(bt);Nt.x=He-(Nt.x+Nt.width-je)}break}}let ft;const pt=et=>ft=et;for(let et=0;et<Ge;et++){const Ze=Ie.glyphAt(et);ft=Ze.glyphObj;const me=ft.index,je=ye.levels[Ze.charIndex]&1;if(je){const He=e.getMirroredCharacter(b[Ze.charIndex]);He&&Ze.fontData.fontObj.forEachGlyph(He,0,0,pt)}if(K){const{charIndex:He,fontData:nt}=Ze,yt=Ze.x+te,lt=Ze.x+Ze.width+te;he[He*4]=je?lt:yt,he[He*4+1]=je?yt:lt,he[He*4+2]=Ie.baseline+nt.caretBottom+_e,he[He*4+3]=Ie.baseline+nt.caretTop+_e;const bt=He-Be;bt>1&&d(he,Be,bt),Be=He}if(F){const{charIndex:He}=Ze;for(;He>ge;)ge++,F.hasOwnProperty(ge)&&(Qe=F[ge])}if(!ft.isWhitespace&&!ft.isEmpty){const He=ke++,{fontSizeMult:nt,src:yt,index:lt}=Ze.fontData,bt=fe[yt]||(fe[yt]={});bt[me]||(bt[me]={path:ft.path,pathBounds:[ft.xMin,ft.yMin,ft.xMax,ft.yMax]});const Nt=Ze.x+te,Pt=Ze.y+Ie.baseline+_e;le[He*2]=Nt,le[He*2+1]=Pt;const Ve=Nt+ft.xMin*nt,wt=Pt+ft.yMin*nt,Et=Nt+ft.xMax*nt,zt=Pt+ft.yMax*nt;Ve<Te[0]&&(Te[0]=Ve),wt<Te[1]&&(Te[1]=wt),Et>Te[2]&&(Te[2]=Et),zt>Te[3]&&(Te[3]=zt),He%J===0&&(Ye={start:He,end:He,rect:[1/0,1/0,-1/0,-1/0]},We.push(Ye)),Ye.end++;const Ht=Ye.rect;if(Ve<Ht[0]&&(Ht[0]=Ve),wt<Ht[1]&&(Ht[1]=wt),Et>Ht[2]&&(Ht[2]=Et),zt>Ht[3]&&(Ht[3]=zt),ie[He]=me,ue[He]=lt,F){const an=He*3;xe[an]=Qe>>16&255,xe[an+1]=Qe>>8&255,xe[an+2]=Qe&255}}}}}),he){const Ie=b.length-Be;Ie>1&&d(he,Be,Ie)}}const ve=[];Re.forEach(({index:ye,src:ke,unitsPerEm:Be,ascender:ge,descender:Ye,lineHeight:Qe,capHeight:Ie,xHeight:Fe})=>{ve[ye]={src:ke,unitsPerEm:Be,ascender:ge,descender:Ye,lineHeight:Qe,capHeight:Ie,xHeight:Fe}}),H.typesetting=h()-ne,j({glyphIds:ie,glyphFontIndices:ue,glyphPositions:le,glyphData:fe,fontData:ve,caretPositions:he,glyphColors:xe,chunkedBounds:We,fontSize:E,topBaseline:_e+Ke[0].baseline,blockBounds:[te,_e-oe,te+Se,_e],visibleBounds:Te,timings:H})})}function l(b,_){o({...b,metricsOnly:!0},w=>{const[S,E,A,N]=w.blockBounds;_({width:A-S,height:N-E})})}function c(b){let _=b.match(/^([\d.]+)%$/),w=_?parseFloat(_[1]):NaN;return isNaN(w)?0:w/100}function d(b,_,w){const S=b[_*4],E=b[_*4+1],A=b[_*4+2],N=b[_*4+3],I=(E-S)/w;for(let P=0;P<w;P++){const L=(_+P)*4;b[L]=S+I*P,b[L+1]=S+I*(P+1),b[L+2]=A,b[L+3]=N}}function h(){return(self.performance||Date).now()}function g(){this.data=[]}const v=["glyphObj","x","y","width","charIndex","fontData"];return g.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/v.length)},glyphAt(b){let _=g.flyweight;return _.data=this.data,_.index=b,_},splitAt(b){let _=new g;return _.data=this.data.splice(b*v.length),_}},g.flyweight=v.reduce((b,_,w,S)=>(Object.defineProperty(b,_,{get(){return this.data[this.index*v.length+w]},set(E){this.data[this.index*v.length+w]=E}}),b),{data:null,index:0}),{typeset:o,measure:l}}const Xg=()=>(self.performance||Date).now(),PE=LK();let Jj;function HCe(t,e,n,r,i,s,a,o,l,c,d=!0){return d?GCe(t,e,n,r,i,s,a,o,l,c).then(null,h=>(Jj||(console.warn("WebGL SDF generation failed, falling back to JS",h),Jj=!0),tF(t,e,n,r,i,s,a,o,l,c))):tF(t,e,n,r,i,s,a,o,l,c)}const WM=[],VCe=5;let u7=0;function jK(){const t=Xg();for(;WM.length&&Xg()-t<VCe;)WM.shift()();u7=WM.length?setTimeout(jK,0):0}const GCe=(...t)=>new Promise((e,n)=>{WM.push(()=>{const r=Xg();try{PE.webgl.generateIntoCanvas(...t),e({timing:Xg()-r})}catch(i){n(i)}}),u7||(u7=setTimeout(jK,0))}),WCe=4,$Ce=2e3,eF={};let qCe=0;function tF(t,e,n,r,i,s,a,o,l,c){const d="TroikaTextSDFGenerator_JS_"+qCe++%WCe;let h=eF[d];return h||(h=eF[d]={workerModule:Iy({name:d,workerId:d,dependencies:[LK,Xg],init(g,v){const b=g().javascript.generate;return function(..._){const w=v();return{textureData:b(..._),timing:v()-w}}},getTransferables(g){return[g.textureData.buffer]}}),requests:0,idleTimer:null}),h.requests++,clearTimeout(h.idleTimer),h.workerModule(t,e,n,r,i,s).then(({textureData:g,timing:v})=>{const b=Xg(),_=new Uint8Array(g.length*4);for(let w=0;w<g.length;w++)_[w*4+c]=g[w];return PE.webglUtils.renderImageData(a,_,o,l,t,e,1<<3-c),v+=Xg()-b,--h.requests===0&&(h.idleTimer=setTimeout(()=>{MCe(d)},$Ce)),{timing:v}})}function XCe(t){t._warm||(PE.webgl.isSupported(t),t._warm=!0)}const YCe=PE.webglUtils.resizeWebGLCanvasWithoutClearing,__={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},KCe=new xn;function Zx(){return(self.performance||Date).now()}const nF=Object.create(null);function FK(t,e){t=JCe({},t);const n=Zx(),r=[];if(t.font&&r.push({label:"user",src:eAe(t.font)}),t.font=r,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||__.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||__.unicodeFontsURL,t.colorRanges!=null){let g={};for(let v in t.colorRanges)if(t.colorRanges.hasOwnProperty(v)){let b=t.colorRanges[v];typeof b!="number"&&(b=KCe.set(b).getHex()),g[v]=b}t.colorRanges=g}Object.freeze(t);const{textureWidth:i,sdfExponent:s}=__,{sdfGlyphSize:a}=t,o=i/a*4;let l=nF[a];if(!l){const g=document.createElement("canvas");g.width=i,g.height=a*256/o,l=nF[a]={glyphCount:0,sdfGlyphSize:a,sdfCanvas:g,sdfTexture:new ra(g,void 0,void 0,void 0,rs,rs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,ZCe(l)}const{sdfTexture:c,sdfCanvas:d}=l;HK(t).then(g=>{const{glyphIds:v,glyphFontIndices:b,fontData:_,glyphPositions:w,fontSize:S,timings:E}=g,A=[],N=new Float32Array(v.length*4);let I=0,P=0;const L=Zx(),R=_.map(G=>{let Z=l.glyphsByFont.get(G.src);return Z||l.glyphsByFont.set(G.src,Z=new Map),Z});v.forEach((G,Z)=>{const B=b[Z],{src:q,unitsPerEm:Y}=_[B];let K=R[B].get(G);if(!K){const{path:H,pathBounds:se}=g.glyphData[q][G],re=Math.max(se[2]-se[0],se[3]-se[1])/a*(__.sdfMargin*a+.5),ie=l.glyphCount++,ue=[se[0]-re,se[1]-re,se[2]+re,se[3]+re];R[B].set(G,K={path:H,atlasIndex:ie,sdfViewBox:ue}),A.push(K)}const{sdfViewBox:J}=K,F=w[P++],j=w[P++],X=S/Y;N[I++]=F+J[0]*X,N[I++]=j+J[1]*X,N[I++]=F+J[2]*X,N[I++]=j+J[3]*X,v[Z]=K.atlasIndex}),E.quads=(E.quads||0)+(Zx()-L);const O=Zx();E.sdf={};const W=d.height,U=Math.ceil(l.glyphCount/o),V=Math.pow(2,Math.ceil(Math.log2(U*a)));V>W&&(console.info(`Increasing SDF texture size ${W}->${V}`),YCe(d,i,V),c.dispose()),Promise.all(A.map(G=>UK(G,l,t.gpuAccelerateSDF).then(({timing:Z})=>{E.sdf[G.atlasIndex]=Z}))).then(()=>{A.length&&!l.contextLost&&(BK(l),c.needsUpdate=!0),E.sdfTotal=Zx()-O,E.total=Zx()-n,e(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:a,sdfExponent:s,glyphBounds:N,glyphAtlasIndices:v,glyphColors:g.glyphColors,caretPositions:g.caretPositions,chunkedBounds:g.chunkedBounds,ascender:g.ascender,descender:g.descender,lineHeight:g.lineHeight,capHeight:g.capHeight,xHeight:g.xHeight,topBaseline:g.topBaseline,blockBounds:g.blockBounds,visibleBounds:g.visibleBounds,timings:g.timings}))})}),Promise.resolve().then(()=>{l.contextLost||XCe(d)})}function UK({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:r,sdfCanvas:i,contextLost:s},a){if(s)return Promise.resolve({timing:-1});const{textureWidth:o,sdfExponent:l}=__,c=Math.max(n[2]-n[0],n[3]-n[1]),d=Math.floor(e/4),h=d%(o/r)*r,g=Math.floor(d/(o/r))*r,v=e%4;return HCe(r,r,t,n,c,l,i,h,g,v,a)}function ZCe(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(UK(s,t,!0))})}),Promise.all(r).then(()=>{BK(t),t.sdfTexture.needsUpdate=!0})})}function QCe({font:t,characters:e,sdfGlyphSize:n},r){let i=Array.isArray(e)?e.join(`
`):""+e;FK({font:t,sdfGlyphSize:n,text:i},r)}function JCe(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let MM;function eAe(t){return MM||(MM=typeof document>"u"?{}:document.createElement("a")),MM.href=t,MM.href}function BK(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 a=n.image.data;(!a||a.length!==r*i*4)&&(a=new Uint8Array(r*i*4),n.image={width:r,height:i,data:a},n.flipY=!1,n.isDataTexture=!0),s.readPixels(0,0,r,i,s.RGBA,s.UNSIGNED_BYTE,a)}}const tAe=Iy({name:"Typesetter",dependencies:[BCe,UCe,ECe],init(t,e,n){return t(e,n())}}),HK=Iy({name:"Typesetter",dependencies:[tAe],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}});HK.onMainThread;const rF={};function nAe(t){let e=rF[t];return e||(e=rF[t]=new Sp(1,1,t,t).translate(.5,.5,0)),e}const rAe="aTroikaGlyphBounds",iF="aTroikaGlyphIndex",iAe="aTroikaGlyphColor";class sAe extends CE{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 Ga,this.boundingBox=new Ca}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=nAe(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(rAe,e,4),this.updateAttributeData(iF,n,1),this.updateAttributeData(iAe,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:a,max:o,sin:l,cos:c}=Math,d=i/2,h=i*2,g=Math.abs(n),v=e[0]/g,b=e[2]/g,_=s((v+d)/h)!==s((b+d)/h)?-g:a(l(v)*g,l(b)*g),w=s((v-d)/h)!==s((b-d)/h)?g:o(l(v)*g,l(b)*g),S=s((v+i)/h)!==s((b+i)/h)?g*2:o(g-c(v)*g,g-c(b)*g);r.min.set(_,e[1],n<0?-S:0),r.max.set(w,e[3],n<0?0:S)}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(iF).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 cv(n,r)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const aAe=`
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;
`,oAe=`
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);
`,lAe=`
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;
}
`,cAe=`
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 uAe(t){const e=c7(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Lt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new ci(0,0,0,0)},uTroikaClipRect:{value:new ci(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Lt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new xn},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new yr},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:aAe,vertexTransform:oAe,fragmentDefs:lAe,fragmentColorTransform:cAe,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(zK,`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 z9=new _p({color:16777215,side:Xc,transparent:!0}),sF=8421504,aF=new rr,TM=new ze,U6=new ze,l_=[],dAe=new ze,B6="+x+y";function oF(t){return Array.isArray(t)?t[0]:t}let VK=()=>{const t=new Us(new Sp(1,1),z9);return VK=()=>t,t},GK=()=>{const t=new Us(new Sp(1,1,32,1),z9);return GK=()=>t,t};const fAe={type:"syncstart"},hAe={type:"synccomplete"},WK=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],pAe=WK.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let $K=class extends Us{constructor(){const e=new sAe;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=sF,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=B6,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(fAe),FK({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(hAe),e&&e()})))}onBeforeRender(e,n,r,i,s,a){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return uAe(e)}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=z9.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 oF(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return oF(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const n=e.isTextOutlineMaterial,r=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:o,blockBounds:l}=i;r.uTroikaSDFTexture.value=o,r.uTroikaSDFTextureSize.value.set(o.image.width,o.image.height),r.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,r.uTroikaSDFExponent.value=i.sdfExponent,r.uTroikaTotalBounds.value.fromArray(l),r.uTroikaUseGlyphColors.value=!n&&!!i.glyphColors;let c=0,d=0,h=0,g,v,b,_=0,w=0;if(n){let{outlineWidth:E,outlineOffsetX:A,outlineOffsetY:N,outlineBlur:I,outlineOpacity:P}=this;c=this._parsePercent(E)||0,d=Math.max(0,this._parsePercent(I)||0),g=P,_=this._parsePercent(A)||0,w=this._parsePercent(N)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(b=this.strokeColor,r.uTroikaStrokeColor.value.set(b??sF),v=this.strokeOpacity,v==null&&(v=1)),g=this.fillOpacity;r.uTroikaEdgeOffset.value=c,r.uTroikaPositionOffset.value.set(_,w),r.uTroikaBlurRadius.value=d,r.uTroikaStrokeWidth.value=h,r.uTroikaStrokeOpacity.value=v,r.uTroikaFillOpacity.value=g??1,r.uTroikaCurveRadius.value=this.curveRadius||0;let S=this.clipRect;if(S&&Array.isArray(S)&&S.length===4)r.uTroikaClipRect.value.fromArray(S);else{const E=(this.fontSize||.1)*100;r.uTroikaClipRect.value.set(l[0]-E,l[1]-E,l[2]+E,l[3]+E)}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 o=e.hasOwnProperty("color")?e.color:e.color=new xn;(s!==o._input||typeof s=="object")&&o.set(o._input=s)}let a=this.orientation||B6;if(a!==e._orientation){let o=r.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let l=a!==B6&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,d,h,g]=l;TM.set(0,0,0)[d]=c==="-"?1:-1,U6.set(0,0,0)[g]=h==="-"?-1:1,aF.lookAt(dAe,TM.cross(U6),U6),o.setFromMatrix4(aF)}else o.identity();e._orientation=a}}_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 Lt){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 Lt){return TM.copy(e),this.localPositionToTextCoords(this.worldToLocal(TM),n)}raycast(e,n){const{textRenderInfo:r,curveRadius:i}=this;if(r){const s=r.blockBounds,a=i?GK():VK(),o=a.geometry,{position:l,uv:c}=o.attributes;for(let d=0;d<c.count;d++){let h=s[0]+c.getX(d)*(s[2]-s[0]);const g=s[1]+c.getY(d)*(s[3]-s[1]);let v=0;i&&(v=i-Math.cos(h/i)*i,h=Math.sin(h/i)*i),l.setXYZ(d,h,g,v)}o.boundingSphere=this.geometry.boundingSphere,o.boundingBox=this.geometry.boundingBox,a.matrixWorld=this.matrixWorld,a.material.side=this.material.side,l_.length=0,a.raycast(e,l_);for(let d=0;d<l_.length;d++)l_[d].object=this,n.push(l_[d])}}copy(e){const n=this.geometry;return super.copy(e),this.geometry=n,pAe.forEach(r=>{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};WK.forEach(t=>{const e="_private_"+t;Object.defineProperty($K.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});new Ca;new xn;const pa=T.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:r,fontSize:i=1,children:s,characters:a,onSync:o,...l},c)=>{const d=$c(({invalidate:b})=>b),[h]=T.useState(()=>new $K),[g,v]=T.useMemo(()=>{const b=[];let _="";return T.Children.forEach(s,w=>{typeof w=="string"||typeof w=="number"?_+=w:b.push(w)}),[b,_]},[s]);return KTe(()=>new Promise(b=>QCe({font:r,characters:a},b)),["troika-text",r,a]),T.useLayoutEffect(()=>void h.sync(()=>{d(),o&&o(h)})),T.useEffect(()=>()=>h.dispose(),[h]),T.createElement("primitive",lh({object:h,ref:c,font:r,text:v,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),g)}),sm=T.forwardRef(({threshold:t=15,geometry:e,...n},r)=>{const i=T.useRef(null);T.useImperativeHandle(r,()=>i.current,[]);const s=T.useMemo(()=>[0,0,0,1,0,0],[]),a=T.useRef(null),o=T.useRef(null);return T.useLayoutEffect(()=>{const l=i.current.parent,c=e??(l==null?void 0:l.geometry);if(!c||a.current===c&&o.current===t)return;a.current=c,o.current=t;const h=new l9(c,t).attributes.position.array;i.current.geometry.setPositions(h),i.current.geometry.attributes.instanceStart.needsUpdate=!0,i.current.geometry.attributes.instanceEnd.needsUpdate=!0,i.current.computeLineDistances()}),T.createElement(yCe,lh({segments:!0,points:s,ref:i,raycast:()=>null},n))}),mAe=T.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:a,onStart:o,onEnd:l,...c},d)=>{const h=$c(P=>P.invalidate),g=$c(P=>P.camera),v=$c(P=>P.gl),b=$c(P=>P.events),_=$c(P=>P.setEvents),w=$c(P=>P.set),S=$c(P=>P.get),E=$c(P=>P.performance),A=e||g,N=r||b.connected||v.domElement,I=T.useMemo(()=>new mCe(A),[A]);return RE(()=>{I.enabled&&I.update()},-1),T.useEffect(()=>(s&&I.connect(s===!0?N:s),I.connect(N),()=>void I.dispose()),[s,N,n,I,h]),T.useEffect(()=>{const P=O=>{h(),n&&E.regress(),a&&a(O)},L=O=>{o&&o(O)},R=O=>{l&&l(O)};return I.addEventListener("change",P),I.addEventListener("start",L),I.addEventListener("end",R),()=>{I.removeEventListener("start",L),I.removeEventListener("end",R),I.removeEventListener("change",P)}},[a,o,l,I,h,_]),T.useEffect(()=>{if(t){const P=S().controls;return w({controls:I}),()=>w({controls:P})}},[t,I]),T.createElement("primitive",lh({ref:d,object:I,enableDamping:i},c))}),Of=1e-5;function gAe(t,e,n){const r=new G0,i=n-Of;return r.absarc(Of,Of,Of,-Math.PI/2,-Math.PI,!0),r.absarc(Of,e-i*2,Of,Math.PI,Math.PI/2,!0),r.absarc(t-i*2,e-i*2,Of,Math.PI/2,0,!0),r.absarc(t-i*2,Of,Of,0,-Math.PI/2,!0),r}const Vu=T.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:l=.4,children:c,...d},h){return T.createElement("mesh",lh({ref:h},d),T.createElement(vAe,{args:[e,n,r],radius:i,steps:s,smoothness:a,bevelSegments:o,creaseAngle:l}),c)}),vAe=T.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:l=.4,...c},d){const h=T.useMemo(()=>gAe(e,n,i),[e,n,i]),g=T.useMemo(()=>({depth:r-i*2,bevelEnabled:!0,bevelSegments:o*2,steps:s,bevelSize:i-Of,bevelThickness:i,curveSegments:a}),[r,i,a,o,s]),v=T.useRef(null);return T.useLayoutEffect(()=>{v.current&&(v.current.center(),oCe(v.current,l))},[h,g,l]),T.useImperativeHandle(d,()=>v.current),T.createElement("extrudeGeometry",lh({ref:v,args:[h,g]},c))});function mi(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Er(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 vo(t){return typeof t=="string"?t:""}function H6(t){return!!t}function j9(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 mi(e)}function qK(t){if(!t)return null;const e=j9(t.setup);if(!e)return null;const n=vo(e.model),r=vo(e.schema_version),i=mi(e.cluster);if(!i)return null;const s=Array.isArray(i.nodes)?i.nodes:[],a=mi(e.trainer),o=mi(e.inference),l=new Map,c=Array.isArray(a==null?void 0:a.nodes)?a.nodes:[];for(const g of c){const v=mi(g);if(!v)continue;const b=Er(v.node_id);if(b===null)continue;const _=Array.isArray(v.gpus)?v.gpus:[];for(const w of _){const S=mi(w);if(!S)continue;const E=Er(S.gpu_index);E!==null&&l.set(`${b}-${E}`,{role:"trainer",gpu_index:E,rank:Er(S.rank)??void 0,dp_rank:Er(S.dp_rank)??void 0,tp_rank:Er(S.tp_rank)??void 0,pp_rank:Er(S.pp_rank)??void 0})}}const d=Array.isArray(o==null?void 0:o.nodes)?o.nodes:[];for(const g of d){const v=mi(g);if(!v)continue;const b=Er(v.node_id);if(b===null)continue;const _=Array.isArray(v.gpus)?v.gpus:[];for(const w of _){const S=mi(w);if(!S)continue;const E=Er(S.gpu_index);E!==null&&l.set(`${b}-${E}`,{role:"inference",gpu_index:E,server_idx:Er(S.server_idx)??void 0,tp_group_id:Er(S.tp_group_id)??void 0,port:Er(S.port)??void 0,url:vo(S.url)||void 0})}}const h=[];for(const g of s){const v=mi(g);if(!v)continue;const b=Er(v.node_id)??0,_=mi(v.hardware),w=mi(_==null?void 0:_.cpu),S={model:vo(w==null?void 0:w.model),cores:Er(w==null?void 0:w.cores)??0,logical_cores:Er(w==null?void 0:w.logical_cores)??0,sockets:Er(w==null?void 0:w.sockets)??1,architecture:vo(w==null?void 0:w.architecture),frequency_mhz:Er(w==null?void 0:w.frequency_mhz)??0},E=mi(_==null?void 0:_.memory),A={total_gb:Er(E==null?void 0:E.total_gb)??0},N=mi(_==null?void 0:_.gpu),P=(Array.isArray(N==null?void 0:N.devices)?N.devices:[]).map((G,Z)=>{const B=mi(G),q=Z,Y=`${b}-${q}`,K=l.get(Y)??{role:"unassigned",gpu_index:q};return{hardware:{name:vo(B==null?void 0:B.name),memory_total_gb:Er(B==null?void 0:B.memory_total_gb)??0,pcie_gen:Er(B==null?void 0:B.pcie_gen)??0,pcie_width:Er(B==null?void 0:B.pcie_width)??0,serial:vo(B==null?void 0:B.serial),uuid:vo(B==null?void 0:B.uuid)},role:K,local_index:q}}),L=mi(N==null?void 0:N.interconnect),R=L?{nvlink:H6(L.nvlink),topology:vo(L.topology),links_per_gpu:Er(L.links_per_gpu)??0,speed_gbps:Er(L.speed_gbps)??0,connections:Er(L.connections)??0}:null,O=mi(v.software),W=mi(O==null?void 0:O.os),U=mi(O==null?void 0:O.container),V=mi(O==null?void 0:O.packages);h.push({node_id:b,hostname:vo(v.hostname),ip:vo(v.ip),is_driver:H6(v.is_driver),cpu:S,memory:A,gpus:P,interconnect:R,os:vo(W==null?void 0:W.platform),container:U?{runtime:vo(U.runtime),is_container:H6(U.is_container)}:null,software:{cuda:vo(V==null?void 0:V.cuda),pytorch:vo(V==null?void 0:V.pytorch),python:vo(V==null?void 0:V.python)}})}return{model:n,schema_version:r,nodes:h,total_gpus:Er(i.total_gpus)??0,trainer_total_gpus:Er(a==null?void 0:a.total_gpus)??0,inference_total_gpus:Er(o==null?void 0:o.total_gpus)??0,trainer_config:a?{data_parallel_size:Er(a.data_parallel_size)??0,megatron_tensor_parallel_size:Er(a.megatron_tensor_parallel_size)??0,megatron_pipeline_parallel_size:Er(a.megatron_pipeline_parallel_size)??0,backend:vo(a.backend),world_size:Er(a.world_size)??0}:null,inference_config:o?{num_servers:Er(o.num_servers)??0,tensor_parallel_size:Er(o.tensor_parallel_size)??0,placement_strategy:vo(o.placement_strategy)}:null}}const Sn={trainer:"#2563eb",inference:"#dc2626",unassigned:"#111111",nvlink:"#c7d5f0",platform:"#ffffff",platformBorder:"#111111",gpuBody:"#ffffff",gpuBodyHover:"#ffffff",moduleBody:"#ffffff",moduleBodyHover:"#ffffff",chip:"#ffffff",chipBorder:"#ededed",textBlack:"#000000",background:"#ffffff",gridColor:"#ffffff"};function xAe(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 yAe({position:t,gpu:e,nodeId:n,onHover:r,onUnhover:i,onClick:s,isHovered:a}){const o=e.role.role==="trainer"?Sn.trainer:e.role.role==="inference"?Sn.inference:Sn.unassigned,l=e.role.role==="trainer"?"Trainer":e.role.role==="inference"?"Inference":"",{brand:c,model:d}=xAe(e.hardware.name),h=.095;return p.jsxs("group",{position:t,children:[p.jsxs(Vu,{args:[.95,.18,.6],radius:0,smoothness:4,onPointerOver:g=>{g.stopPropagation(),r()},onPointerOut:i,onClick:g=>{g.stopPropagation(),s()},children:[p.jsx("meshBasicMaterial",{color:a?Sn.gpuBodyHover:Sn.gpuBody}),p.jsx(sm,{color:Sn.platformBorder,threshold:1,scale:1.002})]}),e.role.role!=="unassigned"&&p.jsxs(p.Fragment,{children:[p.jsxs("mesh",{position:[-.34,h-.003,-.2],rotation:[-Math.PI/2,0,0],children:[p.jsx("planeGeometry",{args:[.055,.055]}),p.jsx("meshStandardMaterial",{color:o,side:Xc})]}),p.jsx(pa,{position:[-.285,h,-.2],rotation:[-Math.PI/2,0,0],fontSize:.04,color:Sn.textBlack,anchorX:"left",anchorY:"middle",children:l})]}),p.jsx(pa,{position:[0,h,-.04],rotation:[-Math.PI/2,0,0],fontSize:.055,color:Sn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:c}),p.jsx(pa,{position:[0,h,.07],rotation:[-Math.PI/2,0,0],fontSize:.07,color:Sn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:d}),p.jsx(pa,{position:[.4,h,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:Sn.textBlack,anchorX:"right",anchorY:"middle",children:`GPU ${e.local_index}`}),e.role.rank!==void 0&&p.jsx(pa,{position:[-.4,h,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:Sn.textBlack,anchorX:"left",anchorY:"middle",children:`Rank ${e.role.rank}`}),e.role.server_idx!==void 0&&p.jsx(pa,{position:[-.4,h,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:Sn.textBlack,anchorX:"left",anchorY:"middle",children:`Server ${e.role.server_idx}`}),a&&p.jsx(I9,{position:[0,.35,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:p.jsxs("div",{className:"bg-white border border-black rounded-none px-3 py-2 min-w-[180px]",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-1",children:e.hardware.name}),p.jsxs("div",{className:"text-[10px] text-black space-y-0.5",children:[p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"VRAM"}),p.jsxs("span",{className:"font-mono",children:[e.hardware.memory_total_gb," GB"]})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"PCIe"}),p.jsxs("span",{className:"font-mono",children:["Gen",e.hardware.pcie_gen," x",e.hardware.pcie_width]})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Role"}),p.jsxs("span",{className:"font-semibold",style:{color:o},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})`]})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Node"}),p.jsxs("span",{className:"font-mono",children:["#",n]})]})]})]})})]})}function bAe({position:t,memoryGb:e,isHovered:n,onHover:r,onUnhover:i}){return p.jsxs("group",{position:t,children:[p.jsxs(Vu,{args:[.85,.12,.35],radius:0,smoothness:4,onPointerOver:a=>{a.stopPropagation(),r()},onPointerOut:i,children:[p.jsx("meshBasicMaterial",{color:n?Sn.moduleBodyHover:Sn.moduleBody}),p.jsx(sm,{color:Sn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(pa,{position:[0,.063,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:Sn.textBlack,anchorX:"center",anchorY:"middle",children:"VRAM"}),p.jsx(pa,{position:[0,.063,.05],rotation:[-Math.PI/2,0,0],fontSize:.055,color:Sn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`${e}GB`})]})}function _Ae(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 SAe({position:t,cpu:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const a=_Ae(e.model);return p.jsxs("group",{position:t,children:[p.jsxs(Vu,{args:[.6,.08,.6],radius:0,smoothness:4,onPointerOver:o=>{o.stopPropagation(),r()},onPointerOut:i,onClick:o=>{o.stopPropagation(),s()},children:[p.jsx("meshBasicMaterial",{color:n?Sn.gpuBodyHover:Sn.chip}),p.jsx(sm,{color:Sn.platformBorder,threshold:1,scale:1.002})]}),p.jsxs("mesh",{position:[0,.041,0],children:[p.jsx("boxGeometry",{args:[.45,.005,.45]}),p.jsx("meshBasicMaterial",{color:Sn.platform}),p.jsx(sm,{color:Sn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(pa,{position:[0,.05,-.12],rotation:[-Math.PI/2,0,0],fontSize:.032,color:Sn.textBlack,anchorX:"center",anchorY:"middle",children:a}),p.jsx(pa,{position:[0,.05,0],rotation:[-Math.PI/2,0,0],fontSize:.045,color:Sn.textBlack,anchorX:"center",anchorY:"middle",children:"CPU"}),p.jsx(pa,{position:[0,.05,.1],rotation:[-Math.PI/2,0,0],fontSize:.028,color:Sn.textBlack,anchorX:"center",anchorY:"middle",children:`${e.cores}C / ${e.logical_cores}T`}),n&&p.jsx(I9,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:p.jsxs("div",{className:"bg-white border border-black rounded-none px-3 py-2 min-w-[180px]",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-1",children:e.model}),p.jsxs("div",{className:"text-[10px] text-black space-y-0.5",children:[p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Cores"}),p.jsx("span",{className:"font-mono",children:e.cores})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Threads"}),p.jsx("span",{className:"font-mono",children:e.logical_cores})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Sockets"}),p.jsx("span",{className:"font-mono",children:e.sockets})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Frequency"}),p.jsxs("span",{className:"font-mono",children:[(e.frequency_mhz/1e3).toFixed(2)," GHz"]})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Arch"}),p.jsx("span",{className:"font-mono",children:e.architecture})]})]})]})})]})}function wAe({position:t,memory:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){return p.jsxs("group",{position:t,children:[p.jsxs(Vu,{args:[.6,.12,.35],radius:0,smoothness:4,onPointerOver:o=>{o.stopPropagation(),r()},onPointerOut:i,onClick:o=>{o.stopPropagation(),s()},children:[p.jsx("meshBasicMaterial",{color:n?Sn.moduleBodyHover:Sn.moduleBody}),p.jsx(sm,{color:Sn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(pa,{position:[0,.063,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:Sn.textBlack,anchorX:"center",anchorY:"middle",children:"RAM"}),p.jsx(pa,{position:[0,.063,.05],rotation:[-Math.PI/2,0,0],fontSize:.045,color:Sn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`${Math.round(e.total_gb)}GB`}),n&&p.jsx(I9,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:p.jsxs("div",{className:"bg-white border border-black rounded-none px-3 py-2 min-w-[140px]",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-1",children:"System Memory"}),p.jsx("div",{className:"text-[10px] text-black space-y-0.5",children:p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Total"}),p.jsxs("span",{className:"font-mono",children:[e.total_gb.toFixed(0)," GB"]})]})})]})})]})}function MAe({vramPositions:t,vramDepth:e,interconnect:n}){if(!(n!=null&&n.nvlink)||t.length<2)return null;const r=[...t].sort((h,g)=>h[0]-g[0]),i=r[0][0],s=r[r.length-1][0],a=(i+s)/2,o=s-i,c=t[0][2]-e/2-.18,d=.065;return p.jsxs("group",{children:[p.jsx(Vu,{args:[o,.02,.035],radius:.002,smoothness:4,position:[a,d,c],children:p.jsx("meshBasicMaterial",{color:Sn.nvlink})}),t.map((h,g)=>{const v=h[2]-e/2,b=Math.abs(v-c),_=(v+c)/2;return p.jsx("group",{children:p.jsx(Vu,{args:[.02,.02,b],radius:.001,smoothness:2,position:[h[0],d,_],children:p.jsx("meshBasicMaterial",{color:Sn.nvlink})})},g)}),p.jsx(pa,{position:[a,.035,c-.15],rotation:[-Math.PI/2,0,0],fontSize:.06,color:Sn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`NVLink · ${n.links_per_gpu} links/GPU · ${n.speed_gbps} Gbps`})]})}function TAe({node:t,position:e,hoveredItem:n,setHoveredItem:r,setSelectedItem:i}){const s=t.gpus.length,a=1.15,o=s*a,l=Math.max(o+1.8,3.5),c=3.2,d=.6,h=.35,g=.6,v=.06,b=-.15,_=b-d/2-v-h/2,w=b+d/2+.08,S=w+.4+g/2,E=t.gpus.map((N,I)=>[I*a-(o-a)/2,.14,b]),A=t.gpus.map((N,I)=>[I*a-(o-a)/2,.11,_]);return p.jsxs("group",{position:e,children:[p.jsxs(Vu,{args:[l,.06,c],radius:0,smoothness:4,children:[p.jsx("meshBasicMaterial",{color:Sn.platform}),p.jsx(sm,{color:Sn.platformBorder,threshold:1,scale:1.002})]}),p.jsxs(pa,{position:[0,.04,-c/2+.15],rotation:[-Math.PI/2,0,0],fontSize:.09,color:Sn.textBlack,anchorX:"center",anchorY:"middle",children:[`Node ${t.node_id}`,t.is_driver?" (Driver)":""]}),p.jsx(pa,{position:[0,.04,-c/2+.3],rotation:[-Math.PI/2,0,0],fontSize:.05,color:Sn.textBlack,anchorX:"center",anchorY:"middle",children:`${t.hostname} · ${t.ip}`}),t.gpus.map((N,I)=>{const P=E[I],L=[e[0]+P[0],e[1]+P[1],e[2]+P[2]];return p.jsxs("group",{children:[p.jsx(yAe,{position:P,gpu:N,nodeId:t.node_id,isHovered:n===`gpu-${t.node_id}-${N.local_index}`,onHover:()=>r(`gpu-${t.node_id}-${N.local_index}`),onUnhover:()=>r(null),onClick:()=>i({type:"gpu",nodeId:t.node_id,gpuIndex:N.local_index,data:N,worldPosition:L})}),p.jsx(bAe,{position:A[I],memoryGb:N.hardware.memory_total_gb,isHovered:n===`vram-${t.node_id}-${N.local_index}`,onHover:()=>r(`vram-${t.node_id}-${N.local_index}`),onUnhover:()=>r(null)})]},I)}),p.jsx(MAe,{vramPositions:A,vramDepth:h,interconnect:t.interconnect}),(()=>{const N=[0,.09,S],I=[.75,.11,S],P=[e[0]+N[0],e[1]+N[1],e[2]+N[2]],L=[e[0]+I[0],e[1]+I[1],e[2]+I[2]];return p.jsxs(p.Fragment,{children:[p.jsx(SAe,{position:N,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:P})}),p.jsx(wAe,{position:I,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:L})})]})})(),(()=>{var q,Y;const N=((q=t.gpus[0])==null?void 0:q.hardware.pcie_gen)??0,I=((Y=t.gpus[0])==null?void 0:Y.hardware.pcie_width)??0;if(N===0||s<1)return null;const P=[...E].sort((K,J)=>K[0]-J[0]),L=P[0][0],R=P[P.length-1][0],O=(L+R)/2,W=R-L,U=.065,V=w,G=S-g/2,Z=Math.abs(G-V),B=(V+G)/2;return p.jsxs("group",{children:[p.jsx(Vu,{args:[W,.02,.035],radius:.002,smoothness:4,position:[O,U,w],children:p.jsx("meshBasicMaterial",{color:Sn.chipBorder})}),E.map((K,J)=>{const F=b+d/2,j=Math.abs(w-F),X=(F+w)/2;return p.jsx("group",{children:p.jsx(Vu,{args:[.02,.02,j],radius:.001,smoothness:2,position:[K[0],U,X],children:p.jsx("meshBasicMaterial",{color:Sn.chipBorder})})},J)}),p.jsx(Vu,{args:[.02,.02,Z],radius:.001,smoothness:2,position:[0,U,B],children:p.jsx("meshBasicMaterial",{color:Sn.chipBorder})}),p.jsx(pa,{position:[.15,.035,B],rotation:[-Math.PI/2,0,-Math.PI/2],fontSize:.06,maxWidth:Z-.1,color:Sn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,textAlign:"center",children:`PCIe Gen${N} x${I}`})]})})(),(()=>{const N=[];return t.software.cuda&&N.push(`CUDA ${t.software.cuda}`),t.software.pytorch&&N.push(`PyTorch ${t.software.pytorch}`),t.software.python&&N.push(`Python ${t.software.python}`),N.length===0?null:p.jsx(pa,{position:[0,.035,c/2-.1],rotation:[-Math.PI/2,0,0],fontSize:.03,color:Sn.textBlack,anchorX:"center",anchorY:"middle",children:N.join(" · ")})})()]})}function XK(){return p.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.05,0],children:[p.jsx("planeGeometry",{args:[50,50]}),p.jsx("meshBasicMaterial",{color:Sn.background})]})}function EAe({node:t,position:e,onClick:n}){const[r,i]=T.useState(!1),s=T.useRef(null);T.useEffect(()=>()=>{document.body.style.cursor="auto"},[]);const a=t.gpus.filter(b=>b.role.role==="trainer").length,o=t.gpus.filter(b=>b.role.role==="inference").length,l=t.gpus.length,c=(()=>{const b=[`${l} GPUs`],_=[];return a>0&&_.push(`${a}T`),o>0&&_.push(`${o}I`),_.length>0&&b.push(_.join(" ")),b.join(" · ")})(),d=2.5,h=1.5,g=.5,v=g/2+.005;return RE(()=>{if(!s.current)return;const b=r?e[1]+.06:e[1];s.current.position.y+=(b-s.current.position.y)*.15}),p.jsxs("group",{ref:s,position:e,children:[p.jsxs(Vu,{args:[d,g,h],radius:0,smoothness:4,onPointerOver:b=>{b.stopPropagation(),i(!0),document.body.style.cursor="pointer"},onPointerOut:()=>{i(!1),document.body.style.cursor="auto"},onClick:b=>{b.stopPropagation(),document.body.style.cursor="auto",n()},children:[p.jsx("meshBasicMaterial",{color:Sn.platform}),p.jsx(sm,{color:r?Sn.trainer:Sn.platformBorder,threshold:1,scale:1.002})]}),t.gpus.map((b,_)=>{const A=-(l*.18+(l-1)*.06)/2+.18/2+_*(.18+.06),N=b.role.role==="trainer"?Sn.trainer:b.role.role==="inference"?Sn.inference:Sn.unassigned;return p.jsxs("mesh",{position:[A,g/2+.025,-.15],children:[p.jsx("boxGeometry",{args:[.18,.04,.22]}),p.jsx("meshBasicMaterial",{color:N})]},_)}),p.jsxs(pa,{position:[-d/2+.15,v,-h/2+.15],rotation:[-Math.PI/2,0,0],fontSize:.12,color:Sn.textBlack,anchorX:"left",anchorY:"middle",fontWeight:700,children:[`Node ${t.node_id}`,t.is_driver?"  DRIVER":""]}),p.jsx(pa,{position:[-d/2+.15,v,-h/2+.35],rotation:[-Math.PI/2,0,0],fontSize:.07,color:Sn.textBlack,anchorX:"left",anchorY:"middle",children:t.hostname}),p.jsx(pa,{position:[-d/2+.15,v,.25],rotation:[-Math.PI/2,0,0],fontSize:.08,color:Sn.textBlack,anchorX:"left",anchorY:"middle",children:c}),p.jsx(pa,{position:[-d/2+.15,v,.45],rotation:[-Math.PI/2,0,0],fontSize:.06,color:Sn.textBlack,anchorX:"left",anchorY:"middle",children:`${t.cpu.cores}C CPU · ${Math.round(t.memory.total_gb)}GB RAM`})]})}function CAe({topology:t,onSelectNode:e}){const i=T.useMemo(()=>{const a=[],o=Math.ceil(Math.sqrt(t.nodes.length)),l=3.2,c=2.2;return t.nodes.forEach((d,h)=>{const g=Math.floor(h/o),v=h%o,_=-(Math.min(o,t.nodes.length-g*o)-1)*l/2;a.push([v*l+_,.3,g*c])}),a},[t.nodes]),s=T.useMemo(()=>{if(i.length===0)return{w:4,d:3,cx:0,cz:0};let a=1/0,o=-1/0,l=1/0,c=-1/0;for(const[h,,g]of i)a=Math.min(a,h-2.5/2),o=Math.max(o,h+2.5/2),l=Math.min(l,g-1.5/2),c=Math.max(c,g+1.5/2);const d=.6;return{w:o-a+d*2,d:c-l+d*2,cx:(a+o)/2,cz:(l+c)/2}},[i]);return p.jsxs(p.Fragment,{children:[p.jsx("color",{attach:"background",args:[Sn.background]}),p.jsx("ambientLight",{intensity:.7}),p.jsx("directionalLight",{position:[8,12,5],intensity:.8}),p.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),p.jsx("hemisphereLight",{color:"#ffffff",groundColor:"#ffffff",intensity:.5}),p.jsx(XK,{}),p.jsx("gridHelper",{args:[50,50,Sn.gridColor,Sn.gridColor],position:[0,-.04,0]}),p.jsxs(Vu,{args:[s.w,.06,s.d],radius:0,smoothness:4,position:[s.cx,0,s.cz],children:[p.jsx("meshBasicMaterial",{color:Sn.platform}),p.jsx(sm,{color:Sn.platformBorder,threshold:1,scale:1.002})]}),t.nodes.map((a,o)=>p.jsx(EAe,{node:a,position:i[o],onClick:()=>e(a.node_id)},a.node_id))]})}function AAe({focusTarget:t,overviewPosition:e,overviewLookAt:n}){const{camera:r}=$c(),i=$c(g=>g.controls),s=T.useRef(new ze(...e)),a=T.useRef(new ze(...n)),o=T.useRef(!1),l=T.useRef(null),c=T.useRef(e.join(",")),d=e.join(",");T.useEffect(()=>{c.current=d,!t&&i&&(r.position.set(...e),i.target.set(...n),i.update(),o.current=!1)},[d]);const h=t?t.position.join(","):null;return T.useEffect(()=>{if(l.current=h,t){const[g,v,b]=t.position;s.current.set(g+.8,v+1.2,b+1.4),a.current.set(g,v,b),o.current=!0}else o.current=!1},[h]),RE(()=>{if(!i||!o.current)return;const g=.06;r.position.lerp(s.current,g);const v=i;v.target.lerp(a.current,g),i.update();const b=r.position.distanceTo(s.current),_=v.target.distanceTo(a.current);b<.01&&_<.01&&(r.position.copy(s.current),v.target.copy(a.current),i.update(),o.current=!1)}),null}function Yi({label:t,value:e,mono:n=!0}){return p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:t}),p.jsx("span",{className:n?"font-mono":"",children:e})]})}function NAe({topology:t,focusedItem:e,onClose:n}){return p.jsx("div",{className:"absolute top-4 right-4 w-72 max-h-[calc(100%-2rem)] overflow-auto",children:e?p.jsxs("div",{className:"bg-white border border-black rounded-none p-4",children:[e.type==="gpu"&&(()=>{const r=e.data,i=r.role.role==="trainer"?Sn.trainer:r.role.role==="inference"?Sn.inference:Sn.unassigned;return p.jsxs("div",{className:"space-y-1 text-[11px] text-black",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-2",children:"GPU Details"}),p.jsx("div",{className:"font-mono text-black text-xs mb-1",children:r.hardware.name}),p.jsx(Yi,{label:"Node / Index",value:`#${e.nodeId} / GPU ${r.local_index}`}),p.jsx(Yi,{label:"Role",value:p.jsx("span",{className:"font-semibold",style:{color:i},children:r.role.role.charAt(0).toUpperCase()+r.role.role.slice(1)}),mono:!1}),r.role.rank!==void 0&&p.jsx(Yi,{label:"Rank",value:r.role.rank}),r.role.dp_rank!==void 0&&p.jsx(Yi,{label:"DP / TP / PP",value:`${r.role.dp_rank} / ${r.role.tp_rank} / ${r.role.pp_rank}`}),r.role.server_idx!==void 0&&p.jsx(Yi,{label:"Server",value:r.role.server_idx}),r.role.url&&p.jsx(Yi,{label:"URL",value:p.jsx("span",{className:"text-[9px]",children:r.role.url})}),p.jsx("div",{className:"border-t border-black mt-1.5 pt-1.5"}),p.jsx(Yi,{label:"VRAM",value:`${r.hardware.memory_total_gb} GB`}),p.jsx(Yi,{label:"PCIe",value:`Gen${r.hardware.pcie_gen} x${r.hardware.pcie_width}`}),p.jsx(Yi,{label:"Serial",value:p.jsx("span",{className:"text-[9px]",children:r.hardware.serial})}),p.jsx(Yi,{label:"UUID",value:p.jsx("span",{className:"text-[9px] break-all",children:r.hardware.uuid})})]})})(),e.type==="cpu"&&(()=>{const r=e.data;return p.jsxs("div",{className:"space-y-1 text-[11px] text-black",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-2",children:"CPU Details"}),p.jsx("div",{className:"font-mono text-black text-xs mb-1",children:r.model}),p.jsx(Yi,{label:"Node",value:`#${e.nodeId}`}),p.jsx(Yi,{label:"Architecture",value:r.architecture}),p.jsx(Yi,{label:"Cores",value:r.cores}),p.jsx(Yi,{label:"Logical Cores",value:r.logical_cores}),p.jsx(Yi,{label:"Sockets",value:r.sockets}),p.jsx(Yi,{label:"Frequency",value:`${(r.frequency_mhz/1e3).toFixed(2)} GHz`})]})})(),e.type==="ram"&&(()=>{const r=e.data;return p.jsxs("div",{className:"space-y-1 text-[11px] text-black",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-2",children:"System Memory"}),p.jsx(Yi,{label:"Node",value:`#${e.nodeId}`}),p.jsx(Yi,{label:"Total",value:`${r.total_gb.toFixed(0)} GB`})]})})(),p.jsx("button",{onClick:n,className:"mt-4 w-full py-1.5 text-xs font-medium text-black border border-black rounded-none hover:bg-black hover:text-white transition-colors",children:"Close"})]}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"bg-white border border-black rounded-none p-4 mb-3",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-2",children:"Cluster Overview"}),p.jsxs("div",{className:"space-y-1 text-[11px] text-black",children:[p.jsx(Yi,{label:"Model",value:p.jsx("span",{className:"text-black",children:t.model||"—"}),mono:!1}),p.jsx(Yi,{label:"Nodes",value:t.nodes.length}),p.jsx(Yi,{label:"Total GPUs",value:t.total_gpus}),t.trainer_config&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-black mt-2 pt-2 mb-1 text-[10px] font-semibold uppercase tracking-wider",style:{color:Sn.trainer},children:"Trainer"}),p.jsx(Yi,{label:"GPUs",value:t.trainer_total_gpus}),p.jsx(Yi,{label:"Backend",value:t.trainer_config.backend}),p.jsx(Yi,{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&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-black mt-2 pt-2 mb-1 text-[10px] font-semibold uppercase tracking-wider",style:{color:Sn.inference},children:"Inference"}),p.jsx(Yi,{label:"GPUs",value:t.inference_total_gpus}),p.jsx(Yi,{label:"Servers",value:t.inference_config.num_servers}),p.jsx(Yi,{label:"TP Size",value:t.inference_config.tensor_parallel_size}),p.jsx(Yi,{label:"Placement",value:t.inference_config.placement_strategy})]})]})]}),p.jsxs("div",{className:"bg-white border border-black rounded-none p-3",children:[p.jsx("div",{className:"text-[10px] font-semibold text-black mb-1.5",children:"Legend"}),p.jsxs("div",{className:"space-y-1",children:[p.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-black",children:[p.jsx("div",{className:"w-3 h-2",style:{background:Sn.trainer}}),"Trainer GPU"]}),p.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-black",children:[p.jsx("div",{className:"w-3 h-2",style:{background:Sn.inference}}),"Inference GPU"]}),p.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-black",children:[p.jsx("div",{className:"w-3 h-2",style:{background:Sn.unassigned}}),"Unassigned GPU"]}),p.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-black",children:[p.jsx("div",{className:"w-3 h-1",style:{background:Sn.nvlink}}),"NVLink"]})]})]})]})})}function RAe({topology:t,hoveredItem:e,setHoveredItem:n,setSelectedItem:r,focusedItem:i}){const s=T.useMemo(()=>{const a=[],o=Math.ceil(Math.sqrt(t.nodes.length)),l=6.5,c=3.5;return t.nodes.forEach((d,h)=>{const g=Math.floor(h/o),v=h%o,_=-(Math.min(o,t.nodes.length-g*o)-1)*l/2;a.push([v*l+_,0,g*c])}),a},[t.nodes]);return p.jsxs(p.Fragment,{children:[p.jsx("color",{attach:"background",args:[Sn.background]}),p.jsx("ambientLight",{intensity:.7}),p.jsx("directionalLight",{position:[8,12,5],intensity:.8}),p.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),p.jsx("hemisphereLight",{color:"#ffffff",groundColor:"#ffffff",intensity:.5}),p.jsx(XK,{}),p.jsx("gridHelper",{args:[50,50,Sn.gridColor,Sn.gridColor],position:[0,-.04,0]}),t.nodes.map((a,o)=>p.jsx(TAe,{node:a,position:s[o],hoveredItem:i?null:e,setHoveredItem:i?()=>{}:n,setSelectedItem:i?()=>{}:r},a.node_id))]})}function YK({topology:t}){const[e,n]=T.useState(null),[r,i]=T.useState(null),[s,a]=T.useState(null),o=t.nodes.length>1,l=o&&s===null,c=T.useMemo(()=>{if(!o||s===null)return t;const S=t.nodes.find(E=>E.node_id===s);return S?{...t,nodes:[S]}:t},[t,s,o]),d=T.useMemo(()=>{const S=l?t:c,E=S.nodes.length,A=Math.max(...S.nodes.map(I=>I.gpus.length),1);if(l){const I=Math.max(4,E*1.5);return[I*.6,I*.9,I*.6]}const N=Math.max(3.5,E*1.8,A*.8);return[N*.8,N*.7,N*.8]},[t,c,l]),h=T.useMemo(()=>[0,0,0],[]),g=T.useCallback(S=>{i(S),S&&n(null)},[]),v=T.useCallback(()=>{i(null)},[]),b=T.useCallback(()=>{a(null),i(null),n(null)},[]),_=T.useCallback(S=>{a(S),i(null),n(null)},[]),w=r!==null;return p.jsxs("div",{className:"relative w-full h-full bg-white",children:[p.jsxs(ZEe,{camera:{position:d,fov:45,near:.1,far:100},gl:{antialias:!0,alpha:!1},onCreated:({gl:S})=>{S.setClearColor(Sn.background),S.toneMapping=nu},children:[l?p.jsx(CAe,{topology:t,onSelectNode:_}):p.jsx(RAe,{topology:c,hoveredItem:e,setHoveredItem:n,setSelectedItem:g,focusedItem:r}),p.jsx(AAe,{focusTarget:!l&&r?{position:r.worldPosition}:null,overviewPosition:d,overviewLookAt:h}),p.jsx(mAe,{makeDefault:!0,enablePan:!0,enableZoom:!0,enableRotate:!0,minDistance:1,maxDistance:30,maxPolarAngle:Math.PI/2-.05,onStart:()=>{r&&v()}})]}),o&&s!==null&&p.jsx("button",{onClick:b,className:"absolute top-4 left-4 px-3 py-1.5 text-xs font-medium text-black bg-white border border-black rounded-none hover:bg-black hover:text-white transition-colors select-none",children:"← Back to cluster"}),p.jsx(NAe,{topology:l?t:c,focusedItem:r,onClose:v}),p.jsx("div",{className:"absolute bottom-4 left-4 text-[10px] text-black/60 select-none",children:l?"Click a node to inspect · Drag to orbit · Scroll to zoom":w?"Move to dismiss · Click Close to return":"Drag to orbit · Scroll to zoom · Right-click to pan · Click an object to focus"})]})}function KK(t){if(t&&typeof t=="object"&&"value"in t)return KK(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 kAe=[1,5,10,30,60,120,300],V6=gT,lF=gT,PAe=["torch_allocated_gb"],DAe="__timeline_noop_metric__";function DE(t){return j9(t==null?void 0:t.setup)}function IAe(t){const e=DE(t),n={},r=mi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const a=mi(s);if(!a)continue;const o=Er(a.node_id),l=Array.isArray(a.gpus)?a.gpus:[];for(const c of l){const d=mi(c);if(!d)continue;const h=Er(d.rank);h!==null&&(n[h]={node_id:o,local_rank:Er(d.local_rank)})}}return n}function OAe(t){const e=DE(t),n=mi(e==null?void 0:e.inference);return Er(n==null?void 0:n.num_servers)??void 0}function LAe(t){const e=DE(t),n={},r=mi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const a=mi(s);if(!a)continue;const o=Er(a.node_id),l=Array.isArray(a.gpus)?a.gpus:[];for(const c of l){const d=mi(c);if(!d)continue;const h=Er(d.server_idx);h!==null&&(h in n||(n[h]=o))}}return n}function cF(t){const e=DE(t),n=mi(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 zAe(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),a=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10),l=s*3600+a*60+o;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function jAe({value:t,onChange:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(""),a=T.useRef(null),o=c=>{c&&(s(V6(t)),setTimeout(()=>{var d;return(d=a.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=zAe(i);c!==null&&(e(c),r(!1))};return p.jsxs(aT,{open:n,onOpenChange:o,children:[p.jsx(oT,{asChild:!0,children:p.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:[V6(t),p.jsx(Vr,{className:"size-3 text-muted-foreground"})]})}),p.jsxs(lT,{align:"start",className:"w-40 p-1.5 gap-1",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("input",{ref:a,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"}),p.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"})]}),p.jsx("div",{className:"flex flex-col",children:kAe.map(c=>p.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:V6(c)},c))})]})]})}function FAe(){var B,q,Y,K;const t=ki(ml),[e,n]=cn(Nce),[r,i]=cn(Rce),s=!0,{data:a,isFetching:o,isPlaceholderData:l,error:c}=due(t||"",e,r,!!t),{data:d}=ed(t||"",!!t,s),h=T.useMemo(()=>{var F;const J=(F=d==null?void 0:d.config)==null?void 0:F.trainer_devices;return KK(J)},[(B=d==null?void 0:d.config)==null?void 0:B.trainer_devices]),g=(a==null?void 0:a.interval_start)??null,v=(a==null?void 0:a.interval_end)??null,b=o&&(l||!a),[_,w]=T.useState(()=>[...PAe]),S=T.useMemo(()=>{const J=Array.from(new Set(_.filter(F=>typeof F=="string"&&F.trim().length>0))).sort((F,j)=>F.localeCompare(j));return J.length>0?J:[DAe]},[_]),E=T.useMemo(()=>IAe(d==null?void 0:d.summary),[d==null?void 0:d.summary]),A=T.useMemo(()=>{const J={},F=(a==null?void 0:a.trainer_events)??[];for(const j of F){const X=j.rank;if(!Number.isFinite(X))continue;const H=J[X]??{node_id:null,local_rank:null},se=H.node_id!==null?H.node_id:typeof j.node_id=="number"&&Number.isFinite(j.node_id)?j.node_id:null,re=H.local_rank!==null?H.local_rank:typeof j.local_rank=="number"&&Number.isFinite(j.local_rank)?j.local_rank:null;J[X]={node_id:se,local_rank:re}}return J},[a==null?void 0:a.trainer_events]),N=T.useMemo(()=>{const J={};return new Set([...Object.keys(E).map(Number),...Object.keys(A).map(Number)]).forEach(j=>{const X=E[j],H=A[j];J[j]={node_id:(X==null?void 0:X.node_id)??(H==null?void 0:H.node_id)??null,local_rank:(X==null?void 0:X.local_rank)??(H==null?void 0:H.local_rank)??null}}),J},[E,A]),I=T.useMemo(()=>LAe(d==null?void 0:d.summary),[d==null?void 0:d.summary]),P=T.useMemo(()=>{const J={},F=(a==null?void 0:a.inference_events)??[];for(const j of F){const X=j.server;Number.isFinite(X)&&J[X]===void 0&&typeof j.node_id=="number"&&Number.isFinite(j.node_id)&&(J[X]=j.node_id)}return J},[a==null?void 0:a.inference_events]),L=T.useMemo(()=>{const J={};return new Set([...Object.keys(I).map(Number),...Object.keys(P).map(Number)]).forEach(j=>{J[j]=I[j]??P[j]??null}),J},[I,P]),R=T.useMemo(()=>{const J=((a==null?void 0:a.trainer_events)??[]).map(j=>j.rank).filter(j=>Number.isFinite(j)),F=Object.keys(N).map(Number);return Array.from(new Set([...J,...F])).sort((j,X)=>j-X)},[a==null?void 0:a.trainer_events,N]),O=T.useMemo(()=>R.map(J=>{var F,j;return{rank:J,node_id:((F=N[J])==null?void 0:F.node_id)??null,local_rank:((j=N[J])==null?void 0:j.local_rank)??null}}),[R,N]),W=T.useMemo(()=>{const J=[];let F=!1;return R.forEach(j=>{var H;const X=(H=N[j])==null?void 0:H.local_rank;X!=null&&(J[j]=X,F=!0)}),F?J:h},[N,R,h]),U=pue(t||"",S,O,g,v,!!t&&g!==null&&v!==null&&O.length>0),V=T.useMemo(()=>{const J={};return O.forEach((F,j)=>{var H;const X=(H=U[j])==null?void 0:H.data;J[F.rank]=(X==null?void 0:X.metrics)??[]}),J},[O,U]),G=T.useMemo(()=>{const J=[];U.forEach(X=>{const H=X.data;H!=null&&H.available_metrics&&H.available_metrics.forEach(se=>{typeof se=="string"&&J.push(se)})});const F=Array.from(new Set(J));if(F.length>0)return F;const j=new Set;return U.forEach(X=>{var se;const H=X.data;(se=H==null?void 0:H.metrics)==null||se.forEach(re=>{typeof re.metric_name=="string"&&j.add(re.metric_name)})}),Array.from(j).sort((X,H)=>X.localeCompare(H))},[U]),Z=U.some(J=>J.isFetching);return t?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center gap-2 h-7",children:[p.jsx(jk,{currentPage:e,totalPages:(a==null?void 0:a.total_pages)??1,onPageChange:n}),p.jsx(jAe,{value:r,onChange:J=>{const F=Math.floor(e*r/J);i(J),n(F)}}),g!==null&&v!==null&&(a==null?void 0:a.global_min_time)!=null&&p.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[lF(g-a.global_min_time)," – ",lF(v-a.global_min_time)]})]})})}),p.jsx("div",{className:"flex-1 overflow-auto p-6",children:p.jsxs("div",{className:"max-w-7xl mx-auto",children:[c&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error: ",c instanceof Error?c.message:"Unknown error"]})})}),p.jsx(Pbe,{orchestratorData:a==null?void 0:a.orchestrator_events,trainerData:a==null?void 0:a.trainer_events,inferenceData:a==null?void 0:a.inference_events,isLoading:b,intervalStart:(a==null?void 0:a.interval_start)??0,intervalEnd:(a==null?void 0:a.interval_end)??r,trainerGpuMetricsByRank:V,trainerGpuMetricsIsLoading:Z,trainerAvailableGpuMetrics:G,selectedTrainerGpuMetrics:_,onSelectedTrainerGpuMetricsChange:w,trainerSystemGpuIndices:W,trainerRankInfoByRank:N,totalSetupNodes:cF(d==null?void 0:d.summary),inferenceServerNodeMap:L,numInferenceServers:OAe(d==null?void 0:d.summary)??((q=d==null?void 0:d.config)==null?void 0:q.num_inference_servers),maxConcurrentPrompts:(Y=d==null?void 0:d.config)==null?void 0:Y.max_concurrent_prompts,groupSize:(K=d==null?void 0:d.config)==null?void 0:K.group_size})]})}),p.jsx(UAe,{runPath:t,trainerEvents:a==null?void 0:a.trainer_events,totalSetupNodes:cF(d==null?void 0:d.summary)})]}):p.jsx(hm,{description:"Select a run from the sidebar to view the timeline."})}function UAe({runPath:t,trainerEvents:e,totalSetupNodes:n}){const[r,i]=cn(_G),[s,a]=cn(bG),[o,l]=T.useState("inference"),[c,d]=T.useState(r),[h,g]=T.useState(s);r!==c&&(d(r),r&&l("inference")),s!==h&&(g(s),s&&l("trainer"));const{data:v}=fue(t??"",(r==null?void 0:r.groupId)??null,!!r&&!!t),b=T.useMemo(()=>{if(!r||!(v!=null&&v.events))return null;const se={};for(const re of v.events)re.sample_id!==void 0&&(se[re.sample_id]||(se[re.sample_id]=[]),se[re.sample_id].push(re));return se},[r,v]),_=T.useMemo(()=>{if(!v)return null;const se=v.environment_response_times??[],re=v.compute_reward_times??[],ie={};for(const le of se)ie[le.sample_idx]||(ie[le.sample_idx]=[]),ie[le.sample_idx].push({turn_order:le.turn_order,time:le.time});for(const le of Object.values(ie))le.sort((fe,xe)=>fe.turn_order-xe.turn_order);const ue={};for(const le of re)ue[le.sample_idx]=le.time;return{envBySample:ie,rewardBySample:ue}},[v]),w=T.useMemo(()=>{if(!b)return null;let se=1/0,re=-1/0;for(const[ie,ue]of Object.entries(b)){for(const le of ue){se=Math.min(se,le.start_time),re=Math.max(re,le.end_time);let fe=le.end_time;le.environment_response_time&&le.environment_response_time>0&&(fe+=le.environment_response_time),le.compute_reward_time&&le.compute_reward_time>0&&(fe+=le.compute_reward_time),re=Math.max(re,fe)}if(_){const le=Number(ie),fe=[...ue].sort((We,Se)=>We.start_time-Se.start_time),xe=_.envBySample[le]??[];let he=-1/0;for(let We=0;We<fe.length;We++)he=fe[We].end_time,We<xe.length&&xe[We].time>0&&(he+=xe[We].time);const Te=_.rewardBySample[le]??0;Te>0&&(he+=Te),re=Math.max(re,he)}}return se===1/0?null:{start:se,end:re,duration:re-se}},[b,_]),{data:S}=hue(t??"",(s==null?void 0:s.eventType)??null,(s==null?void 0:s.rank)??null,(s==null?void 0:s.step)??null,!!t&&!!s),E=T.useMemo(()=>S!=null&&S.events&&S.events.length>0?S.events:e??[],[S,e]),A=T.useMemo(()=>{if(E.length===0)return{};const se={};for(const re of E)se[re.rank]||(se[re.rank]=[]),se[re.rank].push(re);return se},[E]),N=T.useMemo(()=>s?(A[s.rank]||[]).find(re=>re.event_type===s.eventType&&re.step===s.step&&re.rank===s.rank&&!re.event_type.includes("/"))??null:null,[s,A]),I=T.useMemo(()=>s?(A[s.rank]||[]).filter(re=>re.event_type.startsWith(s.eventType+"/")&&re.step===s.step):[],[s,A]),P=ki(dT),L=ki(yG),R=T.useMemo(()=>!r||!b?[]:Object.keys(b).map(Number).map(se=>({group_id:r.groupId,sample_idx:se})),[r,b]),{data:O}=w8(t??"",R,!!t&&R.length>0&&P),W=!P||R.length===0||!!O,U=T.useMemo(()=>!P||!(O!=null&&O.statuses)?!1:O.statuses.some(se=>se.kind==="rollouts_discarded"),[P,O]),V=T.useMemo(()=>b?Object.values(b).some(se=>se.some(re=>re.is_canceled)):!1,[b]),{data:G}=RG(t??"",(r==null?void 0:r.groupId)??null,(r==null?void 0:r.sampleId)??null,!!t&&!!r,r==null?void 0:r.isEval),Z=T.useMemo(()=>!G||G.kind!=="rollouts_discarded"?null:G.discard_reason,[G]),B=T.useMemo(()=>{if(!G||G.kind===null)return null;const se=G.samples_data;if(!se||se.length===0)return null;const re=se.map(ie=>ie.reward).filter(ie=>ie!==null);return re.length===0?null:re.every(ie=>ie===0)?"all_zero":re.every(ie=>ie>0)?"all_positive":null},[G]),q=se=>{switch(se){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return se.split("_").map(re=>re.charAt(0).toUpperCase()+re.slice(1)).join(" ")}},Y=!!r,K=!!s&&I.length>0&&!!N,J=o==="inference"&&!Y&&K?"trainer":o==="trainer"&&!K&&Y?"inference":o;if(!Y&&!K)return null;const F=()=>{J==="inference"?(i(null),K&&l("trainer")):(a(null),Y&&l("inference"))},j=N?NG(N.event_type,N.step,N.microbatch,N.minibatch):null,X=N?u2(N.event_type):void 0,H=Y&&K;return p.jsxs("footer",{className:"border-t bg-white shrink-0 h-[28vh] flex flex-col",children:[p.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0",children:[H&&p.jsxs("div",{className:"flex items-center bg-muted rounded-md p-0.5 gap-0.5",children:[p.jsx("button",{onClick:()=>l("inference"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${J==="inference"?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Inference"}),p.jsx("button",{onClick:()=>l("trainer"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${J==="trainer"?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Trainer"})]}),J==="inference"&&r&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:V?"#adadad":U?"#6b7280":r.isEval?"#047857":"#075985"}}),p.jsxs("span",{className:"text-xs font-medium",children:["Sample ",r.sampleId]})]}),p.jsx("span",{className:"text-muted-foreground",children:"/"}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:`w-2.5 h-2.5 rounded-sm${W?"":" animate-pulse bg-muted"}`,style:W?{backgroundColor:V?"#c9c9c9":U?"#a1a1a1":r.isEval?"#10b981":"#0369a1"}:void 0}),p.jsxs("span",{className:"text-xs font-medium",children:["Group ",r.groupId]})]}),V&&p.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-gray-100 text-gray-500 border border-gray-200",children:"Canceled due to async policy"}),Z&&p.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-red-100 text-red-700 border border-red-200",children:q(Z)}),Z==="zero_advantage"&&B==="all_zero"&&p.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"}),Z==="zero_advantage"&&B==="all_positive"&&p.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"})]}),J==="trainer"&&j&&N&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:X}}),p.jsxs("span",{className:"text-xs font-medium",children:[j.primary," Breakdown"]}),p.jsxs("span",{className:"text-xs text-muted-foreground",children:["GPU ",N.rank]}),p.jsxs("span",{className:"text-xs text-muted-foreground",children:["(Step ",N.step,")"]})]}),p.jsx("button",{onClick:F,className:"ml-auto text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:p.jsx(Ju,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"overflow-auto flex-1 min-h-0",children:[J==="inference"&&r&&b&&w&&p.jsx(qbe,{eventsBySampleId:b,selectedSampleId:r.sampleId,timeBounds:w,groupId:r.groupId,runPath:t??"",envResponseTimesBySample:_==null?void 0:_.envBySample,computeRewardTimeBySample:L?_==null?void 0:_.rewardBySample:void 0,onSampleClick:se=>{i({sampleId:se,groupId:r.groupId,isEval:r.isEval})},showNodeLabel:typeof n=="number"&&n>1,isEval:r.isEval}),J==="trainer"&&N&&I.length>0&&p.jsx(r_e,{parentEvent:N,childEvents:I})]})]})}function F9(t,e){const n=typeof IntersectionObserver>"u",[r,i]=T.useState(n),[s,a]=T.useState(n),o=T.useRef(null),l=(e==null?void 0:e.root)??null,c=(e==null?void 0:e.rootMargin)??"0px",d=(e==null?void 0:e.threshold)??0;return T.useEffect(()=>{const h=t.current;if(!h||typeof IntersectionObserver>"u")return;const g=new IntersectionObserver(([v])=>{const b=v.isIntersecting;i(b),b?(o.current&&(clearTimeout(o.current),o.current=null),a(!0)):(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(!1),o.current=null},2e3))},{root:l,rootMargin:c,threshold:d});return g.observe(h),()=>{g.disconnect(),o.current&&clearTimeout(o.current)}},[t,l,c,d]),r||s}const EM={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"}]}},BAe={discarded_stats:{label:"Discarded Rollouts",metrics:[{prefix:"discarded_count",label:"Discarded Count",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_pct",label:"Zero Advantage %",simple:!0,group:"General"},{prefix:"discarded_max_async_pct",label:"Max Async %",simple:!0,group:"General"},{prefix:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length",simple:!0,group:"General"},{prefix:"discarded_group_length_gini_mean",label:"Group Completion Length Gini",simple:!0,group:"General"},{prefix:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_zero_pct",label:"Zero Adv (All Reward = 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_positive_pct",label:"Zero Adv (All Reward > 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_mean_reward",label:"Zero Adv Mean Reward",simple:!0,group:"General"},{prefix:"canceled_count",label:"Canceled Count",simple:!0,group:"Canceled"}]},discarded_tokens:{label:"Discarded Rollouts",metrics:[{prefix:"discarded_length_prompt",label:"Discarded Tokens Prompt"},{prefix:"discarded_length_completion",label:"Discarded Tokens Completion"},{prefix:"discarded_length_sum",label:"Discarded Tokens Total"}],unit:"tokens"}},HAe={timeline_full_step:{label:"Timeline",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_save_batch_total",label:"Batch Completion (Save Batch)",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_microbatch:{label:"Timeline",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)"}]}},d7=["mean","std","min","max"],s1="histogram",a1="distribution_over_time";function uF(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 b0(t,e,n){for(const r of n.metrics){const i="simple"in r&&r.simple,s="group"in r?r.group:void 0,a="showZeroLine"in n?n.showZeroLine:!1,o="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:a,unit:o});continue}for(const d of d7){const h=`${r.prefix}_${d}`,g=d.charAt(0).toUpperCase()+d.slice(1);t.push({category:e,categoryLabel:n.label,group:s,metricKey:h,label:`${r.label} - ${g}`,prefix:r.prefix,suffix:d,showZeroLine:a,unit:o})}const l=`${r.prefix}_${s1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:l,label:`${r.label} - Histogram`,prefix:r.prefix,suffix:s1,showZeroLine:a,unit:o,isHistogram:!0,histogramMetricType:uF(r.prefix)});const c=`${r.prefix}_${a1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:c,label:`${r.label} - Distribution Over Time`,prefix:r.prefix,suffix:a1,showZeroLine:a,unit:o,isDistributionOverTime:!0,histogramMetricType:uF(r.prefix)})}}function VAe(t,e={},n=[]){const r=[];for(const[i,s]of Object.entries(e))for(const[a,o]of Object.entries(s)){const l=a?`custom_${i}_${a}`:`custom_${i}`;b0(r,l,{label:e1(i),metrics:o.map(c=>({prefix:c,label:e1(c),simple:!0,group:a?e1(a):void 0}))})}b0(r,"rewards",EM.rewards),t.length>0&&b0(r,"rollout_metrics",{label:"Samples Metrics",metrics:t.flatMap(i=>[{prefix:`reward_${i}`,label:e1(i)},{prefix:`reward_${i}_gini_mean`,label:`${e1(i)} Sparsity (Gini)`,simple:!0}])}),b0(r,"advantage",EM.advantage),r.push(...GAe(n)),b0(r,"tokens",EM.tokens),b0(r,"rollouts_general",EM.rollouts_general);for(const[i,s]of Object.entries(BAe))b0(r,i,s);for(const[i,s]of Object.entries(HAe))b0(r,i,s);return r}function GAe(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 a=e1(s),o=`${r} / ${a}`,l=`${i}reward_${s}`,c="evals";for(const d of d7){const h=d.charAt(0).toUpperCase()+d.slice(1);e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${d}`,label:`${r} ${a} - ${h}`,prefix:l,suffix:d,isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${s1}`,label:`${r} ${a} - Histogram`,prefix:l,suffix:s1,isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${a1}`,label:`${r} ${a} - Distribution Over Time`,prefix:l,suffix:a1,isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}for(const s of["length_completion","length_prompt","length_sum"]){const a=s==="length_completion"?"Tokens Completion":s==="length_prompt"?"Tokens Prompt":"Tokens Total",o=`${r} / ${a}`,l=`${i}${s}`,c="evals";for(const d of d7){const h=d.charAt(0).toUpperCase()+d.slice(1);e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${d}`,label:`${r} ${a} - ${h}`,prefix:l,suffix:d,unit:"tokens",isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${s1}`,label:`${r} ${a} - Histogram`,prefix:l,suffix:s1,unit:"tokens",isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${a1}`,label:`${r} ${a} - Distribution Over Time`,prefix:l,suffix:a1,unit:"tokens",isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}}return e}function e1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function WAe(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 $Ae(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.isHistogram?"histogram":n.isDistributionOverTime?"distribution_over_time":n.isEvalMetric?"eval_metric":"step_metric",evalName:n.evalName,histogramMetricType:n.histogramMetricType,simple:!n.suffix}))}function U9({openAtom:t=x8}={}){const[e,n]=cn(t);return!ki(ml)||e?null:p.jsx(Tn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Metrics"})}function B9({currentStep:t,maxSelectableStep:e,openAtom:n=x8,selectedMetricsAtom:r=zce,selectedStepAtom:i=uT,includeDiscardedDefaults:s=!1,evalConfig:a}){var fe,xe;const[o,l]=cn(n),[c,d]=cn(r),[h,g]=T.useState(!1),v=h&&(a==null?void 0:a.selectedSampleIdx)!=null,[b,_]=T.useState(!1),[w,S]=T.useState(10),[E,A]=T.useState("10"),N=ki(ml),I=ki(cT),P=ki(fT),L=!0,R=!!a,{data:O}=fm(),{data:W}=ed(N||"",!!N,L),U=T.useMemo(()=>(W==null?void 0:W.available_rollout_metric_names)??[],[W==null?void 0:W.available_rollout_metric_names]),V=T.useMemo(()=>{var he;return((he=W==null?void 0:W.step_metrics_info)==null?void 0:he.custom_metric_sections)??{}},[(fe=W==null?void 0:W.step_metrics_info)==null?void 0:fe.custom_metric_sections]),G=T.useMemo(()=>{var he;return((he=W==null?void 0:W.eval_info)==null?void 0:he.evals)??[]},[(xe=W==null?void 0:W.eval_info)==null?void 0:xe.evals]),Z=T.useRef(!1);T.useEffect(()=>{if(R||Z.current)return;if(c.length>0){Z.current=!0;return}if(!W)return;Z.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",...U.flatMap(Te=>[`reward_${Te}_mean`,`reward_${Te}_distribution_over_time`]),...s?["discarded_count","discarded_zero_advantage_pct","discarded_max_async_pct","discarded_zero_advantage_all_zero_pct","discarded_zero_advantage_all_positive_pct"]:[]];d(he)},[W,U,R]);const B=T.useRef(new Set);T.useEffect(()=>{if(R||U.length===0)return;const he=[];for(const Te of U){if(!B.current.has(Te)){const We=`reward_${Te}_mean`,Se=`reward_${Te}_distribution_over_time`;c.includes(We)||he.push(We),c.includes(Se)||he.push(Se)}B.current.add(Te)}he.length>0&&d(Te=>[...Te,...he])},[U,R]);const q=T.useRef("");T.useEffect(()=>{if(!R||!a)return;const he=`${a.prefix}|${a.rewardNames.join(",")}`;if(he===q.current)return;q.current=he;const Te=a.prefix,We=[`${Te}length_completion_mean`,`${Te}length_completion_std`,`${Te}length_completion_min`,`${Te}length_completion_max`,`${Te}length_completion_distribution_over_time`,...a.rewardNames.flatMap(Se=>[`${Te}reward_${Se}_mean`,`${Te}reward_${Se}_distribution_over_time`])];d(We)},[a,R,d]);const Y=T.useMemo(()=>{const he=(O==null?void 0:O.runs)||[],Te=new Set(I);return N&&Te.add(N),he.filter(We=>Te.has(We.run_id)).map(We=>({runPath:We.run_id,runName:We.name,color:We.color,isSelected:We.run_id===N}))},[N,I,O==null?void 0:O.runs]),K=T.useMemo(()=>VAe(U,V,G),[U,V,G]),J=T.useMemo(()=>WAe(K),[K]),F=T.useMemo(()=>{const he=new Set(K.map(Te=>Te.metricKey));return c.filter(Te=>he.has(Te))},[c,K]),j=T.useMemo(()=>$Ae(K),[K]),X=T.useMemo(()=>F.map(he=>{const Te=K.find(We=>We.metricKey===he);return{id:he,metricKey:he,label:(Te==null?void 0:Te.label)||he,plotType:Te!=null&&Te.isHistogram?"histogram":Te!=null&&Te.isDistributionOverTime?"distribution_over_time":Te!=null&&Te.isEvalMetric?"eval_metric":"step_metric"}}),[F,K]),H=he=>{he&&d(Te=>Te.includes(he)?Te.filter(We=>We!==he):[...Te,he])},se=he=>{d(Te=>Te.filter(We=>We!==he))},re=he=>K.find(Te=>Te.metricKey===he),[ie,ue]=T.useState(null),le=T.useCallback(he=>{if(!he||!o){ue(null);return}const Te=he.querySelector('[data-slot="scroll-area-viewport"]');Te&&ue(Te)},[o]);return!N||!o?null:p.jsxs("div",{className:"w-[320px] border-l border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[p.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center justify-between shrink-0",children:[p.jsx("h2",{className:"font-semibold text-sm",children:R?"Eval Metrics":"Training Metrics"}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l(!1),children:p.jsx(Yle,{className:"h-4 w-4"})})]}),p.jsx("div",{className:"px-4 py-2 border-b border-border shrink-0",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(K1,{catalog:j,onSelect:he=>H(he.metricKey),existingPlots:X,children:p.jsxs("button",{type:"button",className:Rt("flex flex-1 items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs transition-colors select-none min-h-[28px]","border-input bg-transparent hover:bg-accent/50",F.length>0?"text-foreground":"text-muted-foreground"),children:[p.jsx("span",{className:"font-medium",children:"Charts"}),F.length>0&&p.jsx("span",{className:"text-[10px] bg-accent text-accent-foreground rounded px-1.5 py-0 font-medium",children:F.length}),p.jsx(Vr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 ml-auto"})]})}),p.jsx(cS,{label:"EMA",variant:"selecting",size:"sm",enabled:b,onEnabledChange:_,value:E,onValueChange:A,onValueCommit:he=>{const Te=parseInt(he,10);!isNaN(Te)&&Te>=2&&Te<=100?(S(Te),A(Te.toString())):A(w.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"})]})}),p.jsx(yv,{ref:le,className:"flex-1 min-h-0",children:p.jsxs("div",{className:"p-4 space-y-4",children:[R&&p.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[p.jsx(Tn,{variant:h?"outline":"default",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>g(!1),children:"All"}),p.jsx(Tn,{variant:h?"default":"outline",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>g(!0),disabled:(a==null?void 0:a.selectedSampleIdx)==null,children:"Selected"})]}),F.length===0?p.jsx("div",{className:"h-32 flex items-center justify-center text-muted-foreground text-sm text-center px-4",children:"Click on a metric above to add charts"}):Object.entries(J).map(([he,{label:Te,metrics:We}])=>{const Se=We.filter(Le=>F.includes(Le.metricKey)).map(Le=>Le.metricKey);return Se.length===0?null:p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:Te}),p.jsx("div",{className:"space-y-4",children:Se.map(Le=>{const pe=re(Le);if(v&&(pe!=null&&pe.isHistogram||pe!=null&&pe.isDistributionOverTime||pe!=null&&pe.suffix&&pe.suffix!=="mean"&&pe.suffix!==""))return null;const Re=R&&v?`/s/${a.selectedSampleIdx}/`:"/",Xe=R&&Le.startsWith("eval/")?Le.replace(/^(eval\/[^/]+)\//,`$1${Re}`):Le,Ae=(pe==null?void 0:pe.histogramMetricType)||"",Pe=R&&Ae.startsWith("eval/")?Ae.replace(/^(eval\/[^/]+)\//,`$1${Re}`):Ae,Ke=v&&(pe==null?void 0:pe.suffix)==="mean"?(pe.label||Le).replace(/ - Mean$/,""):(pe==null?void 0:pe.label)||Le;return pe!=null&&pe.isHistogram?p.jsx(KAe,{runPath:N,step:t,metricType:Pe,label:Ke,showZeroLine:pe==null?void 0:pe.showZeroLine,unit:pe==null?void 0:pe.unit,isTokenMetric:(pe==null?void 0:pe.category)==="tokens",onRemove:()=>se(Le),scrollRoot:ie},Pe):pe!=null&&pe.isDistributionOverTime?p.jsx(QAe,{runPath:N,metricType:Pe,label:Ke,showZeroLine:pe==null?void 0:pe.showZeroLine,unit:pe==null?void 0:pe.unit,isTokenMetric:(pe==null?void 0:pe.category)==="tokens",currentStep:t,shouldPoll:L,onRemove:()=>se(Le),selectedStepAtom:i,maxSelectableStep:e,scrollRoot:ie},Pe):p.jsx(XAe,{runs:Y,shouldPoll:L,metricKey:Xe,label:Ke,showZeroLine:pe==null?void 0:pe.showZeroLine,unit:pe==null?void 0:pe.unit,isTokenMetric:(pe==null?void 0:pe.category)==="tokens",showEma:b,emaSpan:w,currentStep:t,onRemove:()=>se(Le),hoveredRunId:P,selectedStepAtom:i,maxSelectableStep:e,scrollRoot:ie},Le)})})]},he)})]})})]})}function qAe(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 Df(t,e,n,r){const{isEval:i,evalName:s,rawMetricName:a,sampleIdx:o}=qAe(e),l=kG(t,e,n&&!i,r),c=yue(t,s,a,n&&i,r,o);return i?c:l}function XAe({runs:t,shouldPoll:e,metricKey:n,label:r,showZeroLine:i,unit:s,isTokenMetric:a,showEma:o=!1,emaSpan:l=10,currentStep:c,onRemove:d,hoveredRunId:h=null,selectedStepAtom:g=uT,maxSelectableStep:v,scrollRoot:b=null}){var We,Se,Le,pe,Re,ne,Xe,Ae,Pe,Ke;const _=zd(g),w=T.useRef(null),S=T.useRef(null),E=T.useRef(null),A=T.useRef(null),N=T.useRef(null),I=F9(w,{root:b,threshold:0}),P=Df(((We=t[0])==null?void 0:We.runPath)||"",n,I&&!!t[0],e),L=Df(((Se=t[1])==null?void 0:Se.runPath)||"",n,I&&!!t[1],e),R=Df(((Le=t[2])==null?void 0:Le.runPath)||"",n,I&&!!t[2],e),O=Df(((pe=t[3])==null?void 0:pe.runPath)||"",n,I&&!!t[3],e),W=Df(((Re=t[4])==null?void 0:Re.runPath)||"",n,I&&!!t[4],e),U=Df(((ne=t[5])==null?void 0:ne.runPath)||"",n,I&&!!t[5],e),V=Df(((Xe=t[6])==null?void 0:Xe.runPath)||"",n,I&&!!t[6],e),G=Df(((Ae=t[7])==null?void 0:Ae.runPath)||"",n,I&&!!t[7],e),Z=Df(((Pe=t[8])==null?void 0:Pe.runPath)||"",n,I&&!!t[8],e),B=Df(((Ke=t[9])==null?void 0:Ke.runPath)||"",n,I&&!!t[9],e),q=T.useMemo(()=>{const oe=t.filter(_e=>!_e.isSelected),te=t.filter(_e=>_e.isSelected);return[...oe,...te]},[t]),Y=T.useMemo(()=>q.slice(0,10),[q]),K=T.useMemo(()=>{const oe=new Map;return Y.forEach((te,_e)=>{oe.set(te.runPath,_e)}),oe},[Y]),{uplotData:J,seriesConfig:F,isFetching:j,isRefetching:X,isPlaceholderData:H,hasData:se,minStep:re,maxStep:ie}=T.useMemo(()=>{const oe=[P,L,R,O,W,U,V,G,Z,B],te=new Map;t.forEach((Fe,Ge)=>{Ge<10&&te.set(Fe.runPath,oe[Ge])});const _e=new Set,ve=new Map;let ye=!1,ke=!1,Be=!1;if(q.forEach((Fe,Ge)=>{var Oe;if(Ge>=10)return;const Me=te.get(Fe.runPath);if(!Me)return;Me.isFetching&&(ye=!0),Me.isRefetching&&(ke=!0),Me.isPlaceholderData&&(Be=!0);const $e=((Oe=Me.data)==null?void 0:Oe.metrics)||[],dt=new Map;$e.forEach(st=>{_e.add(st.step),dt.set(st.step,st.value)}),ve.set(Ge,dt)}),_e.size===0)return{uplotData:null,seriesConfig:[],isFetching:ye,isRefetching:ke,isPlaceholderData:Be,hasData:!1,minStep:0,maxStep:0};const ge=Array.from(_e).sort((Fe,Ge)=>Fe-Ge),Ye=new Float64Array(ge),Qe=[{label:"Step"}],Ie=[Ye];return q.forEach((Fe,Ge)=>{if(Ge>=10)return;const Me=ve.get(Ge)||new Map,$e=ge.map(ft=>Me.get(ft)??null),dt=h===Fe.runPath,Oe=h!==null;let st;Oe&&!dt?st=.1:st=o?.3:1,Ie.push($e),Qe.push({label:sv(Fe),stroke:Fe.color,width:1,alpha:st,spanGaps:!0,points:{show:!1}})}),o&&q.forEach((Fe,Ge)=>{if(Ge>=10)return;const Me=ve.get(Ge)||new Map,$e=2/(l+1);let dt=null;const Oe=[];ge.forEach(et=>{const Ze=Me.get(et);Ze!==void 0?(dt===null?dt=Ze:dt=$e*Ze+(1-$e)*dt,Oe.push(dt)):Oe.push(null)});const st=h===Fe.runPath,ft=h!==null;let pt;ft&&!st?pt=.1:pt=1,Ie.push(Oe),Qe.push({label:`${sv(Fe)} (EMA)`,stroke:Fe.color,width:1.5,alpha:pt,spanGaps:!0,points:{show:!1}})}),{uplotData:Ie,seriesConfig:Qe,isFetching:ye,isRefetching:ke,isPlaceholderData:Be,hasData:!0,minStep:ge[0],maxStep:ge[ge.length-1]}},[t,q,P,L,R,O,W,U,V,G,Z,B,o,l,h]),ue=n.split("_").pop()||"",le=T.useCallback(oe=>oe==null?"N/A":a&&(ue==="min"||ue==="max")?Math.round(oe).toLocaleString():qu(oe),[a,ue]),fe=T.useCallback(oe=>Math.abs(oe)>=1e3?`${parseFloat((oe/1e3).toFixed(1))}k`:a?ue==="min"||ue==="max"?Math.round(oe).toString():String(parseFloat(oe.toFixed(1))):Number.isInteger(oe)?oe.toLocaleString():Math.abs(oe)<.01&&oe!==0?oe.toExponential(1):String(parseFloat(oe.toFixed(2))),[a,ue]),xe=T.useCallback(oe=>oe>=1e3?`${(oe/1e3).toFixed(0)}k`:oe.toString(),[]);T.useEffect(()=>{if(!S.current||!J||!se)return;const oe=S.current,te=oe.clientWidth,_e=160;let ve=1/0,ye=-1/0;for(let pt=1;pt<J.length;pt++){const et=J[pt];for(let Ze=0;Ze<et.length;Ze++){const me=et[Ze];me!=null&&(me<ve&&(ve=me),me>ye&&(ye=me))}}const ke=ye-ve,Be=Math.max(Math.abs(ye),Math.abs(ve)),ge=Math.max(Be*.05,1e-10),Ye=Math.max(ke*.1,ge);let Qe,Ie;i?(Qe=Math.min(ve-Ye,0),Ie=Math.max(ye+Ye,0)):(Qe=ve-Ye,Ie=ye+Ye);const Fe="rgba(128, 128, 128, 0.15)",Ge="rgba(100, 100, 100, 0.9)",Me=(pt,et)=>{if(!et||et.length===0)return 36;const Ze=Math.max(...et.map(me=>me.length));return Math.max(36,Ze*6+12)},$e=c!=null&&Number.isFinite(re)&&Number.isFinite(ie)&&c>=re&&c<=ie,dt={width:te,height:_e,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Qe,Ie]}},axes:[{stroke:Ge,grid:{stroke:Fe,width:1},ticks:{stroke:Fe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(pt,et)=>et.map(xe)},{stroke:Ge,grid:{stroke:Fe,width:1},ticks:{stroke:Fe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:Me,values:(pt,et)=>et.map(fe)}],series:F,hooks:{draw:[pt=>{if($e&&c!=null){const et=pt.ctx,Ze=pt.valToPos(c,"x",!0),me=pt.valToPos(Ie,"y",!0),je=pt.valToPos(Qe,"y",!0);et.save(),et.strokeStyle="rgba(128, 128, 128, 0.25)",et.lineWidth=2,et.beginPath(),et.moveTo(Ze,me),et.lineTo(Ze,je),et.stroke(),et.restore()}if(i&&Qe<0&&Ie>0){const et=pt.ctx,Ze=pt.valToPos(0,"y",!0),me=pt.valToPos(pt.scales.x.min,"x",!0),je=pt.valToPos(pt.scales.x.max,"x",!0);et.save(),et.strokeStyle="rgba(128, 128, 128, 0.5)",et.lineWidth=1,et.setLineDash([5,5]),et.beginPath(),et.moveTo(me,Ze),et.lineTo(je,Ze),et.stroke(),et.restore()}}],setCursor:[pt=>{if(!A.current)return;const{left:et,idx:Ze}=pt.cursor;if(N.current=Ze??null,Ze==null||et===void 0||et<0){A.current.style.display="none";return}const me=J[0][Ze];if(me===void 0){A.current.style.display="none";return}let je=`<div class="font-medium mb-1">Step ${Number(me).toLocaleString()}</div>`;const He=Y.length;t.forEach(Nt=>{var zt,Ht;const Pt=K.get(Nt.runPath);if(Pt===void 0)return;const Ve=Pt+1,wt=(zt=J[Ve])==null?void 0:zt[Ze];let Et;if(o){const an=He+Pt+1;Et=(Ht=J[an])==null?void 0:Ht[Ze]}wt!=null&&(je+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Nt.color}"></div>
                    <span>${X8(Nt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${o?.7:1}">${le(wt)}${s?` ${s}`:""}</span>
                    ${o&&Et!==void 0&&Et!==null?`<span class="text-muted-foreground">(EMA: ${le(Et)})</span>`:""}
                  </div>
                </div>
              `)}),A.current.innerHTML=je,A.current.style.display="block",A.current.style.left="0px",A.current.style.top="0px";const nt=A.current.getBoundingClientRect(),yt=S.current.getBoundingClientRect();let lt=yt.left+et+15;lt+nt.width+20>window.innerWidth&&(lt=yt.left+et-nt.width-15+pt.bbox.left),lt=Math.max(4,lt);let bt=yt.top-nt.height+20;bt<4&&(bt=yt.bottom-20),A.current.style.left=`${lt-nt.left}px`,A.current.style.top=`${bt-nt.top}px`}]}};E.current&&E.current.destroy();const Oe=new ma(dt,J,oe);E.current=Oe;const st=()=>{const pt=N.current;if(pt!=null){let et=J[0][pt];et!==void 0&&!isNaN(et)&&(v!=null&&et>v&&(et=v),_(et))}};oe.addEventListener("click",st);const ft=new ResizeObserver(pt=>{for(const et of pt){const{width:Ze}=et.contentRect;Oe&&Ze>0&&Oe.setSize({width:Ze,height:_e})}});return ft.observe(oe),()=>{oe.removeEventListener("click",st),ft.disconnect(),Oe.destroy(),E.current=null}},[J,F,se,i,fe,xe,le,q,o,s,c,re,ie,_,v,t,Y,K]);const he=T.useCallback(()=>{A.current&&(A.current.style.display="none")},[]),Te=j&&(!X||H);return p.jsxs("div",{ref:w,className:Rt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",Te&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2",children:[p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:r})}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("button",{onClick:d,className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 transition-opacity",children:p.jsx(Ju,{className:"h-3.5 w-3.5"})})})]}),se?p.jsxs("div",{className:"h-40 cursor-pointer relative bg-white rounded",ref:S,onMouseLeave:he,children:[p.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"}}),X&&!H&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:j?"Loading...":"No data"})]})}function YAe(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=[],a=new Array(e).fill(0);for(let o=0;o<=e;o++)s.push(n+o*i);for(const o of t){let l=Math.floor((o-n)/i);l>=e&&(l=e-1),a[l]++}return{binEdges:s,counts:a}}function KAe({runPath:t,step:e,metricType:n,label:r,showZeroLine:i,isTokenMetric:s,onRemove:a,scrollRoot:o=null}){const l=T.useRef(null),c=T.useRef(null),d=T.useRef(null),h=T.useRef(null),g=F9(l,{root:o,threshold:0}),{data:v,isFetching:b,isRefetching:_,isPlaceholderData:w}=_ue(t,e??null,n,g&&!!t&&e!==null&&e!==void 0&&!!n),{histogramData:S,hasData:E}=T.useMemo(()=>{const P=(v==null?void 0:v.values)??[];if(P.length===0)return{histogramData:null,hasData:!1};const{binEdges:L,counts:R}=YAe(P,25),O=L.slice(0,-1).map((W,U)=>(W+L[U+1])/2);return{histogramData:{binEdges:L,binCenters:O,counts:R,totalCount:P.length,min:Math.min(...P),max:Math.max(...P),mean:P.reduce((W,U)=>W+U,0)/P.length},hasData:!0}},[v==null?void 0:v.values]),A=T.useCallback(P=>P==null?"N/A":s?Math.round(P).toLocaleString():qu(P),[s]);T.useEffect(()=>{if(!c.current||!S||!E)return;const P=c.current,L=P.clientWidth,R=160,O=new Float64Array(S.binCenters),W=new Float64Array(S.counts),U=[O,W],G=Math.max(...S.counts)*1.1,Z="rgba(128, 128, 128, 0.15)",B="rgba(100, 100, 100, 0.9)",q="rgba(59, 130, 246, 0.7)",Y=S.binEdges[1]-S.binEdges[0],J={width:L,height:R,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[0,G]}},axes:[{stroke:B,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:(X,H)=>H.map(se=>Math.abs(se)>=1e3?`${parseFloat((se/1e3).toFixed(1))}k`:Math.abs(se)<.01&&se!==0?se.toExponential(1):String(parseFloat(se.toFixed(2))))},{stroke:B,grid:{stroke:Z,width:1},ticks:{stroke:Z,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(X,H)=>{if(!H||H.length===0)return 36;const se=Math.max(...H.map(re=>re.length));return Math.max(36,se*6+12)},values:(X,H)=>H.map(se=>se>=1e3?`${(se/1e3).toFixed(0)}k`:Math.round(se).toString())}],series:[{label:"Value"},{label:"Count",stroke:q,fill:q,width:0,paths:(X,H)=>{const se=new Path2D,{data:re}=X,ie=re[0],ue=re[H];for(let le=0;le<ie.length;le++){const fe=ie[le],xe=ue[le];if(xe==null||xe===0)continue;const he=X.valToPos(fe-Y/2,"x",!0),Te=X.valToPos(fe+Y/2,"x",!0),We=X.valToPos(0,"y",!0),Se=X.valToPos(xe,"y",!0),Le=Math.max(1,Te-he-1);se.rect(he+.5,Se,Le,We-Se)}return{stroke:se,fill:se}}}],hooks:{draw:[X=>{if(i&&S.min<0&&S.max>0){const H=X.ctx,se=X.valToPos(0,"x",!0),re=X.valToPos(0,"y",!0),ie=X.valToPos(G,"y",!0);H.save(),H.strokeStyle="rgba(128, 128, 128, 0.5)",H.lineWidth=1,H.setLineDash([5,5]),H.beginPath(),H.moveTo(se,re),H.lineTo(se,ie),H.stroke(),H.restore()}}],setCursor:[X=>{if(!h.current)return;const{left:H,idx:se}=X.cursor;if(se==null||H===void 0||H<0){h.current.style.display="none";return}const re=S.binCenters[se],ie=S.counts[se],ue=S.binEdges[se],le=S.binEdges[se+1];if(re===void 0||ie===void 0){h.current.style.display="none";return}const fe=(ie/S.totalCount*100).toFixed(1);h.current.innerHTML=`
              <div class="font-medium mb-1">Range: ${A(ue)} - ${A(le)}</div>
              <div class="text-muted-foreground">Count: ${ie.toLocaleString()} (${fe}%)</div>
            `,h.current.style.display="block",h.current.style.left="0px",h.current.style.top="0px";const xe=h.current.getBoundingClientRect(),he=c.current.getBoundingClientRect();let Te=he.left+H+15;Te+xe.width+20>window.innerWidth&&(Te=he.left+H-xe.width-15+X.bbox.left),Te=Math.max(4,Te);let We=he.top-xe.height+20;We<4&&(We=he.bottom-20),h.current.style.left=`${Te-xe.left}px`,h.current.style.top=`${We-xe.top}px`}]}};d.current&&d.current.destroy();const F=new ma(J,U,P);d.current=F;const j=new ResizeObserver(X=>{for(const H of X){const{width:se}=H.contentRect;F&&se>0&&F.setSize({width:se,height:R})}});return j.observe(P),()=>{j.disconnect(),F.destroy(),d.current=null}},[S,E,i,A]);const N=T.useCallback(()=>{h.current&&(h.current.style.display="none")},[]),I=b&&(!_||w);return p.jsxs("div",{ref:l,className:Rt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",I&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2",children:[p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:r})}),p.jsx("div",{className:"flex items-center gap-2",children:p.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:p.jsx(Ju,{className:"h-3.5 w-3.5"})})})]}),E?p.jsxs("div",{className:"h-40 relative bg-white rounded",ref:c,onMouseLeave:N,children:[p.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"}}),_&&!w&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:b?"Loading...":e==null?"Select a step to view histogram":"No data"})]})}const C5=100;function ZAe(t,e,n){const r=t.length;if(r<=C5)return{steps:t,counts:e};const i=Math.ceil(r/C5),s=[],a=[],o=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),d=Math.floor((l+c-1)/2);s.push(t[d]);const h=new Array(o).fill(0);for(let g=l;g<c;g++){const v=e[g];for(let b=0;b<o;b++)h[b]+=v[b]||0}a.push(h)}return{steps:s,counts:a}}function QAe({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,currentStep:s,shouldPoll:a,onRemove:o,selectedStepAtom:l=uT,maxSelectableStep:c,scrollRoot:d=null}){const h=T.useRef(null),g=T.useRef(null),v=T.useRef(null),b=T.useRef(null),_=T.useRef(null),w=zd(l),S=F9(h,{root:d,threshold:0}),{data:E,isFetching:A,isRefetching:N,isPlaceholderData:I}=PG(t,e,S&&!!t&&!!e,a),P=E&&E.steps.length>0&&E.bin_edges.length>0,L=P&&E.steps.length>C5,R=T.useMemo(()=>!P||!E?null:L?ZAe(E.steps,E.counts,E.bin_edges):{steps:E.steps,counts:E.counts},[P,E,L]),O=T.useCallback(q=>q==null?"N/A":i?Math.round(q).toLocaleString():qu(q),[i]),W=T.useCallback(q=>Math.abs(q)>=1e3?`${parseFloat((q/1e3).toFixed(1))}k`:i?Math.round(q).toString():Number.isInteger(q)?q.toLocaleString():Math.abs(q)<.01&&q!==0?q.toExponential(1):String(parseFloat(q.toFixed(2))),[i]),U=T.useCallback(()=>{const q={top:8,right:8,bottom:24,left:40};if(!v.current||!E)return q;const Y=v.current.getContext("2d");if(!Y)return q;const K="10px system-ui, sans-serif",J=5;let F=0;Y.save(),Y.setTransform(1,0,0,1,0,0),Y.font=K;for(let j=0;j<J;j++){const X=(E.global_min??0)+j/(J-1)*((E.global_max??0)-(E.global_min??0)),H=W(X);F=Math.max(F,Y.measureText(H).width)}return Y.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(F)+12)}},[E,W]);T.useEffect(()=>{if(!g.current||!v.current||!P||!E||!R)return;const q=g.current,Y=v.current,K=Y.getContext("2d");if(!K)return;const J=q.clientWidth,F=160,j="rgba(100, 100, 100, 0.9)",X="rgba(128, 128, 128, 0.15)",H="10px system-ui, sans-serif",se=window.devicePixelRatio||1;Y.width=J*se,Y.height=F*se,Y.style.width=`${J}px`,Y.style.height=`${F}px`,K.scale(se,se),K.font=H,K.clearRect(0,0,J,F);const re=U(),ie=J-re.left-re.right,ue=F-re.top-re.bottom,le=R.steps,fe=E.bin_edges,xe=R.counts,he=le.length,Te=fe.length-1;if(he===0||Te===0)return;let We=0;for(const Pe of xe)for(const Ke of Pe)Ke>We&&(We=Ke);const Se=Math.min(5,he),Le=5,pe=ie/Math.max(he,1),Re=Pe=>re.left+(Pe+.5)*pe,ne=Pe=>{const Ke=(E.global_max??1)-(E.global_min??0),oe=(Pe-(E.global_min??0))/(Ke||1);return re.top+ue-oe*ue},Xe=Pe=>Pe===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(Pe/We)*.75})`;K.strokeStyle=X,K.lineWidth=1;for(let Pe=0;Pe<Se;Pe++){const Ke=Math.floor(Pe/Math.max(Se-1,1)*(he-1)),oe=Re(Ke);K.beginPath(),K.moveTo(oe,re.top),K.lineTo(oe,F-re.bottom),K.stroke()}for(let Pe=0;Pe<Le;Pe++){const Ke=(E.global_min??0)+Pe/(Le-1)*((E.global_max??0)-(E.global_min??0)),oe=ne(Ke);K.beginPath(),K.moveTo(re.left,oe),K.lineTo(J-re.right,oe),K.stroke()}const Ae=pe;for(let Pe=0;Pe<he;Pe++){const Ke=re.left+Pe*pe,oe=xe[Pe];for(let te=0;te<Te;te++){const _e=oe[te];if(_e===0)continue;const ve=fe[te+1],ye=fe[te],ke=ne(ve),Be=ne(ye),ge=Math.max(1,Be-ke);K.fillStyle=Xe(_e),K.fillRect(Ke,ke,Ae,ge)}}if(r&&(E.global_min??0)<0&&(E.global_max??0)>0){const Pe=ne(0);K.strokeStyle="rgba(128, 128, 128, 0.5)",K.lineWidth=1,K.setLineDash([5,5]),K.beginPath(),K.moveTo(re.left,Pe),K.lineTo(J-re.right,Pe),K.stroke(),K.setLineDash([])}if(s!=null){let Pe=-1,Ke=1/0;for(let oe=0;oe<le.length;oe++){const te=Math.abs(le[oe]-s);te<Ke&&(Ke=te,Pe=oe)}if(Pe>=0){const oe=Re(Pe);K.strokeStyle="rgba(128, 128, 128, 0.25)",K.lineWidth=1,K.beginPath(),K.moveTo(oe,re.top),K.lineTo(oe,F-re.bottom),K.stroke()}}K.strokeStyle=j,K.lineWidth=1,K.beginPath(),K.moveTo(re.left,F-re.bottom),K.lineTo(J-re.right,F-re.bottom),K.stroke(),K.beginPath(),K.moveTo(re.left,re.top),K.lineTo(re.left,F-re.bottom),K.stroke(),K.fillStyle=j,K.font=H,K.textAlign="center";for(let Pe=0;Pe<Se;Pe++){const Ke=Math.floor(Pe/Math.max(Se-1,1)*(he-1)),oe=le[Ke],te=Re(Ke),_e=oe>=1e3?`${(oe/1e3).toFixed(0)}k`:oe.toString();K.fillText(_e,te,F-6)}K.textAlign="right",K.textBaseline="middle";for(let Pe=0;Pe<Le;Pe++){const Ke=(E.global_min??0)+Pe/(Le-1)*((E.global_max??0)-(E.global_min??0)),oe=ne(Ke);K.fillText(W(Ke),re.left-4,oe)}},[E,R,P,r,s,W,U]),T.useEffect(()=>{if(!g.current)return;const q=g.current,Y=new ResizeObserver(()=>{if(v.current&&g.current){const K=g.current.clientWidth;v.current.style.width=`${K}px`}});return Y.observe(q),()=>{Y.disconnect()}},[]);const V=T.useCallback(q=>{if(!E||!R||!v.current||!g.current)return;const Y=v.current.getBoundingClientRect(),K=q.clientX-Y.left,J=g.current.clientWidth,F=U(),j=J-F.left-F.right;if(j<=0)return;const X=(K-F.left)/j,H=Math.round(X*(R.steps.length-1));if(H>=0&&H<R.steps.length){let se=R.steps[H];c!=null&&se>c&&(se=c),w(se)}},[E,R,U,w,c]),G=T.useCallback(q=>{var _e;if(!E||!R||!b.current||!v.current||!g.current)return;const Y=v.current.getBoundingClientRect(),K=q.clientX-Y.left,J=q.clientY-Y.top,F=g.current.clientWidth,j=160,X=U(),H=F-X.left-X.right,se=j-X.top-X.bottom;if(H<=0||se<=0){_.current&&(_.current.style.display="none");return}if(K<X.left||K>F-X.right||J<X.top||J>j-X.bottom){b.current.style.display="none",_.current&&(_.current.style.display="none");return}const re=(K-X.left)/H,ie=Math.min(R.steps.length-1,Math.max(0,Math.round(re*(R.steps.length-1)))),ue=R.steps[ie];if(_.current){const ve=H/Math.max(R.steps.length,1),ye=X.left+(ie+.5)*ve;_.current.style.display="block",_.current.style.left=`${ye}px`,_.current.style.top=`${X.top}px`,_.current.style.bottom=`${X.bottom}px`}const le=1-(J-X.top)/se,fe=E.bin_edges.length-1,xe=Math.min(fe-1,Math.max(0,Math.floor(le*fe))),he=E.bin_edges[xe],Te=E.bin_edges[xe+1],We=((_e=R.counts[ie])==null?void 0:_e[xe])??0,Le=(R.counts[ie]??[]).reduce((ve,ye)=>ve+ye,0),pe=Le>0?(We/Le*100).toFixed(1):"0.0",ne=L&&E.steps.length>C5?" (aggregated)":"";b.current.innerHTML=`
        <div class="font-medium mb-1">Step ${ue.toLocaleString()}${ne}</div>
        <div class="text-muted-foreground">Range: ${O(he)} to ${O(Te)}</div>
        <div class="text-muted-foreground">Count: ${We.toLocaleString()} (${pe}%)</div>
      `,b.current.style.display="block",b.current.style.left="0px",b.current.style.top="0px";const Xe=b.current.getBoundingClientRect(),Ae=q.clientX;let Pe=Ae;Pe+Xe.width+20>window.innerWidth&&(Pe=Ae-Xe.width);const Ke=Math.max(4,window.innerWidth-Xe.width-4);Pe=Math.min(Math.max(4,Pe),Ke);const oe=g.current.getBoundingClientRect();let te=oe.top-Xe.height+20;te<4&&(te=oe.bottom-20),b.current.style.left=`${Pe-Xe.left}px`,b.current.style.top=`${te-Xe.top}px`},[E,R,O,U,L]),Z=T.useCallback(()=>{b.current&&(b.current.style.display="none"),_.current&&(_.current.style.display="none")},[]),B=A&&(!N||I);return p.jsxs("div",{ref:h,className:Rt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",B&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2",children:[p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:n})}),p.jsx("div",{className:"flex items-center gap-2",children:p.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:p.jsx(Ju,{className:"h-3.5 w-3.5"})})})]}),P?p.jsxs("div",{className:"h-40 relative bg-white rounded",ref:g,children:[p.jsx("canvas",{className:"block w-full h-full max-w-full cursor-pointer",ref:v,onClick:V,onMouseMove:G,onMouseLeave:Z}),p.jsx("div",{ref:_,className:"absolute z-[2] border-l border-dashed border-gray-500/70 pointer-events-none",style:{display:"none"}}),p.jsx("div",{ref:b,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"}}),N&&!I&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:A?"Loading...":"No data"})]})}function DS(t,e=60){if(!t)return"";const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"..."}function JAe(t){return t===null||Number.isNaN(t)?null:`hsl(${Math.max(0,Math.min(1,t))*120} 70% 38%)`}function G6(t,e,n){return e==null||n==null||e>=n?void 0:`hsl(${(Math.max(0,Math.min(1,(t-e)/(n-e)))*120).toFixed(0)} 80% 38%)`}function dF(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 W6(t,e,n=85){if(t===null||e===null||e<=0)return null;const r=Math.max(0,Math.min(e,t));return`hsl(0 0% ${n-r/e*(n-5)}%)`}function H9({openAtom:t=y8}={}){const[e,n]=cn(t);return!ki(ml)||e?null:p.jsx(Tn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Samples"})}const fF=["gen_length","gen_length_sum","gen_length_avg","reward","advantage"];function V9({prompts:t,data:e,samplesData:n,rolloutMetrics:r,availableMetricNames:i,isLoading:s,step:a,currentStepIndex:o,totalSteps:l,onStepChange:c,hasSteps:d,stepValues:h,openAtom:g=y8,selectedGroupIdAtom:v=SG,selectedSampleIdxAtom:b=wG,viewModeAtom:_=TG,getGroupBadge:w,renderLeftControls:S,onGroupClick:E,hideRewardAdvantage:A=!1,envDetailsOverride:N}){var $e,dt,Oe,st,ft,pt,et,Ze;const[I,P]=cn(g),[L,R]=cn(v),[O,W]=cn(b),[U,V]=cn(_),[G,Z]=cn(Fce),[B,q]=cn(Uce),Y=ki(ml),{data:K}=ed(Y||"",!!Y,!0),J=($e=K==null?void 0:K.config)==null?void 0:$e.max_tokens,F=T.useMemo(()=>dF(J),[J]),j=(dt=K==null?void 0:K.config)==null?void 0:dt.group_size,X=T.useMemo(()=>dF(j),[j]),H=T.useMemo(()=>{if(X==null||X<=1)return null;const me=Math.sqrt(X-1);return{min:-me,max:me}},[X]),se=N??((Oe=K==null?void 0:K.config)==null?void 0:Oe.environments),re=T.useMemo(()=>pw(se),[se]),ie=T.useMemo(()=>{const me=mw(se),je=gw(K==null?void 0:K.data_metric_ranges);return vw(me,je)},[se,K==null?void 0:K.data_metric_ranges]),ue=T.useMemo(()=>{var je;const me=[se,(je=K==null?void 0:K.summary)==null?void 0:je.env_details];for(const He of me){const nt=zk(He);if(nt.length!==0)return nt.some(yt=>(yt==null?void 0:yt.is_multi_turn)===!0)}return!1},[se,(st=K==null?void 0:K.summary)==null?void 0:st.env_details]),[le,fe]=T.useState(new Map),xe=T.useMemo(()=>{if(!r)return null;const me=new Map;for(const je of r){let He=me.get(je.sample_idx);He||(He=new Map,me.set(je.sample_idx,He)),He.set(je.metric_name,{value:je.value,env:je.env})}return me},[r]);xe!==null&&xe!==le&&fe(xe);const he=xe??le,[Te,We]=T.useState([]),Se=T.useMemo(()=>{if(i!=null&&i.length)return i;if(!r)return null;const me=new Set;for(const je of r)me.add(je.metric_name);return[...me].sort()},[i,r]);Se!==null&&Se!==Te&&We(Se);const Le=Se??Te,pe=(me,je)=>{Z(He=>je===!0?He.includes(me)?He:[...He,me]:He.filter(nt=>nt!==me))};T.useEffect(()=>{if(!Le.length&&!e)return;const me=new Set;A&&(me.add("reward"),me.add("advantage")),ue?me.add("gen_length"):(me.add("gen_length_sum"),me.add("gen_length_avg"));const je=fF.filter(nt=>!me.has(nt)),He=new Set([...je,...Le]);Z(nt=>{let yt=nt;!ue&&!nt.includes("gen_length")&&(nt.includes("gen_length_avg")||nt.includes("gen_length_sum"))?yt=[...yt.filter(bt=>bt!=="gen_length_avg"&&bt!=="gen_length_sum"),"gen_length"]:ue&&!nt.includes("gen_length_avg")&&nt.includes("gen_length")&&(yt=[...yt.filter(bt=>bt!=="gen_length"),"gen_length_avg"]);const lt=yt.filter(bt=>He.has(bt));return lt.length===nt.length&&lt.every((bt,Nt)=>bt===nt[Nt])?nt:lt})},[Le,e,Z,A,ue]);const Re=T.useMemo(()=>{const me=new Set;A&&(me.add("reward"),me.add("advantage")),ue?me.add("gen_length"):(me.add("gen_length_sum"),me.add("gen_length_avg"));const je=[],He=new Set;for(const nt of fF)me.has(nt)||G.includes(nt)&&!He.has(nt)&&(je.push(nt),He.add(nt));for(const nt of Le)G.includes(nt)&&!He.has(nt)&&(je.push(nt),He.add(nt));return je},[G,Le,A,ue]),[ne,Xe]=T.useState([]),Ae=T.useRef(0),Pe=T.useRef(null),Ke=T.useRef(a),oe=T.useRef(0);T.useEffect(()=>{var He;const me=(He=Pe.current)==null?void 0:He.querySelector('[data-slot="scroll-area-viewport"]');if(!me)return;const je=()=>{oe.current=me.scrollTop};return me.addEventListener("scroll",je,{passive:!0}),()=>me.removeEventListener("scroll",je)},[I]),T.useEffect(()=>{var me;if(a!==Ke.current){Ke.current=a,Ae.current=0,oe.current=0;const je=(me=Pe.current)==null?void 0:me.querySelector('[data-slot="scroll-area-viewport"]');je&&(je.scrollTop=0)}},[a]);const te=T.useMemo(()=>{if(!t)return new Map;const me=new Map;for(const je of t)me.set(je.group_id,je);return me},[t]),_e=T.useMemo(()=>{if(!n)return new Map;const me=new Map;for(const je of n)me.set(je.sample_idx,je);return me},[n]),ve=T.useMemo(()=>{if(!e)return null;const me=new Map,je=new Map;for(const lt of e){const bt=me.get(lt.sample_idx)||[];bt.push(lt),me.set(lt.sample_idx,bt),je.set(lt.sample_idx,lt.group_id)}const He=new Map;for(const[lt,bt]of me){const Nt=[...bt].sort((Cn,Bn)=>Cn.turn_order-Bn.turn_order),Pt=je.get(lt)??-1,Ve=te.get(Pt)??null,wt=_e.get(lt),Et=Nt.find(Cn=>Cn.turn_type==="model"),zt=(Et==null?void 0:Et.content)??"";let Ht=null,an=null,Dn=0,Vt=0;for(const Cn of Nt)Cn.turn_type==="model"&&typeof Cn.tokens=="number"&&(Dn+=Cn.tokens,Vt+=1);Vt>0&&(Ht=Dn/Vt,an=Dn);const pn={sample_idx:lt,group_id:Pt,prompt:Ve,responsePreview:zt,turnsCount:Nt.length,turnsData:Nt,reward:(wt==null?void 0:wt.reward)??null,advantage:(wt==null?void 0:wt.advantage)??null,assistantTokens:Ht,assistantTokensTotal:an},Bt=He.get(Pt)||[];Bt.push(pn),He.set(Pt,Bt)}const nt=[];for(const[lt,bt]of He){const Nt=te.get(lt)??null;bt.sort((Pt,Ve)=>Pt.sample_idx-Ve.sample_idx),nt.push({group_id:lt,prompt:Nt,samples:bt,sampleCount:bt.length})}return nt.sort((lt,bt)=>lt.group_id-bt.group_id)},[e,te,_e]);ve!==null&&ve!==ne&&Xe(ve);const ye=ve??ne;T.useLayoutEffect(()=>{var je;const me=(je=Pe.current)==null?void 0:je.querySelector('[data-slot="scroll-area-viewport"]');me&&oe.current>0&&me.scrollTop!==oe.current&&(me.scrollTop=oe.current)},[ye]);const ke=T.useMemo(()=>L===null?null:ye.find(me=>me.group_id===L)??null,[ye,L]),Be=ke!==null,ge=T.useMemo(()=>{let me=0;for(const je of ye)for(const He of je.samples)He.assistantTokens!==null&&He.assistantTokens>me&&(me=He.assistantTokens);return me>0?me:null},[ye]),Ye=F??ge,Qe=T.useMemo(()=>{let me=0;for(const je of ye)for(const He of je.samples)He.assistantTokensTotal!==null&&He.assistantTokensTotal>me&&(me=He.assistantTokensTotal);return me>0?me:null},[ye]),Ie=F!=null?Math.max(F,Qe??0)||null:Qe;T.useEffect(()=>{!Be&&U==="samples"&&!s&&V("groups")},[Be,U,V,s]);const Fe=me=>{var He;const je=(He=Pe.current)==null?void 0:He.querySelector('[data-slot="scroll-area-viewport"]');if(je&&(Ae.current=je.scrollTop),E){const nt=ye.find(yt=>yt.group_id===me);nt&&E(me,nt);return}R(me),V("samples")},Ge=me=>{W(me)},Me=me=>{var je;if(me==="samples"&&!Be){V("groups");return}if(me==="groups"||me==="samples"){if(U==="groups"&&me==="samples"){const He=(je=Pe.current)==null?void 0:je.querySelector('[data-slot="scroll-area-viewport"]');He&&(Ae.current=He.scrollTop)}V(me)}};return T.useEffect(()=>{U==="groups"&&Ae.current>0&&requestAnimationFrame(()=>{var je;const me=(je=Pe.current)==null?void 0:je.querySelector('[data-slot="scroll-area-viewport"]');me&&(me.scrollTop=Ae.current,oe.current=Ae.current)})},[U]),T.useEffect(()=>{U!=="samples"||O===null||requestAnimationFrame(()=>{var He;const me=(He=Pe.current)==null?void 0:He.querySelector('[data-slot="scroll-area-viewport"]');if(!me)return;const je=me.querySelector(`[data-sample-idx="${O}"]`);je&&(je.scrollIntoView({block:"nearest",behavior:"smooth"}),setTimeout(()=>{oe.current=me.scrollTop},350))})},[U,O]),!Y||!I?null:p.jsxs("div",{className:"w-[260px] border-r border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[p.jsxs("div",{className:"border-b border-sidebar-border shrink-0",children:[p.jsx("div",{className:"py-2.5 px-1 flex items-center justify-center h-12",children:d?p.jsx(jk,{currentPage:o,totalPages:l,onPageChange:c,pageValues:h}):p.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Loading...":"No steps available"})}),p.jsxs("div",{className:"py-1.5 px-3 flex items-center justify-between border-t border-sidebar-border",children:[S?S({viewMode:U,setViewMode:V,hasSelectedGroupInStep:Be,groups:ye}):p.jsxs(Y0,{type:"single",variant:"outline",size:"sm",value:U,onValueChange:Me,children:[p.jsx(Uo,{value:"groups",className:"text-xs px-2 py-1 h-7",children:"Groups"}),p.jsx(Uo,{value:"samples",className:"text-xs px-2 py-1 h-7",disabled:!Be,children:"Samples"})]}),p.jsxs("div",{className:"flex items-center gap-0.5",children:[p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:p.jsx(uG,{className:"h-4 w-4"})})}),p.jsxs(pl,{align:"end",className:"min-w-[180px]",children:[p.jsx(eS,{children:"Settings"}),p.jsx(Hl,{}),p.jsx(vi,{checked:B,onCheckedChange:me=>q(me===!0),onSelect:me=>me.preventDefault(),children:"Show Tooltips"})]})]}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:p.jsx(jN,{className:"h-4 w-4"})})}),p.jsxs(pl,{align:"end",className:"min-w-[180px]",children:[p.jsx(eS,{children:"Display Metrics"}),p.jsx(Hl,{}),ue?p.jsxs(p.Fragment,{children:[p.jsx(vi,{checked:G.includes("gen_length_sum"),onCheckedChange:me=>pe("gen_length_sum",me),onSelect:me=>me.preventDefault(),children:"Gen. Length Sum"}),p.jsx(vi,{checked:G.includes("gen_length_avg"),onCheckedChange:me=>pe("gen_length_avg",me),onSelect:me=>me.preventDefault(),children:"Gen. Length Avg"})]}):p.jsx(vi,{checked:G.includes("gen_length"),onCheckedChange:me=>pe("gen_length",me),onSelect:me=>me.preventDefault(),children:"Gen. Length"}),!A&&p.jsx(vi,{checked:G.includes("reward"),onCheckedChange:me=>pe("reward",me),onSelect:me=>me.preventDefault(),children:"Reward"}),!A&&p.jsx(vi,{checked:G.includes("advantage"),onCheckedChange:me=>pe("advantage",me),onSelect:me=>me.preventDefault(),children:"Advantage"}),Le.length>0&&p.jsx(Hl,{}),Le.map(me=>p.jsx(vi,{checked:G.includes(me),onCheckedChange:je=>pe(me,je),onSelect:je=>je.preventDefault(),children:f7(me)},me))]})]}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>P(!1),children:p.jsx(qle,{className:"h-4 w-4"})})]})]})]}),p.jsx(yv,{ref:Pe,className:Rt("flex-1 min-h-0 transition-opacity",s&&"opacity-50"),children:ye.length===0?p.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:s?"Loading...":"No samples available"}):U==="groups"||!ke?p.jsx("div",{className:"p-2 space-y-1",children:ye.map(me=>p.jsx(e6e,{group:me,onClick:()=>Fe(me.group_id),isSelected:L===me.group_id,tokenScaleMax:Ye,tokenScaleSumMax:Ie,envRewardRanges:re,envMetricRanges:ie,advantageRange:H,badge:w?w(me):null,displayMetrics:Re,metricsBySampleIdx:he,tooltipsEnabled:B},me.group_id))}):p.jsxs("div",{className:"flex flex-col min-h-0",children:[p.jsxs(mv,{delayDuration:300,open:B?void 0:!1,children:[p.jsx(gv,{asChild:!0,children:p.jsxs("div",{className:"p-3 border-b border-border bg-muted/30 shrink-0 cursor-default",children:[((ft=ke.prompt)==null?void 0:ft.system_prompt)&&p.jsxs("div",{className:"mb-2",children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),p.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere]",children:DS(ke.prompt.system_prompt,100)})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),p.jsx("p",{className:"text-xs text-foreground line-clamp-3 break-words overflow-hidden [overflow-wrap:anywhere]",children:DS((pt=ke.prompt)==null?void 0:pt.prompt,150)})]})]})}),p.jsxs(vv,{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:[((et=ke.prompt)==null?void 0:et.system_prompt)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:ke.prompt.system_prompt})]}),((Ze=ke.prompt)==null?void 0:Ze.prompt)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:ke.prompt.prompt})]})]})]}),p.jsx("div",{className:"p-2 space-y-1",children:ke.samples.map(me=>p.jsx("div",{"data-sample-idx":me.sample_idx,children:p.jsx(i6e,{sample:me,isSelected:O===me.sample_idx,onClick:()=>Ge(me.sample_idx),envRewardRanges:re,envMetricRanges:ie,advantageRange:H,displayMetrics:Re,metricsBySampleIdx:he,tokenScaleMax:Ye,tokenScaleSumMax:Ie,tooltipsEnabled:B})},me.sample_idx))})]})})]})}function e6e({group:t,onClick:e,isSelected:n,tokenScaleMax:r,tokenScaleSumMax:i,envRewardRanges:s,envMetricRanges:a,advantageRange:o,badge:l,displayMetrics:c,metricsBySampleIdx:d,tooltipsEnabled:h}){var g,v,b,_;return p.jsxs(mv,{delayDuration:300,open:h?void 0:!1,children:[p.jsx(gv,{asChild:!0,children:p.jsx("button",{onClick:e,className:Rt("w-full text-left p-3 rounded-lg border transition-colors overflow-hidden",n?"border-primary/50 bg-primary/5":"border-sidebar-border hover:border-border hover:bg-muted/50"),children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[((g=t.prompt)==null?void 0:g.system_prompt)&&p.jsx("p",{className:"text-xs text-muted-foreground mb-1 line-clamp-1 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:DS(t.prompt.system_prompt,50)}),p.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:DS((v=t.prompt)==null?void 0:v.prompt,80)}),l&&p.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:l})]}),c.length>0&&p.jsx("div",{className:"flex items-start gap-1 shrink-0 pt-0",children:c.map(w=>p.jsx("div",{className:"flex flex-col items-start gap-[0.5px]",children:t.samples.map(S=>{const E=h7(S,w,d,r,i,s,o,a);return p.jsx("div",{title:E.label,className:Rt("h-1.5 w-1.5 rounded-none",E.color?"":"bg-muted"),style:E.color?{backgroundColor:E.color}:void 0},S.sample_idx)})},w))})]})})}),p.jsxs(vv,{side:"right",className:"max-w-xl max-h-[70vh] overflow-y-auto p-3 space-y-2 bg-popover text-popover-foreground border border-border shadow-md",children:[((b=t.prompt)==null?void 0:b.system_prompt)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.system_prompt})]}),((_=t.prompt)==null?void 0:_.prompt)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.prompt})]})]})]})}function t6e(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function f7(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function ZK(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function n6e(t,e){switch(e){case"gen_length":case"gen_length_sum":case"gen_length_avg":return Math.round(t).toString();default:return ZK(t)}}function r6e(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 h7(t,e,n,r,i,s,a,o,l){var c,d;switch(e){case"gen_length":return{value:t.assistantTokensTotal,color:W6(t.assistantTokensTotal,i,l),label:t.assistantTokensTotal!==null?`Gen. Length: ${t.assistantTokensTotal}`:"Gen. Length: n/a"};case"gen_length_sum":return{value:t.assistantTokensTotal,color:W6(t.assistantTokensTotal,i,l),label:t.assistantTokensTotal!==null?`Gen. Length Sum: ${t.assistantTokensTotal}`:"Gen. Length Sum: n/a"};case"gen_length_avg":return{value:t.assistantTokens!==null?Math.round(t.assistantTokens):null,color:W6(t.assistantTokens,r,l),label:t.assistantTokens!==null?`Gen. Length Avg: ${Math.round(t.assistantTokens)}`:"Gen. Length Avg: n/a"};case"reward":{const h=((c=t.prompt)==null?void 0:c.env)??null,g=h?s==null?void 0:s.get(h):void 0;return{value:t.reward,color:t.reward!==null?G6(t.reward,(g==null?void 0:g.min)??null,(g==null?void 0:g.max)??null)??JAe(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?G6(t.advantage,(a==null?void 0:a.min)??null,(a==null?void 0:a.max)??null)??null:null,label:t.advantage!==null?`Advantage: ${t.advantage.toFixed(2)}`:"Advantage: n/a"};default:{const h=n.get(t.sample_idx),g=h==null?void 0:h.get(e);if(!g)return{value:null,color:null,label:`${f7(e)}: n/a`};const v=g.env??((d=t.prompt)==null?void 0:d.env)??null,b=r6e(o,v,e),_=G6(g.value,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null);return{value:g.value,color:_??null,label:`${f7(e)}: ${ZK(g.value)}`}}}}function i6e({sample:t,isSelected:e,onClick:n,envRewardRanges:r,envMetricRanges:i,advantageRange:s,displayMetrics:a,metricsBySampleIdx:o,tokenScaleMax:l,tokenScaleSumMax:c,tooltipsEnabled:d}){return p.jsxs(mv,{delayDuration:300,open:d?void 0:!1,children:[p.jsx(gv,{asChild:!0,children:p.jsx("button",{onClick:n,className:Rt("w-full text-left p-3 rounded-lg border transition-colors overflow-hidden",e?"border-primary/50 bg-primary/5":"border-sidebar-border hover:border-border hover:bg-muted/50"),children:p.jsxs("div",{className:"flex items-stretch justify-between gap-2 min-w-0",children:[p.jsx("p",{className:"text-xs text-foreground break-words flex-1 min-w-0 overflow-hidden",style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:a.length>0?Math.max(2,a.filter(h=>h7(t,h,o,l,c,r,s,i,70).value!==null).length):2,overflowWrap:"anywhere"},children:DS(t.responsePreview,300)||"No response"}),a.length>0&&p.jsx("div",{className:"flex items-start gap-1 shrink-0",children:p.jsx("div",{className:"flex flex-col items-center gap-0.5",children:a.map(h=>{const g=h7(t,h,o,l,c,r,s,i,70);return g.value===null?null:p.jsx("span",{className:"text-[10px] font-semibold tabular-nums leading-none",style:g.color?{color:g.color}:void 0,title:g.label,children:n6e(g.value,h)},h)})})})]})})}),p.jsx(vv,{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:p.jsxs("div",{className:"space-y-3",children:[t.turnsData.map(h=>p.jsxs("div",{children:[p.jsxs("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5 flex items-center gap-2",children:[p.jsx("span",{children:t6e(h.turn_type)}),h.tokens!=null&&p.jsxs("span",{className:"font-normal normal-case",children:[h.tokens.toLocaleString()," tokens"]})]}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:h.content||"(empty)"})]},`${h.sample_idx}-${h.turn_order}`)),t.turnsData.length===0&&p.jsx("p",{className:"text-xs text-muted-foreground",children:"No turns available"})]})})]})}function s6e(){var Se,Le,pe,Re;const t=ki(ml),[e]=T7(),[n,r]=cn(uT),[i,s]=cn(SG),[a,o]=cn(wG),l=ki(MG),[c,d]=cn(y8),[,h]=cn(TG),g=ki(x8),[v,b]=cn(hT),[_,w]=cn(pT),S=v.length+(_?1:0),E=ne=>{b(Xe=>Xe.includes(ne)?Xe.filter(Ae=>Ae!==ne):[...Xe,ne])},[A,N]=T.useState(0),[I,P]=T.useState(0),[L,R]=T.useState(!0),O=!0,W=T.useMemo(()=>{const ne=e.get("step");if(!ne)return null;const Xe=Number(ne);return Number.isFinite(Xe)?Xe:null},[e]),U=T.useMemo(()=>{const ne=e.get("sample");if(!ne)return null;const Xe=Number(ne);return Number.isFinite(Xe)?Xe:null},[e]),V=T.useMemo(()=>{const ne=e.get("group");if(!ne)return null;const Xe=Number(ne);return Number.isFinite(Xe)?Xe:null},[e]),G=T.useRef(null),Z=T.useRef({group:null,sample:null});T.useEffect(()=>{if(!t){G.current=null,Z.current={group:null,sample:null};return}if(W==null){G.current=null;return}W!==G.current&&(r(W),G.current=W)},[W,t,r]),T.useEffect(()=>{t&&(V==null||U==null||Z.current.group===V&&Z.current.sample===U||(s(V),o(U),d(!0),h("samples"),Z.current={group:V,sample:U}))},[V,U,t,s,o,d,h]);const{data:B,isLoading:q,error:Y}=oue(t||"",n,!!t),{data:K}=ed(t||"",!!t,O),J=T.useMemo(()=>{var ne;return pw((ne=K==null?void 0:K.config)==null?void 0:ne.environments)},[(Se=K==null?void 0:K.config)==null?void 0:Se.environments]),F=T.useMemo(()=>{var Ae;const ne=mw((Ae=K==null?void 0:K.config)==null?void 0:Ae.environments),Xe=gw(K==null?void 0:K.data_metric_ranges);return vw(ne,Xe)},[(Le=K==null?void 0:K.config)==null?void 0:Le.environments,K==null?void 0:K.data_metric_ranges]),j=T.useMemo(()=>{var Pe;const ne=(Pe=K==null?void 0:K.config)==null?void 0:Pe.group_size,Xe=typeof ne=="object"&&ne!==null&&"value"in ne?Number(ne.value):Number(ne);if(!Xe||isNaN(Xe)||Xe<=1)return null;const Ae=Math.sqrt(Xe-1);return{min:-Ae,max:Ae}},[(pe=K==null?void 0:K.config)==null?void 0:pe.group_size]),X=T.useMemo(()=>{var ne;return(ne=B==null?void 0:B.available_steps)!=null&&ne.length&&n===null?B.available_steps[B.available_steps.length-1]:null},[B,n]);T.useEffect(()=>{X!==null&&n===null&&W==null&&r(X)},[X,W,n,r]);const H=ne=>{r(ne)},[se,re]=T.useState([]),[ie,ue]=T.useState(null);t!==ie&&(re([]),ue(t));const le=B==null?void 0:B.available_steps,fe=T.useMemo(()=>{const ne=le??[];return[...new Set([...se,...ne])].sort((Ae,Pe)=>Ae-Pe)},[le,se]);fe.length>se.length&&re(fe);const xe=fe.length>0,he=xe?fe[fe.length-1]:0,Te=T.useMemo(()=>{if(n==null)return fe.length-1;const ne=fe.indexOf(n);return ne>=0?ne:fe.length-1},[fe,n]),We=ne=>{ne>=0&&ne<fe.length&&H(fe[ne])};return t?p.jsxs("div",{className:"flex h-full overflow-hidden",children:[p.jsx(V9,{prompts:B==null?void 0:B.prompts,data:B==null?void 0:B.rollouts,samplesData:B==null?void 0:B.samples_data,rolloutMetrics:B==null?void 0:B.rollout_metrics,availableMetricNames:B==null?void 0:B.available_rollout_metric_names,isLoading:q,step:n??void 0,currentStepIndex:Te,totalSteps:fe.length,onStepChange:We,hasSteps:xe,stepValues:fe}),p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center justify-between h-7",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(H9,{}),l&&p.jsxs("div",{className:"text-sm text-muted-foreground",children:[p.jsxs("span",{children:["Step ",((Re=l.sample.turns[0])==null?void 0:Re.step)??n]})," · ",p.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",p.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&p.jsx(GT,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&p.jsxs(p.Fragment,{children:[p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(ne=>ne+1),R(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(ne=>ne+1),R(!0)},children:"Expand All"}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",S>0&&` (${S})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(vi,{checked:_,onCheckedChange:ne=>w(!!ne),onSelect:ne=>ne.preventDefault(),children:"Format Think"}),p.jsx(vi,{checked:v.includes("markdown"),onCheckedChange:()=>E("markdown"),onSelect:ne=>ne.preventDefault(),children:"Markdown"}),p.jsx(vi,{checked:v.includes("latex"),onCheckedChange:()=>E("latex"),onSelect:ne=>ne.preventDefault(),children:"LaTeX"}),p.jsx(vi,{checked:v.includes("code"),onCheckedChange:()=>E("code"),onSelect:ne=>ne.preventDefault(),children:"Code"})]})]})]})]}),p.jsx(U9,{})]})})}),p.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:p.jsxs("div",{className:c||g?"max-w-5xl mx-auto":"",children:[Y&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",Y instanceof Error?Y.message:"Unknown error"]})})}),p.jsx(y1,{prompts:B==null?void 0:B.prompts,data:B==null?void 0:B.rollouts,samplesData:B==null?void 0:B.samples_data,rolloutMetrics:B==null?void 0:B.rollout_metrics,goldenAnswers:B==null?void 0:B.golden_answers,infoTurns:B==null?void 0:B.info_turns,isLoading:q,step:n??void 0,scrollToSampleId:U,filterGroupId:i,filterSampleIdx:a,collapseAllSignal:A,expandAllSignal:I,defaultSectionsOpen:L,envRewardRanges:J,envMetricRanges:F,advantageRange:j,renderOptions:v,formatThinkBlocks:_})]})})]}),p.jsx(B9,{currentStep:n,maxSelectableStep:he})]}):p.jsx(hm,{description:"Select a run from the sidebar to view rollouts."})}function a6e(){var ve,ye,ke,Be;const t=ki(ml),[e]=T7(),[n,r]=cn(VD),[i,s]=cn(GD),[a,o]=cn(WD),l=ki($D),[c,d]=cn(zC),[,h]=cn(qD),g=ki(LC),[v,b]=cn(hT),[_,w]=cn(pT),S=v.length+(_?1:0),E=ge=>{b(Ye=>Ye.includes(ge)?Ye.filter(Qe=>Qe!==ge):[...Ye,ge])},[A,N]=T.useState(0),[I,P]=T.useState(0),[L,R]=T.useState(!0),O=!0,W=T.useMemo(()=>{const ge=e.get("step")??e.get("trainer_step");if(!ge)return null;const Ye=Number(ge);return Number.isFinite(Ye)?Ye:null},[e]),U=T.useMemo(()=>{const ge=e.get("sample");if(!ge)return null;const Ye=Number(ge);return Number.isFinite(Ye)?Ye:null},[e]),V=T.useMemo(()=>{const ge=e.get("group");if(!ge)return null;const Ye=Number(ge);return Number.isFinite(Ye)?Ye:null},[e]),G=T.useRef(null),Z=T.useRef({group:null,sample:null});T.useEffect(()=>{if(!t){G.current=null,Z.current={group:null,sample:null};return}if(W==null){G.current=null;return}W!==G.current&&(r(W),G.current=W)},[W,t,r]),T.useEffect(()=>{t&&(V==null||U==null||Z.current.group===V&&Z.current.sample===U||(s(V),o(U),d(!0),h("samples"),Z.current={group:V,sample:U}))},[V,U,t,s,o,d,h]);const{data:B,isLoading:q,error:Y}=lue(t||"",n,!!t),{data:K}=ed(t||"",!!t,O),J=T.useMemo(()=>{var ge;return pw((ge=K==null?void 0:K.config)==null?void 0:ge.environments)},[(ve=K==null?void 0:K.config)==null?void 0:ve.environments]),F=T.useMemo(()=>{var Qe;const ge=mw((Qe=K==null?void 0:K.config)==null?void 0:Qe.environments),Ye=gw(K==null?void 0:K.data_metric_ranges);return vw(ge,Ye)},[(ye=K==null?void 0:K.config)==null?void 0:ye.environments,K==null?void 0:K.data_metric_ranges]),j=T.useMemo(()=>{var Ie;const ge=(Ie=K==null?void 0:K.config)==null?void 0:Ie.group_size,Ye=typeof ge=="object"&&ge!==null&&"value"in ge?Number(ge.value):Number(ge);if(!Ye||isNaN(Ye)||Ye<=1)return null;const Qe=Math.sqrt(Ye-1);return{min:-Qe,max:Qe}},[(ke=K==null?void 0:K.config)==null?void 0:ke.group_size]),X=T.useMemo(()=>{var ge;return(ge=B==null?void 0:B.available_trainer_steps)!=null&&ge.length&&n===null?B.available_trainer_steps[B.available_trainer_steps.length-1]:null},[B,n]);T.useEffect(()=>{X!==null&&n===null&&W==null&&r(X)},[X,W,n,r]);const H=ge=>{r(ge)},[se,re]=T.useState([]),[ie,ue]=T.useState(null),[le,fe]=T.useState(new Map);t!==ie&&(re([]),ue(t),fe(new Map));const xe=B==null?void 0:B.available_trainer_steps,he=T.useMemo(()=>{const ge=xe??[];return[...new Set([...se,...ge])].sort((Qe,Ie)=>Qe-Ie)},[xe,se]);he.length>se.length&&re(he);const Te=he.length>0,We=Te?he[he.length-1]:0,Se=T.useMemo(()=>{if(n==null)return he.length-1;const ge=he.indexOf(n);return ge>=0?ge:he.length-1},[he,n]),Le=ge=>{ge>=0&&ge<he.length&&H(he[ge])},pe=T.useMemo(()=>{if(B!=null&&B.prompts)return B.prompts.map(ge=>({step:ge.trainer_step,group_id:ge.group_id,env:ge.env,system_prompt:ge.system_prompt,tokens_system_prompt:ge.tokens_system_prompt,prompt:ge.prompt,tokens_prompt:ge.tokens_prompt}))},[B]),Re=T.useMemo(()=>{if(B!=null&&B.rollouts)return B.rollouts.map(ge=>({step:ge.trainer_step,group_id:ge.group_id,sample_idx:ge.sample_idx,turn_order:ge.turn_order,turn_type:ge.turn_type,content:ge.content,tokens:ge.tokens}))},[B]),ne=T.useMemo(()=>{if(B!=null&&B.samples_data)return B.samples_data.map(ge=>({step:ge.trainer_step,group_id:ge.group_id,sample_idx:ge.sample_idx,reward:ge.reward,advantage:ge.advantage,turns:ge.turns,total_tokens:ge.total_tokens,raw_string:ge.raw_string}))},[B]),Xe=T.useMemo(()=>{if(!(B!=null&&B.rollout_metrics))return;const ge=n??0;return B.rollout_metrics.map(Ye=>({step:ge,sample_idx:Ye.sample_idx,env:Ye.env,metric_name:Ye.metric_name,value:Ye.value}))},[B,n]),Ae=T.useMemo(()=>{if(!(B!=null&&B.golden_answers))return;const ge=n??0;return B.golden_answers.map(Ye=>({step:ge,sample_idx:Ye.sample_idx,env:Ye.env,key:Ye.key,value:Ye.value}))},[B,n]),Pe=T.useMemo(()=>{if(!(B!=null&&B.info_turns))return;const ge=n??0;return B.info_turns.map(Ye=>({step:ge,sample_idx:Ye.sample_idx,turn_order:Ye.turn_order,env:Ye.env,info_key:Ye.info_key,info_value:Ye.info_value,info_type:Ye.info_type}))},[B,n]),Ke=T.useMemo(()=>{if(!(B!=null&&B.prompts))return null;const ge=new Map;for(const Ye of B.prompts)ge.set(Ye.group_id,Ye.discard_reason);return ge},[B]),oe=Ke??le;Ke&&Ke!==le&&fe(Ke);const te=ge=>{switch(ge){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return ge.split("_").map(Ye=>Ye.charAt(0).toUpperCase()+Ye.slice(1)).join(" ")}},_e=ge=>{switch(ge){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}};return t?p.jsxs("div",{className:"flex h-full overflow-hidden",children:[p.jsx(V9,{prompts:pe,data:Re,samplesData:ne,rolloutMetrics:Xe,isLoading:q,step:n??void 0,currentStepIndex:Se,totalSteps:he.length,onStepChange:Le,hasSteps:Te,stepValues:he,openAtom:zC,selectedGroupIdAtom:GD,selectedSampleIdxAtom:WD,viewModeAtom:qD,getGroupBadge:ge=>{const Ye=oe.get(ge.group_id);return Ye?p.jsx(W1,{variant:_e(Ye),className:"text-[10px] h-4 px-1.5",children:te(Ye)}):null}}),p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center justify-between h-7",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(H9,{openAtom:zC}),l&&p.jsxs("div",{className:"text-sm text-muted-foreground",children:[p.jsxs("span",{children:["Step"," ",((Be=l.sample.turns[0])==null?void 0:Be.step)??n]})," · ",p.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",p.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&p.jsx(GT,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&p.jsxs(p.Fragment,{children:[p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(ge=>ge+1),R(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(ge=>ge+1),R(!0)},children:"Expand All"}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",S>0&&` (${S})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(vi,{checked:_,onCheckedChange:ge=>w(!!ge),onSelect:ge=>ge.preventDefault(),children:"Format Think"}),p.jsx(vi,{checked:v.includes("markdown"),onCheckedChange:()=>E("markdown"),onSelect:ge=>ge.preventDefault(),children:"Markdown"}),p.jsx(vi,{checked:v.includes("latex"),onCheckedChange:()=>E("latex"),onSelect:ge=>ge.preventDefault(),children:"LaTeX"}),p.jsx(vi,{checked:v.includes("code"),onCheckedChange:()=>E("code"),onSelect:ge=>ge.preventDefault(),children:"Code"})]})]})]})]}),p.jsx(U9,{openAtom:LC})]})})}),p.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:p.jsxs("div",{className:c||g?"max-w-5xl mx-auto":"",children:[Y&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",Y instanceof Error?Y.message:"Unknown error"]})})}),p.jsx(y1,{prompts:pe,data:Re,samplesData:ne,rolloutMetrics:Xe,goldenAnswers:Ae,infoTurns:Pe,isLoading:q,step:n??void 0,scrollToSampleId:U,filterGroupId:i,filterSampleIdx:a,lastValidSampleAtom:$D,collapseAllSignal:A,expandAllSignal:I,defaultSectionsOpen:L,envRewardRanges:J,envMetricRanges:F,advantageRange:j,renderOptions:v,formatThinkBlocks:_})]})})]}),p.jsx(B9,{currentStep:n,maxSelectableStep:We,openAtom:LC,selectedMetricsAtom:jce,selectedStepAtom:VD,includeDiscardedDefaults:!0})]}):p.jsx(hm,{description:"Select a run from the sidebar to view discarded rollouts."})}function o6e(){const t=ki(ml),{data:e,error:n}=ed(t||"",!!t,!1),r=T.useMemo(()=>qK(e==null?void 0:e.summary),[e==null?void 0:e.summary]);return t?n?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),p.jsx("div",{className:"text-xs text-muted-foreground",children:n instanceof Error?n.message:"Unknown error"})]})}):e?!r||r.nodes.length===0?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),p.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):p.jsx("div",{className:"h-full w-full",children:p.jsx(YK,{topology:r})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})}):p.jsx(hm,{description:"Select a run from the sidebar to view cluster topology."})}const fs=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],p7=["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"],hF=["torch_allocated_gb","torch_reserved_gb","torch_max_allocated_gb"],pF=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],mF=["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 l6e(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 A5(t,e,n){return n?`${t??"?"}:${e}`:`gpu:${e}`}function IS(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),a=Number.parseInt(r.slice(4,6),16);return`rgba(${i}, ${s}, ${a}, ${e})`}}return t}function m7(t,e){const n=new Map,r=[...t].sort((i,s)=>{const a=typeof i.node_id=="number"&&Number.isFinite(i.node_id)?i.node_id:Number.MAX_SAFE_INTEGER,o=typeof s.node_id=="number"&&Number.isFinite(s.node_id)?s.node_id:Number.MAX_SAFE_INTEGER;return a!==o?a-o: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,a=`${s??"?"}:${i.gpu_index}`;n.has(a)||n.set(a,{node_id:s,gpu_index:i.gpu_index})}return Array.from(n.values()).map((i,s)=>({seriesKey:A5(i.node_id,i.gpu_index,e),...i,label:e?`Node ${i.node_id??"?"} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?fs[s%fs.length]:fs[i.gpu_index%fs.length]}))}function c6e(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:A5(i.node_id,i.gpu_index,e),node_id:i.node_id,gpu_index:i.gpu_index,label:e?`Node ${i.node_id} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?fs[s%fs.length]:fs[i.gpu_index%fs.length]}))}function g7({series:t,activeSeriesKeys:e,onSeriesHover:n,onSeriesToggle:r}){return t.length===0?null:p.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)),a=!!e&&e.size>0&&!s;return p.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",r&&"cursor-pointer",s&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:a?.3:1},onPointerEnter:n?()=>n(i.seriesKey):void 0,onPointerLeave:n?()=>n(null):void 0,onClick:r?()=>r(i.seriesKey):void 0,children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?IS(i.color,.25):i.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:i.label})]},i.seriesKey)})})}function u6e({trainerLabels:t,inferenceLabels:e,activeSeriesKeys:n,onSeriesHover:r,onSeriesToggle:i}){return t.length===0&&e.length===0?null:p.jsxs("div",{className:"space-y-2 mb-3",children:[t.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Trainer"}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:t.map(s=>{const a=!!(n!=null&&n.has(s.seriesKey)),o=!!n&&n.size>0&&!a;return p.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",i&&"cursor-pointer",a&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:o?.3:1},onPointerEnter:r?()=>r(s.seriesKey):void 0,onPointerLeave:r?()=>r(null):void 0,onClick:i?()=>i(s.seriesKey):void 0,children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?IS(s.color,.25):s.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`trainer-${s.seriesKey}`)})})]}),e.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Inference"}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:e.map(s=>{const a=!!(n!=null&&n.has(s.seriesKey)),o=!!n&&n.size>0&&!a;return p.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",i&&"cursor-pointer",a&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:o?.3:1},onPointerEnter:r?()=>r(s.seriesKey):void 0,onPointerLeave:r?()=>r(null):void 0,onClick:i?()=>i(s.seriesKey):void 0,children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?IS(s.color,.25):s.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`inference-${s.seriesKey}`)})})]})]})}function QK(t){const e=Math.abs(t);if(e>=60)return mT(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 ev(t)}const JK=28;function eZ(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,a=t[n];if(a!=null)return s(n)?n:null;let o=n-1,l=n+1;for(;o>=0||l<t.length;){const c=o>=0?t[o]:void 0,d=l<t.length?t[l]:void 0,h=c!=null,g=d!=null;if(h&&g){const v=Math.abs(Number(e[o])-i),_=Math.abs(Number(e[l])-i)<v?l:o;return s(_)?_:null}if(h)return s(o)?o:null;if(g)return s(l)?l:null;o-=1,l+=1}return null}function tZ(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),a=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),o=a-s,l=6;return{lower:s-l*o,upper:a+l*o}}function S1({label:t,onRemove:e}){return p.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] bg-white border border-gray-400 text-gray-600 rounded-full cursor-pointer hover:bg-gray-50 transition-colors",onClick:n=>{n.stopPropagation(),e()},children:[t,p.jsx(Ju,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function d6e({metricName:t,data:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const a=T.useRef(null),o=T.useRef(null),l=T.useRef(null),[c,d]=T.useState(!1),[h,g]=T.useState(null),[v,b]=T.useState(null),_=NT[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:w,seriesConfig:S,hasData:E,nodeIds:A,timeRange:N,outlierBounds:I}=T.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:[],timeRange:i??{start:0,end:1},outlierBounds:null};const O=new Set;let W=1/0,U=-1/0;const V=[];for(const j of e){const X=typeof j.node_id=="number"&&Number.isFinite(j.node_id)?j.node_id:0;O.add(X),j.timestamp<W&&(W=j.timestamp),j.timestamp>U&&(U=j.timestamp),V.push(j.value)}const G=Array.from(O).sort((j,X)=>j-X),Z=i??{start:W,end:U},B={},q=new Set;for(const j of e){const X=typeof j.node_id=="number"&&Number.isFinite(j.node_id)?j.node_id:0;q.add(j.timestamp),B[j.timestamp]||(B[j.timestamp]={}),B[j.timestamp][X]=j.value}const Y=Array.from(q).sort((j,X)=>j-X);if(Y.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:G,timeRange:Z,outlierBounds:null};const K=Y.map(j=>j-Z.start),J=[{label:"Time"}],F=[K];for(let j=0;j<G.length;j++){const X=G[j],H=Y.map(se=>{var re;return((re=B[se])==null?void 0:re[X])??null});F.push(H),J.push({label:`Node ${X}`,stroke:fs[j%fs.length],width:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:F,seriesConfig:J,hasData:!0,nodeIds:G,timeRange:Z,outlierBounds:tZ(V)}},[e,i]),P=A.length>1,L=T.useCallback(O=>Math.abs(O)>=1e3?`${parseFloat((O/1e3).toFixed(1))}k`:Number.isInteger(O)?O.toLocaleString():Math.abs(O)<.01&&O!==0?O.toExponential(1):String(parseFloat(O.toFixed(2))),[]);T.useEffect(()=>{if(!a.current||!w||!E)return;const O=a.current,W=O.clientWidth,U=192;let V=Number.POSITIVE_INFINITY,G=Number.NEGATIVE_INFINITY;for(let re=1;re<w.length;re+=1){const ie=w[re];for(let ue=0;ue<ie.length;ue+=1){const le=ie[ue];le!=null&&(c&&I?le>=I.lower&&le<=I.upper&&(le<V&&(V=le),le>G&&(G=le)):(le<V&&(V=le),le>G&&(G=le)))}}V===Number.POSITIVE_INFINITY&&I&&(V=I.lower,G=I.upper);const Z=G-V,B=Math.max(Math.abs(G),Math.abs(V)),q=Math.max(B*.05,1e-10),Y=Math.max(Z*.1,q),K=[h!==null?h:Math.max(0,V-Y),v!==null?v:G+Y],J="rgba(128, 128, 128, 0.15)",F="rgba(100, 100, 100, 0.9)",X={width:W,height:U,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:P},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(re,ie,ue)=>{const le=N.end-N.start;return le>0?[0,le]:[ie,ue]}},y:{range:K}},axes:[{stroke:F,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:(re,ie,ue,le)=>[ue,le],values:(re,ie)=>ie.map(ue=>X0(N.start+Number(ue),N.end-N.start))},{stroke:F,grid:{stroke:J,width:1},ticks:{stroke:J,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(re,ie)=>{if(!ie||ie.length===0)return 40;const ue=Math.max(...ie.map(le=>le.length));return Math.max(40,ue*7+14)},values:(re,ie)=>ie.map(L)}],series:S,hooks:{setCursor:[re=>{if(!l.current||!a.current)return;const{left:ie,idx:ue}=re.cursor;if(ue==null||ie===void 0||ie<0){l.current.style.display="none";return}const le=w[0][ue];if(le===void 0){l.current.style.display="none";return}const fe=w[0],xe=(()=>{const Ae=re.scales.x,Pe=Number(Ae.min),Ke=Number(Ae.max);if(!Number.isFinite(Pe)||!Number.isFinite(Ke))return null;const oe=Math.abs(Ke-Pe);if(oe<=0)return null;const te=Math.max(1,re.bbox.width);return oe*JK/te})(),he=QK(Number(le)+s),Te=N.start+Number(le);let Se=`<div class="font-medium mb-1">${X0(Te,N.end-N.start)}</div>`;Se+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${he}</div>`,Se+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Te.toFixed(3)}</div>`;let Le=!1;for(let Ae=0;Ae<A.length;Ae+=1){const Pe=w[Ae+1],Ke=eZ(Pe,fe,ue,xe);if(Ke===null)continue;const oe=Pe==null?void 0:Pe[Ke];if(oe==null)continue;Le=!0;const te=qu(oe);Se+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${fs[Ae%fs.length]}"></div>
                  <span class="text-muted-foreground">Node ${A[Ae]}:</span>
                  <span class="font-medium">${te} ${_.unit}</span>
                </div>
              `}if(!Le){l.current.style.display="none";return}l.current.innerHTML=Se,l.current.style.display="block";const pe=a.current.getBoundingClientRect(),Re=l.current.getBoundingClientRect();let ne=pe.left+ie+15;ne+Re.width+20>window.innerWidth&&(ne=pe.left+ie-Re.width-15+re.bbox.left),ne=Math.max(4,ne);let Xe=pe.top-Re.height+20;Xe<4&&(Xe=pe.bottom-20),l.current.style.left=`${ne}px`,l.current.style.top=`${Xe}px`}]}};o.current&&o.current.destroy();const H=new ma(X,w,O);o.current=H;const se=new ResizeObserver(re=>{for(const ie of re){const{width:ue}=ie.contentRect;H&&ue>0&&H.setSize({width:ue,height:U})}});return se.observe(O),()=>{se.disconnect(),H.destroy(),o.current=null}},[w,E,S,t,N,s,P,_.unit,A,L,c,I,h,v]);const R=T.useCallback(()=>{l.current&&(l.current.style.display="none")},[]);return p.jsxs("div",{className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white",n&&"opacity-60"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:_.label}),c&&p.jsx(S1,{label:"Ignore Outliers",onRemove:()=>d(!1)}),h!==null&&p.jsx(S1,{label:`Min Y: ${h}`,onRemove:()=>g(null)}),v!==null&&p.jsx(S1,{label:`Max Y: ${v}`,onRemove:()=>b(null)})]}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.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:p.jsx(iw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:c,onCheckedChange:d,children:"Ignore Outliers"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.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:h??"",onChange:O=>{const W=O.target.value;g(W===""?null:Number(W))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.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:v??"",onChange:O=>{const W=O.target.value;b(W===""?null:Number(W))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]})]})]})})]}),E?p.jsxs("div",{className:"h-48 relative bg-white rounded",ref:a,onMouseLeave:R,children:[r&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"}),p.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"}})]}):p.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:n?"Loading...":`No data for ${_.label}`})]})}function v7({data:t,metricNames:e,intervalStart:n,intervalEnd:r,gpuIndices:i,seriesMode:s,isLoading:a,isRefetching:o,seriesRoles:l,activeSeriesKeys:c,xOffset:d=0}){const h=T.useMemo(()=>{const v=new Map;for(const b of t)v.set(b.metric_name,(v.get(b.metric_name)??0)+1);return e.filter(b=>(v.get(b)??0)>0)},[t,e]),g=T.useMemo(()=>a&&e.length>0?e:a&&e.length===0?p7:h,[a,e,h]);return g.length===0&&!a?p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-gray-200 bg-white",children:"No GPU metrics data available"}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:g.map(v=>{const b=t.filter(_=>_.metric_name===v);return p.jsx(m$,{metricName:v,data:b,gpuIndices:i,intervalStart:n,intervalEnd:r,seriesMode:s,showLegend:!1,isLoading:a,isRefetching:o,seriesRoles:l,activeSeriesKeys:c,xOffset:d,xAxisMode:"clock",xAxisTicks:"bounds"},v)})})}function f6e({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const a=T.useMemo(()=>{const l=new Set;for(const d of t)d.metric_name.startsWith("cpu_core_")||l.add(d.metric_name);for(const d of e??[])d.startsWith("cpu_core_")||l.add(d);const c=pF.filter(d=>l.has(d));for(const d of l)c.includes(d)||c.push(d);return c},[t,e]),o=T.useMemo(()=>a.length>0?a:n?pF:a,[a,n]);return o.length===0&&!n?p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-gray-200 bg-white",children:"No CPU metrics data available"}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:o.map(l=>{const c=t.filter(d=>d.metric_name===l);return p.jsx(d6e,{metricName:l,data:c,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s},l)})})}function h6e({metricName:t,data:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:a=0}){const o=T.useRef(null),l=T.useRef(null),c=T.useRef(null),[d,h]=T.useState(!1),[g,v]=T.useState(null),[b,_]=T.useState(null),w=NT[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:S,seriesConfig:E,hasData:A,serverIds:N,timeRange:I,outlierBounds:P}=T.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:[],timeRange:s??{start:0,end:1},outlierBounds:null};const O=new Set;let W=1/0,U=-1/0;const V=[];for(const j of e)O.add(j.server),j.timestamp<W&&(W=j.timestamp),j.timestamp>U&&(U=j.timestamp),V.push(j.value);const G=Array.from(O).sort((j,X)=>j-X),Z=s??{start:W,end:U},B={},q=new Set;for(const j of e)q.add(j.timestamp),B[j.timestamp]||(B[j.timestamp]={}),B[j.timestamp][j.server]=j.value;const Y=Array.from(q).sort((j,X)=>j-X);if(Y.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:G,timeRange:Z,outlierBounds:null};const K=Y.map(j=>j-Z.start),J=[{label:"Time"}],F=[K];for(let j=0;j<G.length;j++){const X=G[j],H=Y.map(re=>{var ie;return((ie=B[re])==null?void 0:ie[X])??null}),se=!!i&&i.size>0&&!i.has(X);F.push(H),J.push({label:`Server ${X}`,stroke:se?IS(fs[j%fs.length],.25):fs[j%fs.length],width:se?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:F,seriesConfig:J,hasData:!0,serverIds:G,timeRange:Z,outlierBounds:tZ(V)}},[e,s,i]),L=T.useCallback(O=>Math.abs(O)>=1e3?`${parseFloat((O/1e3).toFixed(1))}k`:Number.isInteger(O)?O.toLocaleString():Math.abs(O)<.01&&O!==0?O.toExponential(1):String(parseFloat(O.toFixed(2))),[]);T.useEffect(()=>{if(!o.current||!S||!A)return;const O=o.current,W=O.clientWidth,U=192;let V=Number.POSITIVE_INFINITY,G=Number.NEGATIVE_INFINITY;for(let re=1;re<S.length;re+=1){const ie=S[re];for(let ue=0;ue<ie.length;ue+=1){const le=ie[ue];le!=null&&(d&&P?le>=P.lower&&le<=P.upper&&(le<V&&(V=le),le>G&&(G=le)):(le<V&&(V=le),le>G&&(G=le)))}}V===Number.POSITIVE_INFINITY&&P&&(V=P.lower,G=P.upper);const Z=G-V,B=Math.max(Math.abs(G),Math.abs(V)),q=Math.max(B*.05,1e-10),Y=Math.max(Z*.1,q),K=[g!==null?g:Math.max(0,V-Y),b!==null?b:G+Y],J="rgba(128, 128, 128, 0.15)",F="rgba(100, 100, 100, 0.9)",X={width:W,height:U,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:!1},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(re,ie,ue)=>{const le=I.end-I.start;return le>0?[0,le]:[ie,ue]}},y:{range:K}},axes:[{stroke:F,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:(re,ie,ue,le)=>[ue,le],values:(re,ie)=>ie.map(ue=>X0(I.start+Number(ue),I.end-I.start))},{stroke:F,grid:{stroke:J,width:1},ticks:{stroke:J,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(re,ie)=>{if(!ie||ie.length===0)return 40;const ue=Math.max(...ie.map(le=>le.length));return Math.max(40,ue*7+14)},values:(re,ie)=>ie.map(L)}],series:E,hooks:{setCursor:[re=>{if(!c.current||!o.current)return;const{left:ie,idx:ue}=re.cursor;if(ue==null||ie===void 0||ie<0){c.current.style.display="none";return}const le=S[0][ue];if(le===void 0){c.current.style.display="none";return}const fe=S[0],xe=(()=>{const Ae=re.scales.x,Pe=Number(Ae.min),Ke=Number(Ae.max);if(!Number.isFinite(Pe)||!Number.isFinite(Ke))return null;const oe=Math.abs(Ke-Pe);if(oe<=0)return null;const te=Math.max(1,re.bbox.width);return oe*JK/te})(),he=QK(Number(le)+a),Te=I.start+Number(le);let Se=`<div class="font-medium mb-1">${X0(Te,I.end-I.start)}</div>`;Se+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${he}</div>`,Se+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Te.toFixed(3)}</div>`;let Le=!1;for(let Ae=0;Ae<N.length;Ae+=1){const Pe=S[Ae+1],Ke=eZ(Pe,fe,ue,xe);if(Ke===null)continue;const oe=Pe==null?void 0:Pe[Ke];if(oe==null)continue;Le=!0;const te=qu(oe);Se+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${fs[Ae%fs.length]}"></div>
                  <span class="text-muted-foreground">Server ${N[Ae]}:</span>
                  <span class="font-medium">${te} ${w.unit}</span>
                </div>
              `}if(!Le){c.current.style.display="none";return}c.current.innerHTML=Se,c.current.style.display="block";const pe=o.current.getBoundingClientRect(),Re=c.current.getBoundingClientRect();let ne=pe.left+ie+15;ne+Re.width+20>window.innerWidth&&(ne=pe.left+ie-Re.width-15+re.bbox.left),ne=Math.max(4,ne);let Xe=pe.top-Re.height+20;Xe<4&&(Xe=pe.bottom-20),c.current.style.left=`${ne}px`,c.current.style.top=`${Xe}px`}]}};l.current&&l.current.destroy();const H=new ma(X,S,O);l.current=H;const se=new ResizeObserver(re=>{for(const ie of re){const{width:ue}=ie.contentRect;H&&ue>0&&H.setSize({width:ue,height:U})}});return se.observe(O),()=>{se.disconnect(),H.destroy(),l.current=null}},[S,A,E,t,I,a,w.unit,N,L,d,P,g,b]);const R=T.useCallback(()=>{c.current&&(c.current.style.display="none")},[]);return p.jsxs("div",{className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white",n&&"opacity-60"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:w.label}),d&&p.jsx(S1,{label:"Ignore Outliers",onRemove:()=>h(!1)}),g!==null&&p.jsx(S1,{label:`Min Y: ${g}`,onRemove:()=>v(null)}),b!==null&&p.jsx(S1,{label:`Max Y: ${b}`,onRemove:()=>_(null)})]}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.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:p.jsx(iw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:d,onCheckedChange:h,children:"Ignore Outliers"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.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:g??"",onChange:O=>{const W=O.target.value;v(W===""?null:Number(W))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.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:O=>{const W=O.target.value;_(W===""?null:Number(W))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]})]})]})})]}),A?p.jsxs("div",{className:"h-48 relative bg-white rounded",ref:o,onMouseLeave:R,children:[r&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"}),p.jsx("div",{ref:c,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}})]}):p.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:n?"Loading...":`No data for ${w.label}`})]})}function p6e({data:t,activeServerIds:e,onServerHover:n,onServerToggle:r}){const i=T.useMemo(()=>{const s=new Set;for(const o of t)s.add(o.server);return Array.from(s).sort((o,l)=>o-l).map((o,l)=>({serverId:o,label:`Server ${o}`,color:fs[l%fs.length]}))},[t]);return i.length<=1?null:p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mb-3",children:i.map(s=>{const a=!!(e!=null&&e.has(s.serverId)),o=!!e&&e.size>0&&!a;return p.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",r&&"cursor-pointer",a&&"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(s.serverId):void 0,onPointerLeave:n?()=>n(null):void 0,onClick:r?()=>r(s.serverId):void 0,children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?IS(s.color,.25):s.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},s.label)})})}function m6e({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:a=0}){const o=T.useMemo(()=>{const c=new Set;for(const h of t)c.add(h.metric_name);for(const h of e??[])c.add(h);const d=mF.filter(h=>c.has(h));for(const h of c)d.includes(h)||d.push(h);return d},[t,e]),l=T.useMemo(()=>o.length>0?o:n?mF:o,[o,n]);return l.length===0&&!n?p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-gray-200 bg-white",children:"No vLLM metrics data available"}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:l.map(c=>{const d=t.filter(h=>h.metric_name===c);return p.jsx(h6e,{metricName:c,data:d,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:a},c)})})}function g6e({nodeId:t,gpuCount:e,children:n}){const[r,i]=T.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return p.jsxs(Ki,{open:r,onOpenChange:i,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),p.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"mt-3",children:n})})]})}function gF({title:t,gpuData:e,gpuMetricNames:n,timeRange:r,nodeGpuMap:i,isLoading:s,isRefetching:a,open:o,onOpenChange:l,nodeMode:c,onNodeModeChange:d,xOffset:h=0}){const[g,v]=T.useState(!0),[b,_]=T.useState("combined"),w=o??g,S=l??v,E=c??b,A=d??_,[N,I]=T.useState(null),[P,L]=T.useState([]),R=i.size>1,O=T.useMemo(()=>{const K=[],J=Array.from(i.keys()).sort((F,j)=>F-j);for(const F of J){const j=[...i.get(F)??[]].sort((X,H)=>X-H);for(const X of j)K.push({nodeId:F,gpuIndex:X})}return K.map((F,j)=>({seriesKey:A5(F.nodeId,F.gpuIndex,R),node_id:F.nodeId,gpu_index:F.gpuIndex,label:R?`Node ${F.nodeId} GPU ${F.gpuIndex}`:`GPU ${F.gpuIndex}`,color:R?fs[j%fs.length]:fs[F.gpuIndex%fs.length]}))},[i,R]),W=T.useMemo(()=>{const K=m7(e,R);return K.length>0?K:O},[e,R,O]),U=T.useMemo(()=>{const K=new Set;for(const J of e)K.add(J.gpu_index);return Array.from(K).sort((J,F)=>J-F)},[e]),V=T.useMemo(()=>{const K=[],J=Array.from(i.keys()).sort((F,j)=>F-j);for(const F of J){const j=i.get(F),X=e.filter(re=>(typeof re.node_id=="number"?re.node_id:null)===F&&j.includes(re.gpu_index)),H=m7(X,!1),se=H.length>0?H:j.map(re=>({seriesKey:A5(F,re,!1),node_id:F,gpu_index:re,label:`GPU ${re}`,color:fs[re%fs.length]}));K.push({nodeId:F,gpuIndices:j,data:X,labels:se})}return K},[e,i]),G=T.useMemo(()=>{const K=new Set;return E==="combined"||!R?(W.forEach(J=>K.add(J.seriesKey)),K):(V.forEach(J=>{J.labels.forEach(F=>K.add(F.seriesKey))}),K)},[E,R,W,V]),Z=T.useCallback(K=>{L(J=>{const F=J.filter(re=>!G.has(re)),j=J.filter(re=>G.has(re)),H=j.includes(K)?j.filter(re=>re!==K):[...j,K],se=G.size>0&&H.length===G.size?[]:H;return[...F,...se]})},[G]),B=T.useMemo(()=>G.size===0?P:P.filter(K=>G.has(K)),[P,G]),q=T.useMemo(()=>N&&(G.size===0||G.has(N))?N:null,[N,G]),Y=T.useMemo(()=>B.length>0?new Set(B):q?new Set([q]):null,[B,q]);return p.jsxs(Ki,{open:w,onOpenChange:S,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!w&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:t})]})}),w&&R&&p.jsxs(Y0,{type:"single",variant:"selecting",size:"sm",value:E,onValueChange:K=>{K&&A(K)},children:[p.jsx(Uo,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"}),p.jsx(Uo,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Nodes"})]})]}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6",children:E==="combined"||!R?p.jsxs(p.Fragment,{children:[p.jsx(g7,{series:W,activeSeriesKeys:Y,onSeriesHover:I,onSeriesToggle:Z}),p.jsx(v7,{data:e,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:U,seriesMode:R?"node_gpu":"gpu",isLoading:s,isRefetching:a,activeSeriesKeys:Y,xOffset:h})]}):V.map(K=>p.jsxs(g6e,{nodeId:K.nodeId,gpuCount:K.gpuIndices.length,children:[p.jsx(g7,{series:K.labels,activeSeriesKeys:Y,onSeriesHover:I,onSeriesToggle:Z}),p.jsx(v7,{data:K.data,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:K.gpuIndices,seriesMode:"gpu",isLoading:s,isRefetching:a,activeSeriesKeys:Y,xOffset:h})]},K.nodeId))})})]})}function v6e({gpuMetrics:t,cpuMetrics:e,vllmMetrics:n,availableGpuMetrics:r,availableCpuMetrics:i,availableVllmMetrics:s,trainerGpus:a,inferenceGpus:o,isLoading:l,isRefetching:c,systemMetricsOpen:d,onSystemMetricsOpenChange:h,cpuMetricsOpen:g,onCpuMetricsOpenChange:v,vllmMetricsOpen:b,onVllmMetricsOpenChange:_,roleMode:w,onRoleModeChange:S,trainerSectionOpen:E,onTrainerSectionOpenChange:A,inferenceSectionOpen:N,onInferenceSectionOpenChange:I,trainerNodeMode:P,onTrainerNodeModeChange:L,inferenceNodeMode:R,onInferenceNodeModeChange:O,overrideTimeRange:W,xOffset:U=0}){const[V,G]=T.useState(!0),[Z,B]=T.useState(!0),[q,Y]=T.useState(!0),[K,J]=T.useState("separated"),F=d??V,j=h??G,X=g??Z,H=v??B,se=b??q,re=_??Y,ie=w??K,ue=S??J,[le,fe]=T.useState(null),[xe,he]=T.useState([]),[Te,We]=T.useState(null),[Se,Le]=T.useState([]),pe=T.useMemo(()=>W||l6e(t),[t,W]),Re=T.useMemo(()=>{const me=new Set(r),je=p7.filter(lt=>me.has(lt)),He=hF.filter(lt=>me.has(lt)),nt=new Set([...p7,...hF]),yt=r.filter(lt=>!nt.has(lt)).sort();return[...je,...He,...yt]},[r]),ne=T.useMemo(()=>new Set(a.map(me=>`${me.node_id}:${me.gpu_index}`)),[a]),Xe=T.useMemo(()=>new Set(o.map(me=>`${me.node_id}:${me.gpu_index}`)),[o]),Ae=T.useMemo(()=>ne.size===0?[]:t.filter(me=>{const je=typeof me.node_id=="number"&&Number.isFinite(me.node_id)?me.node_id:null;return je===null?!1:ne.has(`${je}:${me.gpu_index}`)}),[t,ne]),Pe=T.useMemo(()=>Xe.size===0?[]:t.filter(me=>{const je=typeof me.node_id=="number"&&Number.isFinite(me.node_id)?me.node_id:null;return je===null?!1:Xe.has(`${je}:${me.gpu_index}`)}),[t,Xe]),Ke=T.useMemo(()=>{const me=new Map;for(const je of a){const He=me.get(je.node_id)??[];He.includes(je.gpu_index)||He.push(je.gpu_index),me.set(je.node_id,He)}for(const[je,He]of me)me.set(je,He.sort((nt,yt)=>nt-yt));return me},[a]),oe=T.useMemo(()=>{const me=new Map;for(const je of o){const He=me.get(je.node_id)??[];He.includes(je.gpu_index)||He.push(je.gpu_index),me.set(je.node_id,He)}for(const[je,He]of me)me.set(je,He.sort((nt,yt)=>nt-yt));return me},[o]),te=T.useMemo(()=>{const me=new Set;for(const je of t)me.add(je.gpu_index);return Array.from(me).sort((je,He)=>je-He)},[t]),_e=T.useMemo(()=>{const me=new Set;for(const je of t){const He=typeof je.node_id=="number"&&Number.isFinite(je.node_id)?je.node_id:null;me.add(He)}return me.size>1},[t]),ve=T.useMemo(()=>m7(t,_e),[t,_e]),ye=T.useMemo(()=>{if(a.length===0&&o.length===0)return[];const me=[...a,...o],je=new Set(me.map(He=>He.node_id)).size>1;return c6e(me,je)},[a,o]),ke=T.useMemo(()=>{const me=ve.length>0?ve:ye,je=new Set(a.map(He=>`${He.node_id}:${He.gpu_index}`));return me.filter(He=>{const nt=`${He.node_id??"?"}:${He.gpu_index}`;return je.has(nt)||je.has(`${He.node_id}:${He.gpu_index}`)})},[ve,ye,a]),Be=T.useMemo(()=>{const me=ve.length>0?ve:ye,je=new Set(o.map(He=>`${He.node_id}:${He.gpu_index}`));return me.filter(He=>{const nt=`${He.node_id??"?"}:${He.gpu_index}`;return je.has(nt)||je.has(`${He.node_id}:${He.gpu_index}`)})},[ve,ye,o]),ge=T.useMemo(()=>{const me={},je=new Set(a.map(nt=>`${nt.node_id}:${nt.gpu_index}`)),He=new Set(o.map(nt=>`${nt.node_id}:${nt.gpu_index}`));if(_e)for(const nt of t){const yt=typeof nt.node_id=="number"&&Number.isFinite(nt.node_id)?nt.node_id:null,lt=`${yt??"?"}:${nt.gpu_index}`,bt=`${yt}:${nt.gpu_index}`;je.has(bt)||je.has(lt)?me[lt]="Trainer":(He.has(bt)||He.has(lt))&&(me[lt]="Inference")}else{for(const nt of a)me[`gpu:${nt.gpu_index}`]="Trainer";for(const nt of o)me[`gpu:${nt.gpu_index}`]="Inference"}return me},[t,a,o,_e]),Ye=a.length>0||o.length>0,Qe=Ae.length>0||!!l&&a.length>0,Ie=Pe.length>0||!!l&&o.length>0,Fe=T.useMemo(()=>{if(!Ye)return ve;const me=new Map;for(const je of ke)me.set(je.seriesKey,je);for(const je of Be)me.set(je.seriesKey,je);return Array.from(me.values())},[Ye,ve,ke,Be]),Ge=T.useMemo(()=>new Set(Fe.map(me=>me.seriesKey)),[Fe]),Me=T.useMemo(()=>Ge.size===0?xe:xe.filter(me=>Ge.has(me)),[xe,Ge]),$e=T.useCallback(me=>{he(je=>{const He=je.filter(Nt=>!Ge.has(Nt)),nt=je.filter(Nt=>Ge.has(Nt)),lt=nt.includes(me)?nt.filter(Nt=>Nt!==me):[...nt,me],bt=Ge.size>0&&lt.length===Ge.size?[]:lt;return[...He,...bt]})},[Ge]),dt=T.useMemo(()=>le&&(Ge.size===0||Ge.has(le))?le:null,[le,Ge]),Oe=T.useMemo(()=>Me.length>0?Ge.size>0&&Me.length===Ge.size?null:new Set(Me):dt?new Set([dt]):null,[Me,dt,Ge]),st=T.useMemo(()=>{const me=new Set;for(const je of n??[])me.add(je.server);return me},[n]),ft=T.useMemo(()=>st.size===0?Se:Se.filter(me=>st.has(me)),[Se,st]),pt=T.useCallback(me=>{Le(je=>{const He=je.filter(Nt=>!st.has(Nt)),nt=je.filter(Nt=>st.has(Nt)),lt=nt.includes(me)?nt.filter(Nt=>Nt!==me):[...nt,me],bt=st.size>0&&lt.length===st.size?[]:lt;return[...He,...bt]})},[st]),et=T.useMemo(()=>Te===null?null:st.size===0||st.has(Te)?Te:null,[Te,st]),Ze=T.useMemo(()=>ft.length>0?st.size>0&&ft.length===st.size?null:new Set(ft):et!==null?new Set([et]):null,[ft,et,st]);return p.jsxs("div",{className:"space-y-4",children:[p.jsxs(Ki,{open:F,onOpenChange:j,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!F&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"GPU Metrics"})]})})}),F&&Ye&&p.jsxs(Y0,{type:"single",variant:"selecting",size:"sm",value:ie,onValueChange:me=>{me&&ue(me)},children:[p.jsx(Uo,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Trainer/Inference"}),p.jsx(Uo,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"})]})]}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:ie==="combined"||!Ye?p.jsxs(p.Fragment,{children:[Ye?p.jsx(u6e,{trainerLabels:ke,inferenceLabels:Be,activeSeriesKeys:Oe,onSeriesHover:fe,onSeriesToggle:$e}):p.jsx(g7,{series:ve,activeSeriesKeys:Oe,onSeriesHover:fe,onSeriesToggle:$e}),p.jsx(v7,{data:t,metricNames:Re,intervalStart:pe.start,intervalEnd:pe.end,gpuIndices:te,seriesMode:_e?"node_gpu":"gpu",isLoading:l,isRefetching:c,seriesRoles:Ye?ge:void 0,activeSeriesKeys:Oe,xOffset:U})]}):p.jsxs(p.Fragment,{children:[Qe&&p.jsx(gF,{title:"Trainer",gpuData:Ae,gpuMetricNames:Re,timeRange:pe,nodeGpuMap:Ke,isLoading:l,isRefetching:c,open:E,onOpenChange:A,nodeMode:P,onNodeModeChange:L,xOffset:U}),Ie&&p.jsxs(p.Fragment,{children:[Qe&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsx(gF,{title:"Inference",gpuData:Pe,gpuMetricNames:Re,timeRange:pe,nodeGpuMap:oe,isLoading:l,isRefetching:c,open:N,onOpenChange:I,nodeMode:R,onNodeModeChange:O,xOffset:U})]}),!l&&Ae.length===0&&Pe.length===0&&p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-gray-200 bg-white",children:"No GPU data matches the trainer/inference role configuration"})]})})})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:X,onOpenChange:H,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!X&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"CPU Metrics"})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"mt-3 mb-4",children:p.jsx(f6e,{data:e,availableMetricNames:i,isLoading:l,isRefetching:c,overrideTimeRange:W,xOffset:U})})})]}),n&&n.length>0||s&&s.length>0||l?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:se,onOpenChange:re,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!se&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"vLLM Metrics"})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[p.jsx(p6e,{data:n??[],activeServerIds:Ze,onServerHover:We,onServerToggle:pt}),p.jsx(m6e,{data:n??[],availableMetricNames:s,isLoading:l,isRefetching:c,activeServerIds:Ze,overrideTimeRange:W,xOffset:U})]})})]})]}):null]})}function x6e(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=$6(r.type,r.args),r}const i=[r];for(let s=1;s<e.length;s++){const o=e[s].trimStart();if(!o||o===")"){o===")"&&i.length>1&&i.pop();continue}const l=o.match(/^\(([^)]*)\):\s*(\d+)\s*x\s+(\w[\w.]*)\((.*)$/);if(l){const b=l[1],_=parseInt(l[2],10),w=l[3];let S=l[4];const E=i[i.length-1];if(S.endsWith(")")){S=S.slice(0,-1);const A={name:b,type:w,args:S,children:[],depth:i.length,repeatCount:_,estimatedParams:0};A.estimatedParams=$6(w,S),E.children.push(A)}else{const A={name:b,type:w,args:"",children:[],depth:i.length,repeatCount:_,estimatedParams:0};E.children.push(A),i.push(A)}continue}const c=o.match(/^\(([^)]*)\):\s*(\w[\w.]*)\((.*)$/);if(!c)continue;const d=c[1],h=c[2];let g=c[3];const v=i[i.length-1];if(g.endsWith(")")){g=g.slice(0,-1);const b={name:d,type:h,args:g,children:[],depth:i.length,repeatCount:1,estimatedParams:0};b.estimatedParams=$6(h,g),v.children.push(b)}else{const b={name:d,type:h,args:"",children:[],depth:i.length,repeatCount:1,estimatedParams:0};v.children.push(b),i.push(b)}}return nZ(r),iZ(r),r}function vF(t){return/^\d+(-\d+)?$/.test(t)}function nZ(t){for(const r of t.children)nZ(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&&vF(r.name)&&vF(t.children[n+i].name)&&rZ(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 rZ(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(!rZ(t.children[n],e.children[n]))return!1;return!0}function iZ(t){if(t.children.length===0)return t.estimatedParams*(t.repeatCount||1);let e=0;for(const n of t.children)e+=iZ(n);return t.estimatedParams=e,e*(t.repeatCount||1)}function $6(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 a=n[0]*n[1];return r?a+n[1]:a}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 a=n[0];return i.includes("rmsnorm")?a:r?a*2:a}if(i.startsWith("conv")&&n.length>=3){const[a,o,l]=n,c=a*o*l*(n[3]??l);return r?c+o:c}return 0}function y6e(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 sZ(t,e,1),e}function sZ(t,e,n){var i,s;const r=(t.repeatCount||1)*n;if(t.children.length===0&&t.type){const a=t.type;e.layerTypeCounts[a]=(e.layerTypeCounts[a]||0)+r,e.totalParams+=t.estimatedParams*r;const o=b6e(t);e.paramsByCategory[o]+=t.estimatedParams*r;const l=((i=t.args.match(/\d+/g))==null?void 0:i.map(Number))??[],c=t.type.toLowerCase();if(c==="embedding"&&l.length>=2&&((!e.vocabSize||l[0]>e.vocabSize)&&(e.vocabSize=l[0]),e.hiddenSize||(e.hiddenSize=l[1])),c==="linear"&&l.length>=2){const d=Math.max(l[0],l[1]);e.hiddenSize&&d>e.hiddenSize&&(!e.intermediateSize||d>e.intermediateSize)&&(e.intermediateSize=d)}}else if(t.children.length>0){t.repeatCount>1&&t.depth>0&&(e.numLayers=Math.max(e.numLayers,t.repeatCount));for(const a of t.children)sZ(a,e,r)}if(t.children.length>0){const a=t.name.toLowerCase();if(a.includes("attn")||a.includes("attention")){for(const o of t.children)if(o.type.toLowerCase()==="linear"){const l=((s=o.args.match(/\d+/g))==null?void 0:s.map(Number))??[];if(l.length>=2){const c=o.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 b6e(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 ly(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 aZ(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 xF={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"}},yF={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 IE(t){return t?yF[t]?yF[t]:t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function _6e(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 N5(){return p.jsx("div",{className:"w-px h-4 bg-border mx-auto"})}function S6e({node:t}){const e=IE(t.name)||t.type,n=aZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?ly(t.estimatedParams):null;return p.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[p.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),r&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 break-all",children:r}),i&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:i})]})}function w6e({node:t}){const e=IE(t.name)||t.type,n=aZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?ly(t.estimatedParams):null;return p.jsxs("div",{className:"rounded-md border bg-background px-2.5 py-2 flex-1 min-w-0 text-center",children:[p.jsx("div",{className:"text-xs font-medium text-foreground",children:e}),r&&p.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5 break-all",children:r}),i&&p.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:i})]})}function M6e({node:t}){const e=IE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?ly(t.estimatedParams):null;return p.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[p.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r}),p.jsx("div",{className:"flex gap-1.5 flex-wrap mt-2",children:t.children.map((i,s)=>p.jsx(w6e,{node:i},s))})]})}function G9({node:t}){return t.children.length===0?p.jsx(S6e,{node:t}):t.repeatCount>1?p.jsx(T6e,{node:t}):t.children.every(n=>n.children.length===0)?p.jsx(M6e,{node:t}):p.jsx(E6e,{node:t})}function T6e({node:t}){return p.jsxs("div",{className:"relative w-full",children:[p.jsx("div",{className:"rounded-lg border-2 border-dashed border-muted-foreground/25 p-3 w-full",children:p.jsx("div",{className:"flex flex-col items-center w-full",children:t.children.map((e,n)=>p.jsxs("div",{className:"flex flex-col items-center w-full",children:[n>0&&p.jsx(N5,{}),p.jsx(G9,{node:e})]},n))})}),p.jsx("div",{className:"absolute left-full top-1/2 -translate-y-1/2 pl-5 pointer-events-none select-none",children:p.jsxs("span",{className:"text-4xl font-extralight text-muted-foreground/50 whitespace-nowrap leading-tight",children:["×",t.repeatCount,p.jsx("br",{}),p.jsx("span",{className:"text-2xl",children:"layers"})]})})]})}function E6e({node:t}){const e=IE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?ly(t.estimatedParams):null;return p.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full",children:[p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r})]}),p.jsx("div",{className:"flex flex-col items-center w-full mt-2",children:t.children.map((i,s)=>p.jsxs("div",{className:"flex flex-col items-center w-full",children:[s>0&&p.jsx(N5,{}),p.jsx(G9,{node:i})]},s))})]})}function C6e({root:t}){const e=T.useMemo(()=>_6e(t),[t]);return p.jsxs("div",{className:"flex flex-col items-center py-8 px-6 max-w-2xl mx-auto",children:[p.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Input"}),e.map((n,r)=>p.jsxs("div",{className:"flex flex-col items-center w-full",children:[p.jsx(N5,{}),p.jsx(G9,{node:n})]},r)),p.jsx(N5,{}),p.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Output"})]})}function A6e({stats:t,rawRepr:e}){const[n,r]=T.useState(!1),i=t.totalParams,s=T.useMemo(()=>Object.entries(t.paramsByCategory).filter(([,o])=>o>0).sort((o,l)=>l[1]-o[1]),[t.paramsByCategory]),a=T.useMemo(()=>Object.entries(t.layerTypeCounts).sort((o,l)=>l[1]-o[1]),[t.layerTypeCounts]);return p.jsxs("div",{className:"w-72 shrink-0 border-l overflow-y-auto p-4 space-y-5",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-base font-semibold",children:t.modelName}),i>0&&p.jsxs("p",{className:"text-sm text-muted-foreground",children:["~",ly(i)," parameters"]})]}),(t.numLayers>0||t.hiddenSize||t.vocabSize)&&p.jsxs("div",{children:[p.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Architecture"}),p.jsxs("div",{className:"space-y-1 text-sm",children:[t.numLayers>0&&p.jsx(CM,{label:"Layers",value:String(t.numLayers)}),t.hiddenSize&&p.jsx(CM,{label:"Hidden size",value:t.hiddenSize.toLocaleString()}),t.vocabSize&&p.jsx(CM,{label:"Vocab size",value:t.vocabSize.toLocaleString()}),t.intermediateSize&&p.jsx(CM,{label:"Intermediate",value:t.intermediateSize.toLocaleString()})]})]}),i>0&&s.length>0&&p.jsxs("div",{children:[p.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Parameters"}),p.jsx("div",{className:"flex h-2 rounded-full overflow-hidden mb-2.5",children:s.map(([o,l])=>p.jsx("div",{className:`${xF[o].bar}`,style:{width:`${l/i*100}%`,minWidth:l>0?"2px":0}},o))}),p.jsx("div",{className:"space-y-0.5",children:s.map(([o,l])=>p.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[p.jsx("div",{className:`w-2 h-2 rounded-sm shrink-0 ${xF[o].bar}`}),p.jsx("span",{className:"capitalize text-muted-foreground",children:o}),p.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:[ly(l)," (",(l/i*100).toFixed(0),"%)"]})]},o))})]}),a.length>0&&p.jsxs("div",{children:[p.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Layer Types"}),p.jsx("div",{className:"space-y-0.5",children:a.map(([o,l])=>p.jsxs("div",{className:"flex items-center text-xs",children:[p.jsx("span",{className:"text-foreground",children:o}),p.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:["×",l]})]},o))})]}),p.jsxs(Ki,{open:n,onOpenChange:r,children:[p.jsxs(Zi,{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider hover:text-foreground transition-colors",children:[n?p.jsx(Vr,{className:"size-3"}):p.jsx(u1,{className:"size-3"}),"Raw repr"]}),p.jsx(Qi,{children:p.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 CM({label:t,value:e}){return p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:t}),p.jsx("span",{className:"font-medium tabular-nums",children:e})]})}function N6e({modelRepr:t}){const e=T.useMemo(()=>x6e(t),[t]),n=T.useMemo(()=>e?y6e(e):null,[e]);return!e||!n?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx(Ble,{className:"size-8 text-muted-foreground mx-auto mb-2"}),p.jsx("div",{className:"text-sm text-muted-foreground",children:"Could not parse model architecture"})]})}):p.jsxs("div",{className:"flex h-full",children:[p.jsx("div",{className:"flex-1 overflow-auto",children:p.jsx(C6e,{root:e})}),p.jsx(A6e,{stats:n,rawRepr:t})]})}function oZ(t){return j9(t==null?void 0:t.setup)}function R6e(t){const e=oZ(t),n=[],r=mi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const a=mi(s);if(!a)continue;const o=Er(a.node_id);if(o===null)continue;const l=Array.isArray(a.gpus)?a.gpus:[];for(const c of l){const d=mi(c);if(!d)continue;const h=Er(d.gpu_index);h!==null&&n.push({node_id:o,gpu_index:h})}}return n}function k6e(t){const e=oZ(t),n=[],r=mi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const a=mi(s);if(!a)continue;const o=Er(a.node_id);if(o===null)continue;const l=Array.isArray(a.gpus)?a.gpus:[];for(const c of l){const d=mi(c);if(!d)continue;const h=Er(d.gpu_index);h!==null&&n.push({node_id:o,gpu_index:h})}}return n}const P6e=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],D6e=[1,5,10,30,60,120,300],q6=gT;function I6e(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),a=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10),l=s*3600+a*60+o;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function AM(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 O6e(t){const e=t.trim().toLowerCase();if(!e)return null;const n=e.match(/^(\d+(?:\.\d+)?)\s*ms$/i);if(n){const a=parseFloat(n[1]);return a>0?a/1e3:null}const r=/^(?:(\d+)\s*m)?\s*(?:(\d+(?:\.\d+)?)\s*s)?$/i,i=e.match(r);if(i&&(i[1]||i[2])){const a=parseInt(i[1]||"0",10),o=parseFloat(i[2]||"0"),l=a*60+o;return l>0?l:null}const s=parseFloat(e);return Number.isFinite(s)&&s>0?s:null}function L6e(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 a=n.get(s);a||(a={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,a)),a.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((a,o)=>a.timestamp-o.timestamp);const s=new Map;for(const a of i.entries){const o=Math.floor(a.timestamp/e);let l=s.get(o);l||(l={sum:0,count:0,ts:0},s.set(o,l)),l.sum+=a.value,l.count+=1,l.ts+=a.timestamp}for(const a of s.values())r.push({...i.key,timestamp:a.ts/a.count,value:a.sum/a.count})}return r}function z6e(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 a=n.get(s);a||(a={key:{metric_name:i.metric_name,node_id:i.node_id,source:i.source},entries:[]},n.set(s,a)),a.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((a,o)=>a.timestamp-o.timestamp);const s=new Map;for(const a of i.entries){const o=Math.floor(a.timestamp/e);let l=s.get(o);l||(l={sum:0,count:0,ts:0},s.set(o,l)),l.sum+=a.value,l.count+=1,l.ts+=a.timestamp}for(const a of s.values())r.push({...i.key,timestamp:a.ts/a.count,value:a.sum/a.count})}return r}function j6e(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 a=n.get(s);a||(a={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,a)),a.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((a,o)=>a.timestamp-o.timestamp);const s=new Map;for(const a of i.entries){const o=Math.floor(a.timestamp/e);let l=s.get(o);l||(l={sum:0,count:0,ts:0},s.set(o,l)),l.sum+=a.value,l.count+=1,l.ts+=a.timestamp}for(const a of s.values())r.push({...i.key,timestamp:a.ts/a.count,value:a.sum/a.count})}return r}function F6e({value:t,onChange:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(""),a=T.useRef(null),o=c=>{c&&(s(q6(t)),setTimeout(()=>{var d;return(d=a.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=I6e(i);c!==null&&(e(c),r(!1))};return p.jsxs(aT,{open:n,onOpenChange:o,children:[p.jsx(oT,{asChild:!0,children:p.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:[q6(t),p.jsx(Vr,{className:"size-3 text-muted-foreground"})]})}),p.jsxs(lT,{align:"start",className:"w-40 p-1.5 gap-1",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("input",{ref:a,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"}),p.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"})]}),p.jsx("div",{className:"flex flex-col",children:D6e.map(c=>p.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:q6(c)},c))})]})]})}function U6e(){var Nt;const[t,e]=T.useState(null),n=T.useRef(0),r=ki(ml),i=!0,[s,a]=cn(Gce),[o,l]=cn(Wce),[c,d]=cn($ce),[h,g]=cn(qce),[v,b]=cn(Xce),[_,w]=cn(Yce),[S,E]=cn(Kce),[A,N]=cn(Zce),[I,P]=cn(Qce),[L,R]=cn(Jce),[O,W]=cn(iue),[U,V]=cn(eue),[G,Z]=cn(tue),[B,q]=cn(nue),[Y,K]=cn(rue),[J,F]=T.useState(AM(_));T.useEffect(()=>{t&&(t.scrollTop=S,n.current=S)},[t]),T.useEffect(()=>{if(!t)return;const Pt=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",Pt,{passive:!0}),()=>{t.removeEventListener("scroll",Pt),E(n.current)}},[t]);const{data:j,error:X}=ed(r||"",!!r,i),H=T.useMemo(()=>qK(j==null?void 0:j.summary),[j==null?void 0:j.summary]),{data:se,isFetching:re,isPlaceholderData:ie}=mue(r||"",o,c,h,!!r),ue=!!r&&se!==void 0,{data:le,isFetching:fe,isPlaceholderData:xe}=gue(r||"",o,c,(se==null?void 0:se.global_min_time)??null,h,P6e,ue),he=!!r&&se!==void 0,{data:Te,isFetching:We,isPlaceholderData:Se}=vue(r||"",o,c,(se==null?void 0:se.global_min_time)??null,h,null,he),Le=(se==null?void 0:se.total_pages)??(le==null?void 0:le.total_pages)??null,pe=se,Re=le,ne=Te,[Xe,Ae]=T.useState([]),[Pe,Ke]=T.useState([]),[oe,te]=T.useState([]);T.useEffect(()=>{pe!=null&&pe.available_metrics&&pe.available_metrics.length>0&&Ae(pe.available_metrics)},[pe==null?void 0:pe.available_metrics]),T.useEffect(()=>{Re!=null&&Re.available_metrics&&Re.available_metrics.length>0&&Ke(Re.available_metrics)},[Re==null?void 0:Re.available_metrics]),T.useEffect(()=>{ne!=null&&ne.available_metrics&&ne.available_metrics.length>0&&te(ne.available_metrics)},[ne==null?void 0:ne.available_metrics]);const[_e,ve]=T.useState(1),[ye,ke]=T.useState(null),[Be,ge]=T.useState(null),[Ye,Qe]=T.useState(null);T.useEffect(()=>{Le!==null&&Le>0&&ve(Le)},[Le]),T.useEffect(()=>{const Pt=(pe==null?void 0:pe.global_min_time)??(Re==null?void 0:Re.global_min_time)??null;Pt!==null&&ke(Pt)},[pe==null?void 0:pe.global_min_time,Re==null?void 0:Re.global_min_time]),T.useEffect(()=>{const Pt=(pe==null?void 0:pe.interval_start)??(Re==null?void 0:Re.interval_start)??null,Ve=(pe==null?void 0:pe.interval_end)??(Re==null?void 0:Re.interval_end)??null;Pt!==null&&Ve!==null&&ge({start:Pt,end:Ve})},[pe==null?void 0:pe.interval_start,pe==null?void 0:pe.interval_end,Re==null?void 0:Re.interval_start,Re==null?void 0:Re.interval_end]),T.useEffect(()=>{ve(1),ke(null),ge(null),Qe(null)},[r]);const Ie=Le??_e,Fe=(pe==null?void 0:pe.interval_start)??(Re==null?void 0:Re.interval_start)??null,Ge=(pe==null?void 0:pe.interval_end)??(Re==null?void 0:Re.interval_end)??null,Me=(pe==null?void 0:pe.global_min_time)??(Re==null?void 0:Re.global_min_time)??ye;T.useEffect(()=>{if(h&&Le!==null&&Le>0){const Pt=Le-1;o!==Pt&&l(Pt)}},[h,Le,o,l]);const $e=Pt=>{g(!1),l(Pt)},dt=Pt=>{if(!h){const Ve=Math.floor(o*c/Pt);l(Ve)}d(Pt)},Oe=()=>{h?g(!1):(g(!0),Le!==null&&Le>0&&l(Le-1))};T.useEffect(()=>{F(AM(_))},[_]);const st=T.useMemo(()=>{const Pt=(pe==null?void 0:pe.metrics)??[];return!v||_<=0?Pt:L6e(Pt,_)},[pe==null?void 0:pe.metrics,v,_]),ft=T.useMemo(()=>{const Pt=(Re==null?void 0:Re.metrics)??[];return!v||_<=0?Pt:z6e(Pt,_)},[Re==null?void 0:Re.metrics,v,_]),pt=T.useMemo(()=>{const Pt=(ne==null?void 0:ne.metrics)??[];return!v||_<=0?Pt:j6e(Pt,_)},[ne==null?void 0:ne.metrics,v,_]),et=T.useMemo(()=>{if(h){const zt=[],Ht=[];if((pe==null?void 0:pe.interval_start)!=null&&Ht.push(pe.interval_start),(pe==null?void 0:pe.interval_end)!=null&&zt.push(pe.interval_end),(Re==null?void 0:Re.interval_start)!=null&&Ht.push(Re.interval_start),(Re==null?void 0:Re.interval_end)!=null&&zt.push(Re.interval_end),(ne==null?void 0:ne.interval_start)!=null&&Ht.push(ne.interval_start),(ne==null?void 0:ne.interval_end)!=null&&zt.push(ne.interval_end),zt.length===0)return null;const an=Math.min(...zt),Dn=Math.max(Me??an,an-c),Vt=Ht.length>0?Math.max(...Ht):Dn;return{start:Math.min(an,Math.max(Dn,Vt)),end:an}}const Pt=(Be==null?void 0:Be.start)??null,Ve=(Be==null?void 0:Be.end)??null,wt=Fe??Pt,Et=Ge??Ve;return wt===null||Et===null?null:{start:wt,end:Et}},[h,pe==null?void 0:pe.interval_end,pe==null?void 0:pe.interval_start,Re==null?void 0:Re.interval_end,Re==null?void 0:Re.interval_start,ne==null?void 0:ne.interval_end,ne==null?void 0:ne.interval_start,Me,c,Fe,Ge,Be==null?void 0:Be.start,Be==null?void 0:Be.end]);T.useEffect(()=>{et&&Qe(et)},[et]);const Ze=et??Ye,me=T.useMemo(()=>!Ze||Me===null?0:Ze.start-Me,[Ze,Me]),je=re&&ie||fe&&xe||We&&Se,He=re&&!pe||ue&&fe&&!Re||he&&We&&!ne,nt=!je&&!He&&(re&&!!pe||fe&&!!Re||We&&!!ne),yt=je||He,lt=T.useMemo(()=>R6e(j==null?void 0:j.summary),[j==null?void 0:j.summary]),bt=T.useMemo(()=>k6e(j==null?void 0:j.summary),[j==null?void 0:j.summary]);return r?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center gap-2 h-7",children:[p.jsxs(Y0,{type:"single",variant:"selecting",size:"sm",value:s,onValueChange:Pt=>{Pt&&a(Pt)},children:[p.jsx(Uo,{value:"metrics",className:"text-xs px-2 py-1 h-7",children:"Metrics"}),p.jsx(Uo,{value:"topology",className:"text-xs px-2 py-1 h-7",children:"Topology"}),p.jsx(Uo,{value:"model",className:"text-xs px-2 py-1 h-7",children:"Model"})]}),s==="metrics"&&p.jsxs(p.Fragment,{children:[p.jsx(jk,{currentPage:o,totalPages:Ie,onPageChange:$e}),p.jsx(F6e,{value:c,onChange:dt}),Ze&&p.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[X0(Ze.start,Ze.end-Ze.start)," ","–"," ",X0(Ze.end,Ze.end-Ze.start)]}),p.jsx("button",{onClick:Oe,className:`ml-1 inline-flex items-center rounded-lg px-2.5 h-7 text-xs font-medium transition-all select-none whitespace-nowrap ${h?"bg-emerald-500 text-white hover:bg-emerald-600":"bg-accent text-muted-foreground hover:bg-muted hover:text-foreground"}`,children:"Live"}),p.jsx(cS,{label:"Aggregate",variant:"selecting",size:"sm",inputType:"text",enabled:v,onEnabledChange:b,value:J,onValueChange:F,onValueCommit:Pt=>{const Ve=O6e(Pt);Ve!==null?(w(Ve),F(AM(Ve))):F(AM(_))},inputWidth:"w-10"})]})]})})}),s==="metrics"&&p.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:p.jsxs("div",{className:"max-w-7xl mx-auto",children:[X&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",X instanceof Error?X.message:"Unknown error"]})})}),p.jsx(v6e,{gpuMetrics:st,cpuMetrics:ft,vllmMetrics:pt,availableGpuMetrics:(pe==null?void 0:pe.available_metrics)??Xe,availableCpuMetrics:(Re==null?void 0:Re.available_metrics)??Pe,availableVllmMetrics:(ne==null?void 0:ne.available_metrics)??oe,trainerGpus:lt,inferenceGpus:bt,isLoading:yt,isRefetching:nt,roleMode:A,onRoleModeChange:N,systemMetricsOpen:I,onSystemMetricsOpenChange:P,cpuMetricsOpen:L,onCpuMetricsOpenChange:R,vllmMetricsOpen:O,onVllmMetricsOpenChange:W,trainerSectionOpen:U,onTrainerSectionOpenChange:V,inferenceSectionOpen:G,onInferenceSectionOpenChange:Z,trainerNodeMode:B,onTrainerNodeModeChange:q,inferenceNodeMode:Y,onInferenceNodeModeChange:K,overrideTimeRange:Ze,xOffset:me})]})}),s==="topology"&&p.jsx("div",{className:"flex-1 overflow-hidden",children:X?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),p.jsx("div",{className:"text-xs text-muted-foreground",children:X instanceof Error?X.message:"Unknown error"})]})}):j?!H||H.nodes.length===0?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),p.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):p.jsx("div",{className:"h-full w-full",children:p.jsx(YK,{topology:H})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})})}),s==="model"&&p.jsx("div",{className:"flex-1 overflow-hidden",children:X?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load model data"}),p.jsx("div",{className:"text-xs text-muted-foreground",children:X instanceof Error?X.message:"Unknown error"})]})}):j?(Nt=j.summary)!=null&&Nt.model_architecture?p.jsx("div",{className:"h-full w-full",children:p.jsx(N6e,{modelRepr:j.summary.model_architecture})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No model architecture available"}),p.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have model_architecture in its W&B summary."})]})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading model architecture…"})})})]}):p.jsx(hm,{description:"Select a run from the sidebar to view infrastructure metrics."})}const lZ=1e4;function c_(t,e){return t*lZ+e}function B6e(){var ke,Be;const t=ki(ml),[e]=T7(),[n,r]=cn(XD),[i,s]=cn(Hce),[a,o]=cn(YD),[l,c]=cn(KD),d=ki(ZD),[h]=cn(jC),[,g]=cn(QD),v=ki(FC),[b,_]=cn(hT),[w,S]=cn(pT),E=b.length+(w?1:0),A=ge=>{_(Ye=>Ye.includes(ge)?Ye.filter(Qe=>Qe!==ge):[...Ye,ge])},[N,I]=T.useState(0),[P,L]=T.useState(0),[R,O]=T.useState(!0),W=!0,U=T.useMemo(()=>{const ge=e.get("step");if(!ge)return null;const Ye=Number(ge);return Number.isFinite(Ye)?Ye:null},[e]),V=T.useRef(null);T.useEffect(()=>{if(!t){V.current=null;return}if(U==null){V.current=null;return}U!==V.current&&(r(U),V.current=U)},[U,t,r]);const{data:G,isLoading:Z,error:B}=cue(t||"",n,i,!!t),{data:q}=ed(t||"",!!t,W),Y=((ke=q==null?void 0:q.summary)==null?void 0:ke.eval_env_details)??((Be=q==null?void 0:q.config)==null?void 0:Be.eval_env_details),K=T.useMemo(()=>pw(Y),[Y]),J=T.useMemo(()=>{const ge=mw(Y),Ye=gw(q==null?void 0:q.data_metric_ranges);return vw(ge,Ye)},[Y,q==null?void 0:q.data_metric_ranges]),[F,j]=T.useState([]),X=G==null?void 0:G.available_rollout_metric_names,H=X&&X.length>0?X:F;X&&X.length>0&&X!==F&&j(X);const se=T.useMemo(()=>{if(i)return{prefix:`eval/${i}/`,rewardNames:H,selectedSampleIdx:a}},[i,H,a]);T.useEffect(()=>{if(!G)return;const ge=G.available_eval_names;ge.length&&(i&&ge.includes(i)||s(ge[0]))},[G==null?void 0:G.available_eval_names,i,s,G]);const re=T.useMemo(()=>{var ge;return(ge=G==null?void 0:G.available_steps)!=null&&ge.length&&n===null?G.available_steps[G.available_steps.length-1]:null},[G==null?void 0:G.available_steps,n]);T.useEffect(()=>{re!==null&&n===null&&U==null&&r(re)},[re,U,n,r]);const ie=ge=>{r(ge)},[ue,le]=T.useState([]),[fe,xe]=T.useState(null);t!==fe&&(le([]),xe(t));const he=G==null?void 0:G.available_steps,Te=T.useMemo(()=>{const ge=he??[];return[...new Set([...ue,...ge])].sort((Qe,Ie)=>Qe-Ie)},[he,ue]);Te.length>ue.length&&le(Te);const We=Te.length>0,Se=We?Te[Te.length-1]:0,Le=T.useMemo(()=>{if(n==null)return Te.length-1;const ge=Te.indexOf(n);return ge>=0?ge:Te.length-1},[Te,n]),pe=ge=>{ge>=0&&ge<Te.length&&ie(Te[ge])},Re=T.useMemo(()=>{if(G!=null&&G.prompts)return G.prompts.map(ge=>({step:ge.step,group_id:ge.sample_idx,env:ge.env,system_prompt:ge.system_prompt,tokens_system_prompt:ge.tokens_system_prompt,prompt:ge.prompt,tokens_prompt:ge.tokens_prompt}))},[G]),ne=T.useMemo(()=>{if(G!=null&&G.rollouts)return G.rollouts.map(ge=>({step:ge.step,group_id:ge.sample_idx,sample_idx:c_(ge.sample_idx,ge.completion_idx),turn_order:ge.turn_order,turn_type:ge.turn_type,content:ge.content,tokens:ge.tokens}))},[G]),Xe=T.useMemo(()=>{if(G!=null&&G.samples_data)return G.samples_data.map(ge=>({step:ge.step,group_id:ge.sample_idx,sample_idx:c_(ge.sample_idx,ge.completion_idx),reward:null,advantage:null,turns:ge.turns,total_tokens:null,raw_string:null}))},[G]),Ae=T.useMemo(()=>{if(G!=null&&G.rollout_metrics)return G.rollout_metrics.map(ge=>({step:ge.step,sample_idx:c_(ge.sample_idx,ge.completion_idx),env:ge.env,metric_name:ge.metric_name,value:ge.value}))},[G]),Pe=T.useMemo(()=>{if(G!=null&&G.golden_answers)return G.golden_answers.map(ge=>({step:ge.step,sample_idx:c_(ge.sample_idx,ge.completion_idx),env:ge.env,key:ge.key,value:ge.value}))},[G]),Ke=T.useMemo(()=>{if(G!=null&&G.info_turns)return G.info_turns.map(ge=>({step:ge.step,sample_idx:c_(ge.sample_idx,ge.completion_idx),turn_order:ge.turn_order,env:ge.env,info_key:ge.info_key,info_value:ge.info_value,info_type:ge.info_type}))},[G]),oe=T.useMemo(()=>{if(!(G!=null&&G.samples_data))return new Map;const ge=new Map;for(const Ye of G.samples_data)ge.set(Ye.sample_idx,(ge.get(Ye.sample_idx)??0)+1);return ge},[G]),te=T.useCallback((ge,Ye)=>{const Qe=oe.get(ge)??Ye.samples.length;if(o(ge),Qe<=1){const Ie=Ye.samples[0];Ie&&c(Ie.sample_idx)}else g("samples")},[oe,o,c,g]),_e=T.useCallback(()=>{g("groups")},[g]),ve=T.useCallback(({viewMode:ge})=>p.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[ge==="samples"&&p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:_e,children:p.jsx(f8,{className:"h-4 w-4"})}),p.jsxs(Z8,{value:i??"",onValueChange:Ye=>{s(Ye),o(null),c(null),g("groups")},children:[p.jsx(J8,{className:"h-7 text-xs min-w-0 flex-1",children:p.jsx(Q8,{placeholder:"Select eval..."})}),p.jsx(ek,{children:((G==null?void 0:G.available_eval_names)??[]).map(Ye=>p.jsx(tk,{value:Ye,className:"text-xs",children:Ye},Ye))})]})]}),[i,G==null?void 0:G.available_eval_names,s,o,c,g,_e]),ye=T.useMemo(()=>{var Ge;if(!d)return null;const ge=((Ge=d.sample.turns[0])==null?void 0:Ge.step)??n,Ye=d.sample.group_id,Ie=d.sample.sample_idx%lZ,Fe=oe.get(Ye)??1;return{step:ge,evalSampleIdx:Ye,completionIdx:Ie,numCompletions:Fe}},[d,n,oe]);return t?p.jsxs("div",{className:"flex h-full overflow-hidden",children:[p.jsx(V9,{prompts:Re,data:ne,samplesData:Xe,rolloutMetrics:Ae,availableMetricNames:H,isLoading:Z,step:n??void 0,currentStepIndex:Le,totalSteps:Te.length,onStepChange:pe,hasSteps:We,stepValues:Te,openAtom:jC,selectedGroupIdAtom:YD,selectedSampleIdxAtom:KD,viewModeAtom:QD,renderLeftControls:ve,onGroupClick:te,hideRewardAdvantage:!0,envDetailsOverride:Y}),p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center justify-between h-7",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(H9,{openAtom:jC}),ye&&p.jsxs("div",{className:"text-sm text-muted-foreground",children:[p.jsxs("span",{children:["Step ",ye.step]}),i&&p.jsxs(p.Fragment,{children:[" · ",p.jsx("span",{children:i})]})," · ",p.jsxs("span",{children:["Sample ",ye.evalSampleIdx]}),ye.numCompletions>1&&p.jsxs(p.Fragment,{children:[" · ",p.jsxs("span",{children:["Completion ",ye.completionIdx]})]})]}),(d==null?void 0:d.sample.raw_string)&&p.jsx(GT,{rawString:d.sample.raw_string,totalTokens:d.sample.total_tokens,turns:d.sample.turns.length}),d&&p.jsxs(p.Fragment,{children:[p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{I(ge=>ge+1),O(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{L(ge=>ge+1),O(!0)},children:"Expand All"}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",E>0&&` (${E})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(vi,{checked:w,onCheckedChange:ge=>S(!!ge),onSelect:ge=>ge.preventDefault(),children:"Format Think"}),p.jsx(vi,{checked:b.includes("markdown"),onCheckedChange:()=>A("markdown"),onSelect:ge=>ge.preventDefault(),children:"Markdown"}),p.jsx(vi,{checked:b.includes("latex"),onCheckedChange:()=>A("latex"),onSelect:ge=>ge.preventDefault(),children:"LaTeX"}),p.jsx(vi,{checked:b.includes("code"),onCheckedChange:()=>A("code"),onSelect:ge=>ge.preventDefault(),children:"Code"})]})]})]})]}),se&&p.jsx(U9,{openAtom:FC})]})})}),p.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:p.jsxs("div",{className:h||v?"max-w-5xl mx-auto":"",children:[B&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",B instanceof Error?B.message:"Unknown error"]})})}),p.jsx(y1,{prompts:Re,data:ne,samplesData:Xe,rolloutMetrics:Ae,goldenAnswers:Pe,infoTurns:Ke,isLoading:Z,step:n??void 0,filterGroupId:a,filterSampleIdx:l,lastValidSampleAtom:ZD,collapseAllSignal:N,expandAllSignal:P,defaultSectionsOpen:R,envRewardRanges:K,envMetricRanges:J,renderOptions:b,formatThinkBlocks:w})]})})]}),se&&p.jsx(B9,{currentStep:n,maxSelectableStep:Se,openAtom:FC,selectedMetricsAtom:Vce,selectedStepAtom:XD,evalConfig:se})]}):p.jsx(hm,{description:"Select a run from the sidebar to view evals."})}function H6e(){return p.jsx("div",{className:"h-full flex items-center justify-center overflow-auto pb-40",children:p.jsxs("div",{className:"max-w-2xl px-6 py-12 text-center",children:[p.jsx("div",{className:"flex items-center justify-center mb-8",children:p.jsx("img",{src:"/logo-full.svg",alt:"Telescope",className:"h-12"})}),p.jsxs("div",{className:"space-y-4 text-base text-foreground/60 leading-relaxed text-justify",children:[p.jsx("p",{children:"Telescope is a framework to post-train LLMs with reinforcement learning for reasoning and agents."}),p.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."}),p.jsx("p",{children:"This visualization tool provides critical insight into your runs: metrics, rollouts, infrastructure, inference traces, trainer GPU events, and more."}),p.jsx("p",{children:"Telescope is built with a modern stack and focused on infrastructure, observability, scalability, and reliability."}),p.jsxs("p",{children:["You can find the documentation at"," ",p.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"}),"."]})]}),p.jsxs("div",{className:"mt-10 flex items-center justify-center gap-6 text-xs text-muted-foreground",children:[p.jsx("a",{href:"https://github.com/eduardoslonski/telescope",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Trainer"}),p.jsx("span",{className:"text-border",children:"|"}),p.jsx("a",{href:"https://github.com/eduardoslonski/telescope-ui",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"UI Visualization"}),p.jsx("span",{className:"text-border",children:"|"}),p.jsx("a",{href:"https://eduardoslonski.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Created by Eduardo Slonski"})]})]})})}function V6e(){return p.jsxs(ile,{children:[p.jsx(Bue,{}),p.jsx("main",{className:"ml-56 h-screen overflow-hidden bg-background",children:p.jsxs(qQ,{children:[p.jsx(If,{path:"/",element:p.jsx(l0e,{})}),p.jsx(If,{path:"/metrics",element:p.jsx(u0e,{})}),p.jsx(If,{path:"/timeline",element:p.jsx(FAe,{})}),p.jsx(If,{path:"/rollouts",element:p.jsx(s6e,{})}),p.jsx(If,{path:"/rollouts-discarded",element:p.jsx(a6e,{})}),p.jsx(If,{path:"/topology",element:p.jsx(o6e,{})}),p.jsx(If,{path:"/infra",element:p.jsx(U6e,{})}),p.jsx(If,{path:"/evals",element:p.jsx(B6e,{})}),p.jsx(If,{path:"/about",element:p.jsx(H6e,{})})]})})]})}IF.createRoot(document.getElementById("root")).render(p.jsx(T.StrictMode,{children:p.jsx(xJ,{children:p.jsx(V6e,{})})}));
