@mastra/deployer-cloud 1.25.1-alpha.0 → 1.26.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/studio/assets/{chunk-3QLPKWC4-DTS4FnMX.js → chunk-3QLPKWC4-DbsQWYtx.js} +1 -1
  3. package/dist/studio/assets/{chunk-ZCJMLMGS-DUqCAztZ.js → chunk-ZCJMLMGS-DvUW68dv.js} +1 -1
  4. package/dist/studio/assets/{index-Bd2BWyq9.js → index-3yHTJowu.js} +1 -1
  5. package/dist/studio/assets/{index-hkbleF_8.js → index-B5PAtxPT.js} +1 -1
  6. package/dist/studio/assets/{index-CLem26k1.js → index-B7OTmqoV.js} +1 -1
  7. package/dist/studio/assets/{index-DFD7sxas.js → index-BVq3rLiR.js} +1 -1
  8. package/dist/studio/assets/{index-DSr9mwVr.js → index-BmPZ_zWk.js} +1 -1
  9. package/dist/studio/assets/{index-Nx7J7mje.js → index-C3usKBTd.js} +1 -1
  10. package/dist/studio/assets/{index-IsIh05sL.js → index-CAvqPacZ.js} +1 -1
  11. package/dist/studio/assets/{index-KV-d7Z_K.js → index-CKRnXuZA.js} +1 -1
  12. package/dist/studio/assets/{index-UFxaORfL.js → index-CQXkvECs.js} +1 -1
  13. package/dist/studio/assets/{index-6lOrrtr1.js → index-CRz_xx1Z.js} +1 -1
  14. package/dist/studio/assets/{index-DkE_IufI.js → index-CgwEUdg9.js} +1 -1
  15. package/dist/studio/assets/{index-DBV4htYQ.js → index-D1R-1J11.js} +1 -1
  16. package/dist/studio/assets/{index-BDRPx-14.js → index-DF8sZyT3.js} +1 -1
  17. package/dist/studio/assets/{index-ndNh83D4.js → index-DrTChucN.js} +1 -1
  18. package/dist/studio/assets/{index-D7V5c-cf.js → index-EfF4JP3x.js} +1 -1
  19. package/dist/studio/assets/{index-DyOtSmkc.js → index-K85mMP2E.js} +1 -1
  20. package/dist/studio/assets/{index-Cas8lkc4.js → index-kVoJdgA9.js} +1 -1
  21. package/dist/studio/assets/{index-03hK8iYF.js → index-yPO2K_eT.js} +1 -1
  22. package/dist/studio/assets/{main-D2e5Fr16.js → main-BZuiDUPM.js} +7 -7
  23. package/dist/studio/assets/{token-APYSY3BW-RPVF55TR-P4FYXpNU.js → token-APYSY3BW-RPVF55TR-BZ-AyJYU.js} +1 -1
  24. package/dist/studio/assets/{token-APYSY3BW-ZWRZO2RI-BVP_WEmK.js → token-APYSY3BW-ZWRZO2RI-Mk32lfnc.js} +1 -1
  25. package/dist/studio/assets/token-util-RMHT2CPJ-CEAUOCJP-b-YZjZXy.js +1 -0
  26. package/dist/studio/assets/token-util-RMHT2CPJ-VVUHOXBL-HeVRkPvw.js +1 -0
  27. package/dist/studio/index.html +1 -1
  28. package/package.json +4 -4
  29. package/dist/studio/assets/token-util-RMHT2CPJ-CEAUOCJP-C7XmH4Cj.js +0 -1
  30. package/dist/studio/assets/token-util-RMHT2CPJ-VVUHOXBL-DFna4FDk.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DBV4htYQ.js","./index-DFD7sxas.js","./index-BDRPx-14.js","./index-DkE_IufI.js","./index-hkbleF_8.js","./index-DyOtSmkc.js","./index-03hK8iYF.js","./index-ndNh83D4.js","./index-DSr9mwVr.js","./index-6lOrrtr1.js","./index-D7V5c-cf.js","./index-UFxaORfL.js","./index-CLem26k1.js","./index-Nx7J7mje.js","./index-IsIh05sL.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-Cas8lkc4.js","./index-KV-d7Z_K.js","./index-Bd2BWyq9.js","./token-util-RMHT2CPJ-VVUHOXBL-DFna4FDk.js","./chunk-ZCJMLMGS-DUqCAztZ.js","./token-APYSY3BW-RPVF55TR-P4FYXpNU.js","./token-util-RMHT2CPJ-CEAUOCJP-C7XmH4Cj.js","./chunk-3QLPKWC4-DTS4FnMX.js","./token-APYSY3BW-ZWRZO2RI-BVP_WEmK.js"])))=>i.map(i=>d[i]);
2
- import{_ as Je}from"./index-DFD7sxas.js";function R8e(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var m$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i7={exports:{}},qC={};var Hxe;function TOt(){if(Hxe)return qC;Hxe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:a}}return qC.Fragment=t,qC.jsx=r,qC.jsxs=r,qC}var Qxe;function NOt(){return Qxe||(Qxe=1,i7.exports=TOt()),i7.exports}var o=NOt(),o7={exports:{}},gn={},Wxe;function AOt(){if(Wxe)return gn;Wxe=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),p=Symbol.iterator;function m(q){return q===null||typeof q!="object"?null:(q=p&&q[p]||q["@@iterator"],typeof q=="function"?q:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function w(q,M,Q){this.props=q,this.context=M,this.refs=x,this.updater=Q||g}w.prototype.isReactComponent={},w.prototype.setState=function(q,M){if(typeof q!="object"&&typeof q!="function"&&q!=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,q,M,"setState")},w.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function O(){}O.prototype=w.prototype;function k(q,M,Q){this.props=q,this.context=M,this.refs=x,this.updater=Q||g}var _=k.prototype=new O;_.constructor=k,y(_,w.prototype),_.isPureReactComponent=!0;var E=Array.isArray;function T(){}var j={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function I(q,M,Q){var G=Q.ref;return{$$typeof:t,type:q,key:M,ref:G!==void 0?G:null,props:Q}}function P(q,M){return I(q.type,M,q.props)}function R(q){return typeof q=="object"&&q!==null&&q.$$typeof===t}function B(q){var M={"=":"=0",":":"=2"};return"$"+q.replace(/[=:]/g,function(Q){return M[Q]})}var D=/\/+/g;function F(q,M){return typeof q=="object"&&q!==null&&q.key!=null?B(""+q.key):M.toString(36)}function U(q){switch(q.status){case"fulfilled":return q.value;case"rejected":throw q.reason;default:switch(typeof q.status=="string"?q.then(T,T):(q.status="pending",q.then(function(M){q.status==="pending"&&(q.status="fulfilled",q.value=M)},function(M){q.status==="pending"&&(q.status="rejected",q.reason=M)})),q.status){case"fulfilled":return q.value;case"rejected":throw q.reason}}throw q}function z(q,M,Q,G,J){var ie=typeof q;(ie==="undefined"||ie==="boolean")&&(q=null);var te=!1;if(q===null)te=!0;else switch(ie){case"bigint":case"string":case"number":te=!0;break;case"object":switch(q.$$typeof){case t:case r:te=!0;break;case f:return te=q._init,z(te(q._payload),M,Q,G,J)}}if(te)return J=J(q),te=G===""?"."+F(q,0):G,E(J)?(Q="",te!=null&&(Q=te.replace(D,"$&/")+"/"),z(J,M,Q,"",function(he){return he})):J!=null&&(R(J)&&(J=P(J,Q+(J.key==null||q&&q.key===J.key?"":(""+J.key).replace(D,"$&/")+"/")+te)),M.push(J)),1;te=0;var se=G===""?".":G+":";if(E(q))for(var oe=0;oe<q.length;oe++)G=q[oe],ie=se+F(G,oe),te+=z(G,M,Q,ie,J);else if(oe=m(q),typeof oe=="function")for(q=oe.call(q),oe=0;!(G=q.next()).done;)G=G.value,ie=se+F(G,oe++),te+=z(G,M,Q,ie,J);else if(ie==="object"){if(typeof q.then=="function")return z(U(q),M,Q,G,J);throw M=String(q),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(q).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return te}function V(q,M,Q){if(q==null)return q;var G=[],J=0;return z(q,G,"","",function(ie){return M.call(Q,ie,J++)}),G}function W(q){if(q._status===-1){var M=q._result;M=M(),M.then(function(Q){(q._status===0||q._status===-1)&&(q._status=1,q._result=Q)},function(Q){(q._status===0||q._status===-1)&&(q._status=2,q._result=Q)}),q._status===-1&&(q._status=0,q._result=M)}if(q._status===1)return q._result.default;throw q._result}var L=typeof reportError=="function"?reportError:function(q){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof q=="object"&&q!==null&&typeof q.message=="string"?String(q.message):String(q),error:q});if(!window.dispatchEvent(M))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",q);return}console.error(q)},Y={map:V,forEach:function(q,M,Q){V(q,function(){M.apply(this,arguments)},Q)},count:function(q){var M=0;return V(q,function(){M++}),M},toArray:function(q){return V(q,function(M){return M})||[]},only:function(q){if(!R(q))throw Error("React.Children.only expected to receive a single React element child.");return q}};return gn.Activity=h,gn.Children=Y,gn.Component=w,gn.Fragment=n,gn.Profiler=a,gn.PureComponent=k,gn.StrictMode=s,gn.Suspense=u,gn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,gn.__COMPILER_RUNTIME={__proto__:null,c:function(q){return j.H.useMemoCache(q)}},gn.cache=function(q){return function(){return q.apply(null,arguments)}},gn.cacheSignal=function(){return null},gn.cloneElement=function(q,M,Q){if(q==null)throw Error("The argument must be a React element, but you passed "+q+".");var G=y({},q.props),J=q.key;if(M!=null)for(ie in M.key!==void 0&&(J=""+M.key),M)!A.call(M,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&M.ref===void 0||(G[ie]=M[ie]);var ie=arguments.length-2;if(ie===1)G.children=Q;else if(1<ie){for(var te=Array(ie),se=0;se<ie;se++)te[se]=arguments[se+2];G.children=te}return I(q.type,J,G)},gn.createContext=function(q){return q={$$typeof:l,_currentValue:q,_currentValue2:q,_threadCount:0,Provider:null,Consumer:null},q.Provider=q,q.Consumer={$$typeof:i,_context:q},q},gn.createElement=function(q,M,Q){var G,J={},ie=null;if(M!=null)for(G in M.key!==void 0&&(ie=""+M.key),M)A.call(M,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=M[G]);var te=arguments.length-2;if(te===1)J.children=Q;else if(1<te){for(var se=Array(te),oe=0;oe<te;oe++)se[oe]=arguments[oe+2];J.children=se}if(q&&q.defaultProps)for(G in te=q.defaultProps,te)J[G]===void 0&&(J[G]=te[G]);return I(q,ie,J)},gn.createRef=function(){return{current:null}},gn.forwardRef=function(q){return{$$typeof:c,render:q}},gn.isValidElement=R,gn.lazy=function(q){return{$$typeof:f,_payload:{_status:-1,_result:q},_init:W}},gn.memo=function(q,M){return{$$typeof:d,type:q,compare:M===void 0?null:M}},gn.startTransition=function(q){var M=j.T,Q={};j.T=Q;try{var G=q(),J=j.S;J!==null&&J(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,L)}catch(ie){L(ie)}finally{M!==null&&Q.types!==null&&(M.types=Q.types),j.T=M}},gn.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},gn.use=function(q){return j.H.use(q)},gn.useActionState=function(q,M,Q){return j.H.useActionState(q,M,Q)},gn.useCallback=function(q,M){return j.H.useCallback(q,M)},gn.useContext=function(q){return j.H.useContext(q)},gn.useDebugValue=function(){},gn.useDeferredValue=function(q,M){return j.H.useDeferredValue(q,M)},gn.useEffect=function(q,M){return j.H.useEffect(q,M)},gn.useEffectEvent=function(q){return j.H.useEffectEvent(q)},gn.useId=function(){return j.H.useId()},gn.useImperativeHandle=function(q,M,Q){return j.H.useImperativeHandle(q,M,Q)},gn.useInsertionEffect=function(q,M){return j.H.useInsertionEffect(q,M)},gn.useLayoutEffect=function(q,M){return j.H.useLayoutEffect(q,M)},gn.useMemo=function(q,M){return j.H.useMemo(q,M)},gn.useOptimistic=function(q,M){return j.H.useOptimistic(q,M)},gn.useReducer=function(q,M,Q){return j.H.useReducer(q,M,Q)},gn.useRef=function(q){return j.H.useRef(q)},gn.useState=function(q){return j.H.useState(q)},gn.useSyncExternalStore=function(q,M,Q){return j.H.useSyncExternalStore(q,M,Q)},gn.useTransition=function(){return j.H.useTransition()},gn.version="19.2.5",gn}var Gxe;function tE(){return Gxe||(Gxe=1,o7.exports=AOt()),o7.exports}var b=tE();const je=$o(b),LS=R8e({__proto__:null,default:je},[b]);var l7={exports:{}},HC={},c7={exports:{}},u7={};var Zxe;function IOt(){return Zxe||(Zxe=1,(function(e){function t(U,z){var V=U.length;U.push(z);e:for(;0<V;){var W=V-1>>>1,L=U[W];if(0<s(L,z))U[W]=z,U[V]=L,V=W;else break e}}function r(U){return U.length===0?null:U[0]}function n(U){if(U.length===0)return null;var z=U[0],V=U.pop();if(V!==z){U[0]=V;e:for(var W=0,L=U.length,Y=L>>>1;W<Y;){var q=2*(W+1)-1,M=U[q],Q=q+1,G=U[Q];if(0>s(M,V))Q<L&&0>s(G,M)?(U[W]=G,U[Q]=V,W=Q):(U[W]=M,U[q]=V,W=q);else if(Q<L&&0>s(G,V))U[W]=G,U[Q]=V,W=Q;else break e}}return z}function s(U,z){var V=U.sortIndex-z.sortIndex;return V!==0?V:U.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(U){for(var z=r(u);z!==null;){if(z.callback===null)n(u);else if(z.startTime<=U)n(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=r(u)}}function _(U){if(g=!1,k(U),!m)if(r(c)!==null)m=!0,E||(E=!0,R());else{var z=r(u);z!==null&&F(_,z.startTime-U)}}var E=!1,T=-1,j=5,A=-1;function I(){return y?!0:!(e.unstable_now()-A<j)}function P(){if(y=!1,E){var U=e.unstable_now();A=U;var z=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),p=!0;var V=h;try{t:{for(k(U),f=r(c);f!==null&&!(f.expirationTime>U&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var L=W(f.expirationTime<=U);if(U=e.unstable_now(),typeof L=="function"){f.callback=L,k(U),z=!0;break t}f===r(c)&&n(c),k(U)}else n(c);f=r(c)}if(f!==null)z=!0;else{var Y=r(u);Y!==null&&F(_,Y.startTime-U),z=!1}}break e}finally{f=null,h=V,p=!1}z=void 0}}finally{z?R():E=!1}}}var R;if(typeof O=="function")R=function(){O(P)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,D=B.port2;B.port1.onmessage=P,R=function(){D.postMessage(null)}}else R=function(){x(P,0)};function F(U,z){T=x(function(){U(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(U){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var V=h;h=z;try{return U()}finally{h=V}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(U,z){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var V=h;h=U;try{return z()}finally{h=V}},e.unstable_scheduleCallback=function(U,z,V){var W=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?W+V:W):V=W,U){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=V+L,U={id:d++,callback:z,priorityLevel:U,startTime:V,expirationTime:L,sortIndex:-1},V>W?(U.sortIndex=V,t(u,U),r(c)===null&&U===r(u)&&(g?(w(T),T=-1):g=!0,F(_,V-W))):(U.sortIndex=L,t(c,U),m||p||(m=!0,E||(E=!0,R()))),U},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(U){var z=h;return function(){var V=h;h=z;try{return U.apply(this,arguments)}finally{h=V}}}})(u7)),u7}var Yxe;function ROt(){return Yxe||(Yxe=1,c7.exports=IOt()),c7.exports}var d7={exports:{}},ec={};var Xxe;function POt(){if(Xxe)return ec;Xxe=1;var e=tE();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return ec.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,ec.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return a(c,u,null,d)},ec.flushSync=function(c){var u=i.T,d=n.p;try{if(i.T=null,n.p=2,c)return c()}finally{i.T=u,n.p=d,n.d.f()}},ec.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,n.d.C(c,u))},ec.prefetchDNS=function(c){typeof c=="string"&&n.d.D(c)},ec.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?n.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&n.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},ec.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=l(u.as,u.crossOrigin);n.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&n.d.M(c)},ec.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin);n.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},ec.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=l(u.as,u.crossOrigin);n.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else n.d.m(c)},ec.requestFormReset=function(c){n.d.r(c)},ec.unstable_batchedUpdates=function(c,u){return c(u)},ec.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},ec.useFormStatus=function(){return i.H.useHostTransitionStatus()},ec.version="19.2.5",ec}var Kxe;function P8e(){if(Kxe)return d7.exports;Kxe=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),d7.exports=POt(),d7.exports}var Jxe;function MOt(){if(Jxe)return HC;Jxe=1;var e={env:{}};var t=ROt(),r=tE(),n=P8e();function s(v){var S="https://react.dev/errors/"+v;if(1<arguments.length){S+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)S+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+v+"; visit "+S+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(v){return!(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)}function i(v){var S=v,C=v;if(v.alternate)for(;S.return;)S=S.return;else{v=S;do S=v,(S.flags&4098)!==0&&(C=S.return),v=S.return;while(v)}return S.tag===3?C:null}function l(v){if(v.tag===13){var S=v.memoizedState;if(S===null&&(v=v.alternate,v!==null&&(S=v.memoizedState)),S!==null)return S.dehydrated}return null}function c(v){if(v.tag===31){var S=v.memoizedState;if(S===null&&(v=v.alternate,v!==null&&(S=v.memoizedState)),S!==null)return S.dehydrated}return null}function u(v){if(i(v)!==v)throw Error(s(188))}function d(v){var S=v.alternate;if(!S){if(S=i(v),S===null)throw Error(s(188));return S!==v?null:v}for(var C=v,N=S;;){var $=C.return;if($===null)break;var H=$.alternate;if(H===null){if(N=$.return,N!==null){C=N;continue}break}if($.child===H.child){for(H=$.child;H;){if(H===C)return u($),v;if(H===N)return u($),S;H=H.sibling}throw Error(s(188))}if(C.return!==N.return)C=$,N=H;else{for(var ee=!1,de=$.child;de;){if(de===C){ee=!0,C=$,N=H;break}if(de===N){ee=!0,N=$,C=H;break}de=de.sibling}if(!ee){for(de=H.child;de;){if(de===C){ee=!0,C=H,N=$;break}if(de===N){ee=!0,N=H,C=$;break}de=de.sibling}if(!ee)throw Error(s(189))}}if(C.alternate!==N)throw Error(s(190))}if(C.tag!==3)throw Error(s(188));return C.stateNode.current===C?v:S}function f(v){var S=v.tag;if(S===5||S===26||S===27||S===6)return v;for(v=v.child;v!==null;){if(S=f(v),S!==null)return S;v=v.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function B(v){return v===null||typeof v!="object"?null:(v=R&&v[R]||v["@@iterator"],typeof v=="function"?v:null)}var D=Symbol.for("react.client.reference");function F(v){if(v==null)return null;if(typeof v=="function")return v.$$typeof===D?null:v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case y:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof v=="object")switch(v.$$typeof){case g:return"Portal";case k:return v.displayName||"Context";case O:return(v._context.displayName||"Context")+".Consumer";case _:var S=v.render;return v=v.displayName,v||(v=S.displayName||S.name||"",v=v!==""?"ForwardRef("+v+")":"ForwardRef"),v;case j:return S=v.displayName||null,S!==null?S:F(v.type)||"Memo";case A:S=v._payload,v=v._init;try{return F(v(S))}catch{}}return null}var U=Array.isArray,z=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},L=[],Y=-1;function q(v){return{current:v}}function M(v){0>Y||(v.current=L[Y],L[Y]=null,Y--)}function Q(v,S){Y++,L[Y]=v.current,v.current=S}var G=q(null),J=q(null),ie=q(null),te=q(null);function se(v,S){switch(Q(ie,S),Q(J,v),Q(G,null),S.nodeType){case 9:case 11:v=(v=S.documentElement)&&(v=v.namespaceURI)?pxe(v):0;break;default:if(v=S.tagName,S=S.namespaceURI)S=pxe(S),v=mxe(S,v);else switch(v){case"svg":v=1;break;case"math":v=2;break;default:v=0}}M(G),Q(G,v)}function oe(){M(G),M(J),M(ie)}function he(v){v.memoizedState!==null&&Q(te,v);var S=G.current,C=mxe(S,v.type);S!==C&&(Q(J,v),Q(G,C))}function K(v){J.current===v&&(M(G),M(J)),te.current===v&&(M(te),zC._currentValue=W)}var re,le;function pe(v){if(re===void 0)try{throw Error()}catch(C){var S=C.stack.trim().match(/\n( *(at )?)/);re=S&&S[1]||"",le=-1<C.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-D1R-1J11.js","./index-BVq3rLiR.js","./index-DF8sZyT3.js","./index-CgwEUdg9.js","./index-B5PAtxPT.js","./index-K85mMP2E.js","./index-yPO2K_eT.js","./index-DrTChucN.js","./index-BmPZ_zWk.js","./index-CRz_xx1Z.js","./index-EfF4JP3x.js","./index-CQXkvECs.js","./index-B7OTmqoV.js","./index-C3usKBTd.js","./index-CAvqPacZ.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-kVoJdgA9.js","./index-CKRnXuZA.js","./index-3yHTJowu.js","./token-util-RMHT2CPJ-VVUHOXBL-HeVRkPvw.js","./chunk-ZCJMLMGS-DvUW68dv.js","./token-APYSY3BW-RPVF55TR-BZ-AyJYU.js","./token-util-RMHT2CPJ-CEAUOCJP-b-YZjZXy.js","./chunk-3QLPKWC4-DbsQWYtx.js","./token-APYSY3BW-ZWRZO2RI-Mk32lfnc.js"])))=>i.map(i=>d[i]);
2
+ import{_ as Je}from"./index-BVq3rLiR.js";function R8e(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var m$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i7={exports:{}},qC={};var Hxe;function TOt(){if(Hxe)return qC;Hxe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:a}}return qC.Fragment=t,qC.jsx=r,qC.jsxs=r,qC}var Qxe;function NOt(){return Qxe||(Qxe=1,i7.exports=TOt()),i7.exports}var o=NOt(),o7={exports:{}},gn={},Wxe;function AOt(){if(Wxe)return gn;Wxe=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),p=Symbol.iterator;function m(q){return q===null||typeof q!="object"?null:(q=p&&q[p]||q["@@iterator"],typeof q=="function"?q:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function w(q,M,Q){this.props=q,this.context=M,this.refs=x,this.updater=Q||g}w.prototype.isReactComponent={},w.prototype.setState=function(q,M){if(typeof q!="object"&&typeof q!="function"&&q!=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,q,M,"setState")},w.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function O(){}O.prototype=w.prototype;function k(q,M,Q){this.props=q,this.context=M,this.refs=x,this.updater=Q||g}var _=k.prototype=new O;_.constructor=k,y(_,w.prototype),_.isPureReactComponent=!0;var E=Array.isArray;function T(){}var j={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function I(q,M,Q){var G=Q.ref;return{$$typeof:t,type:q,key:M,ref:G!==void 0?G:null,props:Q}}function P(q,M){return I(q.type,M,q.props)}function R(q){return typeof q=="object"&&q!==null&&q.$$typeof===t}function B(q){var M={"=":"=0",":":"=2"};return"$"+q.replace(/[=:]/g,function(Q){return M[Q]})}var D=/\/+/g;function F(q,M){return typeof q=="object"&&q!==null&&q.key!=null?B(""+q.key):M.toString(36)}function U(q){switch(q.status){case"fulfilled":return q.value;case"rejected":throw q.reason;default:switch(typeof q.status=="string"?q.then(T,T):(q.status="pending",q.then(function(M){q.status==="pending"&&(q.status="fulfilled",q.value=M)},function(M){q.status==="pending"&&(q.status="rejected",q.reason=M)})),q.status){case"fulfilled":return q.value;case"rejected":throw q.reason}}throw q}function z(q,M,Q,G,J){var ie=typeof q;(ie==="undefined"||ie==="boolean")&&(q=null);var te=!1;if(q===null)te=!0;else switch(ie){case"bigint":case"string":case"number":te=!0;break;case"object":switch(q.$$typeof){case t:case r:te=!0;break;case f:return te=q._init,z(te(q._payload),M,Q,G,J)}}if(te)return J=J(q),te=G===""?"."+F(q,0):G,E(J)?(Q="",te!=null&&(Q=te.replace(D,"$&/")+"/"),z(J,M,Q,"",function(he){return he})):J!=null&&(R(J)&&(J=P(J,Q+(J.key==null||q&&q.key===J.key?"":(""+J.key).replace(D,"$&/")+"/")+te)),M.push(J)),1;te=0;var se=G===""?".":G+":";if(E(q))for(var oe=0;oe<q.length;oe++)G=q[oe],ie=se+F(G,oe),te+=z(G,M,Q,ie,J);else if(oe=m(q),typeof oe=="function")for(q=oe.call(q),oe=0;!(G=q.next()).done;)G=G.value,ie=se+F(G,oe++),te+=z(G,M,Q,ie,J);else if(ie==="object"){if(typeof q.then=="function")return z(U(q),M,Q,G,J);throw M=String(q),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(q).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return te}function V(q,M,Q){if(q==null)return q;var G=[],J=0;return z(q,G,"","",function(ie){return M.call(Q,ie,J++)}),G}function W(q){if(q._status===-1){var M=q._result;M=M(),M.then(function(Q){(q._status===0||q._status===-1)&&(q._status=1,q._result=Q)},function(Q){(q._status===0||q._status===-1)&&(q._status=2,q._result=Q)}),q._status===-1&&(q._status=0,q._result=M)}if(q._status===1)return q._result.default;throw q._result}var L=typeof reportError=="function"?reportError:function(q){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof q=="object"&&q!==null&&typeof q.message=="string"?String(q.message):String(q),error:q});if(!window.dispatchEvent(M))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",q);return}console.error(q)},Y={map:V,forEach:function(q,M,Q){V(q,function(){M.apply(this,arguments)},Q)},count:function(q){var M=0;return V(q,function(){M++}),M},toArray:function(q){return V(q,function(M){return M})||[]},only:function(q){if(!R(q))throw Error("React.Children.only expected to receive a single React element child.");return q}};return gn.Activity=h,gn.Children=Y,gn.Component=w,gn.Fragment=n,gn.Profiler=a,gn.PureComponent=k,gn.StrictMode=s,gn.Suspense=u,gn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,gn.__COMPILER_RUNTIME={__proto__:null,c:function(q){return j.H.useMemoCache(q)}},gn.cache=function(q){return function(){return q.apply(null,arguments)}},gn.cacheSignal=function(){return null},gn.cloneElement=function(q,M,Q){if(q==null)throw Error("The argument must be a React element, but you passed "+q+".");var G=y({},q.props),J=q.key;if(M!=null)for(ie in M.key!==void 0&&(J=""+M.key),M)!A.call(M,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&M.ref===void 0||(G[ie]=M[ie]);var ie=arguments.length-2;if(ie===1)G.children=Q;else if(1<ie){for(var te=Array(ie),se=0;se<ie;se++)te[se]=arguments[se+2];G.children=te}return I(q.type,J,G)},gn.createContext=function(q){return q={$$typeof:l,_currentValue:q,_currentValue2:q,_threadCount:0,Provider:null,Consumer:null},q.Provider=q,q.Consumer={$$typeof:i,_context:q},q},gn.createElement=function(q,M,Q){var G,J={},ie=null;if(M!=null)for(G in M.key!==void 0&&(ie=""+M.key),M)A.call(M,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=M[G]);var te=arguments.length-2;if(te===1)J.children=Q;else if(1<te){for(var se=Array(te),oe=0;oe<te;oe++)se[oe]=arguments[oe+2];J.children=se}if(q&&q.defaultProps)for(G in te=q.defaultProps,te)J[G]===void 0&&(J[G]=te[G]);return I(q,ie,J)},gn.createRef=function(){return{current:null}},gn.forwardRef=function(q){return{$$typeof:c,render:q}},gn.isValidElement=R,gn.lazy=function(q){return{$$typeof:f,_payload:{_status:-1,_result:q},_init:W}},gn.memo=function(q,M){return{$$typeof:d,type:q,compare:M===void 0?null:M}},gn.startTransition=function(q){var M=j.T,Q={};j.T=Q;try{var G=q(),J=j.S;J!==null&&J(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,L)}catch(ie){L(ie)}finally{M!==null&&Q.types!==null&&(M.types=Q.types),j.T=M}},gn.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},gn.use=function(q){return j.H.use(q)},gn.useActionState=function(q,M,Q){return j.H.useActionState(q,M,Q)},gn.useCallback=function(q,M){return j.H.useCallback(q,M)},gn.useContext=function(q){return j.H.useContext(q)},gn.useDebugValue=function(){},gn.useDeferredValue=function(q,M){return j.H.useDeferredValue(q,M)},gn.useEffect=function(q,M){return j.H.useEffect(q,M)},gn.useEffectEvent=function(q){return j.H.useEffectEvent(q)},gn.useId=function(){return j.H.useId()},gn.useImperativeHandle=function(q,M,Q){return j.H.useImperativeHandle(q,M,Q)},gn.useInsertionEffect=function(q,M){return j.H.useInsertionEffect(q,M)},gn.useLayoutEffect=function(q,M){return j.H.useLayoutEffect(q,M)},gn.useMemo=function(q,M){return j.H.useMemo(q,M)},gn.useOptimistic=function(q,M){return j.H.useOptimistic(q,M)},gn.useReducer=function(q,M,Q){return j.H.useReducer(q,M,Q)},gn.useRef=function(q){return j.H.useRef(q)},gn.useState=function(q){return j.H.useState(q)},gn.useSyncExternalStore=function(q,M,Q){return j.H.useSyncExternalStore(q,M,Q)},gn.useTransition=function(){return j.H.useTransition()},gn.version="19.2.5",gn}var Gxe;function tE(){return Gxe||(Gxe=1,o7.exports=AOt()),o7.exports}var b=tE();const je=$o(b),LS=R8e({__proto__:null,default:je},[b]);var l7={exports:{}},HC={},c7={exports:{}},u7={};var Zxe;function IOt(){return Zxe||(Zxe=1,(function(e){function t(U,z){var V=U.length;U.push(z);e:for(;0<V;){var W=V-1>>>1,L=U[W];if(0<s(L,z))U[W]=z,U[V]=L,V=W;else break e}}function r(U){return U.length===0?null:U[0]}function n(U){if(U.length===0)return null;var z=U[0],V=U.pop();if(V!==z){U[0]=V;e:for(var W=0,L=U.length,Y=L>>>1;W<Y;){var q=2*(W+1)-1,M=U[q],Q=q+1,G=U[Q];if(0>s(M,V))Q<L&&0>s(G,M)?(U[W]=G,U[Q]=V,W=Q):(U[W]=M,U[q]=V,W=q);else if(Q<L&&0>s(G,V))U[W]=G,U[Q]=V,W=Q;else break e}}return z}function s(U,z){var V=U.sortIndex-z.sortIndex;return V!==0?V:U.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(U){for(var z=r(u);z!==null;){if(z.callback===null)n(u);else if(z.startTime<=U)n(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=r(u)}}function _(U){if(g=!1,k(U),!m)if(r(c)!==null)m=!0,E||(E=!0,R());else{var z=r(u);z!==null&&F(_,z.startTime-U)}}var E=!1,T=-1,j=5,A=-1;function I(){return y?!0:!(e.unstable_now()-A<j)}function P(){if(y=!1,E){var U=e.unstable_now();A=U;var z=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),p=!0;var V=h;try{t:{for(k(U),f=r(c);f!==null&&!(f.expirationTime>U&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var L=W(f.expirationTime<=U);if(U=e.unstable_now(),typeof L=="function"){f.callback=L,k(U),z=!0;break t}f===r(c)&&n(c),k(U)}else n(c);f=r(c)}if(f!==null)z=!0;else{var Y=r(u);Y!==null&&F(_,Y.startTime-U),z=!1}}break e}finally{f=null,h=V,p=!1}z=void 0}}finally{z?R():E=!1}}}var R;if(typeof O=="function")R=function(){O(P)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,D=B.port2;B.port1.onmessage=P,R=function(){D.postMessage(null)}}else R=function(){x(P,0)};function F(U,z){T=x(function(){U(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(U){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var V=h;h=z;try{return U()}finally{h=V}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(U,z){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var V=h;h=U;try{return z()}finally{h=V}},e.unstable_scheduleCallback=function(U,z,V){var W=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?W+V:W):V=W,U){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=V+L,U={id:d++,callback:z,priorityLevel:U,startTime:V,expirationTime:L,sortIndex:-1},V>W?(U.sortIndex=V,t(u,U),r(c)===null&&U===r(u)&&(g?(w(T),T=-1):g=!0,F(_,V-W))):(U.sortIndex=L,t(c,U),m||p||(m=!0,E||(E=!0,R()))),U},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(U){var z=h;return function(){var V=h;h=z;try{return U.apply(this,arguments)}finally{h=V}}}})(u7)),u7}var Yxe;function ROt(){return Yxe||(Yxe=1,c7.exports=IOt()),c7.exports}var d7={exports:{}},ec={};var Xxe;function POt(){if(Xxe)return ec;Xxe=1;var e=tE();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return ec.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,ec.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return a(c,u,null,d)},ec.flushSync=function(c){var u=i.T,d=n.p;try{if(i.T=null,n.p=2,c)return c()}finally{i.T=u,n.p=d,n.d.f()}},ec.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,n.d.C(c,u))},ec.prefetchDNS=function(c){typeof c=="string"&&n.d.D(c)},ec.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?n.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&n.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},ec.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=l(u.as,u.crossOrigin);n.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&n.d.M(c)},ec.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin);n.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},ec.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=l(u.as,u.crossOrigin);n.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else n.d.m(c)},ec.requestFormReset=function(c){n.d.r(c)},ec.unstable_batchedUpdates=function(c,u){return c(u)},ec.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},ec.useFormStatus=function(){return i.H.useHostTransitionStatus()},ec.version="19.2.5",ec}var Kxe;function P8e(){if(Kxe)return d7.exports;Kxe=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),d7.exports=POt(),d7.exports}var Jxe;function MOt(){if(Jxe)return HC;Jxe=1;var e={env:{}};var t=ROt(),r=tE(),n=P8e();function s(v){var S="https://react.dev/errors/"+v;if(1<arguments.length){S+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)S+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+v+"; visit "+S+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(v){return!(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)}function i(v){var S=v,C=v;if(v.alternate)for(;S.return;)S=S.return;else{v=S;do S=v,(S.flags&4098)!==0&&(C=S.return),v=S.return;while(v)}return S.tag===3?C:null}function l(v){if(v.tag===13){var S=v.memoizedState;if(S===null&&(v=v.alternate,v!==null&&(S=v.memoizedState)),S!==null)return S.dehydrated}return null}function c(v){if(v.tag===31){var S=v.memoizedState;if(S===null&&(v=v.alternate,v!==null&&(S=v.memoizedState)),S!==null)return S.dehydrated}return null}function u(v){if(i(v)!==v)throw Error(s(188))}function d(v){var S=v.alternate;if(!S){if(S=i(v),S===null)throw Error(s(188));return S!==v?null:v}for(var C=v,N=S;;){var $=C.return;if($===null)break;var H=$.alternate;if(H===null){if(N=$.return,N!==null){C=N;continue}break}if($.child===H.child){for(H=$.child;H;){if(H===C)return u($),v;if(H===N)return u($),S;H=H.sibling}throw Error(s(188))}if(C.return!==N.return)C=$,N=H;else{for(var ee=!1,de=$.child;de;){if(de===C){ee=!0,C=$,N=H;break}if(de===N){ee=!0,N=$,C=H;break}de=de.sibling}if(!ee){for(de=H.child;de;){if(de===C){ee=!0,C=H,N=$;break}if(de===N){ee=!0,N=H,C=$;break}de=de.sibling}if(!ee)throw Error(s(189))}}if(C.alternate!==N)throw Error(s(190))}if(C.tag!==3)throw Error(s(188));return C.stateNode.current===C?v:S}function f(v){var S=v.tag;if(S===5||S===26||S===27||S===6)return v;for(v=v.child;v!==null;){if(S=f(v),S!==null)return S;v=v.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function B(v){return v===null||typeof v!="object"?null:(v=R&&v[R]||v["@@iterator"],typeof v=="function"?v:null)}var D=Symbol.for("react.client.reference");function F(v){if(v==null)return null;if(typeof v=="function")return v.$$typeof===D?null:v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case y:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof v=="object")switch(v.$$typeof){case g:return"Portal";case k:return v.displayName||"Context";case O:return(v._context.displayName||"Context")+".Consumer";case _:var S=v.render;return v=v.displayName,v||(v=S.displayName||S.name||"",v=v!==""?"ForwardRef("+v+")":"ForwardRef"),v;case j:return S=v.displayName||null,S!==null?S:F(v.type)||"Memo";case A:S=v._payload,v=v._init;try{return F(v(S))}catch{}}return null}var U=Array.isArray,z=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},L=[],Y=-1;function q(v){return{current:v}}function M(v){0>Y||(v.current=L[Y],L[Y]=null,Y--)}function Q(v,S){Y++,L[Y]=v.current,v.current=S}var G=q(null),J=q(null),ie=q(null),te=q(null);function se(v,S){switch(Q(ie,S),Q(J,v),Q(G,null),S.nodeType){case 9:case 11:v=(v=S.documentElement)&&(v=v.namespaceURI)?pxe(v):0;break;default:if(v=S.tagName,S=S.namespaceURI)S=pxe(S),v=mxe(S,v);else switch(v){case"svg":v=1;break;case"math":v=2;break;default:v=0}}M(G),Q(G,v)}function oe(){M(G),M(J),M(ie)}function he(v){v.memoizedState!==null&&Q(te,v);var S=G.current,C=mxe(S,v.type);S!==C&&(Q(J,v),Q(G,C))}function K(v){J.current===v&&(M(G),M(J)),te.current===v&&(M(te),zC._currentValue=W)}var re,le;function pe(v){if(re===void 0)try{throw Error()}catch(C){var S=C.stack.trim().match(/\n( *(at )?)/);re=S&&S[1]||"",le=-1<C.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<C.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+re+v+le}var ce=!1;function ue(v,S){if(!v||ce)return"";ce=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var N={DetermineComponentFrameRoot:function(){try{if(S){var ft=function(){throw Error()};if(Object.defineProperty(ft.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ft,[])}catch(rt){var Ye=rt}Reflect.construct(v,[],ft)}else{try{ft.call()}catch(rt){Ye=rt}v.call(ft.prototype)}}else{try{throw Error()}catch(rt){Ye=rt}(ft=v())&&typeof ft.catch=="function"&&ft.catch(function(){})}}catch(rt){if(rt&&Ye&&typeof rt.stack=="string")return[rt.stack,Ye.stack]}return[null,null]}};N.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var $=Object.getOwnPropertyDescriptor(N.DetermineComponentFrameRoot,"name");$&&$.configurable&&Object.defineProperty(N.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var H=N.DetermineComponentFrameRoot(),ee=H[0],de=H[1];if(ee&&de){var Ne=ee.split(`
5
5
  `),Ge=de.split(`
@@ -36,7 +36,7 @@ Error generating stack: `+N.message+`
36
36
  constructor(\${params}) {
37
37
  \${}
38
38
  }
39
- }`,{label:"class",detail:"definition",type:"keyword"}),bu('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),bu('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],$Ve=kle.concat([bu("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),bu("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),bu("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),SSe=new $Be,FVe=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function XC(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}const lMt=["FunctionDeclaration"],cMt={FunctionDeclaration:XC("function"),ClassDeclaration:XC("class"),ClassExpression:()=>!0,EnumDeclaration:XC("constant"),TypeAliasDeclaration:XC("type"),NamespaceDeclaration:XC("namespace"),VariableDefinition(e,t){e.matchContext(lMt)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function zVe(e,t){let r=SSe.get(t);if(r)return r;let n=[],s=!0;function a(i,l){let c=e.sliceString(i.from,i.to);n.push({label:c,type:l})}return t.cursor(Js.IncludeAnonymous).iterate(i=>{if(s)s=!1;else if(i.name){let l=cMt[i.name];if(l&&l(i,a)||FVe.has(i.name))return!1}else if(i.to-i.from>8192){for(let l of zVe(e,i.node))n.push(l);return!1}}),SSe.set(t,n),n}const q$=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,_le=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function BVe(e){let t=Na(e.state).resolveInner(e.pos,-1);if(_le.indexOf(t.name)>-1)return null;let r=t.name=="VariableName"||t.to-t.from<20&&q$.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let s=t;s;s=s.parent)FVe.has(s.name)&&(n=n.concat(zVe(e.state.doc,s)));return{options:n,from:r?t.from:e.pos,validFor:q$}}function Z7(e,t,r){var n;let s=[];for(;;){let a=t.firstChild,i;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:r};if(a?.name=="MemberExpression"&&((n=i=a.lastChild)===null||n===void 0?void 0:n.name)=="PropertyName")s.push(e(i)),t=a;else return null}}function UVe(e){let t=n=>e.state.doc.sliceString(n.from,n.to),r=Na(e.state).resolveInner(e.pos,-1);return r.name=="PropertyName"?Z7(t,r.parent,t(r)):(r.name=="."||r.name=="?.")&&r.parent.name=="MemberExpression"?Z7(t,r.parent,""):_le.indexOf(r.name)>-1?null:r.name=="VariableName"||r.to-r.from<20&&q$.test(t(r))?{path:[],name:t(r)}:r.name=="MemberExpression"?Z7(t,r,""):e.explicit?{path:[],name:""}:null}function uMt(e,t){let r=e,n=[],s=new Set;for(let a=0;;a++){for(let l of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(l)||s.has(l))continue;s.add(l);let c;try{c=r[l]}catch{continue}n.push({label:l,type:typeof c=="function"?/^[A-Z]/.test(l)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let i=Object.getPrototypeOf(e);if(!i)return n;e=i}}function dMt(e){let t=new Map;return r=>{let n=UVe(r);if(!n)return null;let s=e;for(let i of n.path)if(s=s[i],!s)return null;let a=t.get(s);return a||t.set(s,a=uMt(s,!n.path.length)),{from:r.pos-n.name.length,options:a,validFor:q$}}}const ch=zw.define({name:"javascript",parser:oMt.configure({props:[BS.add({IfStatement:pk({except:/^\s*({|else\b)/}),TryStatement:pk({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:oAt,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:iAt({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":pk({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),US.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":sle,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let r=e.lastChild;return{from:t.to,to:r.type.isError?e.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let r=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,n=e.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),VVe={test:e=>/^JSX/.test(e.name),facet:O6({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Ele=ch.configure({dialect:"ts"},"typescript"),Cle=ch.configure({dialect:"jsx",props:[tle.add(e=>e.isTop?[VVe]:void 0)]}),jle=ch.configure({dialect:"jsx ts",props:[tle.add(e=>e.isTop?[VVe]:void 0)]},"typescript");let qVe=e=>({label:e,type:"keyword"});const HVe="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(qVe),fMt=HVe.concat(["declare","implements","private","protected","public"].map(qVe));function H$(e={}){let t=e.jsx?e.typescript?jle:Cle:e.typescript?Ele:ch,r=e.typescript?$Ve.concat(fMt):kle.concat(HVe);return new Uw(t,[ch.data.of({autocomplete:QAt(_le,zUe(r))}),ch.data.of({autocomplete:BVe}),e.jsx?QVe:[]])}function hMt(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function OSe(e,t,r=e.length){for(let n=t?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return e.sliceString(n.from,Math.min(n.to,r));return""}const pMt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),QVe=pt.inputHandler.of((e,t,r,n,s)=>{if((pMt?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||n!=">"&&n!="/"||!ch.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,l=i.changeByRange(c=>{var u;let{head:d}=c,f=Na(i).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(i.doc.sliceString(d-1,d)!=n||f.name=="JSXAttributeValue"&&f.to>d)){if(n==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(n=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,m=p.parent;if(m&&p.from==d-2&&((h=OSe(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:at.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(n==">"){let p=hMt(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(h=OSe(i.doc,p,d)))return{range:c,changes:{from:d,insert:`</${h}>`}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([a,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function mMt(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach((r,n)=>{var s;!((s=r.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[n]=2)})),r=>{let{state:n}=r,s=[];for(let{from:a,to:i}of ch.findRegions(n)){let l=n.doc.lineAt(a),c={line:l.number-1,col:a-l.from,pos:a};for(let u of e.verify(n.sliceDoc(a,i),t))s.push(gMt(u,n.doc,c))}return s}}function kSe(e,t,r,n){return r.line(e+n.line).from+t+(e==1?n.col-1:-1)}function gMt(e,t,r){let n=kSe(e.line,e.column,t,r),s={from:n,to:e.endLine!=null&&e.endColumn!=1?kSe(e.endLine,e.endColumn,t,r):n,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:a,text:i}=e.fix,l=a[0]+r.pos-n,c=a[1]+r.pos-n;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+l,to:d+c,insert:i},scrollIntoView:!0})}}]}return s}const kD=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:QVe,completionPath:UVe,esLint:mMt,javascript:H$,javascriptLanguage:ch,jsxLanguage:Cle,localCompletionSource:BVe,scopeCompletionSource:dMt,snippets:kle,tsxLanguage:jle,typescriptLanguage:Ele,typescriptSnippets:$Ve},Symbol.toStringTag,{value:"Module"})),KC=["_blank","_self","_top","_parent"],Y7=["ascii","utf-8","utf-16","latin1","latin1"],X7=["get","post","put","delete"],K7=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],gd=["true","false"],Dr={},yMt={a:{attrs:{href:null,ping:null,type:null,media:null,target:KC,hreflang:null}},abbr:Dr,address:Dr,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Dr,aside:Dr,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Dr,base:{attrs:{href:null,target:KC}},bdi:Dr,bdo:Dr,blockquote:{attrs:{cite:null}},body:Dr,br:Dr,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:K7,formmethod:X7,formnovalidate:["novalidate"],formtarget:KC,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Dr,center:Dr,cite:Dr,code:Dr,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Dr,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Dr,div:Dr,dl:Dr,dt:Dr,em:Dr,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Dr,figure:Dr,footer:Dr,form:{attrs:{action:null,name:null,"accept-charset":Y7,autocomplete:["on","off"],enctype:K7,method:X7,novalidate:["novalidate"],target:KC}},h1:Dr,h2:Dr,h3:Dr,h4:Dr,h5:Dr,h6:Dr,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Dr,hgroup:Dr,hr:Dr,html:{attrs:{manifest:null}},i:Dr,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:K7,formmethod:X7,formnovalidate:["novalidate"],formtarget:KC,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Dr,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Dr,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Dr,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Y7,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Dr,noscript:Dr,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Dr,param:{attrs:{name:null,value:null}},pre:Dr,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Dr,rt:Dr,ruby:Dr,samp:Dr,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Y7}},section:Dr,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Dr,source:{attrs:{src:null,type:null,media:null}},span:Dr,strong:Dr,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Dr,summary:Dr,sup:Dr,table:Dr,tbody:Dr,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Dr,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Dr,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Dr,time:{attrs:{datetime:null}},title:Dr,tr:Dr,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Dr,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Dr},WVe={accesskey:null,class:null,contenteditable:gd,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:gd,autocorrect:gd,autocapitalize:gd,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":gd,"aria-autocomplete":["inline","list","both","none"],"aria-busy":gd,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":gd,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":gd,"aria-hidden":gd,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":gd,"aria-multiselectable":gd,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":gd,"aria-relevant":null,"aria-required":gd,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},GVe="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of GVe)WVe[e]=null;let DN=class{constructor(t,r){this.tags={...yMt,...t},this.globalAttrs={...WVe,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};DN.default=new DN;function Yk(e,t,r=e.length){if(!t)return"";let n=t.firstChild,s=n&&n.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,r)):""}function Xk(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function ZVe(e,t,r){let n=r.tags[Yk(e,Xk(t))];return n?.children||r.allTags}function Tle(e,t){let r=[];for(let n=Xk(t);n&&!n.type.isTop;n=Xk(n.parent)){let s=Yk(e,n);if(s&&n.lastChild.name=="CloseTag")break;s&&r.indexOf(s)<0&&(t.name=="EndTag"||t.from>=n.firstChild.to)&&r.push(s)}return r}const YVe=/^[:\-\.\w\u00b7-\uffff]*$/;function _Se(e,t,r,n,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",i=Xk(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:s,options:ZVe(e.doc,i,t).map(l=>({label:l,type:"type"})).concat(Tle(e.doc,r).map((l,c)=>({label:"/"+l,apply:"/"+l+a,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function ESe(e,t,r,n){let s=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:Tle(e.doc,t).map((a,i)=>({label:a,apply:a+s,type:"type",boost:99-i})),validFor:YVe}}function vMt(e,t,r,n){let s=[],a=0;for(let i of ZVe(e.doc,r,t))s.push({label:"<"+i,type:"type"});for(let i of Tle(e.doc,r))s.push({label:"</"+i+">",type:"type",boost:99-a++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function bMt(e,t,r,n,s){let a=Xk(r),i=a?t.tags[Yk(e.doc,a)]:null,l=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:n,to:s,options:c.map(u=>({label:u,type:"property"})),validFor:YVe}}function xMt(e,t,r,n,s){var a;let i=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),l=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=Xk(r),h=f?t.tags[Yk(e.doc,f)]:null;d=h?.attrs&&h.attrs[u]}if(d){let f=e.sliceDoc(n,s).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),n++):c=/^[^\s<>='"]*$/;for(let m of d)l.push({label:m,apply:h+m+p,type:"constant"})}}return{from:n,to:s,options:l,validFor:c}}function XVe(e,t){let{state:r,pos:n}=t,s=Na(r).resolveInner(n,-1),a=s.resolve(n);for(let i=n,l;a==s&&(l=s.childBefore(i));){let c=l.lastChild;if(!c||!c.type.isError||c.from<c.to)break;a=s=l,i=c.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?ESe(r,s,s.from,n):_Se(r,e,s,s.from,n):s.name=="StartTag"||s.name=="IncompleteTag"?_Se(r,e,s,n,n):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?ESe(r,s,n,n):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?bMt(r,e,s,s.name=="AttributeName"?s.from:n,n):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?xMt(r,e,s,s.name=="Is"?n:s.from,n):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?vMt(r,e,s,n):null}function KVe(e){return XVe(DN.default,e)}function JVe(e){let{extraTags:t,extraGlobalAttributes:r}=e,n=r||t?new DN(t,r):DN.default;return s=>XVe(n,s)}const wMt=ch.parser.configure({top:"SingleExpression"}),eqe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Ele.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Cle.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:jle.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:wMt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:ch.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:MN.parser}],tqe=[{name:"style",parser:MN.parser.configure({top:"Styles"})}].concat(GVe.map(e=>({name:e,parser:ch.parser}))),rqe=zw.define({name:"html",parser:YRt.configure({props:[BS.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,r;for(let n=e.node;;){let s=n.lastChild;if(!s||s.name!="Element"||s.to!=n.to)break;t=n=s}return t&&!((r=t.lastChild)&&(r.name=="CloseTag"||r.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),US.add({Element(e){let t=e.firstChild,r=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:r.name=="CloseTag"?r.from:e.to}}}),RUe.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),zT=rqe.configure({wrap:jVe(eqe,tqe)});function nqe(e={}){let t="",r;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(r=jVe((e.nestedLanguages||[]).concat(eqe),(e.nestedAttributes||[]).concat(tqe)));let n=r?rqe.configure({wrap:r,dialect:t}):t?zT.configure({dialect:t}):zT;return new Uw(n,[zT.data.of({autocomplete:JVe(e)}),e.autoCloseTags!==!1?sqe:[],H$().support,DVe().support])}const CSe=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),sqe=pt.inputHandler.of((e,t,r,n,s)=>{if(e.composing||e.state.readOnly||t!=r||n!=">"&&n!="/"||!zT.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,l=i.changeByRange(c=>{var u,d,f;let h=i.doc.sliceString(c.from-1,c.to)==n,{head:p}=c,m=Na(i).resolveInner(p,-1),g;if(h&&n==">"&&m.name=="EndTag"){let y=m.parent;if(((d=(u=y.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=Yk(i.doc,y.parent,p))&&!CSe.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:p,to:x,insert:w}}}}else if(h&&n=="/"&&m.name=="IncompleteCloseTag"){let y=m.parent;if(m.from==p-2&&((f=y.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=Yk(i.doc,y,p))&&!CSe.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`${g}>`;return{range:at.cursor(p+w.length,-1),changes:{from:p,to:x,insert:w}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([a,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),SMt=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:sqe,html:nqe,htmlCompletionSource:KVe,htmlCompletionSourceWith:JVe,htmlLanguage:zT},Symbol.toStringTag,{value:"Module"})),aqe=O6({commentTokens:{block:{open:"<!--",close:"-->"}}}),iqe=new hn,oqe=KIt.configure({props:[US.add(e=>!e.is("Block")||e.is("Document")||dre(e)!=null||OMt(e)?void 0:(t,r)=>({from:r.doc.lineAt(t.from).to,to:t.to})),iqe.add(dre),BS.add({Document:()=>null}),Pb.add({Document:aqe})]});function dre(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function OMt(e){return e.name=="OrderedList"||e.name=="BulletList"}function kMt(e,t){let r=e;for(;;){let n=r.nextSibling,s;if(!n||(s=dre(n.type))!=null&&s<=t)break;r=n}return r.to}const _Mt=wUe.of((e,t,r)=>{for(let n=Na(e).resolveInner(r,-1);n&&!(n.from<t);n=n.parent){let s=n.type.prop(iqe);if(s==null)continue;let a=kMt(n,s);if(a>r)return{from:r,to:a}}return null});function Nle(e){return new Dd(aqe,e,[],"markdown")}const lqe=Nle(oqe),EMt=oqe.configure([cRt,dRt,uRt,fRt,{props:[US.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),Hw=Nle(EMt);function CMt(e,t){return r=>{if(r&&e){let n=null;if(r=/\S*/.exec(r)[0],typeof e=="function"?n=e(r):n=Ke.matchLanguageName(e,r,!0),n instanceof Ke)return n.support?n.support.language.parser:Bw.getSkippingParser(n.load());if(n)return n.parser}return t?t.parser:null}}class J7{constructor(t,r,n,s,a,i,l){this.node=t,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=a,this.type=i,this.item=l}blank(t,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;n.length<t;)n+=" ";return n}else{for(let s=this.to-this.from-n.length-this.spaceAfter.length;s>0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(t,r){let n=this.node.name=="OrderedList"?String(+uqe(this.item,t)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function cqe(e,t){let r=[],n=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let a=r[s],i,l=t.lineAt(a.from),c=a.from-l.from;if(a.name=="Blockquote"&&(i=/^ *>( ?)/.exec(l.text.slice(c))))n.push(new J7(a,c,c+i[0].length,"",i[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),n.push(new J7(a.parent,c,c+d,i[1],u,i[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=i[4],d=i[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=i[2];i[3]&&(f+=i[3].replace(/[xX]/," ")),n.push(new J7(a.parent,c,c+d,i[1],u,f,a))}}return n}function uqe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function eU(e,t,r,n=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let l=uqe(a,t),c=+l[2];if(s>=0){if(c!=s+1)return;r.push({from:a.from+l[1].length,to:a.from+l[0].length,insert:String(s+2+n)})}s=c}let i=a.nextSibling;if(!i)break;a=i}}function Ale(e,t){let r=/^[ \t]*/.exec(e)[0].length;if(!r||t.facet(oE)!=" ")return e;let n=vp(e,4,r),s="";for(let a=n;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(r)}const dqe=(e={})=>({state:t,dispatch:r})=>{let n=Na(t),{doc:s}=t,a=null,i=t.changeByRange(l=>{if(!l.empty||!Hw.isActiveAt(t,l.from,-1)&&!Hw.isActiveAt(t,l.from,1))return a={range:l};let c=l.from,u=s.lineAt(c),d=cqe(n.resolveInner(c,-1),s);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return a={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return a={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||e.nonTightLists===!1){let O=d.length>1?d[d.length-2]:null,k,_="";O&&O.item?(k=u.from+O.from,_=O.marker(s,1)):k=u.from+(O?O.to:0);let E=[{from:k,to:c,insert:_}];return f.node.name=="OrderedList"&&eU(f.item,s,E,-2),O&&O.node.name=="OrderedList"&&eU(O.item,s,E),{range:at.cursor(k+_.length),changes:E}}else{let O=TSe(d,t,u);return{range:at.cursor(c+O.length+1),changes:{from:u.from,insert:O+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let x=s.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let O=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(O),changes:O}}}let p=[];f.node.name=="OrderedList"&&eU(f.item,s,p);let m=f.item&&f.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let x=0,w=d.length-1;x<=w;x++)g+=x==w&&!m?d[x].marker(s,1):d[x].blank(x<w?vp(u.text,4,d[x+1].from)-g.length:null);let y=c;for(;y>u.from&&/\s/.test(u.text.charAt(y-u.from-1));)y--;return g=Ale(g,t),jMt(f.node,t.doc)&&(g=TSe(d,t,u)+t.lineBreak+g),p.push({from:y,to:c,insert:t.lineBreak+g}),{range:at.cursor(y+g.length+1),changes:p}});return a?!1:(r(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},fqe=dqe();function jSe(e){return e.name=="QuoteMark"||e.name=="ListMark"}function jMt(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let r=e.firstChild,n=e.getChild("ListItem","ListItem");if(!n)return!1;let s=t.lineAt(r.to),a=t.lineAt(n.from),i=/^[\s>]*$/.test(s.text);return s.number+(i?0:1)<a.number}function TSe(e,t,r){let n="";for(let s=0,a=e.length-2;s<=a;s++)n+=e[s].blank(s<a?vp(r.text,4,e[s+1].from)-n.length:null,s<a);return Ale(n,t)}function TMt(e,t){let r=e.resolveInner(t,-1),n=t;jSe(r)&&(n=r.from,r=r.parent);for(let s;s=r.childBefore(n);)if(jSe(s))n=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")r=s.lastChild,n=r.to;else break;return r}const hqe=({state:e,dispatch:t})=>{let r=Na(e),n=null,s=e.changeByRange(a=>{let i=a.from,{doc:l}=e;if(a.empty&&Hw.isActiveAt(e,a.from)){let c=l.lineAt(i),u=cqe(TMt(r,i),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(i-c.from>f&&!/\S/.test(c.text.slice(f,i-c.from)))return{range:at.cursor(c.from+f),changes:{from:c.from+f,to:i}};if(i-c.from==f&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let p=d.blank(vp(c.text,4,d.to)-vp(c.text,4,d.from));return h==c.from&&(p=Ale(p,e)),{range:at.cursor(h+p.length),changes:{from:h,to:c.from+d.to,insert:p}}}if(h<i)return{range:at.cursor(h),changes:{from:h,to:i}}}}}return n={range:a}});return n?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},pqe=[{key:"Enter",run:fqe},{key:"Backspace",run:hqe}],mqe=nqe({matchClosingTags:!1});function Ile(e={}){let{codeLanguages:t,defaultCodeLanguage:r,addKeymap:n=!0,base:{parser:s}=lqe,completeHTMLTags:a=!0,pasteURLAsLink:i=!0,htmlTagLanguage:l=mqe}=e;if(!(s instanceof C6))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[l.support,_Mt],d;i&&u.push(gqe),r instanceof Uw?(u.push(r.support),d=r.language):r&&(d=r);let f=t||d?CMt(t,d):void 0;c.push(eRt({codeParser:f,htmlParser:l.language.parser})),n&&u.push(Np.high(iE.of(pqe)));let h=Nle(s.configure(c));return a&&u.push(h.data.of({autocomplete:NMt})),new Uw(h,u)}function NMt(e){let{state:t,pos:r}=e,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(r-25,r));if(!n)return null;let s=Na(t).resolveInner(r,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:r-n[0].length,to:r,options:AMt(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let tU=null;function AMt(){if(tU)return tU;let e=KVe(new lle(Dn.create({extensions:mqe}),0,!0));return tU=e?e.options:[]}const IMt=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,gqe=pt.domEventHandlers({paste:(e,t)=>{var r;let{main:n}=t.state.selection;if(n.empty)return!1;let s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!Hw.isActiveAt(t.state,n.from,1)))return!1;let a=Na(t.state),i=!1;return a.iterate({from:n.from,to:n.to,enter:l=>{(l.from>n.from||IMt.test(l.name))&&(i=!0)},leave:l=>{l.to<n.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),RMt=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:lqe,deleteMarkupBackward:hqe,insertNewlineContinueMarkup:fqe,insertNewlineContinueMarkupCommand:dqe,markdown:Ile,markdownKeymap:pqe,markdownLanguage:Hw,pasteURLAsLink:gqe},Symbol.toStringTag,{value:"Module"}));function gt(e){return new Uw(ale.define(e))}function sb(e){return Je(()=>import("./index-DBV4htYQ.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const yqe=[Ke.of({name:"C",extensions:["c","h","ino"],load(){return Je(()=>import("./index-BDRPx-14.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Ke.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Je(()=>import("./index-BDRPx-14.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Ke.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return sb("Cassandra")}}),Ke.of({name:"CSS",extensions:["css"],load(){return Je(()=>Promise.resolve().then(()=>NPt),void 0,import.meta.url).then(e=>e.css())}}),Ke.of({name:"Go",extensions:["go"],load(){return Je(()=>import("./index-DkE_IufI.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),Ke.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Je(()=>Promise.resolve().then(()=>SMt),void 0,import.meta.url).then(e=>e.html())}}),Ke.of({name:"Java",extensions:["java"],load(){return Je(()=>import("./index-hkbleF_8.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),Ke.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Je(()=>Promise.resolve().then(()=>kD),void 0,import.meta.url).then(e=>e.javascript())}}),Ke.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return Je(()=>import("./index-DyOtSmkc.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),Ke.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Je(()=>Promise.resolve().then(()=>qAt),void 0,import.meta.url).then(e=>e.json())}}),Ke.of({name:"JSX",extensions:["jsx"],load(){return Je(()=>Promise.resolve().then(()=>kD),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ke.of({name:"LESS",extensions:["less"],load(){return Je(()=>import("./index-03hK8iYF.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),Ke.of({name:"Liquid",extensions:["liquid"],load(){return Je(()=>import("./index-ndNh83D4.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),Ke.of({name:"MariaDB SQL",load(){return sb("MariaSQL")}}),Ke.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Je(()=>Promise.resolve().then(()=>RMt),void 0,import.meta.url).then(e=>e.markdown())}}),Ke.of({name:"MS SQL",load(){return sb("MSSQL")}}),Ke.of({name:"MySQL",load(){return sb("MySQL")}}),Ke.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Je(()=>import("./index-DSr9mwVr.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),Ke.of({name:"PLSQL",extensions:["pls"],load(){return sb("PLSQL")}}),Ke.of({name:"PostgreSQL",load(){return sb("PostgreSQL")}}),Ke.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Je(()=>import("./index-6lOrrtr1.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),Ke.of({name:"Rust",extensions:["rs"],load(){return Je(()=>import("./index-D7V5c-cf.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),Ke.of({name:"Sass",extensions:["sass"],load(){return Je(()=>import("./index-UFxaORfL.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Ke.of({name:"SCSS",extensions:["scss"],load(){return Je(()=>import("./index-UFxaORfL.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),Ke.of({name:"SQL",extensions:["sql"],load(){return sb("StandardSQL")}}),Ke.of({name:"SQLite",load(){return sb("SQLite")}}),Ke.of({name:"TSX",extensions:["tsx"],load(){return Je(()=>Promise.resolve().then(()=>kD),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ke.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Je(()=>Promise.resolve().then(()=>kD),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ke.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Je(()=>import("./index-CLem26k1.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),Ke.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Je(()=>import("./index-Nx7J7mje.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),Ke.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Je(()=>import("./index-IsIh05sL.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),Ke.of({name:"APL",extensions:["dyalog","apl"],load(){return Je(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>gt(e.apl))}}),Ke.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Je(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>gt(e.asciiArmor))}}),Ke.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Je(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>gt(e.asn1({})))}}),Ke.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Je(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>gt(e.asterisk))}}),Ke.of({name:"Brainfuck",extensions:["b","bf"],load(){return Je(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>gt(e.brainfuck))}}),Ke.of({name:"Cobol",extensions:["cob","cpy"],load(){return Je(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>gt(e.cobol))}}),Ke.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.csharp))}}),Ke.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"ClojureScript",extensions:["cljs"],load(){return Je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Je(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>gt(e.gss))}}),Ke.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Je(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>gt(e.cmake))}}),Ke.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Je(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>gt(e.coffeeScript))}}),Ke.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Je(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>gt(e.commonLisp))}}),Ke.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Je(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>gt(e.cypher))}}),Ke.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Je(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>gt(e.cython))}}),Ke.of({name:"Crystal",extensions:["cr"],load(){return Je(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>gt(e.crystal))}}),Ke.of({name:"D",extensions:["d"],load(){return Je(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>gt(e.d))}}),Ke.of({name:"Dart",extensions:["dart"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.dart))}}),Ke.of({name:"diff",extensions:["diff","patch"],load(){return Je(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>gt(e.diff))}}),Ke.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Je(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>gt(e.dockerFile))}}),Ke.of({name:"DTD",extensions:["dtd"],load(){return Je(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>gt(e.dtd))}}),Ke.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Je(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>gt(e.dylan))}}),Ke.of({name:"EBNF",load(){return Je(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>gt(e.ebnf))}}),Ke.of({name:"ECL",extensions:["ecl"],load(){return Je(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>gt(e.ecl))}}),Ke.of({name:"edn",extensions:["edn"],load(){return Je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"Eiffel",extensions:["e"],load(){return Je(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>gt(e.eiffel))}}),Ke.of({name:"Elm",extensions:["elm"],load(){return Je(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>gt(e.elm))}}),Ke.of({name:"Erlang",extensions:["erl"],load(){return Je(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>gt(e.erlang))}}),Ke.of({name:"Esper",load(){return Je(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>gt(e.esper))}}),Ke.of({name:"Factor",extensions:["factor"],load(){return Je(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>gt(e.factor))}}),Ke.of({name:"FCL",load(){return Je(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>gt(e.fcl))}}),Ke.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Je(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>gt(e.forth))}}),Ke.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Je(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>gt(e.fortran))}}),Ke.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Je(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.fSharp))}}),Ke.of({name:"Gas",extensions:["s"],load(){return Je(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>gt(e.gas))}}),Ke.of({name:"Gherkin",extensions:["feature"],load(){return Je(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>gt(e.gherkin))}}),Ke.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Je(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>gt(e.groovy))}}),Ke.of({name:"Haskell",extensions:["hs"],load(){return Je(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>gt(e.haskell))}}),Ke.of({name:"Haxe",extensions:["hx"],load(){return Je(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>gt(e.haxe))}}),Ke.of({name:"HXML",extensions:["hxml"],load(){return Je(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>gt(e.hxml))}}),Ke.of({name:"HTTP",load(){return Je(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>gt(e.http))}}),Ke.of({name:"IDL",extensions:["pro"],load(){return Je(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>gt(e.idl))}}),Ke.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Je(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>gt(e.jsonld))}}),Ke.of({name:"Julia",extensions:["jl"],load(){return Je(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>gt(e.julia))}}),Ke.of({name:"Kotlin",extensions:["kt","kts"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.kotlin))}}),Ke.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Je(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>gt(e.liveScript))}}),Ke.of({name:"Lua",extensions:["lua"],load(){return Je(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>gt(e.lua))}}),Ke.of({name:"mIRC",extensions:["mrc"],load(){return Je(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>gt(e.mirc))}}),Ke.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Je(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>gt(e.mathematica))}}),Ke.of({name:"Modelica",extensions:["mo"],load(){return Je(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>gt(e.modelica))}}),Ke.of({name:"MUMPS",extensions:["mps"],load(){return Je(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>gt(e.mumps))}}),Ke.of({name:"Mbox",extensions:["mbox"],load(){return Je(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>gt(e.mbox))}}),Ke.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Je(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>gt(e.nginx))}}),Ke.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Je(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>gt(e.nsis))}}),Ke.of({name:"NTriples",extensions:["nt","nq"],load(){return Je(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>gt(e.ntriples))}}),Ke.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.objectiveC))}}),Ke.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.objectiveCpp))}}),Ke.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Je(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.oCaml))}}),Ke.of({name:"Octave",extensions:["m"],load(){return Je(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>gt(e.octave))}}),Ke.of({name:"Oz",extensions:["oz"],load(){return Je(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>gt(e.oz))}}),Ke.of({name:"Pascal",extensions:["p","pas"],load(){return Je(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>gt(e.pascal))}}),Ke.of({name:"Perl",extensions:["pl","pm"],load(){return Je(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>gt(e.perl))}}),Ke.of({name:"Pig",extensions:["pig"],load(){return Je(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>gt(e.pig))}}),Ke.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Je(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>gt(e.powerShell))}}),Ke.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Je(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>gt(e.properties))}}),Ke.of({name:"ProtoBuf",extensions:["proto"],load(){return Je(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>gt(e.protobuf))}}),Ke.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Je(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>gt(e.pug))}}),Ke.of({name:"Puppet",extensions:["pp"],load(){return Je(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>gt(e.puppet))}}),Ke.of({name:"Q",extensions:["q"],load(){return Je(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>gt(e.q))}}),Ke.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Je(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>gt(e.r))}}),Ke.of({name:"RPM Changes",load(){return Je(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>gt(e.rpmChanges))}}),Ke.of({name:"RPM Spec",extensions:["spec"],load(){return Je(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>gt(e.rpmSpec))}}),Ke.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Je(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>gt(e.ruby))}}),Ke.of({name:"SAS",extensions:["sas"],load(){return Je(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>gt(e.sas))}}),Ke.of({name:"Scala",extensions:["scala"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.scala))}}),Ke.of({name:"Scheme",extensions:["scm","ss"],load(){return Je(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>gt(e.scheme))}}),Ke.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Je(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>gt(e.shell))}}),Ke.of({name:"Sieve",extensions:["siv","sieve"],load(){return Je(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>gt(e.sieve))}}),Ke.of({name:"Smalltalk",extensions:["st"],load(){return Je(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>gt(e.smalltalk))}}),Ke.of({name:"Solr",load(){return Je(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>gt(e.solr))}}),Ke.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Je(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.sml))}}),Ke.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Je(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>gt(e.sparql))}}),Ke.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Je(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>gt(e.spreadsheet))}}),Ke.of({name:"Squirrel",extensions:["nut"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.squirrel))}}),Ke.of({name:"Stylus",extensions:["styl"],load(){return Je(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>gt(e.stylus))}}),Ke.of({name:"Swift",extensions:["swift"],load(){return Je(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>gt(e.swift))}}),Ke.of({name:"sTeX",load(){return Je(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>gt(e.stex))}}),Ke.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Je(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>gt(e.stex))}}),Ke.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Je(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>gt(e.verilog))}}),Ke.of({name:"Tcl",extensions:["tcl"],load(){return Je(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>gt(e.tcl))}}),Ke.of({name:"Textile",extensions:["textile"],load(){return Je(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>gt(e.textile))}}),Ke.of({name:"TiddlyWiki",load(){return Je(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>gt(e.tiddlyWiki))}}),Ke.of({name:"Tiki wiki",load(){return Je(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>gt(e.tiki))}}),Ke.of({name:"TOML",extensions:["toml"],load(){return Je(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>gt(e.toml))}}),Ke.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Je(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>gt(e.troff))}}),Ke.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Je(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>gt(e.ttcn))}}),Ke.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Je(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>gt(e.ttcnCfg))}}),Ke.of({name:"Turtle",extensions:["ttl"],load(){return Je(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>gt(e.turtle))}}),Ke.of({name:"Web IDL",extensions:["webidl"],load(){return Je(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>gt(e.webIDL))}}),Ke.of({name:"VB.NET",extensions:["vb"],load(){return Je(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>gt(e.vb))}}),Ke.of({name:"VBScript",extensions:["vbs"],load(){return Je(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>gt(e.vbScript))}}),Ke.of({name:"Velocity",extensions:["vtl"],load(){return Je(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>gt(e.velocity))}}),Ke.of({name:"Verilog",extensions:["v"],load(){return Je(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>gt(e.verilog))}}),Ke.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Je(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>gt(e.vhdl))}}),Ke.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return Je(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>gt(e.xQuery))}}),Ke.of({name:"Yacas",extensions:["ys"],load(){return Je(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>gt(e.yacas))}}),Ke.of({name:"Z80",extensions:["z80"],load(){return Je(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>gt(e.z80))}}),Ke.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Je(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.mscgen))}}),Ke.of({name:"Xù",extensions:["xu"],load(){return Je(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.xu))}}),Ke.of({name:"MsGenny",extensions:["msgenny"],load(){return Je(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.msgenny))}}),Ke.of({name:"Vue",extensions:["vue"],load(){return Je(()=>import("./index-Cas8lkc4.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),Ke.of({name:"Angular Template",load(){return Je(()=>import("./index-KV-d7Z_K.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];function px(){return px=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},px.apply(null,arguments)}var PMt=e=>{var{theme:t,settings:r={},styles:n=[]}=e,s={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),r.fontSize&&(a.fontSize=r.fontSize),(r.background||r.foreground)&&(s["&"]=a),r.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(s[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(s[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(s[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(s[".cm-content"]={caretColor:r.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var i={};r.gutterActiveForeground&&(i.color=r.gutterActiveForeground),r.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:r.lineHighlight},i.backgroundColor=r.lineHighlight),s[".cm-activeLineGutter"]=i,r.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var l=pt.theme(s,{dark:t==="dark"}),c=Ap.define(n),u=[l,Fx(c)];return u},MMt={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},DMt=[{tag:ne.comment,color:"#6272a4"},{tag:ne.string,color:"#f1fa8c"},{tag:ne.atom,color:"#bd93f9"},{tag:ne.meta,color:"#f8f8f2"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"#ff79c6"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"#66d9ef"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"#50fa7b"},{tag:ne.atom,color:"#bd93f9"}],cE=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return PMt({theme:t,settings:px({},MMt,r),styles:[...DMt,...n]})};cE();function Rle(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const LMt=e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=Mle(e.state,r.from);return n.line?$Mt(e):n.block?zMt(e):!1};function Ple(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let s=e(t,r);return s?(n(r.update(s)),!0):!1}}const $Mt=Ple(VMt,0),FMt=Ple(vqe,0),zMt=Ple((e,t)=>vqe(e,t,UMt(t)),0);function Mle(e,t){let r=e.languageDataAt("commentTokens",t,1);return r.length?r[0]:{}}const JC=50;function BMt(e,{open:t,close:r},n,s){let a=e.sliceDoc(n-JC,n),i=e.sliceDoc(s,s+JC),l=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(i)[0].length,u=a.length-l;if(a.slice(u-t.length,u)==t&&i.slice(c,c+r.length)==r)return{open:{pos:n-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-n<=2*JC?d=f=e.sliceDoc(n,s):(d=e.sliceDoc(n,n+JC),f=e.sliceDoc(s-JC,s));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-r.length;return d.slice(h,h+t.length)==t&&f.slice(m,m+r.length)==r?{open:{pos:n+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:s-p-r.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function UMt(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),s=r.to<=n.to?n:e.doc.lineAt(r.to);s.from>n.from&&s.from==r.to&&(s=r.to==n.to+1?n:e.doc.lineAt(r.to-1));let a=t.length-1;a>=0&&t[a].to>n.from?t[a].to=s.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return t}function vqe(e,t,r=t.selection.ranges){let n=r.map(a=>Mle(t,a.from).block);if(!n.every(a=>a))return null;let s=r.map((a,i)=>BMt(t,n[i],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(r.map((a,i)=>s[i]?[]:[{from:a.from,insert:n[i].open+" "},{from:a.to,insert:" "+n[i].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let i=0,l;i<s.length;i++)if(l=s[i]){let c=n[i],{open:u,close:d}=l;a.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:a}}return null}function VMt(e,t,r=t.selection.ranges){let n=[],s=-1;e:for(let{from:a,to:i}of r){let l=n.length,c=1e9,u;for(let d=a;d<=i;){let f=t.doc.lineAt(d);if(u==null&&(u=Mle(t,f.from).line,!u))continue e;if(f.from>s&&(a==i||i>f.from)){s=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+u.length)==u?h:-1;h<f.text.length&&h<c&&(c=h),n.push({line:f,comment:m,token:u,indent:h,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=l;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=c);n.length==l+1&&(n[l].single=!0)}if(e!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of n)(f||!d)&&a.push({from:l.from+u,insert:c+" "});let i=t.changes(a);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:i,comment:l,token:c}of n)if(l>=0){let u=i.from+l,d=u+c.length;i.text[d-i.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const fre=mg.define(),qMt=mg.define(),HMt=Kt.define(),bqe=Kt.define({combine(e){return gg(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,r)=>(n,s)=>t(n,s)||r(n,s)})}}),xqe=yo.define({create(){return Pm.empty},update(e,t){let r=t.state.facet(bqe),n=t.annotation(fre);if(n){let c=Pu.fromTransaction(t,n.selection),u=n.side,d=u==0?e.undone:e.done;return c?d=Q$(d,d.length,r.minDepth,c):d=Oqe(d,t.startState.selection),new Pm(u==0?n.rest:d,u==0?d:n.rest)}let s=t.annotation(qMt);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(Ao.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Pu.fromTransaction(t),i=t.annotation(Ao.time),l=t.annotation(Ao.userEvent);return a?e=e.addChanges(a,i,l,r,t):t.selection&&(e=e.addSelection(t.startState.selection,i,l,r.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Pm(e.done.map(Pu.fromJSON),e.undone.map(Pu.fromJSON))}});function QMt(e={}){return[xqe,bqe.of(e),pt.domEventHandlers({beforeinput(t,r){let n=t.inputType=="historyUndo"?wqe:t.inputType=="historyRedo"?hre:null;return n?(t.preventDefault(),n(r)):!1}})]}function j6(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let s=r.field(xqe,!1);if(!s)return!1;let a=s.pop(e,r,t);return a?(n(a),!0):!1}}const wqe=j6(0,!1),hre=j6(1,!1),WMt=j6(0,!0),GMt=j6(1,!0);class Pu{constructor(t,r,n,s,a){this.changes=t,this.effects=r,this.mapped=n,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new Pu(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new Pu(t.changes&&Co.fromJSON(t.changes),[],t.mapped&&Vm.fromJSON(t.mapped),t.startSelection&&at.fromJSON(t.startSelection),t.selectionsAfter.map(at.fromJSON))}static fromTransaction(t,r){let n=sh;for(let s of t.startState.facet(HMt)){let a=s(t);a.length&&(n=n.concat(a))}return!n.length&&t.changes.empty?null:new Pu(t.changes.invert(t.startState.doc),n,void 0,r||t.startState.selection,sh)}static selection(t){return new Pu(void 0,sh,void 0,void 0,t)}}function Q$(e,t,r,n){let s=t+1>r+20?t-r-1:0,a=e.slice(s,t);return a.push(n),a}function ZMt(e,t){let r=[],n=!1;return e.iterChangedRanges((s,a)=>r.push(s,a)),t.iterChangedRanges((s,a,i,l)=>{for(let c=0;c<r.length;){let u=r[c++],d=r[c++];l>=u&&i<=d&&(n=!0)}}),n}function YMt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((r,n)=>r.empty!=t.ranges[n].empty).length===0}function Sqe(e,t){return e.length?t.length?e.concat(t):e:t}const sh=[],XMt=200;function Oqe(e,t){if(e.length){let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-XMt));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),Q$(e,e.length-1,1e9,r.setSelAfter(n)))}else return[Pu.selection([t])]}function KMt(e){let t=e[e.length-1],r=e.slice();return r[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),r}function rU(e,t){if(!e.length)return e;let r=e.length,n=sh;for(;r;){let s=JMt(e[r-1],t,n);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,r);return a[r-1]=s,a}else t=s.mapped,r--,n=s.selectionsAfter}return n.length?[Pu.selection(n)]:sh}function JMt(e,t,r){let n=Sqe(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):sh,r);if(!e.changes)return Pu.selection(n);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(a):a;return new Pu(s,tn.mapEffects(e.effects,t),i,e.startSelection.map(a),n)}const eDt=/^(input\.type|delete)($|\.)/;class Pm{constructor(t,r,n=0,s=void 0){this.done=t,this.undone=r,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new Pm(this.done,this.undone):this}addChanges(t,r,n,s,a){let i=this.done,l=i[i.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!n||eDt.test(n))&&(!l.selectionsAfter.length&&r-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,ZMt(l.changes,t.changes))||n=="input.type.compose")?i=Q$(i,i.length-1,s.minDepth,new Pu(t.changes.compose(l.changes),Sqe(tn.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,sh)):i=Q$(i,i.length,s.minDepth,t),new Pm(i,sh,r,n)}addSelection(t,r,n,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:sh;return a.length>0&&r-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&YMt(a[a.length-1],t)?this:new Pm(Oqe(this.done,t),this.undone,r,n)}addMapping(t){return new Pm(rU(this.done,t),rU(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,n){let s=t==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],i=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):r.selection);if(n&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:fre.of({side:t,rest:KMt(s),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let l=s.length==1?sh:s.slice(0,s.length-1);return a.mapped&&(l=rU(l,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:fre.of({side:t,rest:l,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Pm.empty=new Pm(sh,sh);const tDt=[{key:"Mod-z",run:wqe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:hre,preventDefault:!0},{linux:"Ctrl-Shift-z",run:hre,preventDefault:!0},{key:"Mod-u",run:WMt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:GMt,preventDefault:!0}];function uE(e,t){return at.create(e.ranges.map(t),e.mainIndex)}function Ip(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Rp({state:e,dispatch:t},r){let n=uE(e.selection,r);return n.eq(e.selection,!0)?!1:(t(Ip(e,n)),!0)}function T6(e,t){return at.cursor(t?e.to:e.from)}function kqe(e,t){return Rp(e,r=>r.empty?e.moveByChar(r,t):T6(r,t))}function Sc(e){return e.textDirectionAt(e.state.selection.main.head)==Da.LTR}const _qe=e=>kqe(e,!Sc(e)),Eqe=e=>kqe(e,Sc(e));function Cqe(e,t){return Rp(e,r=>r.empty?e.moveByGroup(r,t):T6(r,t))}const rDt=e=>Cqe(e,!Sc(e)),nDt=e=>Cqe(e,Sc(e));function sDt(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function N6(e,t,r){let n=Na(e).resolveInner(t.head),s=r?hn.closedBy:hn.openedBy;for(let c=t.head;;){let u=r?n.childAfter(c):n.childBefore(c);if(!u)break;sDt(e,u,s)?n=u:c=r?u.to:u.from}let a=n.type.prop(s),i,l;return a&&(i=r?Rm(e,n.from,1):Rm(e,n.to,-1))&&i.matched?l=r?i.end.to:i.end.from:l=r?n.to:n.from,at.cursor(l,r?-1:1)}const aDt=e=>Rp(e,t=>N6(e.state,t,!Sc(e))),iDt=e=>Rp(e,t=>N6(e.state,t,Sc(e)));function jqe(e,t){return Rp(e,r=>{if(!r.empty)return T6(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)})}const Tqe=e=>jqe(e,!1),Nqe=e=>jqe(e,!0);function Aqe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,n=0,s;if(t){for(let a of e.state.facet(pt.scrollMargins)){let i=a(e);i?.top&&(r=Math.max(i?.top,r)),i?.bottom&&(n=Math.max(i?.bottom,n))}s=e.scrollDOM.clientHeight-r-n}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function Iqe(e,t){let r=Aqe(e),{state:n}=e,s=uE(n.selection,i=>i.empty?e.moveVertically(i,t,r.height):T6(i,t));if(s.eq(n.selection))return!1;let a;if(r.selfScroll){let i=e.coordsAtPos(n.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+r.marginTop,u=l.bottom-r.marginBottom;i&&i.top>c&&i.bottom<u&&(a=pt.scrollIntoView(s.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(Ip(n,s),{effects:a}),!0}const NSe=e=>Iqe(e,!1),pre=e=>Iqe(e,!0);function zx(e,t,r){let n=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,r);if(s.head==t.head&&s.head!=(r?n.to:n.from)&&(s=e.moveToLineBoundary(t,r,!1)),!r&&s.head==n.from&&n.length){let a=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&t.head!=n.from+a&&(s=at.cursor(n.from+a))}return s}const oDt=e=>Rp(e,t=>zx(e,t,!0)),lDt=e=>Rp(e,t=>zx(e,t,!1)),cDt=e=>Rp(e,t=>zx(e,t,!Sc(e))),uDt=e=>Rp(e,t=>zx(e,t,Sc(e))),dDt=e=>Rp(e,t=>at.cursor(e.lineBlockAt(t.head).from,1)),fDt=e=>Rp(e,t=>at.cursor(e.lineBlockAt(t.head).to,-1));function hDt(e,t,r){let n=!1,s=uE(e.selection,a=>{let i=Rm(e,a.head,-1)||Rm(e,a.head,1)||a.head>0&&Rm(e,a.head-1,1)||a.head<e.doc.length&&Rm(e,a.head+1,-1);if(!i||!i.end)return a;n=!0;let l=i.start.from==a.head?i.end.to:i.end.from;return at.cursor(l)});return n?(t(Ip(e,s)),!0):!1}const pDt=({state:e,dispatch:t})=>hDt(e,t);function Eh(e,t){let r=uE(e.state.selection,n=>{let s=t(n);return at.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(Ip(e.state,r)),!0)}function Rqe(e,t){return Eh(e,r=>e.moveByChar(r,t))}const Pqe=e=>Rqe(e,!Sc(e)),Mqe=e=>Rqe(e,Sc(e));function Dqe(e,t){return Eh(e,r=>e.moveByGroup(r,t))}const mDt=e=>Dqe(e,!Sc(e)),gDt=e=>Dqe(e,Sc(e)),yDt=e=>Eh(e,t=>N6(e.state,t,!Sc(e))),vDt=e=>Eh(e,t=>N6(e.state,t,Sc(e)));function Lqe(e,t){return Eh(e,r=>e.moveVertically(r,t))}const $qe=e=>Lqe(e,!1),Fqe=e=>Lqe(e,!0);function zqe(e,t){return Eh(e,r=>e.moveVertically(r,t,Aqe(e).height))}const ASe=e=>zqe(e,!1),ISe=e=>zqe(e,!0),bDt=e=>Eh(e,t=>zx(e,t,!0)),xDt=e=>Eh(e,t=>zx(e,t,!1)),wDt=e=>Eh(e,t=>zx(e,t,!Sc(e))),SDt=e=>Eh(e,t=>zx(e,t,Sc(e))),ODt=e=>Eh(e,t=>at.cursor(e.lineBlockAt(t.head).from)),kDt=e=>Eh(e,t=>at.cursor(e.lineBlockAt(t.head).to)),RSe=({state:e,dispatch:t})=>(t(Ip(e,{anchor:0})),!0),PSe=({state:e,dispatch:t})=>(t(Ip(e,{anchor:e.doc.length})),!0),MSe=({state:e,dispatch:t})=>(t(Ip(e,{anchor:e.selection.main.anchor,head:0})),!0),DSe=({state:e,dispatch:t})=>(t(Ip(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),_Dt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),EDt=({state:e,dispatch:t})=>{let r=A6(e).map(({from:n,to:s})=>at.range(n,Math.min(s+1,e.doc.length)));return t(e.update({selection:at.create(r),userEvent:"select"})),!0},CDt=({state:e,dispatch:t})=>{let r=uE(e.selection,n=>{let s=Na(e),a=s.resolveStack(n.from,1);if(n.empty){let i=s.resolveStack(n.from,-1);i.node.from>=a.node.from&&i.node.to<=a.node.to&&(a=i)}for(let i=a;i;i=i.next){let{node:l}=i;if((l.from<n.from&&l.to>=n.to||l.to>n.to&&l.from<=n.from)&&i.next)return at.range(l.to,l.from)}return n});return r.eq(e.selection)?!1:(t(Ip(e,r)),!0)};function Bqe(e,t){let{state:r}=e,n=r.selection,s=r.selection.ranges.slice();for(let a of r.selection.ranges){let i=r.doc.lineAt(a.head);if(t?i.to<e.state.doc.length:i.from>0)for(let l=a;;){let c=e.moveVertically(l,t);if(c.head<i.from||c.head>i.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==n.ranges.length?!1:(e.dispatch(Ip(r,at.create(s,s.length-1))),!0)}const jDt=e=>Bqe(e,!1),TDt=e=>Bqe(e,!0),NDt=({state:e,dispatch:t})=>{let r=e.selection,n=null;return r.ranges.length>1?n=at.create([r.main]):r.main.empty||(n=at.create([at.cursor(r.main.head)])),n?(t(Ip(e,n)),!0):!1};function lR(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:n}=e,s=n.changeByRange(a=>{let{from:i,to:l}=a;if(i==l){let c=t(a);c<i?(r="delete.backward",c=_D(e,c,!1)):c>i&&(r="delete.forward",c=_D(e,c,!0)),i=Math.min(i,c),l=Math.max(l,c)}else i=_D(e,i,!1),l=_D(e,l,!0);return i==l?{range:a}:{changes:{from:i,to:l},range:at.cursor(i,i<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(n.update(s,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?pt.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function _D(e,t,r){if(e instanceof pt)for(let n of e.state.facet(pt.atomicRanges).map(s=>s(e)))n.between(t,t,(s,a)=>{s<t&&a>t&&(t=r?a:s)});return t}const Uqe=(e,t,r)=>lR(e,n=>{let s=n.from,{state:a}=e,i=a.doc.lineAt(s),l,c;if(r&&!t&&s>i.from&&s<i.from+200&&!/[^ \t]/.test(l=i.text.slice(0,s-i.from))){if(l[l.length-1]==" ")return s-1;let u=vp(l,a.tabSize),d=u%Vw(a)||Vw(a);for(let f=0;f<d&&l[l.length-1-f]==" ";f++)s--;c=s}else c=gl(i.text,s-i.from,t,t)+i.from,c==s&&i.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(c-i.from,s-i.from))&&(c=gl(i.text,c-i.from,!1,!1)+i.from);return c}),mre=e=>Uqe(e,!1,!0),Vqe=e=>Uqe(e,!0,!1),qqe=(e,t)=>lR(e,r=>{let n=r.head,{state:s}=e,a=s.doc.lineAt(n),i=s.charCategorizer(n);for(let l=null;;){if(n==(t?a.to:a.from)){n==r.head&&a.number!=(t?s.doc.lines:1)&&(n+=t?1:-1);break}let c=gl(a.text,n-a.from,t)+a.from,u=a.text.slice(Math.min(n,c)-a.from,Math.max(n,c)-a.from),d=i(u);if(l!=null&&d!=l)break;(u!=" "||n!=r.head)&&(l=d),n=c}return n}),Hqe=e=>qqe(e,!1),ADt=e=>qqe(e,!0),IDt=e=>lR(e,t=>{let r=e.lineBlockAt(t.head).to;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),RDt=e=>lR(e,t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>r?r:Math.max(0,t.head-1)}),PDt=e=>lR(e,t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),MDt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Ls.of(["",""])},range:at.cursor(n.from)}));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},DDt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let s=n.from,a=e.doc.lineAt(s),i=s==a.from?s-1:gl(a.text,s-a.from,!1)+a.from,l=s==a.to?s+1:gl(a.text,s-a.from,!0)+a.from;return{changes:{from:i,to:l,insert:e.doc.slice(s,l).append(e.doc.slice(i,s))},range:at.cursor(l)}});return r.changes.empty?!1:(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function A6(e){let t=[],r=-1;for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),a=e.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=e.doc.lineAt(n.to-1)),r>=s.number){let i=t[t.length-1];i.to=a.to,i.ranges.push(n)}else t.push({from:s.from,to:a.to,ranges:[n]});r=a.number+1}return t}function Qqe(e,t,r){if(e.readOnly)return!1;let n=[],s=[];for(let a of A6(e)){if(r?a.to==e.doc.length:a.from==0)continue;let i=e.doc.lineAt(r?a.to+1:a.from-1),l=i.length+1;if(r){n.push({from:a.to,to:i.to},{from:a.from,insert:i.text+e.lineBreak});for(let c of a.ranges)s.push(at.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{n.push({from:i.from,to:a.from},{from:a.to,insert:e.lineBreak+i.text});for(let c of a.ranges)s.push(at.range(c.anchor-l,c.head-l))}}return n.length?(t(e.update({changes:n,scrollIntoView:!0,selection:at.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const LDt=({state:e,dispatch:t})=>Qqe(e,t,!1),$Dt=({state:e,dispatch:t})=>Qqe(e,t,!0);function Wqe(e,t,r){if(e.readOnly)return!1;let n=[];for(let a of A6(e))r?n.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):n.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(n);return t(e.update({changes:s,selection:e.selection.map(s,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const FDt=({state:e,dispatch:t})=>Wqe(e,t,!1),zDt=({state:e,dispatch:t})=>Wqe(e,t,!0),BDt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(A6(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),n=uE(t.selection,s=>{let a;if(e.lineWrapping){let i=e.lineBlockAt(s.head),l=e.coordsAtPos(s.head,s.assoc||1);l&&(a=i.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function UDt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=Na(e).resolveInner(t),n=r.childBefore(t),s=r.childAfter(t),a;return n&&s&&n.to<=t&&s.from>=t&&(a=n.type.prop(hn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(n.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const LSe=Gqe(!1),VDt=Gqe(!0);function Gqe(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=t.changeByRange(s=>{let{from:a,to:i}=s,l=t.doc.lineAt(a),c=!e&&a==i&&UDt(t,a);e&&(a=i=(i<=l.to?l:t.doc.lineAt(i)).to);let u=new k6(t,{simulateBreak:a,simulateDoubleBreak:!!c}),d=rle(u,a);for(d==null&&(d=vp(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));i<l.to&&/\s/.test(l.text[i-l.from]);)i++;c?{from:a,to:i}=c:a>l.from&&a<l.from+100&&!/\S/.test(l.text.slice(0,a))&&(a=l.from);let f=["",CN(t,d)];return c&&f.push(CN(t,u.lineIndent(l.from,-1))),{changes:{from:a,to:i,insert:Ls.of(f)},range:at.cursor(a+1+f[1].length)}});return r(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Dle(e,t){let r=-1;return e.changeByRange(n=>{let s=[];for(let i=n.from;i<=n.to;){let l=e.doc.lineAt(i);l.number>r&&(n.empty||n.to>l.from)&&(t(l,s,n),r=l.number),i=l.to+1}let a=e.changes(s);return{changes:s,range:at.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const qDt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new k6(e,{overrideIndentation:a=>{let i=r[a];return i??-1}}),s=Dle(e,(a,i,l)=>{let c=rle(n,a.from);if(c==null)return;/\S/.test(a.text)||(c=0);let u=/^\s*/.exec(a.text)[0],d=CN(e,c);(u!=d||l.from<a.from+u.length)&&(r[a.from]=c,i.push({from:a.from,to:a.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},Zqe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Dle(e,(r,n)=>{n.push({from:r.from,insert:e.facet(oE)})}),{userEvent:"input.indent"})),!0),Yqe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Dle(e,(r,n)=>{let s=/^\s*/.exec(r.text)[0];if(!s)return;let a=vp(s,e.tabSize),i=0,l=CN(e,Math.max(0,a-Vw(e)));for(;i<s.length&&i<l.length&&s.charCodeAt(i)==l.charCodeAt(i);)i++;n.push({from:r.from+i,to:r.from+s.length,insert:l.slice(i)})}),{userEvent:"delete.dedent"})),!0),HDt=e=>(e.setTabFocusMode(),!0),QDt=[{key:"Ctrl-b",run:_qe,shift:Pqe,preventDefault:!0},{key:"Ctrl-f",run:Eqe,shift:Mqe},{key:"Ctrl-p",run:Tqe,shift:$qe},{key:"Ctrl-n",run:Nqe,shift:Fqe},{key:"Ctrl-a",run:dDt,shift:ODt},{key:"Ctrl-e",run:fDt,shift:kDt},{key:"Ctrl-d",run:Vqe},{key:"Ctrl-h",run:mre},{key:"Ctrl-k",run:IDt},{key:"Ctrl-Alt-h",run:Hqe},{key:"Ctrl-o",run:MDt},{key:"Ctrl-t",run:DDt},{key:"Ctrl-v",run:pre}],WDt=[{key:"ArrowLeft",run:_qe,shift:Pqe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:rDt,shift:mDt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:cDt,shift:wDt,preventDefault:!0},{key:"ArrowRight",run:Eqe,shift:Mqe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:nDt,shift:gDt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:uDt,shift:SDt,preventDefault:!0},{key:"ArrowUp",run:Tqe,shift:$qe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:RSe,shift:MSe},{mac:"Ctrl-ArrowUp",run:NSe,shift:ASe},{key:"ArrowDown",run:Nqe,shift:Fqe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:PSe,shift:DSe},{mac:"Ctrl-ArrowDown",run:pre,shift:ISe},{key:"PageUp",run:NSe,shift:ASe},{key:"PageDown",run:pre,shift:ISe},{key:"Home",run:lDt,shift:xDt,preventDefault:!0},{key:"Mod-Home",run:RSe,shift:MSe},{key:"End",run:oDt,shift:bDt,preventDefault:!0},{key:"Mod-End",run:PSe,shift:DSe},{key:"Enter",run:LSe,shift:LSe},{key:"Mod-a",run:_Dt},{key:"Backspace",run:mre,shift:mre,preventDefault:!0},{key:"Delete",run:Vqe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Hqe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:ADt,preventDefault:!0},{mac:"Mod-Backspace",run:RDt,preventDefault:!0},{mac:"Mod-Delete",run:PDt,preventDefault:!0}].concat(QDt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),GDt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:aDt,shift:yDt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:iDt,shift:vDt},{key:"Alt-ArrowUp",run:LDt},{key:"Shift-Alt-ArrowUp",run:FDt},{key:"Alt-ArrowDown",run:$Dt},{key:"Shift-Alt-ArrowDown",run:zDt},{key:"Mod-Alt-ArrowUp",run:jDt},{key:"Mod-Alt-ArrowDown",run:TDt},{key:"Escape",run:NDt},{key:"Mod-Enter",run:VDt},{key:"Alt-l",mac:"Ctrl-l",run:EDt},{key:"Mod-i",run:CDt,preventDefault:!0},{key:"Mod-[",run:Yqe},{key:"Mod-]",run:Zqe},{key:"Mod-Alt-\\",run:qDt},{key:"Shift-Mod-k",run:BDt},{key:"Shift-Mod-\\",run:pDt},{key:"Mod-/",run:LMt},{key:"Alt-A",run:FMt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:HDt}].concat(WDt),ZDt={key:"Tab",run:Zqe,shift:Yqe},$Se=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class By{constructor(t,r,n=0,s=t.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,s),this.bufferStart=n,this.normalize=a?l=>a($Se(l)):$Se,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ku(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=Loe(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Sm(t);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let l=s.charCodeAt(a),c=this.match(l,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(c)return this.value=c,this;break}i==n&&a<r.length&&r.charCodeAt(a)==l&&i++}}}match(t,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],l=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,l=!0)),l||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(By.prototype[Symbol.iterator]=function(){return this});const Xqe={from:-1,to:-1,match:/.*/.exec("")},Lle="gm"+(/x/.unicode==null?"":"u");class Kqe{constructor(t,r,n,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=Xqe,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Jqe(t,r,n,s,a);this.re=new RegExp(r,Lle+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=t.iter();let i=t.lineAt(s);this.curLineStart=i.from,this.matchPos=W$(t,s),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=W$(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const nU=new WeakMap;class gk{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let s=nU.get(t);if(!s||s.from>=n||s.to<=r){let l=new gk(r,t.sliceString(r,n));return nU.set(t,l),l}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=t.sliceString(r,i)+a,i=r),s.to<n&&(a+=t.sliceString(s.to,n)),nU.set(t,new gk(i,a)),new gk(r,a.slice(r-i,n-i))}}class Jqe{constructor(t,r,n,s,a){this.text=t,this.to=a,this.done=!1,this.value=Xqe,this.matchPos=W$(t,s),this.re=new RegExp(r,Lle+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=gk.get(t,s,this.chunkEnd(s+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=W$(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gk.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Kqe.prototype[Symbol.iterator]=Jqe.prototype[Symbol.iterator]=function(){return this});function YDt(e){try{return new RegExp(e,Lle),!0}catch{return!1}}function W$(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}const XDt=e=>{let{state:t}=e,r=String(t.doc.lineAt(e.state.selection.main.head).number),{close:n,result:s}=LNt(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:t.phrase("go")});return s.then(a=>{let i=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!i){e.dispatch({effects:n});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=i,h=d?+d.slice(1):0,p=u?+u:l.number;if(u&&f){let y=p/100;c&&(y=y*(c=="-"?-1:1)+l.number/t.doc.lines),p=Math.round(t.doc.lines*y)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let m=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),g=at.cursor(m.from+Math.max(0,Math.min(h,m.length)));e.dispatch({effects:[n,pt.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},KDt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},JDt=Kt.define({combine(e){return gg(e,KDt,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function e2t(e){return[a2t,s2t]}const t2t=er.mark({class:"cm-selectionMatch"}),r2t=er.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function FSe(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=yi.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=yi.Word)}function n2t(e,t,r,n){return e(t.sliceDoc(r,r+1))==yi.Word&&e(t.sliceDoc(n-1,n))==yi.Word}const s2t=wi.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(JDt),{state:r}=e,n=r.selection;if(n.ranges.length>1)return er.none;let s=n.main,a,i=null;if(s.empty){if(!t.highlightWordAroundCursor)return er.none;let c=r.wordAt(s.head);if(!c)return er.none;i=r.charCategorizer(s.head),a=r.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return er.none;if(t.wholeWords){if(a=r.sliceDoc(s.from,s.to),i=r.charCategorizer(s.head),!(FSe(i,r,s.from,s.to)&&n2t(i,r,s.from,s.to)))return er.none}else if(a=r.sliceDoc(s.from,s.to),!a)return er.none}let l=[];for(let c of e.visibleRanges){let u=new By(r.doc,a,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||FSe(i,r,d,f))&&(s.empty&&d<=s.from&&f>=s.to?l.push(r2t.range(d,f)):(d>=s.to||f<=s.from)&&l.push(t2t.range(d,f)),l.length>t.maxMatches))return er.none}}return er.set(l)}},{decorations:e=>e.decorations}),a2t=pt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),i2t=({state:e,dispatch:t})=>{let{selection:r}=e,n=at.create(r.ranges.map(s=>e.wordAt(s.head)||at.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function o2t(e,t){let{main:r,ranges:n}=e.selection,s=e.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,l=new By(e.doc,t,n[n.length-1].to);;)if(l.next(),l.done){if(i)return null;l=new By(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(c=>c.from==l.value.from))continue;if(a){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const l2t=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(a=>a.from===a.to))return i2t({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=n))return!1;let s=o2t(e,n);return s?(t(e.update({selection:e.selection.addRange(at.range(s.from,s.to),!1),effects:pt.scrollIntoView(s.to)})),!0):!1},dE=Kt.define({combine(e){return gg(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new S2t(t),scrollToMatch:t=>pt.scrollIntoView(t)})}});class eHe{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||YDt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
39
+ }`,{label:"class",detail:"definition",type:"keyword"}),bu('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),bu('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],$Ve=kle.concat([bu("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),bu("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),bu("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),SSe=new $Be,FVe=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function XC(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}const lMt=["FunctionDeclaration"],cMt={FunctionDeclaration:XC("function"),ClassDeclaration:XC("class"),ClassExpression:()=>!0,EnumDeclaration:XC("constant"),TypeAliasDeclaration:XC("type"),NamespaceDeclaration:XC("namespace"),VariableDefinition(e,t){e.matchContext(lMt)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function zVe(e,t){let r=SSe.get(t);if(r)return r;let n=[],s=!0;function a(i,l){let c=e.sliceString(i.from,i.to);n.push({label:c,type:l})}return t.cursor(Js.IncludeAnonymous).iterate(i=>{if(s)s=!1;else if(i.name){let l=cMt[i.name];if(l&&l(i,a)||FVe.has(i.name))return!1}else if(i.to-i.from>8192){for(let l of zVe(e,i.node))n.push(l);return!1}}),SSe.set(t,n),n}const q$=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,_le=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function BVe(e){let t=Na(e.state).resolveInner(e.pos,-1);if(_le.indexOf(t.name)>-1)return null;let r=t.name=="VariableName"||t.to-t.from<20&&q$.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let s=t;s;s=s.parent)FVe.has(s.name)&&(n=n.concat(zVe(e.state.doc,s)));return{options:n,from:r?t.from:e.pos,validFor:q$}}function Z7(e,t,r){var n;let s=[];for(;;){let a=t.firstChild,i;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:r};if(a?.name=="MemberExpression"&&((n=i=a.lastChild)===null||n===void 0?void 0:n.name)=="PropertyName")s.push(e(i)),t=a;else return null}}function UVe(e){let t=n=>e.state.doc.sliceString(n.from,n.to),r=Na(e.state).resolveInner(e.pos,-1);return r.name=="PropertyName"?Z7(t,r.parent,t(r)):(r.name=="."||r.name=="?.")&&r.parent.name=="MemberExpression"?Z7(t,r.parent,""):_le.indexOf(r.name)>-1?null:r.name=="VariableName"||r.to-r.from<20&&q$.test(t(r))?{path:[],name:t(r)}:r.name=="MemberExpression"?Z7(t,r,""):e.explicit?{path:[],name:""}:null}function uMt(e,t){let r=e,n=[],s=new Set;for(let a=0;;a++){for(let l of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(l)||s.has(l))continue;s.add(l);let c;try{c=r[l]}catch{continue}n.push({label:l,type:typeof c=="function"?/^[A-Z]/.test(l)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let i=Object.getPrototypeOf(e);if(!i)return n;e=i}}function dMt(e){let t=new Map;return r=>{let n=UVe(r);if(!n)return null;let s=e;for(let i of n.path)if(s=s[i],!s)return null;let a=t.get(s);return a||t.set(s,a=uMt(s,!n.path.length)),{from:r.pos-n.name.length,options:a,validFor:q$}}}const ch=zw.define({name:"javascript",parser:oMt.configure({props:[BS.add({IfStatement:pk({except:/^\s*({|else\b)/}),TryStatement:pk({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:oAt,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:iAt({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":pk({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),US.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":sle,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let r=e.lastChild;return{from:t.to,to:r.type.isError?e.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let r=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,n=e.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),VVe={test:e=>/^JSX/.test(e.name),facet:O6({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Ele=ch.configure({dialect:"ts"},"typescript"),Cle=ch.configure({dialect:"jsx",props:[tle.add(e=>e.isTop?[VVe]:void 0)]}),jle=ch.configure({dialect:"jsx ts",props:[tle.add(e=>e.isTop?[VVe]:void 0)]},"typescript");let qVe=e=>({label:e,type:"keyword"});const HVe="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(qVe),fMt=HVe.concat(["declare","implements","private","protected","public"].map(qVe));function H$(e={}){let t=e.jsx?e.typescript?jle:Cle:e.typescript?Ele:ch,r=e.typescript?$Ve.concat(fMt):kle.concat(HVe);return new Uw(t,[ch.data.of({autocomplete:QAt(_le,zUe(r))}),ch.data.of({autocomplete:BVe}),e.jsx?QVe:[]])}function hMt(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function OSe(e,t,r=e.length){for(let n=t?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return e.sliceString(n.from,Math.min(n.to,r));return""}const pMt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),QVe=pt.inputHandler.of((e,t,r,n,s)=>{if((pMt?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||n!=">"&&n!="/"||!ch.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,l=i.changeByRange(c=>{var u;let{head:d}=c,f=Na(i).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(i.doc.sliceString(d-1,d)!=n||f.name=="JSXAttributeValue"&&f.to>d)){if(n==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(n=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,m=p.parent;if(m&&p.from==d-2&&((h=OSe(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:at.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(n==">"){let p=hMt(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(h=OSe(i.doc,p,d)))return{range:c,changes:{from:d,insert:`</${h}>`}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([a,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function mMt(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach((r,n)=>{var s;!((s=r.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[n]=2)})),r=>{let{state:n}=r,s=[];for(let{from:a,to:i}of ch.findRegions(n)){let l=n.doc.lineAt(a),c={line:l.number-1,col:a-l.from,pos:a};for(let u of e.verify(n.sliceDoc(a,i),t))s.push(gMt(u,n.doc,c))}return s}}function kSe(e,t,r,n){return r.line(e+n.line).from+t+(e==1?n.col-1:-1)}function gMt(e,t,r){let n=kSe(e.line,e.column,t,r),s={from:n,to:e.endLine!=null&&e.endColumn!=1?kSe(e.endLine,e.endColumn,t,r):n,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:a,text:i}=e.fix,l=a[0]+r.pos-n,c=a[1]+r.pos-n;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+l,to:d+c,insert:i},scrollIntoView:!0})}}]}return s}const kD=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:QVe,completionPath:UVe,esLint:mMt,javascript:H$,javascriptLanguage:ch,jsxLanguage:Cle,localCompletionSource:BVe,scopeCompletionSource:dMt,snippets:kle,tsxLanguage:jle,typescriptLanguage:Ele,typescriptSnippets:$Ve},Symbol.toStringTag,{value:"Module"})),KC=["_blank","_self","_top","_parent"],Y7=["ascii","utf-8","utf-16","latin1","latin1"],X7=["get","post","put","delete"],K7=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],gd=["true","false"],Dr={},yMt={a:{attrs:{href:null,ping:null,type:null,media:null,target:KC,hreflang:null}},abbr:Dr,address:Dr,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Dr,aside:Dr,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Dr,base:{attrs:{href:null,target:KC}},bdi:Dr,bdo:Dr,blockquote:{attrs:{cite:null}},body:Dr,br:Dr,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:K7,formmethod:X7,formnovalidate:["novalidate"],formtarget:KC,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Dr,center:Dr,cite:Dr,code:Dr,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Dr,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Dr,div:Dr,dl:Dr,dt:Dr,em:Dr,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Dr,figure:Dr,footer:Dr,form:{attrs:{action:null,name:null,"accept-charset":Y7,autocomplete:["on","off"],enctype:K7,method:X7,novalidate:["novalidate"],target:KC}},h1:Dr,h2:Dr,h3:Dr,h4:Dr,h5:Dr,h6:Dr,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Dr,hgroup:Dr,hr:Dr,html:{attrs:{manifest:null}},i:Dr,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:K7,formmethod:X7,formnovalidate:["novalidate"],formtarget:KC,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Dr,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Dr,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Dr,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Y7,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Dr,noscript:Dr,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Dr,param:{attrs:{name:null,value:null}},pre:Dr,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Dr,rt:Dr,ruby:Dr,samp:Dr,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Y7}},section:Dr,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Dr,source:{attrs:{src:null,type:null,media:null}},span:Dr,strong:Dr,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Dr,summary:Dr,sup:Dr,table:Dr,tbody:Dr,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Dr,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Dr,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Dr,time:{attrs:{datetime:null}},title:Dr,tr:Dr,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Dr,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Dr},WVe={accesskey:null,class:null,contenteditable:gd,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:gd,autocorrect:gd,autocapitalize:gd,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":gd,"aria-autocomplete":["inline","list","both","none"],"aria-busy":gd,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":gd,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":gd,"aria-hidden":gd,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":gd,"aria-multiselectable":gd,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":gd,"aria-relevant":null,"aria-required":gd,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},GVe="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of GVe)WVe[e]=null;let DN=class{constructor(t,r){this.tags={...yMt,...t},this.globalAttrs={...WVe,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};DN.default=new DN;function Yk(e,t,r=e.length){if(!t)return"";let n=t.firstChild,s=n&&n.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,r)):""}function Xk(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function ZVe(e,t,r){let n=r.tags[Yk(e,Xk(t))];return n?.children||r.allTags}function Tle(e,t){let r=[];for(let n=Xk(t);n&&!n.type.isTop;n=Xk(n.parent)){let s=Yk(e,n);if(s&&n.lastChild.name=="CloseTag")break;s&&r.indexOf(s)<0&&(t.name=="EndTag"||t.from>=n.firstChild.to)&&r.push(s)}return r}const YVe=/^[:\-\.\w\u00b7-\uffff]*$/;function _Se(e,t,r,n,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",i=Xk(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:s,options:ZVe(e.doc,i,t).map(l=>({label:l,type:"type"})).concat(Tle(e.doc,r).map((l,c)=>({label:"/"+l,apply:"/"+l+a,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function ESe(e,t,r,n){let s=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:Tle(e.doc,t).map((a,i)=>({label:a,apply:a+s,type:"type",boost:99-i})),validFor:YVe}}function vMt(e,t,r,n){let s=[],a=0;for(let i of ZVe(e.doc,r,t))s.push({label:"<"+i,type:"type"});for(let i of Tle(e.doc,r))s.push({label:"</"+i+">",type:"type",boost:99-a++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function bMt(e,t,r,n,s){let a=Xk(r),i=a?t.tags[Yk(e.doc,a)]:null,l=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:n,to:s,options:c.map(u=>({label:u,type:"property"})),validFor:YVe}}function xMt(e,t,r,n,s){var a;let i=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),l=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=Xk(r),h=f?t.tags[Yk(e.doc,f)]:null;d=h?.attrs&&h.attrs[u]}if(d){let f=e.sliceDoc(n,s).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(s,s+1)==f[0]?"":f[0],f=f.slice(1),n++):c=/^[^\s<>='"]*$/;for(let m of d)l.push({label:m,apply:h+m+p,type:"constant"})}}return{from:n,to:s,options:l,validFor:c}}function XVe(e,t){let{state:r,pos:n}=t,s=Na(r).resolveInner(n,-1),a=s.resolve(n);for(let i=n,l;a==s&&(l=s.childBefore(i));){let c=l.lastChild;if(!c||!c.type.isError||c.from<c.to)break;a=s=l,i=c.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?ESe(r,s,s.from,n):_Se(r,e,s,s.from,n):s.name=="StartTag"||s.name=="IncompleteTag"?_Se(r,e,s,n,n):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?ESe(r,s,n,n):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?bMt(r,e,s,s.name=="AttributeName"?s.from:n,n):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?xMt(r,e,s,s.name=="Is"?n:s.from,n):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?vMt(r,e,s,n):null}function KVe(e){return XVe(DN.default,e)}function JVe(e){let{extraTags:t,extraGlobalAttributes:r}=e,n=r||t?new DN(t,r):DN.default;return s=>XVe(n,s)}const wMt=ch.parser.configure({top:"SingleExpression"}),eqe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Ele.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Cle.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:jle.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:wMt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:ch.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:MN.parser}],tqe=[{name:"style",parser:MN.parser.configure({top:"Styles"})}].concat(GVe.map(e=>({name:e,parser:ch.parser}))),rqe=zw.define({name:"html",parser:YRt.configure({props:[BS.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,r;for(let n=e.node;;){let s=n.lastChild;if(!s||s.name!="Element"||s.to!=n.to)break;t=n=s}return t&&!((r=t.lastChild)&&(r.name=="CloseTag"||r.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),US.add({Element(e){let t=e.firstChild,r=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:r.name=="CloseTag"?r.from:e.to}}}),RUe.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),zT=rqe.configure({wrap:jVe(eqe,tqe)});function nqe(e={}){let t="",r;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(r=jVe((e.nestedLanguages||[]).concat(eqe),(e.nestedAttributes||[]).concat(tqe)));let n=r?rqe.configure({wrap:r,dialect:t}):t?zT.configure({dialect:t}):zT;return new Uw(n,[zT.data.of({autocomplete:JVe(e)}),e.autoCloseTags!==!1?sqe:[],H$().support,DVe().support])}const CSe=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),sqe=pt.inputHandler.of((e,t,r,n,s)=>{if(e.composing||e.state.readOnly||t!=r||n!=">"&&n!="/"||!zT.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,l=i.changeByRange(c=>{var u,d,f;let h=i.doc.sliceString(c.from-1,c.to)==n,{head:p}=c,m=Na(i).resolveInner(p,-1),g;if(h&&n==">"&&m.name=="EndTag"){let y=m.parent;if(((d=(u=y.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=Yk(i.doc,y.parent,p))&&!CSe.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:p,to:x,insert:w}}}}else if(h&&n=="/"&&m.name=="IncompleteCloseTag"){let y=m.parent;if(m.from==p-2&&((f=y.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=Yk(i.doc,y,p))&&!CSe.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`${g}>`;return{range:at.cursor(p+w.length,-1),changes:{from:p,to:x,insert:w}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([a,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),SMt=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:sqe,html:nqe,htmlCompletionSource:KVe,htmlCompletionSourceWith:JVe,htmlLanguage:zT},Symbol.toStringTag,{value:"Module"})),aqe=O6({commentTokens:{block:{open:"<!--",close:"-->"}}}),iqe=new hn,oqe=KIt.configure({props:[US.add(e=>!e.is("Block")||e.is("Document")||dre(e)!=null||OMt(e)?void 0:(t,r)=>({from:r.doc.lineAt(t.from).to,to:t.to})),iqe.add(dre),BS.add({Document:()=>null}),Pb.add({Document:aqe})]});function dre(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function OMt(e){return e.name=="OrderedList"||e.name=="BulletList"}function kMt(e,t){let r=e;for(;;){let n=r.nextSibling,s;if(!n||(s=dre(n.type))!=null&&s<=t)break;r=n}return r.to}const _Mt=wUe.of((e,t,r)=>{for(let n=Na(e).resolveInner(r,-1);n&&!(n.from<t);n=n.parent){let s=n.type.prop(iqe);if(s==null)continue;let a=kMt(n,s);if(a>r)return{from:r,to:a}}return null});function Nle(e){return new Dd(aqe,e,[],"markdown")}const lqe=Nle(oqe),EMt=oqe.configure([cRt,dRt,uRt,fRt,{props:[US.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),Hw=Nle(EMt);function CMt(e,t){return r=>{if(r&&e){let n=null;if(r=/\S*/.exec(r)[0],typeof e=="function"?n=e(r):n=Ke.matchLanguageName(e,r,!0),n instanceof Ke)return n.support?n.support.language.parser:Bw.getSkippingParser(n.load());if(n)return n.parser}return t?t.parser:null}}class J7{constructor(t,r,n,s,a,i,l){this.node=t,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=a,this.type=i,this.item=l}blank(t,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;n.length<t;)n+=" ";return n}else{for(let s=this.to-this.from-n.length-this.spaceAfter.length;s>0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(t,r){let n=this.node.name=="OrderedList"?String(+uqe(this.item,t)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function cqe(e,t){let r=[],n=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let a=r[s],i,l=t.lineAt(a.from),c=a.from-l.from;if(a.name=="Blockquote"&&(i=/^ *>( ?)/.exec(l.text.slice(c))))n.push(new J7(a,c,c+i[0].length,"",i[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),n.push(new J7(a.parent,c,c+d,i[1],u,i[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=i[4],d=i[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=i[2];i[3]&&(f+=i[3].replace(/[xX]/," ")),n.push(new J7(a.parent,c,c+d,i[1],u,f,a))}}return n}function uqe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function eU(e,t,r,n=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let l=uqe(a,t),c=+l[2];if(s>=0){if(c!=s+1)return;r.push({from:a.from+l[1].length,to:a.from+l[0].length,insert:String(s+2+n)})}s=c}let i=a.nextSibling;if(!i)break;a=i}}function Ale(e,t){let r=/^[ \t]*/.exec(e)[0].length;if(!r||t.facet(oE)!=" ")return e;let n=vp(e,4,r),s="";for(let a=n;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(r)}const dqe=(e={})=>({state:t,dispatch:r})=>{let n=Na(t),{doc:s}=t,a=null,i=t.changeByRange(l=>{if(!l.empty||!Hw.isActiveAt(t,l.from,-1)&&!Hw.isActiveAt(t,l.from,1))return a={range:l};let c=l.from,u=s.lineAt(c),d=cqe(n.resolveInner(c,-1),s);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return a={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return a={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||e.nonTightLists===!1){let O=d.length>1?d[d.length-2]:null,k,_="";O&&O.item?(k=u.from+O.from,_=O.marker(s,1)):k=u.from+(O?O.to:0);let E=[{from:k,to:c,insert:_}];return f.node.name=="OrderedList"&&eU(f.item,s,E,-2),O&&O.node.name=="OrderedList"&&eU(O.item,s,E),{range:at.cursor(k+_.length),changes:E}}else{let O=TSe(d,t,u);return{range:at.cursor(c+O.length+1),changes:{from:u.from,insert:O+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let x=s.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let O=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(O),changes:O}}}let p=[];f.node.name=="OrderedList"&&eU(f.item,s,p);let m=f.item&&f.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let x=0,w=d.length-1;x<=w;x++)g+=x==w&&!m?d[x].marker(s,1):d[x].blank(x<w?vp(u.text,4,d[x+1].from)-g.length:null);let y=c;for(;y>u.from&&/\s/.test(u.text.charAt(y-u.from-1));)y--;return g=Ale(g,t),jMt(f.node,t.doc)&&(g=TSe(d,t,u)+t.lineBreak+g),p.push({from:y,to:c,insert:t.lineBreak+g}),{range:at.cursor(y+g.length+1),changes:p}});return a?!1:(r(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},fqe=dqe();function jSe(e){return e.name=="QuoteMark"||e.name=="ListMark"}function jMt(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let r=e.firstChild,n=e.getChild("ListItem","ListItem");if(!n)return!1;let s=t.lineAt(r.to),a=t.lineAt(n.from),i=/^[\s>]*$/.test(s.text);return s.number+(i?0:1)<a.number}function TSe(e,t,r){let n="";for(let s=0,a=e.length-2;s<=a;s++)n+=e[s].blank(s<a?vp(r.text,4,e[s+1].from)-n.length:null,s<a);return Ale(n,t)}function TMt(e,t){let r=e.resolveInner(t,-1),n=t;jSe(r)&&(n=r.from,r=r.parent);for(let s;s=r.childBefore(n);)if(jSe(s))n=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")r=s.lastChild,n=r.to;else break;return r}const hqe=({state:e,dispatch:t})=>{let r=Na(e),n=null,s=e.changeByRange(a=>{let i=a.from,{doc:l}=e;if(a.empty&&Hw.isActiveAt(e,a.from)){let c=l.lineAt(i),u=cqe(TMt(r,i),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(i-c.from>f&&!/\S/.test(c.text.slice(f,i-c.from)))return{range:at.cursor(c.from+f),changes:{from:c.from+f,to:i}};if(i-c.from==f&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let p=d.blank(vp(c.text,4,d.to)-vp(c.text,4,d.from));return h==c.from&&(p=Ale(p,e)),{range:at.cursor(h+p.length),changes:{from:h,to:c.from+d.to,insert:p}}}if(h<i)return{range:at.cursor(h),changes:{from:h,to:i}}}}}return n={range:a}});return n?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},pqe=[{key:"Enter",run:fqe},{key:"Backspace",run:hqe}],mqe=nqe({matchClosingTags:!1});function Ile(e={}){let{codeLanguages:t,defaultCodeLanguage:r,addKeymap:n=!0,base:{parser:s}=lqe,completeHTMLTags:a=!0,pasteURLAsLink:i=!0,htmlTagLanguage:l=mqe}=e;if(!(s instanceof C6))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[l.support,_Mt],d;i&&u.push(gqe),r instanceof Uw?(u.push(r.support),d=r.language):r&&(d=r);let f=t||d?CMt(t,d):void 0;c.push(eRt({codeParser:f,htmlParser:l.language.parser})),n&&u.push(Np.high(iE.of(pqe)));let h=Nle(s.configure(c));return a&&u.push(h.data.of({autocomplete:NMt})),new Uw(h,u)}function NMt(e){let{state:t,pos:r}=e,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(r-25,r));if(!n)return null;let s=Na(t).resolveInner(r,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:r-n[0].length,to:r,options:AMt(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let tU=null;function AMt(){if(tU)return tU;let e=KVe(new lle(Dn.create({extensions:mqe}),0,!0));return tU=e?e.options:[]}const IMt=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,gqe=pt.domEventHandlers({paste:(e,t)=>{var r;let{main:n}=t.state.selection;if(n.empty)return!1;let s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!Hw.isActiveAt(t.state,n.from,1)))return!1;let a=Na(t.state),i=!1;return a.iterate({from:n.from,to:n.to,enter:l=>{(l.from>n.from||IMt.test(l.name))&&(i=!0)},leave:l=>{l.to<n.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),RMt=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:lqe,deleteMarkupBackward:hqe,insertNewlineContinueMarkup:fqe,insertNewlineContinueMarkupCommand:dqe,markdown:Ile,markdownKeymap:pqe,markdownLanguage:Hw,pasteURLAsLink:gqe},Symbol.toStringTag,{value:"Module"}));function gt(e){return new Uw(ale.define(e))}function sb(e){return Je(()=>import("./index-D1R-1J11.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const yqe=[Ke.of({name:"C",extensions:["c","h","ino"],load(){return Je(()=>import("./index-DF8sZyT3.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Ke.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Je(()=>import("./index-DF8sZyT3.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),Ke.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return sb("Cassandra")}}),Ke.of({name:"CSS",extensions:["css"],load(){return Je(()=>Promise.resolve().then(()=>NPt),void 0,import.meta.url).then(e=>e.css())}}),Ke.of({name:"Go",extensions:["go"],load(){return Je(()=>import("./index-CgwEUdg9.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),Ke.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Je(()=>Promise.resolve().then(()=>SMt),void 0,import.meta.url).then(e=>e.html())}}),Ke.of({name:"Java",extensions:["java"],load(){return Je(()=>import("./index-B5PAtxPT.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),Ke.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Je(()=>Promise.resolve().then(()=>kD),void 0,import.meta.url).then(e=>e.javascript())}}),Ke.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return Je(()=>import("./index-K85mMP2E.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),Ke.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Je(()=>Promise.resolve().then(()=>qAt),void 0,import.meta.url).then(e=>e.json())}}),Ke.of({name:"JSX",extensions:["jsx"],load(){return Je(()=>Promise.resolve().then(()=>kD),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ke.of({name:"LESS",extensions:["less"],load(){return Je(()=>import("./index-yPO2K_eT.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),Ke.of({name:"Liquid",extensions:["liquid"],load(){return Je(()=>import("./index-DrTChucN.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),Ke.of({name:"MariaDB SQL",load(){return sb("MariaSQL")}}),Ke.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Je(()=>Promise.resolve().then(()=>RMt),void 0,import.meta.url).then(e=>e.markdown())}}),Ke.of({name:"MS SQL",load(){return sb("MSSQL")}}),Ke.of({name:"MySQL",load(){return sb("MySQL")}}),Ke.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Je(()=>import("./index-BmPZ_zWk.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),Ke.of({name:"PLSQL",extensions:["pls"],load(){return sb("PLSQL")}}),Ke.of({name:"PostgreSQL",load(){return sb("PostgreSQL")}}),Ke.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Je(()=>import("./index-CRz_xx1Z.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),Ke.of({name:"Rust",extensions:["rs"],load(){return Je(()=>import("./index-EfF4JP3x.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),Ke.of({name:"Sass",extensions:["sass"],load(){return Je(()=>import("./index-CQXkvECs.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Ke.of({name:"SCSS",extensions:["scss"],load(){return Je(()=>import("./index-CQXkvECs.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),Ke.of({name:"SQL",extensions:["sql"],load(){return sb("StandardSQL")}}),Ke.of({name:"SQLite",load(){return sb("SQLite")}}),Ke.of({name:"TSX",extensions:["tsx"],load(){return Je(()=>Promise.resolve().then(()=>kD),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ke.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Je(()=>Promise.resolve().then(()=>kD),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ke.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Je(()=>import("./index-B7OTmqoV.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),Ke.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Je(()=>import("./index-C3usKBTd.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),Ke.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Je(()=>import("./index-CAvqPacZ.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),Ke.of({name:"APL",extensions:["dyalog","apl"],load(){return Je(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>gt(e.apl))}}),Ke.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Je(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>gt(e.asciiArmor))}}),Ke.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Je(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>gt(e.asn1({})))}}),Ke.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Je(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>gt(e.asterisk))}}),Ke.of({name:"Brainfuck",extensions:["b","bf"],load(){return Je(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>gt(e.brainfuck))}}),Ke.of({name:"Cobol",extensions:["cob","cpy"],load(){return Je(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>gt(e.cobol))}}),Ke.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.csharp))}}),Ke.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"ClojureScript",extensions:["cljs"],load(){return Je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Je(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>gt(e.gss))}}),Ke.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Je(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>gt(e.cmake))}}),Ke.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Je(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>gt(e.coffeeScript))}}),Ke.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Je(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>gt(e.commonLisp))}}),Ke.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Je(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>gt(e.cypher))}}),Ke.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Je(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>gt(e.cython))}}),Ke.of({name:"Crystal",extensions:["cr"],load(){return Je(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>gt(e.crystal))}}),Ke.of({name:"D",extensions:["d"],load(){return Je(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>gt(e.d))}}),Ke.of({name:"Dart",extensions:["dart"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.dart))}}),Ke.of({name:"diff",extensions:["diff","patch"],load(){return Je(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>gt(e.diff))}}),Ke.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Je(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>gt(e.dockerFile))}}),Ke.of({name:"DTD",extensions:["dtd"],load(){return Je(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>gt(e.dtd))}}),Ke.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Je(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>gt(e.dylan))}}),Ke.of({name:"EBNF",load(){return Je(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>gt(e.ebnf))}}),Ke.of({name:"ECL",extensions:["ecl"],load(){return Je(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>gt(e.ecl))}}),Ke.of({name:"edn",extensions:["edn"],load(){return Je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"Eiffel",extensions:["e"],load(){return Je(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>gt(e.eiffel))}}),Ke.of({name:"Elm",extensions:["elm"],load(){return Je(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>gt(e.elm))}}),Ke.of({name:"Erlang",extensions:["erl"],load(){return Je(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>gt(e.erlang))}}),Ke.of({name:"Esper",load(){return Je(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>gt(e.esper))}}),Ke.of({name:"Factor",extensions:["factor"],load(){return Je(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>gt(e.factor))}}),Ke.of({name:"FCL",load(){return Je(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>gt(e.fcl))}}),Ke.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Je(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>gt(e.forth))}}),Ke.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Je(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>gt(e.fortran))}}),Ke.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Je(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.fSharp))}}),Ke.of({name:"Gas",extensions:["s"],load(){return Je(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>gt(e.gas))}}),Ke.of({name:"Gherkin",extensions:["feature"],load(){return Je(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>gt(e.gherkin))}}),Ke.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Je(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>gt(e.groovy))}}),Ke.of({name:"Haskell",extensions:["hs"],load(){return Je(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>gt(e.haskell))}}),Ke.of({name:"Haxe",extensions:["hx"],load(){return Je(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>gt(e.haxe))}}),Ke.of({name:"HXML",extensions:["hxml"],load(){return Je(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>gt(e.hxml))}}),Ke.of({name:"HTTP",load(){return Je(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>gt(e.http))}}),Ke.of({name:"IDL",extensions:["pro"],load(){return Je(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>gt(e.idl))}}),Ke.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Je(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>gt(e.jsonld))}}),Ke.of({name:"Julia",extensions:["jl"],load(){return Je(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>gt(e.julia))}}),Ke.of({name:"Kotlin",extensions:["kt","kts"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.kotlin))}}),Ke.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Je(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>gt(e.liveScript))}}),Ke.of({name:"Lua",extensions:["lua"],load(){return Je(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>gt(e.lua))}}),Ke.of({name:"mIRC",extensions:["mrc"],load(){return Je(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>gt(e.mirc))}}),Ke.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Je(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>gt(e.mathematica))}}),Ke.of({name:"Modelica",extensions:["mo"],load(){return Je(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>gt(e.modelica))}}),Ke.of({name:"MUMPS",extensions:["mps"],load(){return Je(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>gt(e.mumps))}}),Ke.of({name:"Mbox",extensions:["mbox"],load(){return Je(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>gt(e.mbox))}}),Ke.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Je(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>gt(e.nginx))}}),Ke.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Je(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>gt(e.nsis))}}),Ke.of({name:"NTriples",extensions:["nt","nq"],load(){return Je(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>gt(e.ntriples))}}),Ke.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.objectiveC))}}),Ke.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.objectiveCpp))}}),Ke.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Je(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.oCaml))}}),Ke.of({name:"Octave",extensions:["m"],load(){return Je(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>gt(e.octave))}}),Ke.of({name:"Oz",extensions:["oz"],load(){return Je(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>gt(e.oz))}}),Ke.of({name:"Pascal",extensions:["p","pas"],load(){return Je(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>gt(e.pascal))}}),Ke.of({name:"Perl",extensions:["pl","pm"],load(){return Je(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>gt(e.perl))}}),Ke.of({name:"Pig",extensions:["pig"],load(){return Je(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>gt(e.pig))}}),Ke.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Je(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>gt(e.powerShell))}}),Ke.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Je(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>gt(e.properties))}}),Ke.of({name:"ProtoBuf",extensions:["proto"],load(){return Je(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>gt(e.protobuf))}}),Ke.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Je(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>gt(e.pug))}}),Ke.of({name:"Puppet",extensions:["pp"],load(){return Je(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>gt(e.puppet))}}),Ke.of({name:"Q",extensions:["q"],load(){return Je(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>gt(e.q))}}),Ke.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Je(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>gt(e.r))}}),Ke.of({name:"RPM Changes",load(){return Je(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>gt(e.rpmChanges))}}),Ke.of({name:"RPM Spec",extensions:["spec"],load(){return Je(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>gt(e.rpmSpec))}}),Ke.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Je(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>gt(e.ruby))}}),Ke.of({name:"SAS",extensions:["sas"],load(){return Je(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>gt(e.sas))}}),Ke.of({name:"Scala",extensions:["scala"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.scala))}}),Ke.of({name:"Scheme",extensions:["scm","ss"],load(){return Je(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>gt(e.scheme))}}),Ke.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Je(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>gt(e.shell))}}),Ke.of({name:"Sieve",extensions:["siv","sieve"],load(){return Je(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>gt(e.sieve))}}),Ke.of({name:"Smalltalk",extensions:["st"],load(){return Je(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>gt(e.smalltalk))}}),Ke.of({name:"Solr",load(){return Je(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>gt(e.solr))}}),Ke.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Je(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.sml))}}),Ke.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Je(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>gt(e.sparql))}}),Ke.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Je(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>gt(e.spreadsheet))}}),Ke.of({name:"Squirrel",extensions:["nut"],load(){return Je(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.squirrel))}}),Ke.of({name:"Stylus",extensions:["styl"],load(){return Je(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>gt(e.stylus))}}),Ke.of({name:"Swift",extensions:["swift"],load(){return Je(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>gt(e.swift))}}),Ke.of({name:"sTeX",load(){return Je(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>gt(e.stex))}}),Ke.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Je(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>gt(e.stex))}}),Ke.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Je(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>gt(e.verilog))}}),Ke.of({name:"Tcl",extensions:["tcl"],load(){return Je(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>gt(e.tcl))}}),Ke.of({name:"Textile",extensions:["textile"],load(){return Je(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>gt(e.textile))}}),Ke.of({name:"TiddlyWiki",load(){return Je(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>gt(e.tiddlyWiki))}}),Ke.of({name:"Tiki wiki",load(){return Je(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>gt(e.tiki))}}),Ke.of({name:"TOML",extensions:["toml"],load(){return Je(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>gt(e.toml))}}),Ke.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Je(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>gt(e.troff))}}),Ke.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Je(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>gt(e.ttcn))}}),Ke.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Je(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>gt(e.ttcnCfg))}}),Ke.of({name:"Turtle",extensions:["ttl"],load(){return Je(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>gt(e.turtle))}}),Ke.of({name:"Web IDL",extensions:["webidl"],load(){return Je(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>gt(e.webIDL))}}),Ke.of({name:"VB.NET",extensions:["vb"],load(){return Je(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>gt(e.vb))}}),Ke.of({name:"VBScript",extensions:["vbs"],load(){return Je(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>gt(e.vbScript))}}),Ke.of({name:"Velocity",extensions:["vtl"],load(){return Je(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>gt(e.velocity))}}),Ke.of({name:"Verilog",extensions:["v"],load(){return Je(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>gt(e.verilog))}}),Ke.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Je(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>gt(e.vhdl))}}),Ke.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return Je(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>gt(e.xQuery))}}),Ke.of({name:"Yacas",extensions:["ys"],load(){return Je(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>gt(e.yacas))}}),Ke.of({name:"Z80",extensions:["z80"],load(){return Je(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>gt(e.z80))}}),Ke.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Je(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.mscgen))}}),Ke.of({name:"Xù",extensions:["xu"],load(){return Je(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.xu))}}),Ke.of({name:"MsGenny",extensions:["msgenny"],load(){return Je(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.msgenny))}}),Ke.of({name:"Vue",extensions:["vue"],load(){return Je(()=>import("./index-kVoJdgA9.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),Ke.of({name:"Angular Template",load(){return Je(()=>import("./index-CKRnXuZA.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];function px(){return px=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},px.apply(null,arguments)}var PMt=e=>{var{theme:t,settings:r={},styles:n=[]}=e,s={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),r.fontSize&&(a.fontSize=r.fontSize),(r.background||r.foreground)&&(s["&"]=a),r.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(s[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(s[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(s[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(s[".cm-content"]={caretColor:r.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var i={};r.gutterActiveForeground&&(i.color=r.gutterActiveForeground),r.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:r.lineHighlight},i.backgroundColor=r.lineHighlight),s[".cm-activeLineGutter"]=i,r.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var l=pt.theme(s,{dark:t==="dark"}),c=Ap.define(n),u=[l,Fx(c)];return u},MMt={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},DMt=[{tag:ne.comment,color:"#6272a4"},{tag:ne.string,color:"#f1fa8c"},{tag:ne.atom,color:"#bd93f9"},{tag:ne.meta,color:"#f8f8f2"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"#ff79c6"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"#66d9ef"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"#50fa7b"},{tag:ne.atom,color:"#bd93f9"}],cE=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return PMt({theme:t,settings:px({},MMt,r),styles:[...DMt,...n]})};cE();function Rle(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const LMt=e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=Mle(e.state,r.from);return n.line?$Mt(e):n.block?zMt(e):!1};function Ple(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let s=e(t,r);return s?(n(r.update(s)),!0):!1}}const $Mt=Ple(VMt,0),FMt=Ple(vqe,0),zMt=Ple((e,t)=>vqe(e,t,UMt(t)),0);function Mle(e,t){let r=e.languageDataAt("commentTokens",t,1);return r.length?r[0]:{}}const JC=50;function BMt(e,{open:t,close:r},n,s){let a=e.sliceDoc(n-JC,n),i=e.sliceDoc(s,s+JC),l=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(i)[0].length,u=a.length-l;if(a.slice(u-t.length,u)==t&&i.slice(c,c+r.length)==r)return{open:{pos:n-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let d,f;s-n<=2*JC?d=f=e.sliceDoc(n,s):(d=e.sliceDoc(n,n+JC),f=e.sliceDoc(s-JC,s));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-r.length;return d.slice(h,h+t.length)==t&&f.slice(m,m+r.length)==r?{open:{pos:n+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:s-p-r.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function UMt(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),s=r.to<=n.to?n:e.doc.lineAt(r.to);s.from>n.from&&s.from==r.to&&(s=r.to==n.to+1?n:e.doc.lineAt(r.to-1));let a=t.length-1;a>=0&&t[a].to>n.from?t[a].to=s.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return t}function vqe(e,t,r=t.selection.ranges){let n=r.map(a=>Mle(t,a.from).block);if(!n.every(a=>a))return null;let s=r.map((a,i)=>BMt(t,n[i],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(r.map((a,i)=>s[i]?[]:[{from:a.from,insert:n[i].open+" "},{from:a.to,insert:" "+n[i].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let i=0,l;i<s.length;i++)if(l=s[i]){let c=n[i],{open:u,close:d}=l;a.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:a}}return null}function VMt(e,t,r=t.selection.ranges){let n=[],s=-1;e:for(let{from:a,to:i}of r){let l=n.length,c=1e9,u;for(let d=a;d<=i;){let f=t.doc.lineAt(d);if(u==null&&(u=Mle(t,f.from).line,!u))continue e;if(f.from>s&&(a==i||i>f.from)){s=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+u.length)==u?h:-1;h<f.text.length&&h<c&&(c=h),n.push({line:f,comment:m,token:u,indent:h,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=l;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=c);n.length==l+1&&(n[l].single=!0)}if(e!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of n)(f||!d)&&a.push({from:l.from+u,insert:c+" "});let i=t.changes(a);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:i,comment:l,token:c}of n)if(l>=0){let u=i.from+l,d=u+c.length;i.text[d-i.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const fre=mg.define(),qMt=mg.define(),HMt=Kt.define(),bqe=Kt.define({combine(e){return gg(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,r)=>(n,s)=>t(n,s)||r(n,s)})}}),xqe=yo.define({create(){return Pm.empty},update(e,t){let r=t.state.facet(bqe),n=t.annotation(fre);if(n){let c=Pu.fromTransaction(t,n.selection),u=n.side,d=u==0?e.undone:e.done;return c?d=Q$(d,d.length,r.minDepth,c):d=Oqe(d,t.startState.selection),new Pm(u==0?n.rest:d,u==0?d:n.rest)}let s=t.annotation(qMt);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(Ao.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Pu.fromTransaction(t),i=t.annotation(Ao.time),l=t.annotation(Ao.userEvent);return a?e=e.addChanges(a,i,l,r,t):t.selection&&(e=e.addSelection(t.startState.selection,i,l,r.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Pm(e.done.map(Pu.fromJSON),e.undone.map(Pu.fromJSON))}});function QMt(e={}){return[xqe,bqe.of(e),pt.domEventHandlers({beforeinput(t,r){let n=t.inputType=="historyUndo"?wqe:t.inputType=="historyRedo"?hre:null;return n?(t.preventDefault(),n(r)):!1}})]}function j6(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let s=r.field(xqe,!1);if(!s)return!1;let a=s.pop(e,r,t);return a?(n(a),!0):!1}}const wqe=j6(0,!1),hre=j6(1,!1),WMt=j6(0,!0),GMt=j6(1,!0);class Pu{constructor(t,r,n,s,a){this.changes=t,this.effects=r,this.mapped=n,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new Pu(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new Pu(t.changes&&Co.fromJSON(t.changes),[],t.mapped&&Vm.fromJSON(t.mapped),t.startSelection&&at.fromJSON(t.startSelection),t.selectionsAfter.map(at.fromJSON))}static fromTransaction(t,r){let n=sh;for(let s of t.startState.facet(HMt)){let a=s(t);a.length&&(n=n.concat(a))}return!n.length&&t.changes.empty?null:new Pu(t.changes.invert(t.startState.doc),n,void 0,r||t.startState.selection,sh)}static selection(t){return new Pu(void 0,sh,void 0,void 0,t)}}function Q$(e,t,r,n){let s=t+1>r+20?t-r-1:0,a=e.slice(s,t);return a.push(n),a}function ZMt(e,t){let r=[],n=!1;return e.iterChangedRanges((s,a)=>r.push(s,a)),t.iterChangedRanges((s,a,i,l)=>{for(let c=0;c<r.length;){let u=r[c++],d=r[c++];l>=u&&i<=d&&(n=!0)}}),n}function YMt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((r,n)=>r.empty!=t.ranges[n].empty).length===0}function Sqe(e,t){return e.length?t.length?e.concat(t):e:t}const sh=[],XMt=200;function Oqe(e,t){if(e.length){let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-XMt));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),Q$(e,e.length-1,1e9,r.setSelAfter(n)))}else return[Pu.selection([t])]}function KMt(e){let t=e[e.length-1],r=e.slice();return r[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),r}function rU(e,t){if(!e.length)return e;let r=e.length,n=sh;for(;r;){let s=JMt(e[r-1],t,n);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,r);return a[r-1]=s,a}else t=s.mapped,r--,n=s.selectionsAfter}return n.length?[Pu.selection(n)]:sh}function JMt(e,t,r){let n=Sqe(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):sh,r);if(!e.changes)return Pu.selection(n);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(a):a;return new Pu(s,tn.mapEffects(e.effects,t),i,e.startSelection.map(a),n)}const eDt=/^(input\.type|delete)($|\.)/;class Pm{constructor(t,r,n=0,s=void 0){this.done=t,this.undone=r,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new Pm(this.done,this.undone):this}addChanges(t,r,n,s,a){let i=this.done,l=i[i.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!n||eDt.test(n))&&(!l.selectionsAfter.length&&r-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,ZMt(l.changes,t.changes))||n=="input.type.compose")?i=Q$(i,i.length-1,s.minDepth,new Pu(t.changes.compose(l.changes),Sqe(tn.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,sh)):i=Q$(i,i.length,s.minDepth,t),new Pm(i,sh,r,n)}addSelection(t,r,n,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:sh;return a.length>0&&r-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&YMt(a[a.length-1],t)?this:new Pm(Oqe(this.done,t),this.undone,r,n)}addMapping(t){return new Pm(rU(this.done,t),rU(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,n){let s=t==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],i=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):r.selection);if(n&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:fre.of({side:t,rest:KMt(s),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let l=s.length==1?sh:s.slice(0,s.length-1);return a.mapped&&(l=rU(l,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:fre.of({side:t,rest:l,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Pm.empty=new Pm(sh,sh);const tDt=[{key:"Mod-z",run:wqe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:hre,preventDefault:!0},{linux:"Ctrl-Shift-z",run:hre,preventDefault:!0},{key:"Mod-u",run:WMt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:GMt,preventDefault:!0}];function uE(e,t){return at.create(e.ranges.map(t),e.mainIndex)}function Ip(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Rp({state:e,dispatch:t},r){let n=uE(e.selection,r);return n.eq(e.selection,!0)?!1:(t(Ip(e,n)),!0)}function T6(e,t){return at.cursor(t?e.to:e.from)}function kqe(e,t){return Rp(e,r=>r.empty?e.moveByChar(r,t):T6(r,t))}function Sc(e){return e.textDirectionAt(e.state.selection.main.head)==Da.LTR}const _qe=e=>kqe(e,!Sc(e)),Eqe=e=>kqe(e,Sc(e));function Cqe(e,t){return Rp(e,r=>r.empty?e.moveByGroup(r,t):T6(r,t))}const rDt=e=>Cqe(e,!Sc(e)),nDt=e=>Cqe(e,Sc(e));function sDt(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function N6(e,t,r){let n=Na(e).resolveInner(t.head),s=r?hn.closedBy:hn.openedBy;for(let c=t.head;;){let u=r?n.childAfter(c):n.childBefore(c);if(!u)break;sDt(e,u,s)?n=u:c=r?u.to:u.from}let a=n.type.prop(s),i,l;return a&&(i=r?Rm(e,n.from,1):Rm(e,n.to,-1))&&i.matched?l=r?i.end.to:i.end.from:l=r?n.to:n.from,at.cursor(l,r?-1:1)}const aDt=e=>Rp(e,t=>N6(e.state,t,!Sc(e))),iDt=e=>Rp(e,t=>N6(e.state,t,Sc(e)));function jqe(e,t){return Rp(e,r=>{if(!r.empty)return T6(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)})}const Tqe=e=>jqe(e,!1),Nqe=e=>jqe(e,!0);function Aqe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,n=0,s;if(t){for(let a of e.state.facet(pt.scrollMargins)){let i=a(e);i?.top&&(r=Math.max(i?.top,r)),i?.bottom&&(n=Math.max(i?.bottom,n))}s=e.scrollDOM.clientHeight-r-n}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function Iqe(e,t){let r=Aqe(e),{state:n}=e,s=uE(n.selection,i=>i.empty?e.moveVertically(i,t,r.height):T6(i,t));if(s.eq(n.selection))return!1;let a;if(r.selfScroll){let i=e.coordsAtPos(n.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+r.marginTop,u=l.bottom-r.marginBottom;i&&i.top>c&&i.bottom<u&&(a=pt.scrollIntoView(s.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(Ip(n,s),{effects:a}),!0}const NSe=e=>Iqe(e,!1),pre=e=>Iqe(e,!0);function zx(e,t,r){let n=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,r);if(s.head==t.head&&s.head!=(r?n.to:n.from)&&(s=e.moveToLineBoundary(t,r,!1)),!r&&s.head==n.from&&n.length){let a=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&t.head!=n.from+a&&(s=at.cursor(n.from+a))}return s}const oDt=e=>Rp(e,t=>zx(e,t,!0)),lDt=e=>Rp(e,t=>zx(e,t,!1)),cDt=e=>Rp(e,t=>zx(e,t,!Sc(e))),uDt=e=>Rp(e,t=>zx(e,t,Sc(e))),dDt=e=>Rp(e,t=>at.cursor(e.lineBlockAt(t.head).from,1)),fDt=e=>Rp(e,t=>at.cursor(e.lineBlockAt(t.head).to,-1));function hDt(e,t,r){let n=!1,s=uE(e.selection,a=>{let i=Rm(e,a.head,-1)||Rm(e,a.head,1)||a.head>0&&Rm(e,a.head-1,1)||a.head<e.doc.length&&Rm(e,a.head+1,-1);if(!i||!i.end)return a;n=!0;let l=i.start.from==a.head?i.end.to:i.end.from;return at.cursor(l)});return n?(t(Ip(e,s)),!0):!1}const pDt=({state:e,dispatch:t})=>hDt(e,t);function Eh(e,t){let r=uE(e.state.selection,n=>{let s=t(n);return at.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(Ip(e.state,r)),!0)}function Rqe(e,t){return Eh(e,r=>e.moveByChar(r,t))}const Pqe=e=>Rqe(e,!Sc(e)),Mqe=e=>Rqe(e,Sc(e));function Dqe(e,t){return Eh(e,r=>e.moveByGroup(r,t))}const mDt=e=>Dqe(e,!Sc(e)),gDt=e=>Dqe(e,Sc(e)),yDt=e=>Eh(e,t=>N6(e.state,t,!Sc(e))),vDt=e=>Eh(e,t=>N6(e.state,t,Sc(e)));function Lqe(e,t){return Eh(e,r=>e.moveVertically(r,t))}const $qe=e=>Lqe(e,!1),Fqe=e=>Lqe(e,!0);function zqe(e,t){return Eh(e,r=>e.moveVertically(r,t,Aqe(e).height))}const ASe=e=>zqe(e,!1),ISe=e=>zqe(e,!0),bDt=e=>Eh(e,t=>zx(e,t,!0)),xDt=e=>Eh(e,t=>zx(e,t,!1)),wDt=e=>Eh(e,t=>zx(e,t,!Sc(e))),SDt=e=>Eh(e,t=>zx(e,t,Sc(e))),ODt=e=>Eh(e,t=>at.cursor(e.lineBlockAt(t.head).from)),kDt=e=>Eh(e,t=>at.cursor(e.lineBlockAt(t.head).to)),RSe=({state:e,dispatch:t})=>(t(Ip(e,{anchor:0})),!0),PSe=({state:e,dispatch:t})=>(t(Ip(e,{anchor:e.doc.length})),!0),MSe=({state:e,dispatch:t})=>(t(Ip(e,{anchor:e.selection.main.anchor,head:0})),!0),DSe=({state:e,dispatch:t})=>(t(Ip(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),_Dt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),EDt=({state:e,dispatch:t})=>{let r=A6(e).map(({from:n,to:s})=>at.range(n,Math.min(s+1,e.doc.length)));return t(e.update({selection:at.create(r),userEvent:"select"})),!0},CDt=({state:e,dispatch:t})=>{let r=uE(e.selection,n=>{let s=Na(e),a=s.resolveStack(n.from,1);if(n.empty){let i=s.resolveStack(n.from,-1);i.node.from>=a.node.from&&i.node.to<=a.node.to&&(a=i)}for(let i=a;i;i=i.next){let{node:l}=i;if((l.from<n.from&&l.to>=n.to||l.to>n.to&&l.from<=n.from)&&i.next)return at.range(l.to,l.from)}return n});return r.eq(e.selection)?!1:(t(Ip(e,r)),!0)};function Bqe(e,t){let{state:r}=e,n=r.selection,s=r.selection.ranges.slice();for(let a of r.selection.ranges){let i=r.doc.lineAt(a.head);if(t?i.to<e.state.doc.length:i.from>0)for(let l=a;;){let c=e.moveVertically(l,t);if(c.head<i.from||c.head>i.to){s.some(u=>u.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==n.ranges.length?!1:(e.dispatch(Ip(r,at.create(s,s.length-1))),!0)}const jDt=e=>Bqe(e,!1),TDt=e=>Bqe(e,!0),NDt=({state:e,dispatch:t})=>{let r=e.selection,n=null;return r.ranges.length>1?n=at.create([r.main]):r.main.empty||(n=at.create([at.cursor(r.main.head)])),n?(t(Ip(e,n)),!0):!1};function lR(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:n}=e,s=n.changeByRange(a=>{let{from:i,to:l}=a;if(i==l){let c=t(a);c<i?(r="delete.backward",c=_D(e,c,!1)):c>i&&(r="delete.forward",c=_D(e,c,!0)),i=Math.min(i,c),l=Math.max(l,c)}else i=_D(e,i,!1),l=_D(e,l,!0);return i==l?{range:a}:{changes:{from:i,to:l},range:at.cursor(i,i<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(n.update(s,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?pt.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function _D(e,t,r){if(e instanceof pt)for(let n of e.state.facet(pt.atomicRanges).map(s=>s(e)))n.between(t,t,(s,a)=>{s<t&&a>t&&(t=r?a:s)});return t}const Uqe=(e,t,r)=>lR(e,n=>{let s=n.from,{state:a}=e,i=a.doc.lineAt(s),l,c;if(r&&!t&&s>i.from&&s<i.from+200&&!/[^ \t]/.test(l=i.text.slice(0,s-i.from))){if(l[l.length-1]==" ")return s-1;let u=vp(l,a.tabSize),d=u%Vw(a)||Vw(a);for(let f=0;f<d&&l[l.length-1-f]==" ";f++)s--;c=s}else c=gl(i.text,s-i.from,t,t)+i.from,c==s&&i.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(c-i.from,s-i.from))&&(c=gl(i.text,c-i.from,!1,!1)+i.from);return c}),mre=e=>Uqe(e,!1,!0),Vqe=e=>Uqe(e,!0,!1),qqe=(e,t)=>lR(e,r=>{let n=r.head,{state:s}=e,a=s.doc.lineAt(n),i=s.charCategorizer(n);for(let l=null;;){if(n==(t?a.to:a.from)){n==r.head&&a.number!=(t?s.doc.lines:1)&&(n+=t?1:-1);break}let c=gl(a.text,n-a.from,t)+a.from,u=a.text.slice(Math.min(n,c)-a.from,Math.max(n,c)-a.from),d=i(u);if(l!=null&&d!=l)break;(u!=" "||n!=r.head)&&(l=d),n=c}return n}),Hqe=e=>qqe(e,!1),ADt=e=>qqe(e,!0),IDt=e=>lR(e,t=>{let r=e.lineBlockAt(t.head).to;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),RDt=e=>lR(e,t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>r?r:Math.max(0,t.head-1)}),PDt=e=>lR(e,t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),MDt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Ls.of(["",""])},range:at.cursor(n.from)}));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},DDt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let s=n.from,a=e.doc.lineAt(s),i=s==a.from?s-1:gl(a.text,s-a.from,!1)+a.from,l=s==a.to?s+1:gl(a.text,s-a.from,!0)+a.from;return{changes:{from:i,to:l,insert:e.doc.slice(s,l).append(e.doc.slice(i,s))},range:at.cursor(l)}});return r.changes.empty?!1:(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function A6(e){let t=[],r=-1;for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),a=e.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=e.doc.lineAt(n.to-1)),r>=s.number){let i=t[t.length-1];i.to=a.to,i.ranges.push(n)}else t.push({from:s.from,to:a.to,ranges:[n]});r=a.number+1}return t}function Qqe(e,t,r){if(e.readOnly)return!1;let n=[],s=[];for(let a of A6(e)){if(r?a.to==e.doc.length:a.from==0)continue;let i=e.doc.lineAt(r?a.to+1:a.from-1),l=i.length+1;if(r){n.push({from:a.to,to:i.to},{from:a.from,insert:i.text+e.lineBreak});for(let c of a.ranges)s.push(at.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{n.push({from:i.from,to:a.from},{from:a.to,insert:e.lineBreak+i.text});for(let c of a.ranges)s.push(at.range(c.anchor-l,c.head-l))}}return n.length?(t(e.update({changes:n,scrollIntoView:!0,selection:at.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const LDt=({state:e,dispatch:t})=>Qqe(e,t,!1),$Dt=({state:e,dispatch:t})=>Qqe(e,t,!0);function Wqe(e,t,r){if(e.readOnly)return!1;let n=[];for(let a of A6(e))r?n.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):n.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(n);return t(e.update({changes:s,selection:e.selection.map(s,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const FDt=({state:e,dispatch:t})=>Wqe(e,t,!1),zDt=({state:e,dispatch:t})=>Wqe(e,t,!0),BDt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(A6(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),n=uE(t.selection,s=>{let a;if(e.lineWrapping){let i=e.lineBlockAt(s.head),l=e.coordsAtPos(s.head,s.assoc||1);l&&(a=i.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function UDt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=Na(e).resolveInner(t),n=r.childBefore(t),s=r.childAfter(t),a;return n&&s&&n.to<=t&&s.from>=t&&(a=n.type.prop(hn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(n.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const LSe=Gqe(!1),VDt=Gqe(!0);function Gqe(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=t.changeByRange(s=>{let{from:a,to:i}=s,l=t.doc.lineAt(a),c=!e&&a==i&&UDt(t,a);e&&(a=i=(i<=l.to?l:t.doc.lineAt(i)).to);let u=new k6(t,{simulateBreak:a,simulateDoubleBreak:!!c}),d=rle(u,a);for(d==null&&(d=vp(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));i<l.to&&/\s/.test(l.text[i-l.from]);)i++;c?{from:a,to:i}=c:a>l.from&&a<l.from+100&&!/\S/.test(l.text.slice(0,a))&&(a=l.from);let f=["",CN(t,d)];return c&&f.push(CN(t,u.lineIndent(l.from,-1))),{changes:{from:a,to:i,insert:Ls.of(f)},range:at.cursor(a+1+f[1].length)}});return r(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Dle(e,t){let r=-1;return e.changeByRange(n=>{let s=[];for(let i=n.from;i<=n.to;){let l=e.doc.lineAt(i);l.number>r&&(n.empty||n.to>l.from)&&(t(l,s,n),r=l.number),i=l.to+1}let a=e.changes(s);return{changes:s,range:at.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const qDt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new k6(e,{overrideIndentation:a=>{let i=r[a];return i??-1}}),s=Dle(e,(a,i,l)=>{let c=rle(n,a.from);if(c==null)return;/\S/.test(a.text)||(c=0);let u=/^\s*/.exec(a.text)[0],d=CN(e,c);(u!=d||l.from<a.from+u.length)&&(r[a.from]=c,i.push({from:a.from,to:a.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},Zqe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Dle(e,(r,n)=>{n.push({from:r.from,insert:e.facet(oE)})}),{userEvent:"input.indent"})),!0),Yqe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Dle(e,(r,n)=>{let s=/^\s*/.exec(r.text)[0];if(!s)return;let a=vp(s,e.tabSize),i=0,l=CN(e,Math.max(0,a-Vw(e)));for(;i<s.length&&i<l.length&&s.charCodeAt(i)==l.charCodeAt(i);)i++;n.push({from:r.from+i,to:r.from+s.length,insert:l.slice(i)})}),{userEvent:"delete.dedent"})),!0),HDt=e=>(e.setTabFocusMode(),!0),QDt=[{key:"Ctrl-b",run:_qe,shift:Pqe,preventDefault:!0},{key:"Ctrl-f",run:Eqe,shift:Mqe},{key:"Ctrl-p",run:Tqe,shift:$qe},{key:"Ctrl-n",run:Nqe,shift:Fqe},{key:"Ctrl-a",run:dDt,shift:ODt},{key:"Ctrl-e",run:fDt,shift:kDt},{key:"Ctrl-d",run:Vqe},{key:"Ctrl-h",run:mre},{key:"Ctrl-k",run:IDt},{key:"Ctrl-Alt-h",run:Hqe},{key:"Ctrl-o",run:MDt},{key:"Ctrl-t",run:DDt},{key:"Ctrl-v",run:pre}],WDt=[{key:"ArrowLeft",run:_qe,shift:Pqe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:rDt,shift:mDt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:cDt,shift:wDt,preventDefault:!0},{key:"ArrowRight",run:Eqe,shift:Mqe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:nDt,shift:gDt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:uDt,shift:SDt,preventDefault:!0},{key:"ArrowUp",run:Tqe,shift:$qe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:RSe,shift:MSe},{mac:"Ctrl-ArrowUp",run:NSe,shift:ASe},{key:"ArrowDown",run:Nqe,shift:Fqe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:PSe,shift:DSe},{mac:"Ctrl-ArrowDown",run:pre,shift:ISe},{key:"PageUp",run:NSe,shift:ASe},{key:"PageDown",run:pre,shift:ISe},{key:"Home",run:lDt,shift:xDt,preventDefault:!0},{key:"Mod-Home",run:RSe,shift:MSe},{key:"End",run:oDt,shift:bDt,preventDefault:!0},{key:"Mod-End",run:PSe,shift:DSe},{key:"Enter",run:LSe,shift:LSe},{key:"Mod-a",run:_Dt},{key:"Backspace",run:mre,shift:mre,preventDefault:!0},{key:"Delete",run:Vqe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Hqe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:ADt,preventDefault:!0},{mac:"Mod-Backspace",run:RDt,preventDefault:!0},{mac:"Mod-Delete",run:PDt,preventDefault:!0}].concat(QDt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),GDt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:aDt,shift:yDt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:iDt,shift:vDt},{key:"Alt-ArrowUp",run:LDt},{key:"Shift-Alt-ArrowUp",run:FDt},{key:"Alt-ArrowDown",run:$Dt},{key:"Shift-Alt-ArrowDown",run:zDt},{key:"Mod-Alt-ArrowUp",run:jDt},{key:"Mod-Alt-ArrowDown",run:TDt},{key:"Escape",run:NDt},{key:"Mod-Enter",run:VDt},{key:"Alt-l",mac:"Ctrl-l",run:EDt},{key:"Mod-i",run:CDt,preventDefault:!0},{key:"Mod-[",run:Yqe},{key:"Mod-]",run:Zqe},{key:"Mod-Alt-\\",run:qDt},{key:"Shift-Mod-k",run:BDt},{key:"Shift-Mod-\\",run:pDt},{key:"Mod-/",run:LMt},{key:"Alt-A",run:FMt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:HDt}].concat(WDt),ZDt={key:"Tab",run:Zqe,shift:Yqe},$Se=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class By{constructor(t,r,n=0,s=t.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,s),this.bufferStart=n,this.normalize=a?l=>a($Se(l)):$Se,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ku(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=Loe(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Sm(t);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let l=s.charCodeAt(a),c=this.match(l,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(c)return this.value=c,this;break}i==n&&a<r.length&&r.charCodeAt(a)==l&&i++}}}match(t,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],l=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,l=!0)),l||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(By.prototype[Symbol.iterator]=function(){return this});const Xqe={from:-1,to:-1,match:/.*/.exec("")},Lle="gm"+(/x/.unicode==null?"":"u");class Kqe{constructor(t,r,n,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=Xqe,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Jqe(t,r,n,s,a);this.re=new RegExp(r,Lle+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=t.iter();let i=t.lineAt(s);this.curLineStart=i.from,this.matchPos=W$(t,s),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=W$(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const nU=new WeakMap;class gk{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let s=nU.get(t);if(!s||s.from>=n||s.to<=r){let l=new gk(r,t.sliceString(r,n));return nU.set(t,l),l}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=t.sliceString(r,i)+a,i=r),s.to<n&&(a+=t.sliceString(s.to,n)),nU.set(t,new gk(i,a)),new gk(r,a.slice(r-i,n-i))}}class Jqe{constructor(t,r,n,s,a){this.text=t,this.to=a,this.done=!1,this.value=Xqe,this.matchPos=W$(t,s),this.re=new RegExp(r,Lle+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=gk.get(t,s,this.chunkEnd(s+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=W$(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gk.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Kqe.prototype[Symbol.iterator]=Jqe.prototype[Symbol.iterator]=function(){return this});function YDt(e){try{return new RegExp(e,Lle),!0}catch{return!1}}function W$(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}const XDt=e=>{let{state:t}=e,r=String(t.doc.lineAt(e.state.selection.main.head).number),{close:n,result:s}=LNt(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:t.phrase("go")});return s.then(a=>{let i=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!i){e.dispatch({effects:n});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=i,h=d?+d.slice(1):0,p=u?+u:l.number;if(u&&f){let y=p/100;c&&(y=y*(c=="-"?-1:1)+l.number/t.doc.lines),p=Math.round(t.doc.lines*y)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let m=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),g=at.cursor(m.from+Math.max(0,Math.min(h,m.length)));e.dispatch({effects:[n,pt.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},KDt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},JDt=Kt.define({combine(e){return gg(e,KDt,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function e2t(e){return[a2t,s2t]}const t2t=er.mark({class:"cm-selectionMatch"}),r2t=er.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function FSe(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=yi.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=yi.Word)}function n2t(e,t,r,n){return e(t.sliceDoc(r,r+1))==yi.Word&&e(t.sliceDoc(n-1,n))==yi.Word}const s2t=wi.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(JDt),{state:r}=e,n=r.selection;if(n.ranges.length>1)return er.none;let s=n.main,a,i=null;if(s.empty){if(!t.highlightWordAroundCursor)return er.none;let c=r.wordAt(s.head);if(!c)return er.none;i=r.charCategorizer(s.head),a=r.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c<t.minSelectionLength||c>200)return er.none;if(t.wholeWords){if(a=r.sliceDoc(s.from,s.to),i=r.charCategorizer(s.head),!(FSe(i,r,s.from,s.to)&&n2t(i,r,s.from,s.to)))return er.none}else if(a=r.sliceDoc(s.from,s.to),!a)return er.none}let l=[];for(let c of e.visibleRanges){let u=new By(r.doc,a,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||FSe(i,r,d,f))&&(s.empty&&d<=s.from&&f>=s.to?l.push(r2t.range(d,f)):(d>=s.to||f<=s.from)&&l.push(t2t.range(d,f)),l.length>t.maxMatches))return er.none}}return er.set(l)}},{decorations:e=>e.decorations}),a2t=pt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),i2t=({state:e,dispatch:t})=>{let{selection:r}=e,n=at.create(r.ranges.map(s=>e.wordAt(s.head)||at.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function o2t(e,t){let{main:r,ranges:n}=e.selection,s=e.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,l=new By(e.doc,t,n[n.length-1].to);;)if(l.next(),l.done){if(i)return null;l=new By(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(c=>c.from==l.value.from))continue;if(a){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const l2t=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(a=>a.from===a.to))return i2t({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=n))return!1;let s=o2t(e,n);return s?(t(e.update({selection:e.selection.addRange(at.range(s.from,s.to),!1),effects:pt.scrollIntoView(s.to)})),!0):!1},dE=Kt.define({combine(e){return gg(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new S2t(t),scrollToMatch:t=>pt.scrollIntoView(t)})}});class eHe{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||YDt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
40
40
  `:n=="r"?"\r":n=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new p2t(this):new d2t(this)}getCursor(t,r=0,n){let s=t.doc?t:Dn.create({doc:t});return n==null&&(n=s.doc.length),this.regexp?wO(this,s,r,n):xO(this,s,r,n)}}class tHe{constructor(t){this.spec=t}}function c2t(e,t,r){return(n,s,a,i)=>{if(r&&!r(n,s,a,i))return!1;let l=n>=i&&s<=i+a.length?a.slice(n-i,s-i):t.doc.sliceString(n,s);return e(l,t,n,s)}}function xO(e,t,r,n){let s;return e.wholeWord&&(s=u2t(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(s=c2t(e.test,t,s)),new By(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:a=>a.toLowerCase(),s)}function u2t(e,t){return(r,n,s,a)=>((a>r||a+s.length<n)&&(a=Math.max(0,r-2),s=e.sliceString(a,Math.min(e.length,n+2))),(t(G$(s,r-a))!=yi.Word||t(Z$(s,r-a))!=yi.Word)&&(t(Z$(s,n-a))!=yi.Word||t(G$(s,n-a))!=yi.Word))}class d2t extends tHe{constructor(t){super(t)}nextMatch(t,r,n){let s=xO(this.spec,t,n,t.doc.length).nextOverlapping();if(s.done){let a=Math.min(t.doc.length,r+this.spec.unquoted.length);s=xO(this.spec,t,0,a).nextOverlapping()}return s.done||s.value.from==r&&s.value.to==n?null:s.value}prevMatchInRange(t,r,n){for(let s=n;;){let a=Math.max(r,s-1e4-this.spec.unquoted.length),i=xO(this.spec,t,a,s),l=null;for(;!i.nextOverlapping().done;)l=i.value;if(l)return l;if(a==r)return null;s-=1e4}}prevMatch(t,r,n){let s=this.prevMatchInRange(t,0,r);return s||(s=this.prevMatchInRange(t,Math.max(0,n-this.spec.unquoted.length),t.doc.length)),s&&(s.from!=r||s.to!=n)?s:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,r){let n=xO(this.spec,t,0,t.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(t,r,n,s){let a=xO(this.spec,t,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function f2t(e,t,r){return(n,s,a)=>(!r||r(n,s,a))&&e(a[0],t,n,s)}function wO(e,t,r,n){let s;return e.wholeWord&&(s=h2t(t.charCategorizer(t.selection.main.head))),e.test&&(s=f2t(e.test,t,s)),new Kqe(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:s},r,n)}function G$(e,t){return e.slice(gl(e,t,!1),t)}function Z$(e,t){return e.slice(t,gl(e,t))}function h2t(e){return(t,r,n)=>!n[0].length||(e(G$(n.input,n.index))!=yi.Word||e(Z$(n.input,n.index))!=yi.Word)&&(e(Z$(n.input,n.index+n[0].length))!=yi.Word||e(G$(n.input,n.index+n[0].length))!=yi.Word)}class p2t extends tHe{nextMatch(t,r,n){let s=wO(this.spec,t,n,t.doc.length).next();return s.done&&(s=wO(this.spec,t,0,r).next()),s.done?null:s.value}prevMatchInRange(t,r,n){for(let s=1;;s++){let a=Math.max(r,n-s*1e4),i=wO(this.spec,t,a,n),l=null;for(;!i.next().done;)l=i.value;if(l&&(a==r||l.from>a+10))return l;if(a==r)return null}}prevMatch(t,r,n){return this.prevMatchInRange(t,0,r)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return t.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let a=+n.slice(0,s);if(a>0&&a<t.match.length)return t.match[a]+n.slice(s)}return r})}matchAll(t,r){let n=wO(this.spec,t,0,t.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(t,r,n,s){let a=wO(this.spec,t,Math.max(0,r-250),Math.min(n+250,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const LN=tn.define(),$le=tn.define(),Bb=yo.define({create(e){return new sU(gre(e).create(),null)},update(e,t){for(let r of t.effects)r.is(LN)?e=new sU(r.value.create(),e.panel):r.is($le)&&(e=new sU(e.query,r.value?Fle:null));return e},provide:e=>EN.from(e,t=>t.panel)});class sU{constructor(t,r){this.query=t,this.panel=r}}const m2t=er.mark({class:"cm-searchMatch"}),g2t=er.mark({class:"cm-searchMatch cm-searchMatch-selected"}),y2t=wi.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Bb))}update(e){let t=e.state.field(Bb);(t!=e.startState.field(Bb)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return er.none;let{view:r}=this,n=new Kc;for(let s=0,a=r.visibleRanges,i=a.length;s<i;s++){let{from:l,to:c}=a[s];for(;s<i-1&&c>a[s+1].from-500;)c=a[++s].to;e.highlight(r.state,l,c,(u,d)=>{let f=r.state.selection.ranges.some(h=>h.from==u&&h.to==d);n.add(u,d,f?g2t:m2t)})}return n.finish()}},{decorations:e=>e.decorations});function cR(e){return t=>{let r=t.state.field(Bb,!1);return r&&r.query.spec.valid?e(t,r):sHe(t)}}const Y$=cR((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let s=at.single(n.from,n.to),a=e.state.facet(dE);return e.dispatch({selection:s,effects:[zle(e,n),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),nHe(e),!0}),X$=cR((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,s=t.prevMatch(r,n,n);if(!s)return!1;let a=at.single(s.from,s.to),i=e.state.facet(dE);return e.dispatch({selection:a,effects:[zle(e,s),i.scrollToMatch(a.main,e)],userEvent:"select.search"}),nHe(e),!0}),v2t=cR((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:at.create(r.map(n=>at.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),b2t=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:s}=r.main,a=[],i=0;for(let l=new By(e.doc,e.sliceDoc(n,s));!l.next().done;){if(a.length>1e3)return!1;l.value.from==n&&(i=a.length),a.push(at.range(l.value.from,l.value.to))}return t(e.update({selection:at.create(a,i),userEvent:"select.search.matches"})),!0},zSe=cR((e,{query:t})=>{let{state:r}=e,{from:n,to:s}=r.selection.main;if(r.readOnly)return!1;let a=t.nextMatch(r,n,n);if(!a)return!1;let i=a,l=[],c,u,d=[];i.from==n&&i.to==s&&(u=r.toText(t.getReplacement(i)),l.push({from:i.from,to:i.to,insert:u}),i=t.nextMatch(r,i.from,i.to),d.push(pt.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let f=e.state.changes(l);return i&&(c=at.single(i.from,i.to).map(f),d.push(zle(e,i)),d.push(r.facet(dE).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),x2t=cR((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(s=>{let{from:a,to:i}=s;return{from:a,to:i,insert:t.getReplacement(s)}});if(!r.length)return!1;let n=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:pt.announce.of(n),userEvent:"input.replace.all"}),!0});function Fle(e){return e.state.facet(dE).createPanel(e)}function gre(e,t){var r,n,s,a,i;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(dE);return new eHe({search:((r=t?.literal)!==null&&r!==void 0?r:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(n=t?.caseSensitive)!==null&&n!==void 0?n:u.caseSensitive,literal:(s=t?.literal)!==null&&s!==void 0?s:u.literal,regexp:(a=t?.regexp)!==null&&a!==void 0?a:u.regexp,wholeWord:(i=t?.wholeWord)!==null&&i!==void 0?i:u.wholeWord})}function rHe(e){let t=ele(e,Fle);return t&&t.dom.querySelector("[main-field]")}function nHe(e){let t=rHe(e);t&&t==e.root.activeElement&&t.select()}const sHe=e=>{let t=e.state.field(Bb,!1);if(t&&t.panel){let r=rHe(e);if(r&&r!=e.root.activeElement){let n=gre(e.state,t.query.spec);n.valid&&e.dispatch({effects:LN.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[$le.of(!0),t?LN.of(gre(e.state,t.query.spec)):tn.appendConfig.of(k2t)]});return!0},aHe=e=>{let t=e.state.field(Bb,!1);if(!t||!t.panel)return!1;let r=ele(e,Fle);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:$le.of(!1)}),!0},w2t=[{key:"Mod-f",run:sHe,scope:"editor search-panel"},{key:"F3",run:Y$,shift:X$,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Y$,shift:X$,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:aHe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:b2t},{key:"Mod-Alt-g",run:XDt},{key:"Mod-d",run:l2t,preventDefault:!0}];class S2t{constructor(t){this.view=t;let r=this.query=t.state.field(Bb).query.spec;this.commit=this.commit.bind(this),this.searchField=ka("input",{value:r.search,placeholder:yd(t,"Find"),"aria-label":yd(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ka("input",{value:r.replace,placeholder:yd(t,"Replace"),"aria-label":yd(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ka("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=ka("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=ka("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(s,a,i){return ka("button",{class:"cm-button",name:s,onclick:a,type:"button"},i)}this.dom=ka("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>Y$(t),[yd(t,"next")]),n("prev",()=>X$(t),[yd(t,"previous")]),n("select",()=>v2t(t),[yd(t,"all")]),ka("label",null,[this.caseField,yd(t,"match case")]),ka("label",null,[this.reField,yd(t,"regexp")]),ka("label",null,[this.wordField,yd(t,"by word")]),...t.state.readOnly?[]:[ka("br"),this.replaceField,n("replace",()=>zSe(t),[yd(t,"replace")]),n("replaceAll",()=>x2t(t),[yd(t,"replace all")])],ka("button",{name:"close",onclick:()=>aHe(t),"aria-label":yd(t,"close"),type:"button"},["×"])])}commit(){let t=new eHe({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:LN.of(t)}))}keydown(t){GTt(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?X$:Y$)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),zSe(this.view))}update(t){for(let r of t.transactions)for(let n of r.effects)n.is(LN)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(dE).top}}function yd(e,t){return e.state.phrase(t)}const ED=30,CD=/[\s\.,:;?!]/;function zle(e,{from:t,to:r}){let n=e.state.doc.lineAt(t),s=e.state.doc.lineAt(r).to,a=Math.max(n.from,t-ED),i=Math.min(s,r+ED),l=e.state.sliceDoc(a,i);if(a!=n.from){for(let c=0;c<ED;c++)if(!CD.test(l[c+1])&&CD.test(l[c])){l=l.slice(c);break}}if(i!=s){for(let c=l.length-1;c>l.length-ED;c--)if(!CD.test(l[c-1])&&CD.test(l[c])){l=l.slice(0,c);break}}return pt.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${n.number}.`)}const O2t=pt.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),k2t=[Bb,Np.low(y2t),O2t];class BSe{constructor(t,r,n){this.from=t,this.to=r,this.diagnostic=n}}class iw{constructor(t,r,n){this.diagnostics=t,this.panel=r,this.selected=n}static init(t,r,n){let s=n.facet($N).markerFilter;s&&(t=s(t,n));let a=t.slice().sort((d,f)=>d.from-f.from||d.to-f.to),i=new Kc,l=[],c=0;for(let d=0;;){let f=d==a.length?null:a[d];if(!f&&!l.length)break;let h,p;for(l.length?(h=c,p=l.reduce((g,y)=>Math.min(g,y.to),f&&f.from>h?f.from:1e8)):(h=f.from,p=f.to,l.push(f),d++);d<a.length;){let g=a[d];if(g.from==h&&(g.to>g.from||g.to==h))l.push(g),d++,p=Math.min(g.to,p);else{p=Math.min(g.from,p);break}}let m=L2t(l);if(l.some(g=>g.from==g.to||g.from==g.to-1&&n.doc.lineAt(g.from).to==g.from))i.add(h,h,er.widget({widget:new R2t(m),diagnostics:l.slice()}));else{let g=l.reduce((y,x)=>x.markClass?y+" "+x.markClass:y,"");i.add(h,p,er.mark({class:"cm-lintRange cm-lintRange-"+m+g,diagnostics:l.slice(),inclusiveEnd:l.some(y=>y.to>p)}))}c=p;for(let g=0;g<l.length;g++)l[g].to<=c&&l.splice(g--,1)}let u=i.finish();return new iw(u,r,Kk(u))}}function Kk(e,t=null,r=0){let n=null;return e.between(r,1e9,(s,a,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!n)n=new BSe(s,a,t||i.diagnostics[0]);else{if(i.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new BSe(n.from,a,n.diagnostic)}}),n}function _2t(e,t){let r=t.pos,n=t.end||r,s=e.state.facet($N).hideOn(e,r,n);if(s!=null)return s;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(i=>i.is(iHe))||e.changes.touchesRange(a.from,Math.max(a.to,n)))}function E2t(e,t){return e.field(Ld,!1)?t:t.concat(tn.appendConfig.of($2t))}const iHe=tn.define(),Ble=tn.define(),oHe=tn.define(),Ld=yo.define({create(){return new iw(er.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let r=e.diagnostics.map(t.changes),n=null,s=e.panel;if(e.selected){let a=t.changes.mapPos(e.selected.from,1);n=Kk(r,e.selected.diagnostic,a)||Kk(r,null,a)}!r.size&&s&&t.state.facet($N).autoPanel&&(s=null),e=new iw(r,s,n)}for(let r of t.effects)if(r.is(iHe)){let n=t.state.facet($N).autoPanel?r.value.length?FN.open:null:e.panel;e=iw.init(r.value,n,t.state)}else r.is(Ble)?e=new iw(e.diagnostics,r.value?FN.open:null,e.selected):r.is(oHe)&&(e=new iw(e.diagnostics,e.panel,r.value));return e},provide:e=>[EN.from(e,t=>t.panel),pt.decorations.from(e,t=>t.diagnostics)]}),C2t=er.mark({class:"cm-lintRange cm-lintRange-active"});function j2t(e,t,r){let{diagnostics:n}=e.state.field(Ld),s,a=-1,i=-1;n.between(t-(r<0?1:0),t+(r>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||r>0)&&(t<u||r<0)))return s=d.diagnostics,a=c,i=u,!1});let l=e.state.facet($N).tooltipFilter;return s&&l&&(s=l(s,e.state)),s?{pos:a,end:i,above:e.state.doc.lineAt(a).to<i,create(){return{dom:T2t(e,s)}}}:null}function T2t(e,t){return ka("ul",{class:"cm-tooltip-lint"},t.map(r=>cHe(e,r,!1)))}const N2t=e=>{let t=e.state.field(Ld,!1);(!t||!t.panel)&&e.dispatch({effects:E2t(e.state,[Ble.of(!0)])});let r=ele(e,FN.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},USe=e=>{let t=e.state.field(Ld,!1);return!t||!t.panel?!1:(e.dispatch({effects:Ble.of(!1)}),!0)},A2t=e=>{let t=e.state.field(Ld,!1);if(!t)return!1;let r=e.state.selection.main,n=t.diagnostics.iter(r.to+1);return!n.value&&(n=t.diagnostics.iter(0),!n.value||n.from==r.from&&n.to==r.to)?!1:(e.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},I2t=[{key:"Mod-Shift-m",run:N2t,preventDefault:!0},{key:"F8",run:A2t}],$N=Kt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...gg(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:VSe,tooltipFilter:VSe,needsRefresh:(t,r)=>t?r?n=>t(n)||r(n):t:r,hideOn:(t,r)=>t?r?(n,s,a)=>t(n,s,a)||r(n,s,a):t:r,autoPanel:(t,r)=>t||r})}}});function VSe(e,t){return e?t?(r,n)=>t(e(r,n),n):e:t}function lHe(e){let t=[];if(e)e:for(let{name:r}of e){for(let n=0;n<r.length;n++){let s=r[n];if(/[a-zA-Z]/.test(s)&&!t.some(a=>a.toLowerCase()==s.toLowerCase())){t.push(s);continue e}}t.push("")}return t}function cHe(e,t,r){var n;let s=r?lHe(t.actions):[];return ka("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},ka("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(n=t.actions)===null||n===void 0?void 0:n.map((a,i)=>{let l=!1,c=p=>{if(p.preventDefault(),l)return;l=!0;let m=Kk(e.state.field(Ld).diagnostics,t);m&&a.apply(e,m.from,m.to)},{name:u}=a,d=s[i]?u.indexOf(s[i]):-1,f=d<0?u:[u.slice(0,d),ka("u",u.slice(d,d+1)),u.slice(d+1)],h=a.markClass?" "+a.markClass:"";return ka("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${s[i]})"`}.`},f)}),t.source&&ka("div",{class:"cm-diagnosticSource"},t.source))}class R2t extends pf{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return ka("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class qSe{constructor(t,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=cHe(t,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class FN{constructor(t){this.view=t,this.items=[];let r=s=>{if(s.keyCode==27)USe(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],i=lHe(a.actions);for(let l=0;l<i.length;l++)if(i[l].toUpperCase().charCodeAt(0)==s.keyCode){let c=Kk(this.view.state.field(Ld).diagnostics,a);c&&a.actions[l].apply(t,c.from,c.to)}}else return;s.preventDefault()},n=s=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(s.target)&&this.moveSelection(a)};this.list=ka("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=ka("div",{class:"cm-panel-lint"},this.list,ka("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>USe(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Ld).selected;if(!t)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==t.diagnostic)return r;return-1}update(){let{diagnostics:t,selected:r}=this.view.state.field(Ld),n=0,s=!1,a=null,i=new Set;for(t.between(0,this.view.state.doc.length,(l,c,{spec:u})=>{for(let d of u.diagnostics){if(i.has(d))continue;i.add(d);let f=-1,h;for(let p=n;p<this.items.length;p++)if(this.items[p].diagnostic==d){f=p;break}f<0?(h=new qSe(this.view,d),this.items.splice(n,0,h),s=!0):(h=this.items[f],f>n&&(this.items.splice(n,f-n),s=!0)),r&&h.diagnostic==r.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),a=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new qSe(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.top<c.top?this.list.scrollTop-=(c.top-l.top)/u:l.bottom>c.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let t=this.list.firstChild;function r(){let n=t;t=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;t!=n.dom;)r();t=n.dom.nextSibling}else this.list.insertBefore(n.dom,t);for(;t;)r()}moveSelection(t){if(this.selectedIndex<0)return;let r=this.view.state.field(Ld),n=Kk(r.diagnostics,this.items[t].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:oHe.of(n)})}static open(t){return new FN(t)}}function P2t(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function jD(e){return P2t(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const M2t=pt.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:jD("#d11")},".cm-lintRange-warning":{backgroundImage:jD("orange")},".cm-lintRange-info":{backgroundImage:jD("#999")},".cm-lintRange-hint":{backgroundImage:jD("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function D2t(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function L2t(e){let t="hint",r=1;for(let n of e){let s=D2t(n.severity);s>r&&(r=s,t=n.severity)}return t}const $2t=[Ld,pt.decorations.compute([Ld],e=>{let{selected:t,panel:r}=e.field(Ld);return!t||!r||t.from==t.to?er.none:er.set([C2t.range(t.from,t.to)])}),MNt(j2t,{hideOn:_2t}),M2t];var HSe=function(t){t===void 0&&(t={});var{crosshairCursor:r=!1}=t,n=[];t.closeBracketsKeymap!==!1&&(n=n.concat(IIt)),t.defaultKeymap!==!1&&(n=n.concat(GDt)),t.searchKeymap!==!1&&(n=n.concat(w2t)),t.historyKeymap!==!1&&(n=n.concat(tDt)),t.foldKeymap!==!1&&(n=n.concat(yAt)),t.completionKeymap!==!1&&(n=n.concat(YUe)),t.lintKeymap!==!1&&(n=n.concat(I2t));var s=[];return t.lineNumbers!==!1&&s.push(WNt()),t.highlightActiveLineGutter!==!1&&s.push(YNt()),t.highlightSpecialChars!==!1&&s.push(uNt()),t.history!==!1&&s.push(QMt()),t.foldGutter!==!1&&s.push(wAt()),t.drawSelection!==!1&&s.push(eNt()),t.dropCursor!==!1&&s.push(aNt()),t.allowMultipleSelections!==!1&&s.push(Dn.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&s.push(cAt()),t.syntaxHighlighting!==!1&&s.push(Fx(_At,{fallback:!0})),t.bracketMatching!==!1&&s.push(IAt()),t.closeBrackets!==!1&&s.push(jIt()),t.autocompletion!==!1&&s.push(ZUe()),t.rectangularSelection!==!1&&s.push(kNt()),r!==!1&&s.push(CNt()),t.highlightActiveLine!==!1&&s.push(gNt()),t.highlightSelectionMatches!==!1&&s.push(e2t()),t.tabSize&&typeof t.tabSize=="number"&&s.push(oE.of(" ".repeat(t.tabSize))),s.concat([iE.of(n.flat())]).filter(Boolean)};const F2t="#e5c07b",QSe="#e06c75",z2t="#56b6c2",B2t="#ffffff",EL="#abb2bf",yre="#7d8799",U2t="#61afef",V2t="#98c379",WSe="#d19a66",q2t="#c678dd",H2t="#21252b",GSe="#2c313a",ZSe="#282c34",aU="#353a42",Q2t="#3E4451",YSe="#528bff",W2t=pt.theme({"&":{color:EL,backgroundColor:ZSe},".cm-content":{caretColor:YSe},".cm-cursor, .cm-dropCursor":{borderLeftColor:YSe},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Q2t},".cm-panels":{backgroundColor:H2t,color:EL},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:ZSe,color:yre,border:"none"},".cm-activeLineGutter":{backgroundColor:GSe},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:aU},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:aU,borderBottomColor:aU},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:GSe,color:EL}}},{dark:!0}),G2t=Ap.define([{tag:ne.keyword,color:q2t},{tag:[ne.name,ne.deleted,ne.character,ne.propertyName,ne.macroName],color:QSe},{tag:[ne.function(ne.variableName),ne.labelName],color:U2t},{tag:[ne.color,ne.constant(ne.name),ne.standard(ne.name)],color:WSe},{tag:[ne.definition(ne.name),ne.separator],color:EL},{tag:[ne.typeName,ne.className,ne.number,ne.changed,ne.annotation,ne.modifier,ne.self,ne.namespace],color:F2t},{tag:[ne.operator,ne.operatorKeyword,ne.url,ne.escape,ne.regexp,ne.link,ne.special(ne.string)],color:z2t},{tag:[ne.meta,ne.comment],color:yre},{tag:ne.strong,fontWeight:"bold"},{tag:ne.emphasis,fontStyle:"italic"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:ne.link,color:yre,textDecoration:"underline"},{tag:ne.heading,fontWeight:"bold",color:QSe},{tag:[ne.atom,ne.bool,ne.special(ne.variableName)],color:WSe},{tag:[ne.processingInstruction,ne.string,ne.inserted],color:V2t},{tag:ne.invalid,color:B2t}]),Z2t=[W2t,Fx(G2t)];var Y2t=pt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),X2t=function(t){t===void 0&&(t={});var{indentWithTab:r=!0,editable:n=!0,readOnly:s=!1,theme:a="light",placeholder:i="",basicSetup:l=!0}=t,c=[];switch(r&&c.unshift(iE.of([ZDt])),l&&(typeof l=="boolean"?c.unshift(HSe()):c.unshift(HSe(l))),i&&c.unshift(xNt(i)),a){case"light":c.push(Y2t);break;case"dark":c.push(Z2t);break;case"none":break;default:c.push(a);break}return n===!1&&c.push(pt.editable.of(!1)),s&&c.push(Dn.readOnly.of(!0)),[...c]},K2t=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});class J2t{constructor(t,r){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=r,this.timeoutMS=r,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(r=>{try{r()}catch(n){console.error("TimeoutLatch callback error:",n)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}let XSe=class{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}};var iU=null,eLt=()=>typeof window>"u"?new XSe:(iU||(iU=new XSe),iU),KSe=mg.define(),tLt=200,rLt=[];function nLt(e){var{value:t,selection:r,onChange:n,onStatistics:s,onCreateEditor:a,onUpdate:i,extensions:l=rLt,autoFocus:c,theme:u="light",height:d=null,minHeight:f=null,maxHeight:h=null,width:p=null,minWidth:m=null,maxWidth:g=null,placeholder:y="",editable:x=!0,readOnly:w=!1,indentWithTab:O=!0,basicSetup:k=!0,root:_,initialState:E}=e,[T,j]=b.useState(),[A,I]=b.useState(),[P,R]=b.useState(),B=b.useState(()=>({current:null}))[0],D=b.useState(()=>({current:null}))[0],F=pt.theme({"&":{height:d,minHeight:f,maxHeight:h,width:p,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),U=pt.updateListener.of(W=>{if(W.docChanged&&typeof n=="function"&&!W.transactions.some(q=>q.annotation(KSe))){B.current?B.current.reset():(B.current=new J2t(()=>{if(D.current){var q=D.current;D.current=null,q()}B.current=null},tLt),eLt().add(B.current));var L=W.state.doc,Y=L.toString();n(Y,W)}s&&s(K2t(W))}),z=X2t({theme:u,editable:x,readOnly:w,placeholder:y,indentWithTab:O,basicSetup:k}),V=[U,F,...z];return i&&typeof i=="function"&&V.push(pt.updateListener.of(i)),V=V.concat(l),b.useLayoutEffect(()=>{if(T&&!P){var W={doc:t,selection:r,extensions:V},L=E?Dn.fromJSON(E.json,W,E.fields):Dn.create(W);if(R(L),!A){var Y=new pt({state:L,parent:T,root:_});I(Y),a&&a(Y,L)}}return()=>{A&&(R(void 0),I(void 0))}},[T,P]),b.useEffect(()=>{e.container&&j(e.container)},[e.container]),b.useEffect(()=>()=>{A&&(A.destroy(),I(void 0)),B.current&&(B.current.cancel(),B.current=null)},[A]),b.useEffect(()=>{c&&A&&A.focus()},[c,A]),b.useEffect(()=>{A&&A.dispatch({effects:tn.reconfigure.of(V)})},[u,l,d,f,h,p,m,g,y,x,w,O,k,n,i]),b.useEffect(()=>{if(t!==void 0){var W=A?A.state.doc.toString():"";if(A&&t!==W){var L=B.current&&!B.current.isDone,Y=()=>{A&&t!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:t||""},annotations:[KSe.of(!0)]})};L?D.current=Y:Y()}}},[t,A]),{state:P,setState:R,view:A,setView:I,container:T,setContainer:j}}var sLt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],bc=b.forwardRef((e,t)=>{var{className:r,value:n="",selection:s,extensions:a=[],onChange:i,onStatistics:l,onCreateEditor:c,onUpdate:u,autoFocus:d,theme:f="light",height:h,minHeight:p,maxHeight:m,width:g,minWidth:y,maxWidth:x,basicSetup:w,placeholder:O,indentWithTab:k,editable:_,readOnly:E,root:T,initialState:j}=e,A=Rle(e,sLt),I=b.useRef(null),{state:P,view:R,container:B,setContainer:D}=nLt({root:T,value:n,autoFocus:d,theme:f,height:h,minHeight:p,maxHeight:m,width:g,minWidth:y,maxWidth:x,basicSetup:w,placeholder:O,indentWithTab:k,editable:_,readOnly:E,selection:s,onChange:i,onStatistics:l,onCreateEditor:c,onUpdate:u,extensions:a,initialState:j});b.useImperativeHandle(t,()=>({editor:I.current,state:P,view:R}),[I,B,P,R]);var F=b.useCallback(z=>{I.current=z,D(z)},[D]);if(typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var U=typeof f=="string"?"cm-theme-"+f:"cm-theme";return o.jsx("div",px({ref:F,className:""+U+(r?" "+r:"")},A))});bc.displayName="CodeMirror";function aLt(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const iLt=e=>{switch(e){case"success":return cLt;case"info":return dLt;case"warning":return uLt;case"error":return fLt;default:return null}},oLt=Array(12).fill(0),lLt=({visible:e,className:t})=>je.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},je.createElement("div",{className:"sonner-spinner"},oLt.map((r,n)=>je.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),cLt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),uLt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),dLt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),fLt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),hLt=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},je.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),je.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),pLt=()=>{const[e,t]=je.useState(document.hidden);return je.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let vre=1;class mLt{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...s}=t,a=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:vre++,i=this.toasts.find(c=>c.id===a),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(c=>c.id===a?(this.publish({...c,...t,id:a,title:n}),{...c,...t,id:a,dismissible:l,title:n}):c):this.addToast({title:n,...s,dismissible:l,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let a=n!==void 0,i;const l=s.then(async u=>{if(i=["resolve",u],je.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(yLt(u)&&!u.ok){a=!1;const f=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,h=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,m=typeof f=="object"&&!je.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:h,...m})}else if(u instanceof Error){a=!1;const f=typeof r.error=="function"?await r.error(u):r.error,h=typeof r.description=="function"?await r.description(u):r.description,m=typeof f=="object"&&!je.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:h,...m})}else if(r.success!==void 0){a=!1;const f=typeof r.success=="function"?await r.success(u):r.success,h=typeof r.description=="function"?await r.description(u):r.description,m=typeof f=="object"&&!je.isValidElement(f)?f:{message:f};this.create({id:n,type:"success",description:h,...m})}}).catch(async u=>{if(i=["reject",u],r.error!==void 0){a=!1;const d=typeof r.error=="function"?await r.error(u):r.error,f=typeof r.description=="function"?await r.description(u):r.description,p=typeof d=="object"&&!je.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:f,...p})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((u,d)=>l.then(()=>i[0]==="reject"?d(i[1]):u(i[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(t,r)=>{const n=r?.id||vre++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const xu=new mLt,gLt=(e,t)=>{const r=t?.id||vre++;return xu.addToast({title:e,...t,id:r}),r},yLt=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",vLt=gLt,bLt=()=>xu.toasts,xLt=()=>xu.getActiveToasts(),gc=Object.assign(vLt,{success:xu.success,info:xu.info,warning:xu.warning,error:xu.error,custom:xu.custom,message:xu.message,promise:xu.promise,dismiss:xu.dismiss,loading:xu.loading},{getHistory:bLt,getToasts:xLt});aLt("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function TD(e){return e.label!==void 0}const wLt=3,SLt="24px",OLt="16px",JSe=4e3,kLt=356,_Lt=14,ELt=45,CLt=200;function nm(...e){return e.filter(Boolean).join(" ")}function jLt(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const TLt=e=>{var t,r,n,s,a,i,l,c,u;const{invert:d,toast:f,unstyled:h,interacting:p,setHeights:m,visibleToasts:g,heights:y,index:x,toasts:w,expanded:O,removeToast:k,defaultRichColors:_,closeButton:E,style:T,cancelButtonStyle:j,actionButtonStyle:A,className:I="",descriptionClassName:P="",duration:R,position:B,gap:D,expandByDefault:F,classNames:U,icons:z,closeButtonAriaLabel:V="Close toast"}=e,[W,L]=je.useState(null),[Y,q]=je.useState(null),[M,Q]=je.useState(!1),[G,J]=je.useState(!1),[ie,te]=je.useState(!1),[se,oe]=je.useState(!1),[he,K]=je.useState(!1),[re,le]=je.useState(0),[pe,ce]=je.useState(0),ue=je.useRef(f.duration||R||JSe),we=je.useRef(null),ke=je.useRef(null),Re=x===0,X=x+1<=g,ae=f.type,be=f.dismissible!==!1,Ae=f.className||"",De=f.descriptionClassName||"",ye=je.useMemo(()=>y.findIndex(nt=>nt.toastId===f.id)||0,[y,f.id]),_e=je.useMemo(()=>{var nt;return(nt=f.closeButton)!=null?nt:E},[f.closeButton,E]),ge=je.useMemo(()=>f.duration||R||JSe,[f.duration,R]),Ee=je.useRef(0),Fe=je.useRef(0),He=je.useRef(0),Xe=je.useRef(null),[St,ze]=B.split("-"),Be=je.useMemo(()=>y.reduce((nt,Jt,jr)=>jr>=ye?nt:nt+Jt.height,0),[y,ye]),Te=pLt(),$e=f.invert||d,Ie=ae==="loading";Fe.current=je.useMemo(()=>ye*D+Be,[ye,Be]),je.useEffect(()=>{ue.current=ge},[ge]),je.useEffect(()=>{Q(!0)},[]),je.useEffect(()=>{const nt=ke.current;if(nt){const Jt=nt.getBoundingClientRect().height;return ce(Jt),m(jr=>[{toastId:f.id,height:Jt,position:f.position},...jr]),()=>m(jr=>jr.filter(sr=>sr.toastId!==f.id))}},[m,f.id]),je.useLayoutEffect(()=>{if(!M)return;const nt=ke.current,Jt=nt.style.height;nt.style.height="auto";const jr=nt.getBoundingClientRect().height;nt.style.height=Jt,ce(jr),m(sr=>sr.find(zr=>zr.toastId===f.id)?sr.map(zr=>zr.toastId===f.id?{...zr,height:jr}:zr):[{toastId:f.id,height:jr,position:f.position},...sr])},[M,f.title,f.description,m,f.id,f.jsx,f.action,f.cancel]);const lt=je.useCallback(()=>{J(!0),le(Fe.current),m(nt=>nt.filter(Jt=>Jt.toastId!==f.id)),setTimeout(()=>{k(f)},CLt)},[f,k,m,Fe]);je.useEffect(()=>{if(f.promise&&ae==="loading"||f.duration===1/0||f.type==="loading")return;let nt;return O||p||Te?(()=>{if(He.current<Ee.current){const sr=new Date().getTime()-Ee.current;ue.current=ue.current-sr}He.current=new Date().getTime()})():ue.current!==1/0&&(Ee.current=new Date().getTime(),nt=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),lt()},ue.current)),()=>clearTimeout(nt)},[O,p,f,ae,Te,lt]),je.useEffect(()=>{f.delete&&(lt(),f.onDismiss==null||f.onDismiss.call(f,f))},[lt,f.delete]);function st(){var nt;if(z?.loading){var Jt;return je.createElement("div",{className:nm(U?.loader,f==null||(Jt=f.classNames)==null?void 0:Jt.loader,"sonner-loader"),"data-visible":ae==="loading"},z.loading)}return je.createElement(lLt,{className:nm(U?.loader,f==null||(nt=f.classNames)==null?void 0:nt.loader),visible:ae==="loading"})}const mt=f.icon||z?.[ae]||iLt(ae);var zt,$r;return je.createElement("li",{tabIndex:0,ref:ke,className:nm(I,Ae,U?.toast,f==null||(t=f.classNames)==null?void 0:t.toast,U?.default,U?.[ae],f==null||(r=f.classNames)==null?void 0:r[ae]),"data-sonner-toast":"","data-rich-colors":(zt=f.richColors)!=null?zt:_,"data-styled":!(f.jsx||f.unstyled||h),"data-mounted":M,"data-promise":!!f.promise,"data-swiped":he,"data-removed":G,"data-visible":X,"data-y-position":St,"data-x-position":ze,"data-index":x,"data-front":Re,"data-swiping":ie,"data-dismissible":be,"data-type":ae,"data-invert":$e,"data-swipe-out":se,"data-swipe-direction":Y,"data-expanded":!!(O||F&&M),"data-testid":f.testId,style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${G?re:Fe.current}px`,"--initial-height":F?"auto":`${pe}px`,...T,...f.style},onDragEnd:()=>{te(!1),L(null),Xe.current=null},onPointerDown:nt=>{nt.button!==2&&(Ie||!be||(we.current=new Date,le(Fe.current),nt.target.setPointerCapture(nt.pointerId),nt.target.tagName!=="BUTTON"&&(te(!0),Xe.current={x:nt.clientX,y:nt.clientY})))},onPointerUp:()=>{var nt,Jt,jr;if(se||!be)return;Xe.current=null;const sr=Number(((nt=ke.current)==null?void 0:nt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Pn=Number(((Jt=ke.current)==null?void 0:Jt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),zr=new Date().getTime()-((jr=we.current)==null?void 0:jr.getTime()),Tt=W==="x"?sr:Pn,bn=Math.abs(Tt)/zr;if(Math.abs(Tt)>=ELt||bn>.11){le(Fe.current),f.onDismiss==null||f.onDismiss.call(f,f),q(W==="x"?sr>0?"right":"left":Pn>0?"down":"up"),lt(),oe(!0);return}else{var Cr,Oe;(Cr=ke.current)==null||Cr.style.setProperty("--swipe-amount-x","0px"),(Oe=ke.current)==null||Oe.style.setProperty("--swipe-amount-y","0px")}K(!1),te(!1),L(null)},onPointerMove:nt=>{var Jt,jr,sr;if(!Xe.current||!be||((Jt=window.getSelection())==null?void 0:Jt.toString().length)>0)return;const zr=nt.clientY-Xe.current.y,Tt=nt.clientX-Xe.current.x;var bn;const Cr=(bn=e.swipeDirections)!=null?bn:jLt(B);!W&&(Math.abs(Tt)>1||Math.abs(zr)>1)&&L(Math.abs(Tt)>Math.abs(zr)?"x":"y");let Oe={x:0,y:0};const Me=qe=>1/(1.5+Math.abs(qe)/20);if(W==="y"){if(Cr.includes("top")||Cr.includes("bottom"))if(Cr.includes("top")&&zr<0||Cr.includes("bottom")&&zr>0)Oe.y=zr;else{const qe=zr*Me(zr);Oe.y=Math.abs(qe)<Math.abs(zr)?qe:zr}}else if(W==="x"&&(Cr.includes("left")||Cr.includes("right")))if(Cr.includes("left")&&Tt<0||Cr.includes("right")&&Tt>0)Oe.x=Tt;else{const qe=Tt*Me(Tt);Oe.x=Math.abs(qe)<Math.abs(Tt)?qe:Tt}(Math.abs(Oe.x)>0||Math.abs(Oe.y)>0)&&K(!0),(jr=ke.current)==null||jr.style.setProperty("--swipe-amount-x",`${Oe.x}px`),(sr=ke.current)==null||sr.style.setProperty("--swipe-amount-y",`${Oe.y}px`)}},_e&&!f.jsx&&ae!=="loading"?je.createElement("button",{"aria-label":V,"data-disabled":Ie,"data-close-button":!0,onClick:Ie||!be?()=>{}:()=>{lt(),f.onDismiss==null||f.onDismiss.call(f,f)},className:nm(U?.closeButton,f==null||(n=f.classNames)==null?void 0:n.closeButton)},($r=z?.close)!=null?$r:hLt):null,(ae||f.icon||f.promise)&&f.icon!==null&&(z?.[ae]!==null||f.icon)?je.createElement("div",{"data-icon":"",className:nm(U?.icon,f==null||(s=f.classNames)==null?void 0:s.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||st():null,f.type!=="loading"?mt:null):null,je.createElement("div",{"data-content":"",className:nm(U?.content,f==null||(a=f.classNames)==null?void 0:a.content)},je.createElement("div",{"data-title":"",className:nm(U?.title,f==null||(i=f.classNames)==null?void 0:i.title)},f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title),f.description?je.createElement("div",{"data-description":"",className:nm(P,De,U?.description,f==null||(l=f.classNames)==null?void 0:l.description)},typeof f.description=="function"?f.description():f.description):null),je.isValidElement(f.cancel)?f.cancel:f.cancel&&TD(f.cancel)?je.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||j,onClick:nt=>{TD(f.cancel)&&be&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,nt),lt())},className:nm(U?.cancelButton,f==null||(c=f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,je.isValidElement(f.action)?f.action:f.action&&TD(f.action)?je.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||A,onClick:nt=>{TD(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,nt),!nt.defaultPrevented&&lt())},className:nm(U?.actionButton,f==null||(u=f.classNames)==null?void 0:u.actionButton)},f.action.label):null)};function e1e(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function NLt(e,t){const r={};return[e,t].forEach((n,s)=>{const a=s===1,i=a?"--mobile-offset":"--offset",l=a?OLt:SLt;function c(u){["top","right","bottom","left"].forEach(d=>{r[`${i}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${i}-${u}`]=l:r[`${i}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),r}const uHe=je.forwardRef(function(t,r){const{id:n,invert:s,position:a="bottom-right",hotkey:i=["altKey","KeyT"],expand:l,closeButton:c,className:u,offset:d,mobileOffset:f,theme:h="light",richColors:p,duration:m,style:g,visibleToasts:y=wLt,toastOptions:x,dir:w=e1e(),gap:O=_Lt,icons:k,containerAriaLabel:_="Notifications"}=t,[E,T]=je.useState([]),j=je.useMemo(()=>n?E.filter(M=>M.toasterId===n):E.filter(M=>!M.toasterId),[E,n]),A=je.useMemo(()=>Array.from(new Set([a].concat(j.filter(M=>M.position).map(M=>M.position)))),[j,a]),[I,P]=je.useState([]),[R,B]=je.useState(!1),[D,F]=je.useState(!1),[U,z]=je.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=je.useRef(null),W=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),L=je.useRef(null),Y=je.useRef(!1),q=je.useCallback(M=>{T(Q=>{var G;return(G=Q.find(J=>J.id===M.id))!=null&&G.delete||xu.dismiss(M.id),Q.filter(({id:J})=>J!==M.id)})},[]);return je.useEffect(()=>xu.subscribe(M=>{if(M.dismiss){requestAnimationFrame(()=>{T(Q=>Q.map(G=>G.id===M.id?{...G,delete:!0}:G))});return}setTimeout(()=>{Ooe.flushSync(()=>{T(Q=>{const G=Q.findIndex(J=>J.id===M.id);return G!==-1?[...Q.slice(0,G),{...Q[G],...M},...Q.slice(G+1)]:[M,...Q]})})})}),[E]),je.useEffect(()=>{if(h!=="system"){z(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;const M=window.matchMedia("(prefers-color-scheme: dark)");try{M.addEventListener("change",({matches:Q})=>{z(Q?"dark":"light")})}catch{M.addListener(({matches:G})=>{try{z(G?"dark":"light")}catch(J){console.error(J)}})}},[h]),je.useEffect(()=>{E.length<=1&&B(!1)},[E]),je.useEffect(()=>{const M=Q=>{var G;if(i.every(te=>Q[te]||Q.code===te)){var ie;B(!0),(ie=V.current)==null||ie.focus()}Q.code==="Escape"&&(document.activeElement===V.current||(G=V.current)!=null&&G.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[i]),je.useEffect(()=>{if(V.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,Y.current=!1)}},[V.current]),je.createElement("section",{ref:r,"aria-label":`${_} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((M,Q)=>{var G;const[J,ie]=M.split("-");return j.length?je.createElement("ol",{key:M,dir:w==="auto"?e1e():w,tabIndex:-1,ref:V,className:u,"data-sonner-toaster":!0,"data-sonner-theme":U,"data-y-position":J,"data-x-position":ie,style:{"--front-toast-height":`${((G=I[0])==null?void 0:G.height)||0}px`,"--width":`${kLt}px`,"--gap":`${O}px`,...g,...NLt(d,f)},onBlur:te=>{Y.current&&!te.currentTarget.contains(te.relatedTarget)&&(Y.current=!1,L.current&&(L.current.focus({preventScroll:!0}),L.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||Y.current||(Y.current=!0,L.current=te.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{D||B(!1)},onDragEnd:()=>B(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||F(!0)},onPointerUp:()=>F(!1)},j.filter(te=>!te.position&&Q===0||te.position===M).map((te,se)=>{var oe,he;return je.createElement(TLt,{key:te.id,icons:k,index:se,toast:te,defaultRichColors:p,duration:(oe=x?.duration)!=null?oe:m,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:s,visibleToasts:y,closeButton:(he=x?.closeButton)!=null?he:c,interacting:D,position:M,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:q,toasts:j.filter(K=>K.position==te.position),heights:I.filter(K=>K.position==te.position),setHeights:P,expandByDefault:l,gap:O,expanded:R,swipeDirections:t.swipeDirections})})):null}))}),t1e=e=>{let t;const r=new Set,n=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(p=>p(t,h))}},s=()=>t,l={setState:n,getState:s,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(n,s,l);return l},ALt=(e=>e?t1e(e):t1e),ILt=e=>e;function RLt(e,t=ILt){const r=je.useSyncExternalStore(e.subscribe,je.useCallback(()=>t(e.getState()),[e,t]),je.useCallback(()=>t(e.getInitialState()),[e,t]));return je.useDebugValue(r),r}const r1e=e=>{const t=ALt(e),r=n=>RLt(t,n);return Object.assign(r,t),r},Ule=(e=>e?r1e(e):r1e);function PLt(e,t){let r;try{r=e()}catch{return}return{getItem:s=>{var a;const i=c=>c===null?null:JSON.parse(c,void 0),l=(a=r.getItem(s))!=null?a:null;return l instanceof Promise?l.then(i):i(l)},setItem:(s,a)=>r.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>r.removeItem(s)}}const bre=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return bre(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return bre(n)(r)}}}},MLt=(e,t)=>(r,n,s)=>{let a={storage:PLt(()=>window.localStorage),partialize:y=>y,version:0,merge:(y,x)=>({...x,...y}),...t},i=!1,l=0;const c=new Set,u=new Set;let d=a.storage;if(!d)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...y)},n,s);const f=()=>{const y=a.partialize({...n()});return d.setItem(a.name,{state:y,version:a.version})},h=s.setState;s.setState=(y,x)=>(h(y,x),f());const p=e((...y)=>(r(...y),f()),n,s);s.getInitialState=()=>p;let m;const g=()=>{var y,x;if(!d)return;const w=++l;i=!1,c.forEach(k=>{var _;return k((_=n())!=null?_:p)});const O=((x=a.onRehydrateStorage)==null?void 0:x.call(a,(y=n())!=null?y:p))||void 0;return bre(d.getItem.bind(d))(a.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==a.version){if(a.migrate){const _=a.migrate(k.state,k.version);return _ instanceof Promise?_.then(E=>[!0,E]):[!0,_]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var _;if(w!==l)return;const[E,T]=k;if(m=a.merge(T,(_=n())!=null?_:p),r(m,!0),E)return f()}).then(()=>{w===l&&(O?.(n(),void 0),m=n(),i=!0,u.forEach(k=>k(m)))}).catch(k=>{w===l&&O?.(void 0,k)})};return s.persist={setOptions:y=>{a={...a,...y},y.storage&&(d=y.storage)},clearStorage:()=>{d?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>g(),hasHydrated:()=>i,onHydrate:y=>(c.add(y),()=>{c.delete(y)}),onFinishHydration:y=>(u.add(y),()=>{u.delete(y)})},a.skipHydration||g(),m||p},DLt=MLt;var dHe="vercel.ai.error",LLt=Symbol.for(dHe),fHe,$Lt=class hHe extends Error{constructor({name:t,message:r,cause:n}){super(r),this[fHe]=!0,this.name=t,this.cause=n}static isInstance(t){return hHe.hasMarker(t,dHe)}static hasMarker(t,r){const n=Symbol.for(r);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}};fHe=LLt;var Jk=$Lt;function pHe(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var mHe="AI_InvalidArgumentError",gHe=`vercel.ai.error.${mHe}`,FLt=Symbol.for(gHe),yHe,zLt=class extends Jk{constructor({message:t,cause:r,argument:n}){super({name:mHe,message:t,cause:r}),this[yHe]=!0,this.argument=n}static isInstance(t){return Jk.hasMarker(t,gHe)}};yHe=FLt;var vHe="AI_JSONParseError",bHe=`vercel.ai.error.${vHe}`,BLt=Symbol.for(bHe),xHe,n1e=class extends Jk{constructor({text:t,cause:r}){super({name:vHe,message:`JSON parsing failed: Text: ${t}.
41
41
  Error message: ${pHe(r)}`,cause:r}),this[xHe]=!0,this.text=t}static isInstance(t){return Jk.hasMarker(t,bHe)}};xHe=BLt;var wHe="AI_TypeValidationError",SHe=`vercel.ai.error.${wHe}`,ULt=Symbol.for(SHe),OHe,VLt=class xre extends Jk{constructor({value:t,cause:r}){super({name:wHe,message:`Type validation failed: Value: ${JSON.stringify(t)}.
42
42
  Error message: ${pHe(r)}`,cause:r}),this[OHe]=!0,this.value=t}static isInstance(t){return Jk.hasMarker(t,SHe)}static wrap({value:t,cause:r}){return xre.isInstance(r)&&r.value===t?r:new xre({value:t,cause:r})}};OHe=ULt;var s1e=VLt;let qLt=(e,t=21)=>(r=t)=>{let n="",s=r|0;for(;s--;)n+=e[Math.random()*e.length|0];return n};var E0={exports:{}},a1e;function HLt(){if(a1e)return E0.exports;a1e=1;const e=typeof Buffer<"u",t=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,r=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function n(l,c,u){u==null&&c!==null&&typeof c=="object"&&(u=c,c=void 0),e&&Buffer.isBuffer(l)&&(l=l.toString()),l&&l.charCodeAt(0)===65279&&(l=l.slice(1));const d=JSON.parse(l,c);if(d===null||typeof d!="object")return d;const f=u&&u.protoAction||"error",h=u&&u.constructorAction||"error";if(f==="ignore"&&h==="ignore")return d;if(f!=="ignore"&&h!=="ignore"){if(t.test(l)===!1&&r.test(l)===!1)return d}else if(f!=="ignore"&&h==="ignore"){if(t.test(l)===!1)return d}else if(r.test(l)===!1)return d;return s(d,{protoAction:f,constructorAction:h,safe:u&&u.safe})}function s(l,{protoAction:c="error",constructorAction:u="error",safe:d}={}){let f=[l];for(;f.length;){const h=f;f=[];for(const p of h){if(c!=="ignore"&&Object.prototype.hasOwnProperty.call(p,"__proto__")){if(d===!0)return null;if(c==="error")throw new SyntaxError("Object contains forbidden prototype property");delete p.__proto__}if(u!=="ignore"&&Object.prototype.hasOwnProperty.call(p,"constructor")&&Object.prototype.hasOwnProperty.call(p.constructor,"prototype")){if(d===!0)return null;if(u==="error")throw new SyntaxError("Object contains forbidden prototype property");delete p.constructor}for(const m in p){const g=p[m];g&&typeof g=="object"&&f.push(g)}}}return l}function a(l,c,u){const d=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return n(l,c,u)}finally{Error.stackTraceLimit=d}}function i(l,c){const u=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return n(l,c,{safe:!0})}catch{return null}finally{Error.stackTraceLimit=u}}return E0.exports=a,E0.exports.default=a,E0.exports.parse=a,E0.exports.safeParse=i,E0.exports.scan=s,E0.exports}var QLt=HLt();const WLt=$o(QLt);var GLt=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const s=qLt(r,t);if(e==null)return s;if(r.includes(n))throw new zLt({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return a=>`${e}${n}${s(a)}`};GLt();var wre=Symbol.for("vercel.ai.validator");function ZLt(e){return{[wre]:!0,validate:e}}function YLt(e){return typeof e=="object"&&e!==null&&wre in e&&e[wre]===!0&&"validate"in e}function XLt(e){return YLt(e)?e:KLt(e)}function KLt(e){return ZLt(t=>{const r=e.safeParse(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}})}function JLt({value:e,schema:t}){const r=XLt(t);try{if(r.validate==null)return{success:!0,value:e};const n=r.validate(e);return n.success?n:{success:!1,error:s1e.wrap({value:e,cause:n.error})}}catch(n){return{success:!1,error:s1e.wrap({value:e,cause:n})}}}function i1e({text:e,schema:t}){try{const r=WLt.parse(e);if(t==null)return{success:!0,value:r,rawValue:r};const n=JLt({value:r,schema:t});return n.success?{...n,rawValue:r}:n}catch(r){return{success:!1,error:n1e.isInstance(r)?r:new n1e({text:e,cause:r})}}}const kHe=Symbol("Let zodToJsonSchema decide on which parser to use"),o1e={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},e$t=e=>typeof e=="string"?{...o1e,name:e}:{...o1e,...e},t$t=e=>{const t=e$t(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function _He(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function fa(e,t,r,n,s){e[t]=r,_He(e,t,n,s)}const EHe=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};var Ts;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},e.getValidEnumValues=s=>{const a=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),i={};for(const l of a)i[l]=s[l];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(a){return s[a]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},e.find=(s,a)=>{for(const i of s)if(a(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(Ts||(Ts={}));var Sre;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Sre||(Sre={}));const Er=Ts.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),my=e=>{switch(typeof e){case"undefined":return Er.undefined;case"string":return Er.string;case"number":return Number.isNaN(e)?Er.nan:Er.number;case"boolean":return Er.boolean;case"function":return Er.function;case"bigint":return Er.bigint;case"symbol":return Er.symbol;case"object":return Array.isArray(e)?Er.array:e===null?Er.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Er.promise:typeof Map<"u"&&e instanceof Map?Er.map:typeof Set<"u"&&e instanceof Set?Er.set:typeof Date<"u"&&e instanceof Date?Er.date:Er.object;default:return Er.unknown}},Ct=Ts.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);let mx=class CHe extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let l=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(r(i))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return s(this),n}static assert(t){if(!(t instanceof CHe))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ts.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r=Object.create(null),n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(t(s))}else n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};mx.create=e=>new mx(e);const K$=(e,t)=>{let r;switch(e.code){case Ct.invalid_type:e.received===Er.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ct.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ts.jsonStringifyReplacer)}`;break;case Ct.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ts.joinValues(e.keys,", ")}`;break;case Ct.invalid_union:r="Invalid input";break;case Ct.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ts.joinValues(e.options)}`;break;case Ct.invalid_enum_value:r=`Invalid enum value. Expected ${Ts.joinValues(e.options)}, received '${e.received}'`;break;case Ct.invalid_arguments:r="Invalid function arguments";break;case Ct.invalid_return_type:r="Invalid function return type";break;case Ct.invalid_date:r="Invalid date";break;case Ct.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ts.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ct.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Ct.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Ct.custom:r="Invalid input";break;case Ct.invalid_intersection_types:r="Intersection results could not be merged";break;case Ct.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ct.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ts.assertNever(e)}return{message:r}};let r$t=K$;function jHe(){return r$t}const THe=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let l="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)l=u(i,{data:t,defaultError:l}).message;return{...s,path:a,message:l}};function tr(e,t){const r=jHe(),n=THe({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===K$?void 0:K$].filter(s=>!!s)});e.common.issues.push(n)}let ph=class NHe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return pn;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return NHe.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return pn;a.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:t.value,value:n}}};const pn=Object.freeze({status:"aborted"}),LO=e=>({status:"dirty",value:e}),mf=e=>({status:"valid",value:e}),Ore=e=>e.status==="aborted",kre=e=>e.status==="dirty",Qw=e=>e.status==="valid",zN=e=>typeof Promise<"u"&&e instanceof Promise;var Pr;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Pr||(Pr={}));let gx=class{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const l1e=(e,t)=>{if(Qw(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new mx(e.common.issues);return this._error=r,this._error}}};function Zn(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,l)=>{const{message:c}=e;return i.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??n??l.defaultError}:i.code!=="invalid_type"?{message:l.defaultError}:{message:c??r??l.defaultError}},description:s}}let hs=class{get description(){return this._def.description}_getType(t){return my(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:my(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ph,ctx:{common:t.parent.common,data:t.data,parsedType:my(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(zN(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:my(t)},s=this._parseSync({data:t,path:n.path,parent:n});return l1e(n,s)}"~validate"(t){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:my(t)};if(!this["~standard"].async)try{const n=this._parseSync({data:t,path:[],parent:r});return Qw(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Qw(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:my(t)},s=this._parse({data:t,path:n.path,parent:n}),a=await(zN(s)?s:Promise.resolve(s));return l1e(n,a)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const i=t(s),l=()=>a.addIssue({code:Ct.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(l(),!1)):i?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new yx({schema:this,typeName:Pe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Iy.create(this,this._def)}nullable(){return Gw.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ww.create(this)}promise(){return VN.create(this,this._def)}or(t){return BN.create([this,t],this._def)}and(t){return UN.create(this,t,this._def)}transform(t){return new yx({...Zn(this._def),schema:this,typeName:Pe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new J$({...Zn(this._def),innerType:this,defaultValue:r,typeName:Pe.ZodDefault})}brand(){return new LHe({typeName:Pe.ZodBranded,type:this,...Zn(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new e3({...Zn(this._def),innerType:this,catchValue:r,typeName:Pe.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return $He.create(this,t)}readonly(){return t3.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const n$t=/^c[^\s-]{8,}$/i,s$t=/^[0-9a-z]+$/,a$t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,i$t=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,o$t=/^[a-z0-9_-]{21}$/i,l$t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,c$t=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,u$t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,d$t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let oU;const f$t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,h$t=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,p$t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,m$t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,g$t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,y$t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,AHe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",v$t=new RegExp(`^${AHe}$`);function IHe(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function b$t(e){return new RegExp(`^${IHe(e)}$`)}function RHe(e){let t=`${AHe}T${IHe(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function x$t(e,t){return!!((t==="v4"||!t)&&f$t.test(e)||(t==="v6"||!t)&&p$t.test(e))}function w$t(e,t){if(!l$t.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function S$t(e,t){return!!((t==="v4"||!t)&&h$t.test(e)||(t==="v6"||!t)&&m$t.test(e))}let _re=class eT extends hs{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Er.string){const a=this._getOrReturnCtx(t);return tr(a,{code:Ct.invalid_type,expected:Er.string,received:a.parsedType}),pn}const n=new ph;let s;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=t.data.length>a.value,l=t.data.length<a.value;(i||l)&&(s=this._getOrReturnCtx(t,s),i?tr(s,{code:Ct.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&tr(s,{code:Ct.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")u$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"email",code:Ct.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")oU||(oU=new RegExp(d$t,"u")),oU.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"emoji",code:Ct.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")i$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"uuid",code:Ct.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")o$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"nanoid",code:Ct.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")n$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"cuid",code:Ct.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")s$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"cuid2",code:Ct.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")a$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"ulid",code:Ct.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),tr(s,{validation:"url",code:Ct.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"regex",code:Ct.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?RHe(a).test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?v$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?b$t(a).test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?c$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"duration",code:Ct.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?x$t(t.data,a.version)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"ip",code:Ct.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?w$t(t.data,a.alg)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"jwt",code:Ct.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?S$t(t.data,a.version)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"cidr",code:Ct.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?g$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"base64",code:Ct.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?y$t.test(t.data)||(s=this._getOrReturnCtx(t,s),tr(s,{validation:"base64url",code:Ct.invalid_string,message:a.message}),n.dirty()):Ts.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:Ct.invalid_string,...Pr.errToObj(n)})}_addCheck(t){return new eT({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Pr.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Pr.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Pr.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Pr.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Pr.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Pr.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Pr.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Pr.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Pr.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Pr.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Pr.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Pr.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Pr.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Pr.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Pr.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Pr.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Pr.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Pr.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Pr.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Pr.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Pr.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Pr.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Pr.errToObj(r)})}nonempty(t){return this.min(1,Pr.errToObj(t))}trim(){return new eT({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new eT({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new eT({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};_re.create=e=>new _re({checks:[],typeName:Pe.ZodString,coerce:e?.coerce??!1,...Zn(e)});function O$t(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return a%i/10**s}let Ere=class Cre extends hs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Er.number){const a=this._getOrReturnCtx(t);return tr(a,{code:Ct.invalid_type,expected:Er.number,received:a.parsedType}),pn}let n;const s=new ph;for(const a of this._def.checks)a.kind==="int"?Ts.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),tr(n,{code:Ct.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),tr(n,{code:Ct.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),tr(n,{code:Ct.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?O$t(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),tr(n,{code:Ct.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),tr(n,{code:Ct.not_finite,message:a.message}),s.dirty()):Ts.assertNever(a);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Pr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Pr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Pr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Pr.toString(r))}setLimit(t,r,n,s){return new Cre({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Pr.toString(s)}]})}_addCheck(t){return new Cre({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Pr.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Pr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Pr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Pr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Pr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Pr.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Pr.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Pr.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Pr.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ts.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Ere.create=e=>new Ere({checks:[],typeName:Pe.ZodNumber,coerce:e?.coerce||!1,...Zn(e)});let jre=class Tre extends hs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Er.bigint)return this._getInvalidInput(t);let n;const s=new ph;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),tr(n,{code:Ct.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),tr(n,{code:Ct.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),tr(n,{code:Ct.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):Ts.assertNever(a);return{status:s.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return tr(r,{code:Ct.invalid_type,expected:Er.bigint,received:r.parsedType}),pn}gte(t,r){return this.setLimit("min",t,!0,Pr.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Pr.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Pr.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Pr.toString(r))}setLimit(t,r,n,s){return new Tre({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Pr.toString(s)}]})}_addCheck(t){return new Tre({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Pr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Pr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Pr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Pr.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Pr.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};jre.create=e=>new jre({checks:[],typeName:Pe.ZodBigInt,coerce:e?.coerce??!1,...Zn(e)});let Nre=class extends hs{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Er.boolean){const n=this._getOrReturnCtx(t);return tr(n,{code:Ct.invalid_type,expected:Er.boolean,received:n.parsedType}),pn}return mf(t.data)}};Nre.create=e=>new Nre({typeName:Pe.ZodBoolean,coerce:e?.coerce||!1,...Zn(e)});let Are=class PHe extends hs{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Er.date){const a=this._getOrReturnCtx(t);return tr(a,{code:Ct.invalid_type,expected:Er.date,received:a.parsedType}),pn}if(Number.isNaN(t.data.getTime())){const a=this._getOrReturnCtx(t);return tr(a,{code:Ct.invalid_date}),pn}const n=new ph;let s;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(s=this._getOrReturnCtx(t,s),tr(s,{code:Ct.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ts.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new PHe({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Pr.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Pr.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Are.create=e=>new Are({checks:[],coerce:e?.coerce||!1,typeName:Pe.ZodDate,...Zn(e)});let Ire=class extends hs{_parse(t){if(this._getType(t)!==Er.symbol){const n=this._getOrReturnCtx(t);return tr(n,{code:Ct.invalid_type,expected:Er.symbol,received:n.parsedType}),pn}return mf(t.data)}};Ire.create=e=>new Ire({typeName:Pe.ZodSymbol,...Zn(e)});let Rre=class extends hs{_parse(t){if(this._getType(t)!==Er.undefined){const n=this._getOrReturnCtx(t);return tr(n,{code:Ct.invalid_type,expected:Er.undefined,received:n.parsedType}),pn}return mf(t.data)}};Rre.create=e=>new Rre({typeName:Pe.ZodUndefined,...Zn(e)});let Pre=class extends hs{_parse(t){if(this._getType(t)!==Er.null){const n=this._getOrReturnCtx(t);return tr(n,{code:Ct.invalid_type,expected:Er.null,received:n.parsedType}),pn}return mf(t.data)}};Pre.create=e=>new Pre({typeName:Pe.ZodNull,...Zn(e)});let Mre=class extends hs{constructor(){super(...arguments),this._any=!0}_parse(t){return mf(t.data)}};Mre.create=e=>new Mre({typeName:Pe.ZodAny,...Zn(e)});let Dre=class extends hs{constructor(){super(...arguments),this._unknown=!0}_parse(t){return mf(t.data)}};Dre.create=e=>new Dre({typeName:Pe.ZodUnknown,...Zn(e)});let Uy=class extends hs{_parse(t){const r=this._getOrReturnCtx(t);return tr(r,{code:Ct.invalid_type,expected:Er.never,received:r.parsedType}),pn}};Uy.create=e=>new Uy({typeName:Pe.ZodNever,...Zn(e)});let Lre=class extends hs{_parse(t){if(this._getType(t)!==Er.undefined){const n=this._getOrReturnCtx(t);return tr(n,{code:Ct.invalid_type,expected:Er.void,received:n.parsedType}),pn}return mf(t.data)}};Lre.create=e=>new Lre({typeName:Pe.ZodVoid,...Zn(e)});let Ww=class CL extends hs{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==Er.array)return tr(r,{code:Ct.invalid_type,expected:Er.array,received:r.parsedType}),pn;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,l=r.data.length<s.exactLength.value;(i||l)&&(tr(r,{code:i?Ct.too_big:Ct.too_small,minimum:l?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(tr(r,{code:Ct.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(tr(r,{code:Ct.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,l)=>s.type._parseAsync(new gx(r,i,r.path,l)))).then(i=>ph.mergeArray(n,i));const a=[...r.data].map((i,l)=>s.type._parseSync(new gx(r,i,r.path,l)));return ph.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new CL({...this._def,minLength:{value:t,message:Pr.toString(r)}})}max(t,r){return new CL({...this._def,maxLength:{value:t,message:Pr.toString(r)}})}length(t,r){return new CL({...this._def,exactLength:{value:t,message:Pr.toString(r)}})}nonempty(t){return this.min(1,t)}};Ww.create=(e,t)=>new Ww({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pe.ZodArray,...Zn(t)});function SO(e){if(e instanceof Vy){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Iy.create(SO(n))}return new Vy({...e._def,shape:()=>t})}else return e instanceof Ww?new Ww({...e._def,type:SO(e.element)}):e instanceof Iy?Iy.create(SO(e.unwrap())):e instanceof Gw?Gw.create(SO(e.unwrap())):e instanceof e_?e_.create(e.items.map(t=>SO(t))):e}let Vy=class Zh extends hs{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=Ts.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Er.object){const u=this._getOrReturnCtx(t);return tr(u,{code:Ct.invalid_type,expected:Er.object,received:u.parsedType}),pn}const{status:n,ctx:s}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),l=[];if(!(this._def.catchall instanceof Uy&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||l.push(u);const c=[];for(const u of i){const d=a[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new gx(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Uy){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(tr(s,{code:Ct.unrecognized_keys,keys:l}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new gx(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>ph.mergeObjectSync(n,u)):ph.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Pr.errToObj,new Zh({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Pr.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new Zh({...this._def,unknownKeys:"strip"})}passthrough(){return new Zh({...this._def,unknownKeys:"passthrough"})}extend(t){return new Zh({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Zh({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Pe.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Zh({...this._def,catchall:t})}pick(t){const r={};for(const n of Ts.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Zh({...this._def,shape:()=>r})}omit(t){const r={};for(const n of Ts.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new Zh({...this._def,shape:()=>r})}deepPartial(){return SO(this)}partial(t){const r={};for(const n of Ts.objectKeys(this.shape)){const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}return new Zh({...this._def,shape:()=>r})}required(t){const r={};for(const n of Ts.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Iy;)a=a._def.innerType;r[n]=a}return new Zh({...this._def,shape:()=>r})}keyof(){return DHe(Ts.objectKeys(this.shape))}};Vy.create=(e,t)=>new Vy({shape:()=>e,unknownKeys:"strip",catchall:Uy.create(),typeName:Pe.ZodObject,...Zn(t)});Vy.strictCreate=(e,t)=>new Vy({shape:()=>e,unknownKeys:"strict",catchall:Uy.create(),typeName:Pe.ZodObject,...Zn(t)});Vy.lazycreate=(e,t)=>new Vy({shape:e,unknownKeys:"strip",catchall:Uy.create(),typeName:Pe.ZodObject,...Zn(t)});let BN=class extends hs{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(a){for(const l of a)if(l.result.status==="valid")return l.result;for(const l of a)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;const i=a.map(l=>new mx(l.ctx.common.issues));return tr(r,{code:Ct.invalid_union,unionErrors:i}),pn}if(r.common.async)return Promise.all(n.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const l=i.map(c=>new mx(c));return tr(r,{code:Ct.invalid_union,unionErrors:l}),pn}}get options(){return this._def.options}};BN.create=(e,t)=>new BN({options:e,typeName:Pe.ZodUnion,...Zn(t)});function $re(e,t){const r=my(e),n=my(t);if(e===t)return{valid:!0,data:e};if(r===Er.object&&n===Er.object){const s=Ts.objectKeys(t),a=Ts.objectKeys(e).filter(l=>s.indexOf(l)!==-1),i={...e,...t};for(const l of a){const c=$re(e[l],t[l]);if(!c.valid)return{valid:!1};i[l]=c.data}return{valid:!0,data:i}}else if(r===Er.array&&n===Er.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const i=e[a],l=t[a],c=$re(i,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===Er.date&&n===Er.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}let UN=class extends hs{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(a,i)=>{if(Ore(a)||Ore(i))return pn;const l=$re(a.value,i.value);return l.valid?((kre(a)||kre(i))&&r.dirty(),{status:r.value,value:l.data}):(tr(n,{code:Ct.invalid_intersection_types}),pn)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};UN.create=(e,t,r)=>new UN({left:e,right:t,typeName:Pe.ZodIntersection,...Zn(r)});let e_=class MHe extends hs{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Er.array)return tr(n,{code:Ct.invalid_type,expected:Er.array,received:n.parsedType}),pn;if(n.data.length<this._def.items.length)return tr(n,{code:Ct.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pn;!this._def.rest&&n.data.length>this._def.items.length&&(tr(n,{code:Ct.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new gx(n,i,n.path,l)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>ph.mergeArray(r,i)):ph.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new MHe({...this._def,rest:t})}};e_.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new e_({items:e,typeName:Pe.ZodTuple,rest:null,...Zn(t)})};let Fre=class extends hs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Er.map)return tr(n,{code:Ct.invalid_type,expected:Er.map,received:n.parsedType}),pn;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([l,c],u)=>({key:s._parse(new gx(n,l,n.path,[u,"key"])),value:a._parse(new gx(n,c,n.path,[u,"value"]))}));if(n.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return pn;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(u.value,d.value)}return{status:r.value,value:l}})}else{const l=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return pn;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(u.value,d.value)}return{status:r.value,value:l}}}};Fre.create=(e,t,r)=>new Fre({valueType:t,keyType:e,typeName:Pe.ZodMap,...Zn(r)});let zre=class Bre extends hs{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Er.set)return tr(n,{code:Ct.invalid_type,expected:Er.set,received:n.parsedType}),pn;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(tr(n,{code:Ct.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(tr(n,{code:Ct.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return pn;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const l=[...n.data.values()].map((c,u)=>a._parse(new gx(n,c,n.path,u)));return n.common.async?Promise.all(l).then(c=>i(c)):i(l)}min(t,r){return new Bre({...this._def,minSize:{value:t,message:Pr.toString(r)}})}max(t,r){return new Bre({...this._def,maxSize:{value:t,message:Pr.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};zre.create=(e,t)=>new zre({valueType:e,minSize:null,maxSize:null,typeName:Pe.ZodSet,...Zn(t)});let Ure=class extends hs{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ure.create=(e,t)=>new Ure({getter:e,typeName:Pe.ZodLazy,...Zn(t)});let Vre=class extends hs{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return tr(r,{received:r.data,code:Ct.invalid_literal,expected:this._def.value}),pn}return{status:"valid",value:t.data}}get value(){return this._def.value}};Vre.create=(e,t)=>new Vre({value:e,typeName:Pe.ZodLiteral,...Zn(t)});function DHe(e,t){return new I6({values:e,typeName:Pe.ZodEnum,...Zn(t)})}let I6=class qre extends hs{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return tr(r,{expected:Ts.joinValues(n),received:r.parsedType,code:Ct.invalid_type}),pn}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return tr(r,{received:r.data,code:Ct.invalid_enum_value,options:n}),pn}return mf(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return qre.create(t,{...this._def,...r})}exclude(t,r=this._def){return qre.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};I6.create=DHe;let Hre=class extends hs{_parse(t){const r=Ts.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Er.string&&n.parsedType!==Er.number){const s=Ts.objectValues(r);return tr(n,{expected:Ts.joinValues(s),received:n.parsedType,code:Ct.invalid_type}),pn}if(this._cache||(this._cache=new Set(Ts.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=Ts.objectValues(r);return tr(n,{received:n.data,code:Ct.invalid_enum_value,options:s}),pn}return mf(t.data)}get enum(){return this._def.values}};Hre.create=(e,t)=>new Hre({values:e,typeName:Pe.ZodNativeEnum,...Zn(t)});let VN=class extends hs{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==Er.promise&&r.common.async===!1)return tr(r,{code:Ct.invalid_type,expected:Er.promise,received:r.parsedType}),pn;const n=r.parsedType===Er.promise?r.data:Promise.resolve(r.data);return mf(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};VN.create=(e,t)=>new VN({type:e,typeName:Pe.ZodPromise,...Zn(t)});let yx=class extends hs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:i=>{tr(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async l=>{if(r.value==="aborted")return pn;const c=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return c.status==="aborted"?pn:c.status==="dirty"||r.value==="dirty"?LO(c.value):c});{if(r.value==="aborted")return pn;const l=this._def.schema._parseSync({data:i,path:n.path,parent:n});return l.status==="aborted"?pn:l.status==="dirty"||r.value==="dirty"?LO(l.value):l}}if(s.type==="refinement"){const i=l=>{const c=s.refinement(l,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?pn:(l.status==="dirty"&&r.dirty(),i(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?pn:(l.status==="dirty"&&r.dirty(),i(l.value).then(()=>({status:r.value,value:l.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Qw(i))return pn;const l=s.transform(i.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Qw(i)?Promise.resolve(s.transform(i.value,a)).then(l=>({status:r.value,value:l})):pn);Ts.assertNever(s)}};yx.create=(e,t,r)=>new yx({schema:e,typeName:Pe.ZodEffects,effect:t,...Zn(r)});yx.createWithPreprocess=(e,t,r)=>new yx({schema:t,effect:{type:"preprocess",transform:e},typeName:Pe.ZodEffects,...Zn(r)});let Iy=class extends hs{_parse(t){return this._getType(t)===Er.undefined?mf(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Iy.create=(e,t)=>new Iy({innerType:e,typeName:Pe.ZodOptional,...Zn(t)});let Gw=class extends hs{_parse(t){return this._getType(t)===Er.null?mf(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Gw.create=(e,t)=>new Gw({innerType:e,typeName:Pe.ZodNullable,...Zn(t)});let J$=class extends hs{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===Er.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};J$.create=(e,t)=>new J$({innerType:e,typeName:Pe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Zn(t)});let e3=class extends hs{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return zN(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new mx(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new mx(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};e3.create=(e,t)=>new e3({innerType:e,typeName:Pe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Zn(t)});let Qre=class extends hs{_parse(t){if(this._getType(t)!==Er.nan){const n=this._getOrReturnCtx(t);return tr(n,{code:Ct.invalid_type,expected:Er.nan,received:n.parsedType}),pn}return{status:"valid",value:t.data}}};Qre.create=e=>new Qre({typeName:Pe.ZodNaN,...Zn(e)});let LHe=class extends hs{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},$He=class FHe extends hs{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?pn:a.status==="dirty"?(r.dirty(),LO(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?pn:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new FHe({in:t,out:r,typeName:Pe.ZodPipeline})}},t3=class extends hs{_parse(t){const r=this._def.innerType._parse(t),n=s=>(Qw(s)&&(s.value=Object.freeze(s.value)),s);return zN(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};t3.create=(e,t)=>new t3({innerType:e,typeName:Pe.ZodReadonly,...Zn(t)});var Pe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Pe||(Pe={}));Uy.create;Ww.create;BN.create;UN.create;e_.create;I6.create;VN.create;Iy.create;Gw.create;const k$t=Object.freeze(Object.defineProperty({__proto__:null,DIRTY:LO,INVALID:pn,OK:mf,ParseStatus:ph,Schema:hs,ZodAny:Mre,ZodArray:Ww,ZodBigInt:jre,ZodBoolean:Nre,ZodBranded:LHe,ZodCatch:e3,ZodDate:Are,ZodDefault:J$,ZodEffects:yx,ZodEnum:I6,ZodError:mx,get ZodFirstPartyTypeKind(){return Pe},ZodIntersection:UN,ZodIssueCode:Ct,ZodLazy:Ure,ZodLiteral:Vre,ZodMap:Fre,ZodNaN:Qre,ZodNativeEnum:Hre,ZodNever:Uy,ZodNull:Pre,ZodNullable:Gw,ZodNumber:Ere,ZodObject:Vy,ZodOptional:Iy,ZodParsedType:Er,ZodPipeline:$He,ZodPromise:VN,ZodReadonly:t3,ZodSchema:hs,ZodSet:zre,ZodString:_re,ZodSymbol:Ire,ZodTransformer:yx,ZodTuple:e_,ZodType:hs,ZodUndefined:Rre,ZodUnion:BN,ZodUnknown:Dre,ZodVoid:Lre,addIssueToContext:tr,datetimeRegex:RHe,defaultErrorMap:K$,getErrorMap:jHe,getParsedType:my,isAborted:Ore,isAsync:zN,isDirty:kre,isValid:Qw,makeIssue:THe,get objectUtil(){return Sre},get util(){return Ts}},Symbol.toStringTag,{value:"Module"}));function Hu(e){if(e.target!=="openAi")return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?EHe(t,e.currentPath):t.join("/")}}function _$t(e,t){const r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Pe.ZodAny&&(r.items=Qs(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&fa(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&fa(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(fa(r,"minItems",e.exactLength.value,e.exactLength.message,t),fa(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function E$t(e,t){const r={type:"integer",format:"int64"};if(!e.checks)return r;for(const n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?fa(r,"minimum",n.value,n.message,t):fa(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),fa(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?fa(r,"maximum",n.value,n.message,t):fa(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),fa(r,"maximum",n.value,n.message,t));break;case"multipleOf":fa(r,"multipleOf",n.value,n.message,t);break}return r}function C$t(){return{type:"boolean"}}function zHe(e,t){return Qs(e.type._def,t)}const j$t=(e,t)=>Qs(e.innerType._def,t);function BHe(e,t,r){const n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((s,a)=>BHe(e,t,s))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return T$t(e,t)}}const T$t=(e,t)=>{const r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(const n of e.checks)switch(n.kind){case"min":fa(r,"minimum",n.value,n.message,t);break;case"max":fa(r,"maximum",n.value,n.message,t);break}return r};function N$t(e,t){return{...Qs(e.innerType._def,t),default:e.defaultValue()}}function A$t(e,t){return t.effectStrategy==="input"?Qs(e.schema._def,t):Hu(t)}function I$t(e){return{type:"string",enum:Array.from(e.values)}}const R$t=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function P$t(e,t){const r=[Qs(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Qs(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(a=>!!a);let n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const s=[];return r.forEach(a=>{if(R$t(a))s.push(...a.allOf),a.unevaluatedProperties===void 0&&(n=void 0);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){const{additionalProperties:l,...c}=a;i=c}else n=void 0;s.push(i)}}),s.length?{allOf:s,...n}:void 0}function M$t(e,t){const r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}let lU;const $h={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(lU===void 0&&(lU=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),lU),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function UHe(e,t){const r={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":fa(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":fa(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Fh(r,"email",n.message,t);break;case"format:idn-email":Fh(r,"idn-email",n.message,t);break;case"pattern:zod":Tc(r,$h.email,n.message,t);break}break;case"url":Fh(r,"uri",n.message,t);break;case"uuid":Fh(r,"uuid",n.message,t);break;case"regex":Tc(r,n.regex,n.message,t);break;case"cuid":Tc(r,$h.cuid,n.message,t);break;case"cuid2":Tc(r,$h.cuid2,n.message,t);break;case"startsWith":Tc(r,RegExp(`^${cU(n.value,t)}`),n.message,t);break;case"endsWith":Tc(r,RegExp(`${cU(n.value,t)}$`),n.message,t);break;case"datetime":Fh(r,"date-time",n.message,t);break;case"date":Fh(r,"date",n.message,t);break;case"time":Fh(r,"time",n.message,t);break;case"duration":Fh(r,"duration",n.message,t);break;case"length":fa(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),fa(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{Tc(r,RegExp(cU(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Fh(r,"ipv4",n.message,t),n.version!=="v4"&&Fh(r,"ipv6",n.message,t);break}case"base64url":Tc(r,$h.base64url,n.message,t);break;case"jwt":Tc(r,$h.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&Tc(r,$h.ipv4Cidr,n.message,t),n.version!=="v4"&&Tc(r,$h.ipv6Cidr,n.message,t);break}case"emoji":Tc(r,$h.emoji(),n.message,t);break;case"ulid":{Tc(r,$h.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Fh(r,"binary",n.message,t);break}case"contentEncoding:base64":{fa(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{Tc(r,$h.base64,n.message,t);break}}break}case"nanoid":Tc(r,$h.nanoid,n.message,t)}return r}function cU(e,t){return t.patternStrategy==="escape"?L$t(e):e}const D$t=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function L$t(e){let t="";for(let r=0;r<e.length;r++)D$t.has(e[r])||(t+="\\"),t+=e[r];return t}function Fh(e,t,r,n){e.format||e.anyOf?.some(s=>s.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):fa(e,"format",t,r,n)}function Tc(e,t,r,n){e.pattern||e.allOf?.some(s=>s.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:c1e(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):fa(e,"pattern",c1e(t,n),r,n)}function c1e(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;const r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source;let s="",a=!1,i=!1,l=!1;for(let c=0;c<n.length;c++){if(a){s+=n[c],a=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){l?(s+=n[c],s+=`${n[c-2]}-${n[c]}`.toUpperCase(),l=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(s+=n[c],l=!0):s+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){s+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){s+=`(^|(?<=[\r
@@ -284,7 +284,7 @@ ${J.current.stack}
284
284
  A`,",",",0,",",",",",",",`
285
285
  A`,",",",0,0,",",",",","Z"])),T.x,T.y,a,a,+(d<0),E.x,E.y,n,n,+(A>180),+(d>0),O.x,O.y,a,a,+(d<0),k.x,k.y)}else w+=Ui(cje||(cje=pw(["L",",","Z"])),t,r);return w},hxr={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},pst=e=>{var t=td(e,hxr),{cx:r,cy:n,innerRadius:s,outerRadius:a,cornerRadius:i,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:f}=t;if(a<s||u===d)return null;var h=ya("recharts-sector",f),p=a-s,m=_x(i,p,0,!0),g;return m>0&&Math.abs(u-d)<360?g=fxr({cx:r,cy:n,innerRadius:s,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):g=hst({cx:r,cy:n,innerRadius:s,outerRadius:a,startAngle:u,endAngle:d}),b.createElement("path",Cse({},eu(t),{className:h,d:g}))};function pxr(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(Krt(t)){if(e==="centric"){var{cx:n,cy:s,innerRadius:a,outerRadius:i,angle:l}=t,c=Vl(n,s,a,l),u=Vl(n,s,i,l);return[{x:c.x,y:c.y},{x:u.x,y:u.y}]}return fst(t)}}var kq={},_q={},Eq={},uje;function mxr(){return uje||(uje=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=lnt();function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(Eq)),Eq}var dje;function gxr(){return dje||(dje=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=mxr();function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(_q)),_q}var fje;function yxr(){return fje||(fje=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=cnt(),r=gxr();function n(s,a,i){i&&typeof i!="number"&&t.isIterateeCall(s,a,i)&&(a=i=void 0),s=r.toFinite(s),a===void 0?(a=s,s=0):a=r.toFinite(a),i=i===void 0?s<a?1:-1:r.toFinite(i);const l=Math.max(Math.ceil((a-s)/(i||1)),0),c=new Array(l);for(let u=0;u<l;u++)c[u]=s,s+=i;return c}e.range=n})(kq)),kq}var Cq,hje;function vxr(){return hje||(hje=1,Cq=yxr().range),Cq}var bxr=vxr();const mst=$o(bxr);var Kx=e=>e.chartData,xxr=et([Kx],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),efe=(e,t,r,n)=>n?xxr(e):Kx(e);function Hm(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if($s(t)&&$s(r))return!0}return!1}function pje(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function gst(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,s,a;if($s(r))s=r;else if(typeof r=="function")return;if($s(n))a=n;else if(typeof n=="function")return;var i=[s,a];if(Hm(i))return i}}function wxr(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(Hm(n))return pje(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[s,a]=e,i,l;if(s==="auto")t!=null&&(i=Math.min(...t));else if(Ur(s))i=s;else if(typeof s=="function")try{t!=null&&(i=s(t?.[0]))}catch{}else if(typeof s=="string"&&cCe.test(s)){var c=cCe.exec(s);if(c==null||c[1]==null||t==null)i=void 0;else{var u=+c[1];i=t[0]-u}}else i=t?.[0];if(a==="auto")t!=null&&(l=Math.max(...t));else if(Ur(a))l=a;else if(typeof a=="function")try{t!=null&&(l=a(t?.[1]))}catch{}else if(typeof a=="string"&&uCe.test(a)){var d=uCe.exec(a);if(d==null||d[1]==null||t==null)l=void 0;else{var f=+d[1];l=t[1]+f}}else l=t?.[1];var h=[i,l];if(Hm(h))return t==null?h:pje(h,t,r)}}}var CE=1e9,Sxr={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},rfe,vi=!0,vh="[DecimalError] ",Tw=vh+"Invalid argument: ",tfe=vh+"Exponent out of range: ",jE=Math.floor,ew=Math.pow,Oxr=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Rd,ul=1e7,ii=7,yst=9007199254740991,S5=jE(yst/ii),hr={};hr.absoluteValue=hr.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};hr.comparedTo=hr.cmp=function(e){var t,r,n,s,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(n=a.d.length,s=e.d.length,t=0,r=n<s?n:s;t<r;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return n===s?0:n>s^a.s<0?1:-1};hr.decimalPlaces=hr.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*ii;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};hr.dividedBy=hr.div=function(e){return Ry(this,new this.constructor(e))};hr.dividedToIntegerBy=hr.idiv=function(e){var t=this,r=t.constructor;return La(Ry(t,new r(e),0,1),r.precision)};hr.equals=hr.eq=function(e){return!this.cmp(e)};hr.exponent=function(){return Ro(this)};hr.greaterThan=hr.gt=function(e){return this.cmp(e)>0};hr.greaterThanOrEqualTo=hr.gte=function(e){return this.cmp(e)>=0};hr.isInteger=hr.isint=function(){return this.e>this.d.length-2};hr.isNegative=hr.isneg=function(){return this.s<0};hr.isPositive=hr.ispos=function(){return this.s>0};hr.isZero=function(){return this.s===0};hr.lessThan=hr.lt=function(e){return this.cmp(e)<0};hr.lessThanOrEqualTo=hr.lte=function(e){return this.cmp(e)<1};hr.logarithm=hr.log=function(e){var t,r=this,n=r.constructor,s=n.precision,a=s+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Rd))throw Error(vh+"NaN");if(r.s<1)throw Error(vh+(r.s?"NaN":"-Infinity"));return r.eq(Rd)?new n(0):(vi=!1,t=Ry(SA(r,a),SA(e,a),a),vi=!0,La(t,s))};hr.minus=hr.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?xst(t,e):vst(t,(e.s=-e.s,e))};hr.modulo=hr.mod=function(e){var t,r=this,n=r.constructor,s=n.precision;if(e=new n(e),!e.s)throw Error(vh+"NaN");return r.s?(vi=!1,t=Ry(r,e,0,1).times(e),vi=!0,r.minus(t)):La(new n(r),s)};hr.naturalExponential=hr.exp=function(){return bst(this)};hr.naturalLogarithm=hr.ln=function(){return SA(this)};hr.negated=hr.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};hr.plus=hr.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?vst(t,e):xst(t,(e.s=-e.s,e))};hr.precision=hr.sd=function(e){var t,r,n,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Tw+e);if(t=Ro(s)+1,n=s.d.length-1,r=n*ii+1,n=s.d[n],n){for(;n%10==0;n/=10)r--;for(n=s.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};hr.squareRoot=hr.sqrt=function(){var e,t,r,n,s,a,i,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(vh+"NaN")}for(e=Ro(l),vi=!1,s=Math.sqrt(+l),s==0||s==1/0?(t=Dm(l.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=jE((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(s.toString()),r=c.precision,s=i=r+3;;)if(a=n,n=a.plus(Ry(l,a,i+2)).times(.5),Dm(a.d).slice(0,i)===(t=Dm(n.d)).slice(0,i)){if(t=t.slice(i-3,i+1),s==i&&t=="4999"){if(La(a,r+1,0),a.times(a).eq(l)){n=a;break}}else if(t!="9999")break;i+=4}return vi=!0,La(n,r)};hr.times=hr.mul=function(e){var t,r,n,s,a,i,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,c=h.length,u=p.length,c<u&&(a=h,h=p,p=a,i=c,c=u,u=i),a=[],i=c+u,n=i;n--;)a.push(0);for(n=u;--n>=0;){for(t=0,s=c+n;s>n;)l=a[s]+p[n]*h[s-n-1]+t,a[s--]=l%ul|0,t=l/ul|0;a[s]=(a[s]+t)%ul|0}for(;!a[--i];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,vi?La(e,f.precision):e};hr.toDecimalPlaces=hr.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(rg(e,0,CE),t===void 0?t=n.rounding:rg(t,0,8),La(r,e+Ro(r)+1,t))};hr.toExponential=function(e,t){var r,n=this,s=n.constructor;return e===void 0?r=hS(n,!0):(rg(e,0,CE),t===void 0?t=s.rounding:rg(t,0,8),n=La(new s(n),e+1,t),r=hS(n,!0,e+1)),r};hr.toFixed=function(e,t){var r,n,s=this,a=s.constructor;return e===void 0?hS(s):(rg(e,0,CE),t===void 0?t=a.rounding:rg(t,0,8),n=La(new a(s),e+Ro(s)+1,t),r=hS(n.abs(),!1,e+Ro(n)+1),s.isneg()&&!s.isZero()?"-"+r:r)};hr.toInteger=hr.toint=function(){var e=this,t=e.constructor;return La(new t(e),Ro(e)+1,t.rounding)};hr.toNumber=function(){return+this};hr.toPower=hr.pow=function(e){var t,r,n,s,a,i,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Rd);if(l=new c(l),!l.s){if(e.s<1)throw Error(vh+"Infinity");return l}if(l.eq(Rd))return l;if(n=c.precision,e.eq(Rd))return La(l,n);if(t=e.e,r=e.d.length-1,i=t>=r,a=l.s,i){if((r=d<0?-d:d)<=yst){for(s=new c(Rd),t=Math.ceil(n/ii+4),vi=!1;r%2&&(s=s.times(l),gje(s.d,t)),r=jE(r/2),r!==0;)l=l.times(l),gje(l.d,t);return vi=!0,e.s<0?new c(Rd).div(s):La(s,n)}}else if(a<0)throw Error(vh+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,vi=!1,s=e.times(SA(l,n+u)),vi=!0,s=bst(s),s.s=a,s};hr.toPrecision=function(e,t){var r,n,s=this,a=s.constructor;return e===void 0?(r=Ro(s),n=hS(s,r<=a.toExpNeg||r>=a.toExpPos)):(rg(e,1,CE),t===void 0?t=a.rounding:rg(t,0,8),s=La(new a(s),e,t),r=Ro(s),n=hS(s,e<=r||r<=a.toExpNeg,e)),n};hr.toSignificantDigits=hr.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(rg(e,1,CE),t===void 0?t=n.rounding:rg(t,0,8)),La(new n(r),e,t)};hr.toString=hr.valueOf=hr.val=hr.toJSON=hr[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Ro(e),r=e.constructor;return hS(e,t<=r.toExpNeg||t>=r.toExpPos)};function vst(e,t){var r,n,s,a,i,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),vi?La(t,f):t;if(c=e.d,u=t.d,i=e.e,s=t.e,c=c.slice(),a=i-s,a){for(a<0?(n=c,a=-a,l=u.length):(n=u,s=i,l=c.length),i=Math.ceil(f/ii),l=i>l?i+1:l+1,a>l&&(a=l,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,n=u,u=c,c=n),r=0;a;)r=(c[--a]=c[a]+u[a]+r)/ul|0,c[a]%=ul;for(r&&(c.unshift(r),++s),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=s,vi?La(t,f):t}function rg(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Tw+e)}function Dm(e){var t,r,n,s=e.length-1,a="",i=e[0];if(s>0){for(a+=i,t=1;t<s;t++)n=e[t]+"",r=ii-n.length,r&&(a+=kb(r)),a+=n;i=e[t],n=i+"",r=ii-n.length,r&&(a+=kb(r))}else if(i===0)return"0";for(;i%10===0;)i/=10;return a+i}var Ry=(function(){function e(n,s){var a,i=0,l=n.length;for(n=n.slice();l--;)a=n[l]*s+i,n[l]=a%ul|0,i=a/ul|0;return i&&n.unshift(i),n}function t(n,s,a,i){var l,c;if(a!=i)c=a>i?1:-1;else for(l=c=0;l<a;l++)if(n[l]!=s[l]){c=n[l]>s[l]?1:-1;break}return c}function r(n,s,a){for(var i=0;a--;)n[a]-=i,i=n[a]<s[a]?1:0,n[a]=i*ul+n[a]-s[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,s,a,i){var l,c,u,d,f,h,p,m,g,y,x,w,O,k,_,E,T,j,A=n.constructor,I=n.s==s.s?1:-1,P=n.d,R=s.d;if(!n.s)return new A(n);if(!s.s)throw Error(vh+"Division by zero");for(c=n.e-s.e,T=R.length,_=P.length,p=new A(I),m=p.d=[],u=0;R[u]==(P[u]||0);)++u;if(R[u]>(P[u]||0)&&--c,a==null?w=a=A.precision:i?w=a+(Ro(n)-Ro(s))+1:w=a,w<0)return new A(0);if(w=w/ii+2|0,u=0,T==1)for(d=0,R=R[0],w++;(u<_||d)&&w--;u++)O=d*ul+(P[u]||0),m[u]=O/R|0,d=O%R|0;else{for(d=ul/(R[0]+1)|0,d>1&&(R=e(R,d),P=e(P,d),T=R.length,_=P.length),k=T,g=P.slice(0,T),y=g.length;y<T;)g[y++]=0;j=R.slice(),j.unshift(0),E=R[0],R[1]>=ul/2&&++E;do d=0,l=t(R,g,T,y),l<0?(x=g[0],T!=y&&(x=x*ul+(g[1]||0)),d=x/E|0,d>1?(d>=ul&&(d=ul-1),f=e(R,d),h=f.length,y=g.length,l=t(f,g,h,y),l==1&&(d--,r(f,T<h?j:R,h))):(d==0&&(l=d=1),f=R.slice()),h=f.length,h<y&&f.unshift(0),r(g,f,y),l==-1&&(y=g.length,l=t(R,g,T,y),l<1&&(d++,r(g,T<y?j:R,y))),y=g.length):l===0&&(d++,g=[0]),m[u++]=d,l&&g[0]?g[y++]=P[k]||0:(g=[P[k]],y=1);while((k++<_||g[0]!==void 0)&&w--)}return m[0]||m.shift(),p.e=c,La(p,i?a+Ro(p)+1:a)}})();function bst(e,t){var r,n,s,a,i,l,c=0,u=0,d=e.constructor,f=d.precision;if(Ro(e)>16)throw Error(tfe+Ro(e));if(!e.s)return new d(Rd);for(vi=!1,l=f,i=new d(.03125);e.abs().gte(.1);)e=e.times(i),u+=5;for(n=Math.log(ew(2,u))/Math.LN10*2+5|0,l+=n,r=s=a=new d(Rd),d.precision=l;;){if(s=La(s.times(e),l),r=r.times(++c),i=a.plus(Ry(s,r,l)),Dm(i.d).slice(0,l)===Dm(a.d).slice(0,l)){for(;u--;)a=La(a.times(a),l);return d.precision=f,t==null?(vi=!0,La(a,f)):a}a=i}}function Ro(e){for(var t=e.e*ii,r=e.d[0];r>=10;r/=10)t++;return t}function jq(e,t,r){if(t>e.LN10.sd())throw vi=!0,r&&(e.precision=r),Error(vh+"LN10 precision limit exceeded");return La(new e(e.LN10),t)}function kb(e){for(var t="";e--;)t+="0";return t}function SA(e,t){var r,n,s,a,i,l,c,u,d,f=1,h=10,p=e,m=p.d,g=p.constructor,y=g.precision;if(p.s<1)throw Error(vh+(p.s?"NaN":"-Infinity"));if(p.eq(Rd))return new g(0);if(t==null?(vi=!1,u=y):u=t,p.eq(10))return t==null&&(vi=!0),jq(g,u);if(u+=h,g.precision=u,r=Dm(m),n=r.charAt(0),a=Ro(p),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=Dm(p.d),n=r.charAt(0),f++;a=Ro(p),n>1?(p=new g("0."+r),a++):p=new g(n+"."+r.slice(1))}else return c=jq(g,u+2,y).times(a+""),p=SA(new g(n+"."+r.slice(1)),u-h).plus(c),g.precision=y,t==null?(vi=!0,La(p,y)):p;for(l=i=p=Ry(p.minus(Rd),p.plus(Rd),u),d=La(p.times(p),u),s=3;;){if(i=La(i.times(d),u),c=l.plus(Ry(i,new g(s),u)),Dm(c.d).slice(0,u)===Dm(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(jq(g,u+2,y).times(a+""))),l=Ry(l,new g(f),u),g.precision=y,t==null?(vi=!0,La(l,y)):l;l=c,s+=2}}function mje(e,t){var r,n,s;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(n,s),t){if(s-=n,r=r-n-1,e.e=jE(r/ii),e.d=[],n=(r+1)%ii,r<0&&(n+=ii),n<s){for(n&&e.d.push(+t.slice(0,n)),s-=ii;n<s;)e.d.push(+t.slice(n,n+=ii));t=t.slice(n),n=ii-t.length}else n-=s;for(;n--;)t+="0";if(e.d.push(+t),vi&&(e.e>S5||e.e<-S5))throw Error(tfe+r)}else e.s=0,e.e=0,e.d=[0];return e}function La(e,t,r){var n,s,a,i,l,c,u,d,f=e.d;for(i=1,a=f[0];a>=10;a/=10)i++;if(n=t-i,n<0)n+=ii,s=t,u=f[d=0];else{if(d=Math.ceil((n+1)/ii),a=f.length,d>=a)return e;for(u=a=f[d],i=1;a>=10;a/=10)i++;n%=ii,s=n-ii+i}if(r!==void 0&&(a=ew(10,i-s-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?s>0?u/ew(10,i-s):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(a=Ro(e),f.length=1,t=t-a-1,f[0]=ew(10,(ii-t%ii)%ii),e.e=jE(-t/ii)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,a=1,d--):(f.length=d+1,a=ew(10,ii-n),f[d]=s>0?(u/ew(10,i-s)%ew(10,s)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==ul&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=ul)break;f[d--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(vi&&(e.e>S5||e.e<-S5))throw Error(tfe+Ro(e));return e}function xst(e,t){var r,n,s,a,i,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),vi?La(t,p):t;if(c=e.d,f=t.d,n=t.e,u=e.e,c=c.slice(),i=u-n,i){for(d=i<0,d?(r=c,i=-i,l=f.length):(r=f,n=u,l=c.length),s=Math.max(Math.ceil(p/ii),l)+2,i>s&&(i=s,r.length=1),r.reverse(),s=i;s--;)r.push(0);r.reverse()}else{for(s=c.length,l=f.length,d=s<l,d&&(l=s),s=0;s<l;s++)if(c[s]!=f[s]){d=c[s]<f[s];break}i=0}for(d&&(r=c,c=f,f=r,t.s=-t.s),l=c.length,s=f.length-l;s>0;--s)c[l++]=0;for(s=f.length;s>i;){if(c[--s]<f[s]){for(a=s;a&&c[--a]===0;)c[a]=ul-1;--c[a],c[s]+=ul}c[s]-=f[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=n,vi?La(t,p):t):new h(0)}function hS(e,t,r){var n,s=Ro(e),a=Dm(e.d),i=a.length;return t?(r&&(n=r-i)>0?a=a.charAt(0)+"."+a.slice(1)+kb(n):i>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(s<0?"e":"e+")+s):s<0?(a="0."+kb(-s-1)+a,r&&(n=r-i)>0&&(a+=kb(n))):s>=i?(a+=kb(s+1-i),r&&(n=r-s-1)>0&&(a=a+"."+kb(n))):((n=s+1)<i&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-i)>0&&(s+1===i&&(a+="."),a+=kb(n))),e.s<0?"-"+a:a}function gje(e,t){if(e.length>t)return e.length=t,!0}function wst(e){var t,r,n;function s(a){var i=this;if(!(i instanceof s))return new s(a);if(i.constructor=s,a instanceof s){i.s=a.s,i.e=a.e,i.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Tw+a);if(a>0)i.s=1;else if(a<0)a=-a,i.s=-1;else{i.s=0,i.e=0,i.d=[0];return}if(a===~~a&&a<1e7){i.e=0,i.d=[a];return}return mje(i,a.toString())}else if(typeof a!="string")throw Error(Tw+a);if(a.charCodeAt(0)===45?(a=a.slice(1),i.s=-1):i.s=1,Oxr.test(a))mje(i,a);else throw Error(Tw+a)}if(s.prototype=hr,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=wst,s.config=s.set=kxr,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return s.config(e),s}function kxr(e){if(!e||typeof e!="object")throw Error(vh+"Object expected");var t,r,n,s=["precision",1,CE,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<s.length;t+=3)if((n=e[r=s[t]])!==void 0)if(jE(n)===n&&n>=s[t+1]&&n<=s[t+2])this[r]=n;else throw Error(Tw+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Tw+r+": "+n);return this}var rfe=wst(Sxr);Rd=new rfe(1);const gs=rfe;function Sst(e){var t;return e===0?t=1:t=Math.floor(new gs(e).abs().log(10).toNumber())+1,t}function Ost(e,t,r){for(var n=new gs(e),s=0,a=[];n.lt(t)&&s<1e5;)a.push(n.toNumber()),n=n.add(r),s++;return a}var kst=e=>{var[t,r]=e,[n,s]=[t,r];return t>r&&([n,s]=[r,t]),[n,s]},nfe=(e,t,r)=>{if(e.lte(0))return new gs(0);var n=Sst(e.toNumber()),s=new gs(10).pow(n),a=e.div(s),i=n!==1?.05:.1,l=new gs(Math.ceil(a.div(i).toNumber())).add(r).mul(i),c=l.mul(s);return t?new gs(c.toNumber()):new gs(Math.ceil(c.toNumber()))},_st=(e,t,r)=>{var n;if(e.lte(0))return new gs(0);var s=[1,2,2.5,5],a=e.toNumber(),i=Math.floor(new gs(a).abs().log(10).toNumber()),l=new gs(10).pow(i),c=e.div(l).toNumber(),u=s.findIndex(p=>p>=c-1e-10);if(u===-1&&(l=l.mul(10),u=0),u+=r,u>=s.length){var d=Math.floor(u/s.length);u%=s.length,l=l.mul(new gs(10).pow(d))}var f=(n=s[u])!==null&&n!==void 0?n:1,h=new gs(f).mul(l);return t?h:new gs(Math.ceil(h.toNumber()))},_xr=(e,t,r)=>{var n=new gs(1),s=new gs(e);if(!s.isint()&&r){var a=Math.abs(e);a<1?(n=new gs(10).pow(Sst(e)-1),s=new gs(Math.floor(s.div(n).toNumber())).mul(n)):a>1&&(s=new gs(Math.floor(e)))}else e===0?s=new gs(Math.floor((t-1)/2)):r||(s=new gs(Math.floor(e)));for(var i=Math.floor((t-1)/2),l=[],c=0;c<t;c++)l.push(s.add(new gs(c-i).mul(n)).toNumber());return l},Est=function(t,r,n,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:nfe;if(!Number.isFinite((r-t)/(n-1)))return{step:new gs(0),tickMin:new gs(0),tickMax:new gs(0)};var l=i(new gs(r).sub(t).div(n-1),s,a),c;t<=0&&r>=0?c=new gs(0):(c=new gs(t).add(r).div(2),c=c.sub(new gs(c).mod(l)));var u=Math.ceil(c.sub(t).div(l).toNumber()),d=Math.ceil(new gs(r).sub(c).div(l).toNumber()),f=u+d+1;return f>n?Est(t,r,n,s,a+1,i):(f<n&&(d=r>0?d+(n-f):d,u=r>0?u:u+(n-f)),{step:l,tickMin:c.sub(new gs(u).mul(l)),tickMax:c.add(new gs(d).mul(l))})},yje=function(t){var[r,n]=t,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),[c,u]=kst([r,n]);if(c===-1/0||u===1/0){var d=u===1/0?[c,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),u];return r>n?d.reverse():d}if(c===u)return _xr(c,s,a);var f=i==="snap125"?_st:nfe,{step:h,tickMin:p,tickMax:m}=Est(c,u,l,a,0,f),g=Ost(p,m.add(new gs(.1).mul(h)),h);return r>n?g.reverse():g},vje=function(t,r){var[n,s]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",[l,c]=kst([n,s]);if(l===-1/0||c===1/0)return[n,s];if(l===c)return[l];var u=i==="snap125"?_st:nfe,d=Math.max(r,2),f=u(new gs(c).sub(l).div(d-1),a,0),h=[...Ost(new gs(l),new gs(c),f),c];return a===!1&&(h=h.map(p=>Math.round(p))),n>s?h.reverse():h},Exr=e=>e.rootProps.barCategoryGap,mz=e=>e.rootProps.stackOffset,Cst=e=>e.rootProps.reverseStackOrder,sfe=e=>e.options.chartName,afe=e=>e.rootProps.syncId,jst=e=>e.rootProps.syncMethod,ife=e=>e.options.eventEmitter,Qc={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},A0={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},am={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},gz=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function yz(e,t,r){if(r!=="auto")return r;if(e!=null)return gv(e,t)?"category":"number"}function bje(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function O5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bje(Object(r),!0).forEach(function(n){Cxr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bje(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Cxr(e,t,r){return(t=jxr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jxr(e){var t=Txr(e,"string");return typeof t=="symbol"?t:t+""}function Txr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xje={allowDataOverflow:A0.allowDataOverflow,allowDecimals:A0.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:A0.angleAxisId,includeHidden:!1,name:void 0,reversed:A0.reversed,scale:A0.scale,tick:A0.tick,tickCount:void 0,ticks:void 0,type:A0.type,unit:void 0,niceTicks:"auto"},wje={allowDataOverflow:am.allowDataOverflow,allowDecimals:am.allowDecimals,allowDuplicatedCategory:am.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:am.radiusAxisId,includeHidden:am.includeHidden,name:void 0,reversed:am.reversed,scale:am.scale,tick:am.tick,tickCount:am.tickCount,ticks:void 0,type:am.type,unit:void 0,niceTicks:"auto"},Nxr=(e,t)=>{if(t!=null)return e.polarAxis.angleAxis[t]},ofe=et([Nxr,Ynt],(e,t)=>{var r;if(e!=null)return e;var n=(r=yz(t,"angleAxis",xje.type))!==null&&r!==void 0?r:"category";return O5(O5({},xje),{},{type:n})}),Axr=(e,t)=>e.polarAxis.radiusAxis[t],lfe=et([Axr,Ynt],(e,t)=>{var r;if(e!=null)return e;var n=(r=yz(t,"radiusAxis",wje.type))!==null&&r!==void 0?r:"category";return O5(O5({},wje),{},{type:n})}),vz=e=>e.polarOptions,cfe=et([yv,vv,Kl],axr),Tst=et([vz,cfe],(e,t)=>{if(e!=null)return _x(e.innerRadius,t,0)}),Nst=et([vz,cfe],(e,t)=>{if(e!=null)return _x(e.outerRadius,t,t*.8)}),Ixr=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},Ast=et([vz],Ixr);et([ofe,Ast],gz);var Ist=et([cfe,Tst,Nst],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});et([lfe,Ist],gz);var Rst=et([Pi,vz,Tst,Nst,yv,vv],(e,t,r,n,s,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:i,cy:l,startAngle:c,endAngle:u}=t;return{cx:_x(i,s,s/2),cy:_x(l,a,a/2),innerRadius:r,outerRadius:n,startAngle:c,endAngle:u,clockWise:!1}}}),Ol=(e,t)=>t,bz=(e,t,r)=>r;function Pst(e){return e?.id}function Mst(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:s,dataKey:a}=r,i=new Map;return e.forEach(l=>{var c,u=(c=l.data)!==null&&c!==void 0?c:n;if(!(u==null||u.length===0)){var d=Pst(l);u.forEach((f,h)=>{var p=a==null||s?h:String(Gl(f,a,null)),m=Gl(f,l.dataKey,0),g;i.has(p)?g=i.get(p):g={},Object.assign(g,{[d]:m}),i.set(p,g)})}}),Array.from(i.values())}function ufe(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var xz=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function wz(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function Rxr(e,t){if(e.length===t.length){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return!1}var kl=e=>{var t=Pi(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},TE=e=>e.tooltip.settings.axisId;function dfe(e){if(e!=null){var t=e.ticks,r=e.bandwidth,n=e.range(),s=[Math.min(...n),Math.max(...n)];return{domain:()=>e.domain(),range:(function(a){function i(){return a.apply(this,arguments)}return i.toString=function(){return a.toString()},i})(()=>s),rangeMin:()=>s[0],rangeMax:()=>s[1],isInRange(a){var i=s[0],l=s[1];return i<=l?a>=i&&a<=l:a>=l&&a<=i},bandwidth:r?()=>r.call(e):void 0,ticks:t?a=>t.call(e,a):void 0,map:(a,i)=>{var l=e(a);if(l!=null){if(e.bandwidth&&i!==null&&i!==void 0&&i.position){var c=e.bandwidth();switch(i.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}}var Pxr=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Hm(t)){for(var r,n,s=0;s<t.length;s++){var a=t[s];$s(a)&&((r===void 0||a<r)&&(r=a),(n===void 0||a>n)&&(n=a))}return r!==void 0&&n!==void 0?[r,n]:void 0}return t}default:return t}};function Gb(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Mxr(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ffe(e){let t,r,n;e.length!==2?(t=Gb,r=(l,c)=>Gb(e(l),c),n=(l,c)=>e(l)-c):(t=e===Gb||e===Mxr?e:Dxr,r=e,n=e);function s(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function a(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function i(l,c,u=0,d=l.length){const f=s(l,c,u,d-1);return f>u&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:s,center:i,right:a}}function Dxr(){return 0}function Dst(e){return e===null?NaN:+e}function*Lxr(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const $xr=ffe(Gb),QR=$xr.right;ffe(Dst).center;class Sje extends Map{constructor(t,r=Bxr){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,s]of t)this.set(n,s)}get(t){return super.get(Oje(this,t))}has(t){return super.has(Oje(this,t))}set(t,r){return super.set(Fxr(this,t),r)}delete(t){return super.delete(zxr(this,t))}}function Oje({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function Fxr({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function zxr({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function Bxr(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Uxr(e=Gb){if(e===Gb)return Lst;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function Lst(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Vxr=Math.sqrt(50),qxr=Math.sqrt(10),Hxr=Math.sqrt(2);function k5(e,t,r){const n=(t-e)/Math.max(0,r),s=Math.floor(Math.log10(n)),a=n/Math.pow(10,s),i=a>=Vxr?10:a>=qxr?5:a>=Hxr?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/i,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,s)*i,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=r&&r<2?k5(e,t,r*2):[l,c,u]}function jse(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[s,a,i]=n?k5(t,e,r):k5(e,t,r);if(!(a>=s))return[];const l=a-s+1,c=new Array(l);if(n)if(i<0)for(let u=0;u<l;++u)c[u]=(a-u)/-i;else for(let u=0;u<l;++u)c[u]=(a-u)*i;else if(i<0)for(let u=0;u<l;++u)c[u]=(s+u)/-i;else for(let u=0;u<l;++u)c[u]=(s+u)*i;return c}function Tse(e,t,r){return t=+t,e=+e,r=+r,k5(e,t,r)[2]}function Nse(e,t,r){t=+t,e=+e,r=+r;const n=t<e,s=n?Tse(t,e,r):Tse(e,t,r);return(n?-1:1)*(s<0?1/-s:s)}function kje(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function _je(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function $st(e,t,r=0,n=1/0,s){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(s=s===void 0?Lst:Uxr(s);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(t-u*f/c+h)),m=Math.min(n,Math.floor(t+(c-u)*f/c+h));$st(e,t,p,m,s)}const a=e[t];let i=r,l=n;for(bj(e,r,t),s(e[n],a)>0&&bj(e,r,n);i<l;){for(bj(e,i,l),++i,--l;s(e[i],a)<0;)++i;for(;s(e[l],a)>0;)--l}s(e[r],a)===0?bj(e,r,l):(++l,bj(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function bj(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Qxr(e,t,r){if(e=Float64Array.from(Lxr(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return _je(e);if(t>=1)return kje(e);var n,s=(n-1)*t,a=Math.floor(s),i=kje($st(e,a).subarray(0,a+1)),l=_je(e.subarray(a+1));return i+(l-i)*(s-a)}}function Wxr(e,t,r=Dst){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,s=(n-1)*t,a=Math.floor(s),i=+r(e[a],a,e),l=+r(e[a+1],a+1,e);return i+(l-i)*(s-a)}}function Gxr(e,t,r){e=+e,t=+t,r=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+r;for(var n=-1,s=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(s);++n<s;)a[n]=e+n*r;return a}function Th(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function bv(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Ase=Symbol("implicit");function hfe(){var e=new Sje,t=[],r=[],n=Ase;function s(a){let i=e.get(a);if(i===void 0){if(n!==Ase)return n;e.set(a,i=t.push(a)-1)}return r[i%r.length]}return s.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new Sje;for(const i of a)e.has(i)||e.set(i,t.push(i)-1);return s},s.range=function(a){return arguments.length?(r=Array.from(a),s):r.slice()},s.unknown=function(a){return arguments.length?(n=a,s):n},s.copy=function(){return hfe(t,r).unknown(n)},Th.apply(s,arguments),s}function pfe(){var e=hfe().unknown(void 0),t=e.domain,r=e.range,n=0,s=1,a,i,l=!1,c=0,u=0,d=.5;delete e.unknown;function f(){var h=t().length,p=s<n,m=p?s:n,g=p?n:s;a=(g-m)/Math.max(1,h-c+u*2),l&&(a=Math.floor(a)),m+=(g-m-a*(h-c))*d,i=a*(1-c),l&&(m=Math.round(m),i=Math.round(i));var y=Gxr(h).map(function(x){return m+a*x});return r(p?y.reverse():y)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([n,s]=h,n=+n,s=+s,f()):[n,s]},e.rangeRound=function(h){return[n,s]=h,n=+n,s=+s,l=!0,f()},e.bandwidth=function(){return i},e.step=function(){return a},e.round=function(h){return arguments.length?(l=!!h,f()):l},e.padding=function(h){return arguments.length?(c=Math.min(1,u=+h),f()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},e.paddingOuter=function(h){return arguments.length?(u=+h,f()):u},e.align=function(h){return arguments.length?(d=Math.max(0,Math.min(1,h)),f()):d},e.copy=function(){return pfe(t(),[n,s]).round(l).paddingInner(c).paddingOuter(u).align(d)},Th.apply(f(),arguments)}function Fst(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return Fst(t())},e}function Zxr(){return Fst(pfe.apply(null,arguments).paddingInner(1))}function mfe(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function zst(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function WR(){}var OA=.7,_5=1/OA,Ck="\\s*([+-]?\\d+)\\s*",kA="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Yxr=/^#([0-9a-f]{3,8})$/,Xxr=new RegExp(`^rgb\\(${Ck},${Ck},${Ck}\\)$`),Kxr=new RegExp(`^rgb\\(${Qm},${Qm},${Qm}\\)$`),Jxr=new RegExp(`^rgba\\(${Ck},${Ck},${Ck},${kA}\\)$`),e0r=new RegExp(`^rgba\\(${Qm},${Qm},${Qm},${kA}\\)$`),t0r=new RegExp(`^hsl\\(${kA},${Qm},${Qm}\\)$`),r0r=new RegExp(`^hsla\\(${kA},${Qm},${Qm},${kA}\\)$`),Eje={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};mfe(WR,pS,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Cje,formatHex:Cje,formatHex8:n0r,formatHsl:s0r,formatRgb:jje,toString:jje});function Cje(){return this.rgb().formatHex()}function n0r(){return this.rgb().formatHex8()}function s0r(){return Bst(this).formatHsl()}function jje(){return this.rgb().formatRgb()}function pS(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Yxr.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?Tje(t):r===3?new Du(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?y2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?y2(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Xxr.exec(e))?new Du(t[1],t[2],t[3],1):(t=Kxr.exec(e))?new Du(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Jxr.exec(e))?y2(t[1],t[2],t[3],t[4]):(t=e0r.exec(e))?y2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=t0r.exec(e))?Ije(t[1],t[2]/100,t[3]/100,1):(t=r0r.exec(e))?Ije(t[1],t[2]/100,t[3]/100,t[4]):Eje.hasOwnProperty(e)?Tje(Eje[e]):e==="transparent"?new Du(NaN,NaN,NaN,0):null}function Tje(e){return new Du(e>>16&255,e>>8&255,e&255,1)}function y2(e,t,r,n){return n<=0&&(e=t=r=NaN),new Du(e,t,r,n)}function a0r(e){return e instanceof WR||(e=pS(e)),e?(e=e.rgb(),new Du(e.r,e.g,e.b,e.opacity)):new Du}function Ise(e,t,r,n){return arguments.length===1?a0r(e):new Du(e,t,r,n??1)}function Du(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}mfe(Du,Ise,zst(WR,{brighter(e){return e=e==null?_5:Math.pow(_5,e),new Du(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?OA:Math.pow(OA,e),new Du(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Du(Nw(this.r),Nw(this.g),Nw(this.b),E5(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Nje,formatHex:Nje,formatHex8:i0r,formatRgb:Aje,toString:Aje}));function Nje(){return`#${mw(this.r)}${mw(this.g)}${mw(this.b)}`}function i0r(){return`#${mw(this.r)}${mw(this.g)}${mw(this.b)}${mw((isNaN(this.opacity)?1:this.opacity)*255)}`}function Aje(){const e=E5(this.opacity);return`${e===1?"rgb(":"rgba("}${Nw(this.r)}, ${Nw(this.g)}, ${Nw(this.b)}${e===1?")":`, ${e})`}`}function E5(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Nw(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mw(e){return e=Nw(e),(e<16?"0":"")+e.toString(16)}function Ije(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new rp(e,t,r,n)}function Bst(e){if(e instanceof rp)return new rp(e.h,e.s,e.l,e.opacity);if(e instanceof WR||(e=pS(e)),!e)return new rp;if(e instanceof rp)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,s=Math.min(t,r,n),a=Math.max(t,r,n),i=NaN,l=a-s,c=(a+s)/2;return l?(t===a?i=(r-n)/l+(r<n)*6:r===a?i=(n-t)/l+2:i=(t-r)/l+4,l/=c<.5?a+s:2-a-s,i*=60):l=c>0&&c<1?0:i,new rp(i,l,c,e.opacity)}function o0r(e,t,r,n){return arguments.length===1?Bst(e):new rp(e,t,r,n??1)}function rp(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}mfe(rp,o0r,zst(WR,{brighter(e){return e=e==null?_5:Math.pow(_5,e),new rp(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?OA:Math.pow(OA,e),new rp(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,s=2*r-n;return new Du(Tq(e>=240?e-240:e+120,s,n),Tq(e,s,n),Tq(e<120?e+240:e-120,s,n),this.opacity)},clamp(){return new rp(Rje(this.h),v2(this.s),v2(this.l),E5(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=E5(this.opacity);return`${e===1?"hsl(":"hsla("}${Rje(this.h)}, ${v2(this.s)*100}%, ${v2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Rje(e){return e=(e||0)%360,e<0?e+360:e}function v2(e){return Math.max(0,Math.min(1,e||0))}function Tq(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const gfe=e=>()=>e;function l0r(e,t){return function(r){return e+r*t}}function c0r(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function u0r(e){return(e=+e)==1?Ust:function(t,r){return r-t?c0r(t,r,e):gfe(isNaN(t)?r:t)}}function Ust(e,t){var r=t-e;return r?l0r(e,r):gfe(isNaN(e)?t:e)}const C5=(function e(t){var r=u0r(t);function n(s,a){var i=r((s=Ise(s)).r,(a=Ise(a)).r),l=r(s.g,a.g),c=r(s.b,a.b),u=Ust(s.opacity,a.opacity);return function(d){return s.r=i(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return n.gamma=e,n})(1);function d0r(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),s;return function(a){for(s=0;s<r;++s)n[s]=e[s]*(1-a)+t[s]*a;return n}}function f0r(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function h0r(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,s=new Array(n),a=new Array(r),i;for(i=0;i<n;++i)s[i]=Py(e[i],t[i]);for(;i<r;++i)a[i]=t[i];return function(l){for(i=0;i<n;++i)a[i]=s[i](l);return a}}function p0r(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Kh(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function m0r(e,t){var r={},n={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?r[s]=Py(e[s],t[s]):n[s]=t[s];return function(a){for(s in r)n[s]=r[s](a);return n}}var Rse=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Nq=new RegExp(Rse.source,"g");function g0r(e){return function(){return e}}function y0r(e){return function(t){return e(t)+""}}function Vst(e,t){var r=Rse.lastIndex=Nq.lastIndex=0,n,s,a,i=-1,l=[],c=[];for(e=e+"",t=t+"";(n=Rse.exec(e))&&(s=Nq.exec(t));)(a=s.index)>r&&(a=t.slice(r,a),l[i]?l[i]+=a:l[++i]=a),(n=n[0])===(s=s[0])?l[i]?l[i]+=s:l[++i]=s:(l[++i]=null,c.push({i,x:Kh(n,s)})),r=Nq.lastIndex;return r<t.length&&(a=t.slice(r),l[i]?l[i]+=a:l[++i]=a),l.length<2?c[0]?y0r(c[0].x):g0r(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function Py(e,t){var r=typeof t,n;return t==null||r==="boolean"?gfe(t):(r==="number"?Kh:r==="string"?(n=pS(t))?(t=n,C5):Vst:t instanceof pS?C5:t instanceof Date?p0r:f0r(t)?d0r:Array.isArray(t)?h0r:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?m0r:Kh)(e,t)}function yfe(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var Pje=180/Math.PI,Pse={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function qst(e,t,r,n,s,a){var i,l,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*r+t*n)&&(r-=e*c,n-=t*c),(l=Math.sqrt(r*r+n*n))&&(r/=l,n/=l,c/=l),e*n<t*r&&(e=-e,t=-t,c=-c,i=-i),{translateX:s,translateY:a,rotate:Math.atan2(t,e)*Pje,skewX:Math.atan(c)*Pje,scaleX:i,scaleY:l}}var b2;function v0r(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Pse:qst(t.a,t.b,t.c,t.d,t.e,t.f)}function b0r(e){return e==null||(b2||(b2=document.createElementNS("http://www.w3.org/2000/svg","g")),b2.setAttribute("transform",e),!(e=b2.transform.baseVal.consolidate()))?Pse:(e=e.matrix,qst(e.a,e.b,e.c,e.d,e.e,e.f))}function Hst(e,t,r,n){function s(u){return u.length?u.pop()+" ":""}function a(u,d,f,h,p,m){if(u!==f||d!==h){var g=p.push("translate(",null,t,null,r);m.push({i:g-4,x:Kh(u,f)},{i:g-2,x:Kh(d,h)})}else(f||h)&&p.push("translate("+f+t+h+r)}function i(u,d,f,h){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,n)-2,x:Kh(u,d)})):d&&f.push(s(f)+"rotate("+d+n)}function l(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,n)-2,x:Kh(u,d)}):d&&f.push(s(f)+"skewX("+d+n)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var g=p.push(s(p)+"scale(",null,",",null,")");m.push({i:g-4,x:Kh(u,f)},{i:g-2,x:Kh(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),a(u.translateX,u.translateY,d.translateX,d.translateY,f,h),i(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,g=h.length,y;++m<g;)f[(y=h[m]).i]=y.x(p);return f.join("")}}}var x0r=Hst(v0r,"px, ","px)","deg)"),w0r=Hst(b0r,", ",")",")"),S0r=1e-12;function Mje(e){return((e=Math.exp(e))+1/e)/2}function O0r(e){return((e=Math.exp(e))-1/e)/2}function k0r(e){return((e=Math.exp(2*e))-1)/(e+1)}const QL=(function e(t,r,n){function s(a,i){var l=a[0],c=a[1],u=a[2],d=i[0],f=i[1],h=i[2],p=d-l,m=f-c,g=p*p+m*m,y,x;if(g<S0r)x=Math.log(h/u)/t,y=function(T){return[l+T*p,c+T*m,u*Math.exp(t*T*x)]};else{var w=Math.sqrt(g),O=(h*h-u*u+n*g)/(2*u*r*w),k=(h*h-u*u-n*g)/(2*h*r*w),_=Math.log(Math.sqrt(O*O+1)-O),E=Math.log(Math.sqrt(k*k+1)-k);x=(E-_)/t,y=function(T){var j=T*x,A=Mje(_),I=u/(r*w)*(A*k0r(t*j+_)-O0r(_));return[l+I*p,c+I*m,u*A/Mje(t*j+_)]}}return y.duration=x*1e3*t/Math.SQRT2,y}return s.rho=function(a){var i=Math.max(.001,+a),l=i*i,c=l*l;return e(i,l,c)},s})(Math.SQRT2,2,4);function _0r(e,t){t===void 0&&(t=e,e=Py);for(var r=0,n=t.length-1,s=t[0],a=new Array(n<0?0:n);r<n;)a[r]=e(s,s=t[++r]);return function(i){var l=Math.max(0,Math.min(n-1,Math.floor(i*=n)));return a[l](i-l)}}function E0r(e){return function(){return e}}function j5(e){return+e}var Dje=[0,1];function Wc(e){return e}function Mse(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:E0r(isNaN(t)?NaN:.5)}function C0r(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function j0r(e,t,r){var n=e[0],s=e[1],a=t[0],i=t[1];return s<n?(n=Mse(s,n),a=r(i,a)):(n=Mse(n,s),a=r(a,i)),function(l){return a(n(l))}}function T0r(e,t,r){var n=Math.min(e.length,t.length)-1,s=new Array(n),a=new Array(n),i=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++i<n;)s[i]=Mse(e[i],e[i+1]),a[i]=r(t[i],t[i+1]);return function(l){var c=QR(e,l,1,n)-1;return a[c](s[c](l))}}function GR(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Sz(){var e=Dje,t=Dje,r=Py,n,s,a,i=Wc,l,c,u;function d(){var h=Math.min(e.length,t.length);return i!==Wc&&(i=C0r(e[0],e[h-1])),l=h>2?T0r:j0r,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?a:(c||(c=l(e.map(n),t,r)))(n(i(h)))}return f.invert=function(h){return i(s((u||(u=l(t,e.map(n),Kh)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,j5),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),r=yfe,d()},f.clamp=function(h){return arguments.length?(i=h?!0:Wc,d()):i!==Wc},f.interpolate=function(h){return arguments.length?(r=h,d()):r},f.unknown=function(h){return arguments.length?(a=h,f):a},function(h,p){return n=h,s=p,d()}}function vfe(){return Sz()(Wc,Wc)}function N0r(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function T5(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function x_(e){return e=T5(Math.abs(e)),e?e[1]:NaN}function A0r(e,t){return function(r,n){for(var s=r.length,a=[],i=0,l=e[0],c=0;s>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),a.push(r.substring(s-=l,s+l)),!((c+=l+1)>n));)l=e[i=(i+1)%e.length];return a.reverse().join(t)}}function I0r(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var R0r=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _A(e){if(!(t=R0r.exec(e)))throw new Error("invalid format: "+e);var t;return new bfe({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}_A.prototype=bfe.prototype;function bfe(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}bfe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function P0r(e){e:for(var t=e.length,r=1,n=-1,s;r<t;++r)switch(e[r]){case".":n=s=r;break;case"0":n===0&&(n=r),s=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(s+1):e}var N5;function M0r(e,t){var r=T5(e,t);if(!r)return N5=void 0,e.toPrecision(t);var n=r[0],s=r[1],a=s-(N5=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,i=n.length;return a===i?n:a>i?n+new Array(a-i+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+T5(e,Math.max(0,t+a-1))[0]}function Lje(e,t){var r=T5(e,t);if(!r)return e+"";var n=r[0],s=r[1];return s<0?"0."+new Array(-s).join("0")+n:n.length>s+1?n.slice(0,s+1)+"."+n.slice(s+1):n+new Array(s-n.length+2).join("0")}const $je={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:N0r,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Lje(e*100,t),r:Lje,s:M0r,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Fje(e){return e}var zje=Array.prototype.map,Bje=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function D0r(e){var t=e.grouping===void 0||e.thousands===void 0?Fje:A0r(zje.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Fje:I0r(zje.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,h){f=_A(f);var p=f.fill,m=f.align,g=f.sign,y=f.symbol,x=f.zero,w=f.width,O=f.comma,k=f.precision,_=f.trim,E=f.type;E==="n"?(O=!0,E="g"):$je[E]||(k===void 0&&(k=12),_=!0,E="g"),(x||p==="0"&&m==="=")&&(x=!0,p="0",m="=");var T=(h&&h.prefix!==void 0?h.prefix:"")+(y==="$"?r:y==="#"&&/[boxX]/.test(E)?"0"+E.toLowerCase():""),j=(y==="$"?n:/[%p]/.test(E)?i:"")+(h&&h.suffix!==void 0?h.suffix:""),A=$je[E],I=/[defgprs%]/.test(E);k=k===void 0?6:/[gprs]/.test(E)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function P(R){var B=T,D=j,F,U,z;if(E==="c")D=A(R)+D,R="";else{R=+R;var V=R<0||1/R<0;if(R=isNaN(R)?c:A(Math.abs(R),k),_&&(R=P0r(R)),V&&+R==0&&g!=="+"&&(V=!1),B=(V?g==="("?g:l:g==="-"||g==="("?"":g)+B,D=(E==="s"&&!isNaN(R)&&N5!==void 0?Bje[8+N5/3]:"")+D+(V&&g==="("?")":""),I){for(F=-1,U=R.length;++F<U;)if(z=R.charCodeAt(F),48>z||z>57){D=(z===46?s+R.slice(F+1):R.slice(F))+D,R=R.slice(0,F);break}}}O&&!x&&(R=t(R,1/0));var W=B.length+R.length+D.length,L=W<w?new Array(w-W+1).join(p):"";switch(O&&x&&(R=t(L+R,L.length?w-D.length:1/0),L=""),m){case"<":R=B+R+D+L;break;case"=":R=B+L+R+D;break;case"^":R=L.slice(0,W=L.length>>1)+B+R+D+L.slice(W);break;default:R=L+B+R+D;break}return a(R)}return P.toString=function(){return f+""},P}function d(f,h){var p=Math.max(-8,Math.min(8,Math.floor(x_(h)/3)))*3,m=Math.pow(10,-p),g=u((f=_A(f),f.type="f",f),{suffix:Bje[8+p/3]});return function(y){return g(m*y)}}return{format:u,formatPrefix:d}}var x2,xfe,Qst;L0r({thousands:",",grouping:[3],currency:["$",""]});function L0r(e){return x2=D0r(e),xfe=x2.format,Qst=x2.formatPrefix,x2}function $0r(e){return Math.max(0,-x_(Math.abs(e)))}function F0r(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(x_(t)/3)))*3-x_(Math.abs(e)))}function z0r(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,x_(t)-x_(e))+1}function Wst(e,t,r,n){var s=Nse(e,t,r),a;switch(n=_A(n??",f"),n.type){case"s":{var i=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=F0r(s,i))&&(n.precision=a),Qst(n,i)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=z0r(s,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=$0r(s))&&(n.precision=a-(n.type==="%")*2);break}}return xfe(n)}function Jx(e){var t=e.domain;return e.ticks=function(r){var n=t();return jse(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var s=t();return Wst(s[0],s[s.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),s=0,a=n.length-1,i=n[s],l=n[a],c,u,d=10;for(l<i&&(u=i,i=l,l=u,u=s,s=a,a=u);d-- >0;){if(u=Tse(i,l,r),u===c)return n[s]=i,n[a]=l,t(n);if(u>0)i=Math.floor(i/u)*u,l=Math.ceil(l/u)*u;else if(u<0)i=Math.ceil(i*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function Gst(){var e=vfe();return e.copy=function(){return GR(e,Gst())},Th.apply(e,arguments),Jx(e)}function Zst(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,j5),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return Zst(e).unknown(t)},e=arguments.length?Array.from(e,j5):[0,1],Jx(r)}function Yst(e,t){e=e.slice();var r=0,n=e.length-1,s=e[r],a=e[n],i;return a<s&&(i=r,r=n,n=i,i=s,s=a,a=i),e[r]=t.floor(s),e[n]=t.ceil(a),e}function Uje(e){return Math.log(e)}function Vje(e){return Math.exp(e)}function B0r(e){return-Math.log(-e)}function U0r(e){return-Math.exp(-e)}function V0r(e){return isFinite(e)?+("1e"+e):e<0?0:e}function q0r(e){return e===10?V0r:e===Math.E?Math.exp:t=>Math.pow(e,t)}function H0r(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function qje(e){return(t,r)=>-e(-t,r)}function wfe(e){const t=e(Uje,Vje),r=t.domain;let n=10,s,a;function i(){return s=H0r(n),a=q0r(n),r()[0]<0?(s=qje(s),a=qje(a),e(B0r,U0r)):e(Uje,Vje),t}return t.base=function(l){return arguments.length?(n=+l,i()):n},t.domain=function(l){return arguments.length?(r(l),i()):r()},t.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let h=s(u),p=s(d),m,g;const y=l==null?10:+l;let x=[];if(!(n%1)&&p-h<y){if(h=Math.floor(h),p=Math.ceil(p),u>0){for(;h<=p;++h)for(m=1;m<n;++m)if(g=h<0?m/a(-h):m*a(h),!(g<u)){if(g>d)break;x.push(g)}}else for(;h<=p;++h)for(m=n-1;m>=1;--m)if(g=h>0?m/a(-h):m*a(h),!(g<u)){if(g>d)break;x.push(g)}x.length*2<y&&(x=jse(u,d,y))}else x=jse(h,p,Math.min(p-h,y)).map(a);return f?x.reverse():x},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=_A(c)).precision==null&&(c.trim=!0),c=xfe(c)),l===1/0)return c;const u=Math.max(1,n*l/t.ticks().length);return d=>{let f=d/a(Math.round(s(d)));return f*n<n-.5&&(f*=n),f<=u?c(d):""}},t.nice=()=>r(Yst(r(),{floor:l=>a(Math.floor(s(l))),ceil:l=>a(Math.ceil(s(l)))})),t}function Xst(){const e=wfe(Sz()).domain([1,10]);return e.copy=()=>GR(e,Xst()).base(e.base()),Th.apply(e,arguments),e}function Hje(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Qje(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Sfe(e){var t=1,r=e(Hje(t),Qje(t));return r.constant=function(n){return arguments.length?e(Hje(t=+n),Qje(t)):t},Jx(r)}function Kst(){var e=Sfe(Sz());return e.copy=function(){return GR(e,Kst()).constant(e.constant())},Th.apply(e,arguments)}function Wje(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Q0r(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function W0r(e){return e<0?-e*e:e*e}function Ofe(e){var t=e(Wc,Wc),r=1;function n(){return r===1?e(Wc,Wc):r===.5?e(Q0r,W0r):e(Wje(r),Wje(1/r))}return t.exponent=function(s){return arguments.length?(r=+s,n()):r},Jx(t)}function kfe(){var e=Ofe(Sz());return e.copy=function(){return GR(e,kfe()).exponent(e.exponent())},Th.apply(e,arguments),e}function G0r(){return kfe.apply(null,arguments).exponent(.5)}function Gje(e){return Math.sign(e)*e*e}function Z0r(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Jst(){var e=vfe(),t=[0,1],r=!1,n;function s(a){var i=Z0r(e(a));return isNaN(i)?n:r?Math.round(i):i}return s.invert=function(a){return e.invert(Gje(a))},s.domain=function(a){return arguments.length?(e.domain(a),s):e.domain()},s.range=function(a){return arguments.length?(e.range((t=Array.from(a,j5)).map(Gje)),s):t.slice()},s.rangeRound=function(a){return s.range(a).round(!0)},s.round=function(a){return arguments.length?(r=!!a,s):r},s.clamp=function(a){return arguments.length?(e.clamp(a),s):e.clamp()},s.unknown=function(a){return arguments.length?(n=a,s):n},s.copy=function(){return Jst(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Th.apply(s,arguments),Jx(s)}function eat(){var e=[],t=[],r=[],n;function s(){var i=0,l=Math.max(1,t.length);for(r=new Array(l-1);++i<l;)r[i-1]=Wxr(e,i/l);return a}function a(i){return i==null||isNaN(i=+i)?n:t[QR(r,i)]}return a.invertExtent=function(i){var l=t.indexOf(i);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},a.domain=function(i){if(!arguments.length)return e.slice();e=[];for(let l of i)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Gb),s()},a.range=function(i){return arguments.length?(t=Array.from(i),s()):t.slice()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.quantiles=function(){return r.slice()},a.copy=function(){return eat().domain(e).range(t).unknown(n)},Th.apply(a,arguments)}function tat(){var e=0,t=1,r=1,n=[.5],s=[0,1],a;function i(c){return c!=null&&c<=c?s[QR(n,c,0,r)]:a}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*t-(c-r)*e)/(r+1);return i}return i.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},i.range=function(c){return arguments.length?(r=(s=Array.from(c)).length-1,l()):s.slice()},i.invertExtent=function(c){var u=s.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,n[0]]:u>=r?[n[r-1],t]:[n[u-1],n[u]]},i.unknown=function(c){return arguments.length&&(a=c),i},i.thresholds=function(){return n.slice()},i.copy=function(){return tat().domain([e,t]).range(s).unknown(a)},Th.apply(Jx(i),arguments)}function rat(){var e=[.5],t=[0,1],r,n=1;function s(a){return a!=null&&a<=a?t[QR(e,a,0,n)]:r}return s.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(a){var i=t.indexOf(a);return[e[i-1],e[i]]},s.unknown=function(a){return arguments.length?(r=a,s):r},s.copy=function(){return rat().domain(e).range(t).unknown(r)},Th.apply(s,arguments)}const Aq=new Date,Iq=new Date;function tl(e,t,r,n){function s(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return s.floor=a=>(e(a=new Date(+a)),a),s.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),s.round=a=>{const i=s(a),l=s.ceil(a);return a-i<l-a?i:l},s.offset=(a,i)=>(t(a=new Date(+a),i==null?1:Math.floor(i)),a),s.range=(a,i,l)=>{const c=[];if(a=s.ceil(a),l=l==null?1:Math.floor(l),!(a<i)||!(l>0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(u<a&&a<i);return c},s.filter=a=>tl(i=>{if(i>=i)for(;e(i),!a(i);)i.setTime(i-1)},(i,l)=>{if(i>=i)if(l<0)for(;++l<=0;)for(;t(i,-1),!a(i););else for(;--l>=0;)for(;t(i,1),!a(i););}),r&&(s.count=(a,i)=>(Aq.setTime(+a),Iq.setTime(+i),e(Aq),e(Iq),Math.floor(r(Aq,Iq))),s.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?s.filter(n?i=>n(i)%a===0:i=>s.count(0,i)%a===0):s)),s}const A5=tl(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);A5.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?tl(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):A5);A5.range;const ky=1e3,lh=ky*60,_y=lh*60,Zy=_y*24,_fe=Zy*7,Zje=Zy*30,Rq=Zy*365,gw=tl(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ky)},(e,t)=>(t-e)/ky,e=>e.getUTCSeconds());gw.range;const Efe=tl(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ky)},(e,t)=>{e.setTime(+e+t*lh)},(e,t)=>(t-e)/lh,e=>e.getMinutes());Efe.range;const Cfe=tl(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*lh)},(e,t)=>(t-e)/lh,e=>e.getUTCMinutes());Cfe.range;const jfe=tl(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ky-e.getMinutes()*lh)},(e,t)=>{e.setTime(+e+t*_y)},(e,t)=>(t-e)/_y,e=>e.getHours());jfe.range;const Tfe=tl(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*_y)},(e,t)=>(t-e)/_y,e=>e.getUTCHours());Tfe.range;const ZR=tl(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*lh)/Zy,e=>e.getDate()-1);ZR.range;const Oz=tl(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Zy,e=>e.getUTCDate()-1);Oz.range;const nat=tl(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Zy,e=>Math.floor(e/Zy));nat.range;function e1(e){return tl(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*lh)/_fe)}const kz=e1(0),I5=e1(1),Y0r=e1(2),X0r=e1(3),w_=e1(4),K0r=e1(5),J0r=e1(6);kz.range;I5.range;Y0r.range;X0r.range;w_.range;K0r.range;J0r.range;function t1(e){return tl(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/_fe)}const _z=t1(0),R5=t1(1),ewr=t1(2),twr=t1(3),S_=t1(4),rwr=t1(5),nwr=t1(6);_z.range;R5.range;ewr.range;twr.range;S_.range;rwr.range;nwr.range;const Nfe=tl(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Nfe.range;const Afe=tl(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Afe.range;const Yy=tl(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Yy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:tl(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Yy.range;const Xy=tl(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Xy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:tl(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Xy.range;function sat(e,t,r,n,s,a){const i=[[gw,1,ky],[gw,5,5*ky],[gw,15,15*ky],[gw,30,30*ky],[a,1,lh],[a,5,5*lh],[a,15,15*lh],[a,30,30*lh],[s,1,_y],[s,3,3*_y],[s,6,6*_y],[s,12,12*_y],[n,1,Zy],[n,2,2*Zy],[r,1,_fe],[t,1,Zje],[t,3,3*Zje],[e,1,Rq]];function l(u,d,f){const h=d<u;h&&([u,d]=[d,u]);const p=f&&typeof f.range=="function"?f:c(u,d,f),m=p?p.range(u,+d+1):[];return h?m.reverse():m}function c(u,d,f){const h=Math.abs(d-u)/f,p=ffe(([,,y])=>y).right(i,h);if(p===i.length)return e.every(Nse(u/Rq,d/Rq,f));if(p===0)return A5.every(Math.max(Nse(u,d,f),1));const[m,g]=i[h/i[p-1][2]<i[p][2]/h?p-1:p];return m.every(g)}return[l,c]}const[swr,awr]=sat(Xy,Afe,_z,nat,Tfe,Cfe),[iwr,owr]=sat(Yy,Nfe,kz,ZR,jfe,Efe);function Pq(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Mq(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function xj(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function lwr(e){var t=e.dateTime,r=e.date,n=e.time,s=e.periods,a=e.days,i=e.shortDays,l=e.months,c=e.shortMonths,u=wj(s),d=Sj(s),f=wj(a),h=Sj(a),p=wj(i),m=Sj(i),g=wj(l),y=Sj(l),x=wj(c),w=Sj(c),O={a:z,A:V,b:W,B:L,c:null,d:tTe,e:tTe,f:Awr,g:Bwr,G:Vwr,H:jwr,I:Twr,j:Nwr,L:aat,m:Iwr,M:Rwr,p:Y,q,Q:sTe,s:aTe,S:Pwr,u:Mwr,U:Dwr,V:Lwr,w:$wr,W:Fwr,x:null,X:null,y:zwr,Y:Uwr,Z:qwr,"%":nTe},k={a:M,A:Q,b:G,B:J,c:null,d:rTe,e:rTe,f:Gwr,g:sSr,G:iSr,H:Hwr,I:Qwr,j:Wwr,L:oat,m:Zwr,M:Ywr,p:ie,q:te,Q:sTe,s:aTe,S:Xwr,u:Kwr,U:Jwr,V:eSr,w:tSr,W:rSr,x:null,X:null,y:nSr,Y:aSr,Z:oSr,"%":nTe},_={a:I,A:P,b:R,B,c:D,d:Jje,e:Jje,f:kwr,g:Kje,G:Xje,H:eTe,I:eTe,j:xwr,L:Owr,m:bwr,M:wwr,p:A,q:vwr,Q:Ewr,s:Cwr,S:Swr,u:hwr,U:pwr,V:mwr,w:fwr,W:gwr,x:F,X:U,y:Kje,Y:Xje,Z:ywr,"%":_wr};O.x=E(r,O),O.X=E(n,O),O.c=E(t,O),k.x=E(r,k),k.X=E(n,k),k.c=E(t,k);function E(se,oe){return function(he){var K=[],re=-1,le=0,pe=se.length,ce,ue,we;for(he instanceof Date||(he=new Date(+he));++re<pe;)se.charCodeAt(re)===37&&(K.push(se.slice(le,re)),(ue=Yje[ce=se.charAt(++re)])!=null?ce=se.charAt(++re):ue=ce==="e"?" ":"0",(we=oe[ce])&&(ce=we(he,ue)),K.push(ce),le=re+1);return K.push(se.slice(le,re)),K.join("")}}function T(se,oe){return function(he){var K=xj(1900,void 0,1),re=j(K,se,he+="",0),le,pe;if(re!=he.length)return null;if("Q"in K)return new Date(K.Q);if("s"in K)return new Date(K.s*1e3+("L"in K?K.L:0));if(oe&&!("Z"in K)&&(K.Z=0),"p"in K&&(K.H=K.H%12+K.p*12),K.m===void 0&&(K.m="q"in K?K.q:0),"V"in K){if(K.V<1||K.V>53)return null;"w"in K||(K.w=1),"Z"in K?(le=Mq(xj(K.y,0,1)),pe=le.getUTCDay(),le=pe>4||pe===0?R5.ceil(le):R5(le),le=Oz.offset(le,(K.V-1)*7),K.y=le.getUTCFullYear(),K.m=le.getUTCMonth(),K.d=le.getUTCDate()+(K.w+6)%7):(le=Pq(xj(K.y,0,1)),pe=le.getDay(),le=pe>4||pe===0?I5.ceil(le):I5(le),le=ZR.offset(le,(K.V-1)*7),K.y=le.getFullYear(),K.m=le.getMonth(),K.d=le.getDate()+(K.w+6)%7)}else("W"in K||"U"in K)&&("w"in K||(K.w="u"in K?K.u%7:"W"in K?1:0),pe="Z"in K?Mq(xj(K.y,0,1)).getUTCDay():Pq(xj(K.y,0,1)).getDay(),K.m=0,K.d="W"in K?(K.w+6)%7+K.W*7-(pe+5)%7:K.w+K.U*7-(pe+6)%7);return"Z"in K?(K.H+=K.Z/100|0,K.M+=K.Z%100,Mq(K)):Pq(K)}}function j(se,oe,he,K){for(var re=0,le=oe.length,pe=he.length,ce,ue;re<le;){if(K>=pe)return-1;if(ce=oe.charCodeAt(re++),ce===37){if(ce=oe.charAt(re++),ue=_[ce in Yje?oe.charAt(re++):ce],!ue||(K=ue(se,he,K))<0)return-1}else if(ce!=he.charCodeAt(K++))return-1}return K}function A(se,oe,he){var K=u.exec(oe.slice(he));return K?(se.p=d.get(K[0].toLowerCase()),he+K[0].length):-1}function I(se,oe,he){var K=p.exec(oe.slice(he));return K?(se.w=m.get(K[0].toLowerCase()),he+K[0].length):-1}function P(se,oe,he){var K=f.exec(oe.slice(he));return K?(se.w=h.get(K[0].toLowerCase()),he+K[0].length):-1}function R(se,oe,he){var K=x.exec(oe.slice(he));return K?(se.m=w.get(K[0].toLowerCase()),he+K[0].length):-1}function B(se,oe,he){var K=g.exec(oe.slice(he));return K?(se.m=y.get(K[0].toLowerCase()),he+K[0].length):-1}function D(se,oe,he){return j(se,t,oe,he)}function F(se,oe,he){return j(se,r,oe,he)}function U(se,oe,he){return j(se,n,oe,he)}function z(se){return i[se.getDay()]}function V(se){return a[se.getDay()]}function W(se){return c[se.getMonth()]}function L(se){return l[se.getMonth()]}function Y(se){return s[+(se.getHours()>=12)]}function q(se){return 1+~~(se.getMonth()/3)}function M(se){return i[se.getUTCDay()]}function Q(se){return a[se.getUTCDay()]}function G(se){return c[se.getUTCMonth()]}function J(se){return l[se.getUTCMonth()]}function ie(se){return s[+(se.getUTCHours()>=12)]}function te(se){return 1+~~(se.getUTCMonth()/3)}return{format:function(se){var oe=E(se+="",O);return oe.toString=function(){return se},oe},parse:function(se){var oe=T(se+="",!1);return oe.toString=function(){return se},oe},utcFormat:function(se){var oe=E(se+="",k);return oe.toString=function(){return se},oe},utcParse:function(se){var oe=T(se+="",!0);return oe.toString=function(){return se},oe}}}var Yje={"-":"",_:" ",0:"0"},_l=/^\s*\d+/,cwr=/^%/,uwr=/[\\^$*+?|[\]().{}]/g;function zs(e,t,r){var n=e<0?"-":"",s=(n?-e:e)+"",a=s.length;return n+(a<r?new Array(r-a+1).join(t)+s:s)}function dwr(e){return e.replace(uwr,"\\$&")}function wj(e){return new RegExp("^(?:"+e.map(dwr).join("|")+")","i")}function Sj(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function fwr(e,t,r){var n=_l.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function hwr(e,t,r){var n=_l.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function pwr(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function mwr(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function gwr(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function Xje(e,t,r){var n=_l.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function Kje(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function ywr(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function vwr(e,t,r){var n=_l.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function bwr(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Jje(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function xwr(e,t,r){var n=_l.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function eTe(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function wwr(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Swr(e,t,r){var n=_l.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Owr(e,t,r){var n=_l.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function kwr(e,t,r){var n=_l.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function _wr(e,t,r){var n=cwr.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Ewr(e,t,r){var n=_l.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Cwr(e,t,r){var n=_l.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function tTe(e,t){return zs(e.getDate(),t,2)}function jwr(e,t){return zs(e.getHours(),t,2)}function Twr(e,t){return zs(e.getHours()%12||12,t,2)}function Nwr(e,t){return zs(1+ZR.count(Yy(e),e),t,3)}function aat(e,t){return zs(e.getMilliseconds(),t,3)}function Awr(e,t){return aat(e,t)+"000"}function Iwr(e,t){return zs(e.getMonth()+1,t,2)}function Rwr(e,t){return zs(e.getMinutes(),t,2)}function Pwr(e,t){return zs(e.getSeconds(),t,2)}function Mwr(e){var t=e.getDay();return t===0?7:t}function Dwr(e,t){return zs(kz.count(Yy(e)-1,e),t,2)}function iat(e){var t=e.getDay();return t>=4||t===0?w_(e):w_.ceil(e)}function Lwr(e,t){return e=iat(e),zs(w_.count(Yy(e),e)+(Yy(e).getDay()===4),t,2)}function $wr(e){return e.getDay()}function Fwr(e,t){return zs(I5.count(Yy(e)-1,e),t,2)}function zwr(e,t){return zs(e.getFullYear()%100,t,2)}function Bwr(e,t){return e=iat(e),zs(e.getFullYear()%100,t,2)}function Uwr(e,t){return zs(e.getFullYear()%1e4,t,4)}function Vwr(e,t){var r=e.getDay();return e=r>=4||r===0?w_(e):w_.ceil(e),zs(e.getFullYear()%1e4,t,4)}function qwr(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+zs(t/60|0,"0",2)+zs(t%60,"0",2)}function rTe(e,t){return zs(e.getUTCDate(),t,2)}function Hwr(e,t){return zs(e.getUTCHours(),t,2)}function Qwr(e,t){return zs(e.getUTCHours()%12||12,t,2)}function Wwr(e,t){return zs(1+Oz.count(Xy(e),e),t,3)}function oat(e,t){return zs(e.getUTCMilliseconds(),t,3)}function Gwr(e,t){return oat(e,t)+"000"}function Zwr(e,t){return zs(e.getUTCMonth()+1,t,2)}function Ywr(e,t){return zs(e.getUTCMinutes(),t,2)}function Xwr(e,t){return zs(e.getUTCSeconds(),t,2)}function Kwr(e){var t=e.getUTCDay();return t===0?7:t}function Jwr(e,t){return zs(_z.count(Xy(e)-1,e),t,2)}function lat(e){var t=e.getUTCDay();return t>=4||t===0?S_(e):S_.ceil(e)}function eSr(e,t){return e=lat(e),zs(S_.count(Xy(e),e)+(Xy(e).getUTCDay()===4),t,2)}function tSr(e){return e.getUTCDay()}function rSr(e,t){return zs(R5.count(Xy(e)-1,e),t,2)}function nSr(e,t){return zs(e.getUTCFullYear()%100,t,2)}function sSr(e,t){return e=lat(e),zs(e.getUTCFullYear()%100,t,2)}function aSr(e,t){return zs(e.getUTCFullYear()%1e4,t,4)}function iSr(e,t){var r=e.getUTCDay();return e=r>=4||r===0?S_(e):S_.ceil(e),zs(e.getUTCFullYear()%1e4,t,4)}function oSr(){return"+0000"}function nTe(){return"%"}function sTe(e){return+e}function aTe(e){return Math.floor(+e/1e3)}var sO,cat,uat;lSr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function lSr(e){return sO=lwr(e),cat=sO.format,sO.parse,uat=sO.utcFormat,sO.utcParse,sO}function cSr(e){return new Date(e)}function uSr(e){return e instanceof Date?+e:+new Date(+e)}function Ife(e,t,r,n,s,a,i,l,c,u){var d=vfe(),f=d.invert,h=d.domain,p=u(".%L"),m=u(":%S"),g=u("%I:%M"),y=u("%I %p"),x=u("%a %d"),w=u("%b %d"),O=u("%B"),k=u("%Y");function _(E){return(c(E)<E?p:l(E)<E?m:i(E)<E?g:a(E)<E?y:n(E)<E?s(E)<E?x:w:r(E)<E?O:k)(E)}return d.invert=function(E){return new Date(f(E))},d.domain=function(E){return arguments.length?h(Array.from(E,uSr)):h().map(cSr)},d.ticks=function(E){var T=h();return e(T[0],T[T.length-1],E??10)},d.tickFormat=function(E,T){return T==null?_:u(T)},d.nice=function(E){var T=h();return(!E||typeof E.range!="function")&&(E=t(T[0],T[T.length-1],E??10)),E?h(Yst(T,E)):d},d.copy=function(){return GR(d,Ife(e,t,r,n,s,a,i,l,c,u))},d}function dSr(){return Th.apply(Ife(iwr,owr,Yy,Nfe,kz,ZR,jfe,Efe,gw,cat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function fSr(){return Th.apply(Ife(swr,awr,Xy,Afe,_z,Oz,Tfe,Cfe,gw,uat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Ez(){var e=0,t=1,r,n,s,a,i=Wc,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:i(s===0?.5:(f=(a(f)-r)*s,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([e,t]=f,r=a(e=+e),n=a(t=+t),s=r===n?0:1/(n-r),u):[e,t]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(i=f,u):i};function d(f){return function(h){var p,m;return arguments.length?([p,m]=h,i=f(p,m),u):[i(0),i(1)]}}return u.range=d(Py),u.rangeRound=d(yfe),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return a=f,r=f(e),n=f(t),s=r===n?0:1/(n-r),u}}function e0(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function dat(){var e=Jx(Ez()(Wc));return e.copy=function(){return e0(e,dat())},bv.apply(e,arguments)}function fat(){var e=wfe(Ez()).domain([1,10]);return e.copy=function(){return e0(e,fat()).base(e.base())},bv.apply(e,arguments)}function hat(){var e=Sfe(Ez());return e.copy=function(){return e0(e,hat()).constant(e.constant())},bv.apply(e,arguments)}function Rfe(){var e=Ofe(Ez());return e.copy=function(){return e0(e,Rfe()).exponent(e.exponent())},bv.apply(e,arguments)}function hSr(){return Rfe.apply(null,arguments).exponent(.5)}function pat(){var e=[],t=Wc;function r(n){if(n!=null&&!isNaN(n=+n))return t((QR(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let s of n)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(Gb),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,s)=>t(s/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(s,a)=>Qxr(e,a/n))},r.copy=function(){return pat(t).domain(e)},bv.apply(r,arguments)}function Cz(){var e=0,t=.5,r=1,n=1,s,a,i,l,c,u=Wc,d,f=!1,h;function p(g){return isNaN(g=+g)?h:(g=.5+((g=+d(g))-a)*(n*g<n*a?l:c),u(f?Math.max(0,Math.min(1,g)):g))}p.domain=function(g){return arguments.length?([e,t,r]=g,s=d(e=+e),a=d(t=+t),i=d(r=+r),l=s===a?0:.5/(a-s),c=a===i?0:.5/(i-a),n=a<s?-1:1,p):[e,t,r]},p.clamp=function(g){return arguments.length?(f=!!g,p):f},p.interpolator=function(g){return arguments.length?(u=g,p):u};function m(g){return function(y){var x,w,O;return arguments.length?([x,w,O]=y,u=_0r(g,[x,w,O]),p):[u(0),u(.5),u(1)]}}return p.range=m(Py),p.rangeRound=m(yfe),p.unknown=function(g){return arguments.length?(h=g,p):h},function(g){return d=g,s=g(e),a=g(t),i=g(r),l=s===a?0:.5/(a-s),c=a===i?0:.5/(i-a),n=a<s?-1:1,p}}function mat(){var e=Jx(Cz()(Wc));return e.copy=function(){return e0(e,mat())},bv.apply(e,arguments)}function gat(){var e=wfe(Cz()).domain([.1,1,10]);return e.copy=function(){return e0(e,gat()).base(e.base())},bv.apply(e,arguments)}function yat(){var e=Sfe(Cz());return e.copy=function(){return e0(e,yat()).constant(e.constant())},bv.apply(e,arguments)}function Pfe(){var e=Ofe(Cz());return e.copy=function(){return e0(e,Pfe()).exponent(e.exponent())},bv.apply(e,arguments)}function pSr(){return Pfe.apply(null,arguments).exponent(.5)}const cT=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:pfe,scaleDiverging:mat,scaleDivergingLog:gat,scaleDivergingPow:Pfe,scaleDivergingSqrt:pSr,scaleDivergingSymlog:yat,scaleIdentity:Zst,scaleImplicit:Ase,scaleLinear:Gst,scaleLog:Xst,scaleOrdinal:hfe,scalePoint:Zxr,scalePow:kfe,scaleQuantile:eat,scaleQuantize:tat,scaleRadial:Jst,scaleSequential:dat,scaleSequentialLog:fat,scaleSequentialPow:Rfe,scaleSequentialQuantile:pat,scaleSequentialSqrt:hSr,scaleSequentialSymlog:hat,scaleSqrt:G0r,scaleSymlog:Kst,scaleThreshold:rat,scaleTime:dSr,scaleUtc:fSr,tickFormat:Wst},Symbol.toStringTag,{value:"Module"}));function mSr(e){if(e in cT)return cT[e]();var t="scale".concat(FR(e));if(t in cT)return cT[t]()}function iTe(e,t,r){if(typeof e=="function")return e.copy().domain(t).range(r);if(e!=null){var n=mSr(e);if(n!=null)return n.domain(t).range(r),n}}function Mfe(e,t,r,n){if(!(r==null||n==null))return typeof e.scale=="function"?iTe(e.scale,r,n):iTe(t,r,n)}function gSr(e){return"scale".concat(FR(e))}function ySr(e){return gSr(e)in cT}var vat=(e,t,r)=>{if(e!=null){var{scale:n,type:s}=e;if(n==="auto")return s==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!t)?"point":s==="category"?"band":"linear";if(typeof n=="string")return ySr(n)?n:"point"}};function vSr(e,t){for(var r=0,n=e.length,s=e[0]<e[e.length-1];r<n;){var a=Math.floor((r+n)/2);(s?e[a]<t:e[a]>t)?r=a+1:n=a}return r}function bat(e,t){if(e){var r=t??e.domain(),n=r.map(a=>{var i;return(i=e(a))!==null&&i!==void 0?i:0}),s=e.range();if(!(r.length===0||s.length<2))return a=>{var i,l,c=vSr(n,a);if(c<=0)return r[0];if(c>=r.length)return r[r.length-1];var u=(i=n[c-1])!==null&&i!==void 0?i:0,d=(l=n[c])!==null&&l!==void 0?l:0;return Math.abs(a-u)<=Math.abs(a-d)?r[c-1]:r[c]}}}function bSr(e){if(e!=null)return"invert"in e&&typeof e.invert=="function"?e.invert.bind(e):bat(e,void 0)}function oTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function P5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oTe(Object(r),!0).forEach(function(n){xSr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xSr(e,t,r){return(t=wSr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wSr(e){var t=SSr(e,"string");return typeof t=="symbol"?t:t+""}function SSr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Dse=[0,"auto"],Qo={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},xat=(e,t)=>e.cartesianAxis.xAxis[t],xv=(e,t)=>{var r=xat(e,t);return r??Qo},Wo={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Dse,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:UR},wat=(e,t)=>e.cartesianAxis.yAxis[t],wv=(e,t)=>{var r=wat(e,t);return r??Wo},OSr={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Dfe=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??OSr},iu=(e,t,r)=>{switch(t){case"xAxis":return xv(e,r);case"yAxis":return wv(e,r);case"zAxis":return Dfe(e,r);case"angleAxis":return ofe(e,r);case"radiusAxis":return lfe(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},kSr=(e,t,r)=>{switch(t){case"xAxis":return xv(e,r);case"yAxis":return wv(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},YR=(e,t,r)=>{switch(t){case"xAxis":return xv(e,r);case"yAxis":return wv(e,r);case"angleAxis":return ofe(e,r);case"radiusAxis":return lfe(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},Sat=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function Oat(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var kat=e=>e.graphicalItems.cartesianItems,_Sr=et([Ol,bz],Oat),_at=(e,t,r)=>e.filter(r).filter(n=>t?.includeHidden===!0?!0:!n.hide),XR=et([kat,iu,_Sr],_at,{memoizeOptions:{resultEqualityCheck:wz}}),Eat=et([XR],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(ufe)),Cat=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),ESr=et([XR],Cat),jat=e=>e.map(t=>t.data).filter(Boolean).flat(1),CSr=et([XR],jat,{memoizeOptions:{resultEqualityCheck:wz}}),Tat=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:s}=t;return e.length>0?e:r.slice(n,s+1)},Lfe=et([CSr,efe],Tat),Nat=(e,t,r)=>t?.dataKey!=null?e.map(n=>({value:Gl(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(s=>({value:Gl(s,n)}))):e.map(n=>({value:n})),KR=et([Lfe,iu,XR],Nat);function jk(e){if(eg(e)||e instanceof Date){var t=Number(e);if($s(t))return t}}function lTe(e){if(Array.isArray(e)){var t=[jk(e[0]),jk(e[1])];return Hm(t)?t:void 0}var r=jk(e);if(r!=null)return[r,r]}function Ky(e){return e.map(jk).filter(Mu)}function jSr(e,t){var r=jk(e),n=jk(t);return r==null&&n==null?0:r==null?-1:n==null?1:r-n}var TSr=et([KR],e=>e?.map(t=>t.value).sort(jSr));function Aat(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function NSr(e,t,r){return!r||typeof t!="number"||Wy(t)?[]:r.length?Ky(r.flatMap(n=>{var s=Gl(e,n.dataKey),a,i;if(Array.isArray(s)?[a,i]=s:a=i=s,!(!$s(a)||!$s(i)))return[t-a,t+i]})):[]}var rl=e=>{var t=kl(e),r=TE(e);return YR(e,t,r)},JR=et([rl],e=>e?.dataKey),ASr=et([Eat,efe,rl],Mst),Iat=(e,t,r,n)=>{var s={},a=t.reduce((i,l)=>{if(l.stackId==null)return i;var c=i[l.stackId];return c==null&&(c=[]),c.push(l),i[l.stackId]=c,i},s);return Object.fromEntries(Object.entries(a).map(i=>{var[l,c]=i,u=n?[...c].reverse():c,d=u.map(Pst);return[l,{stackedData:Hyr(e,d,r),graphicalItems:u}]}))},ISr=et([ASr,Eat,mz,Cst],Iat),Rat=(e,t,r,n)=>{var{dataStartIndex:s,dataEndIndex:a}=t;if(n==null&&r!=="zAxis"){var i=Gyr(e,s,a);if(!(i!=null&&i[0]===0&&i[1]===0))return i}},RSr=et([iu],e=>e.allowDataOverflow),$fe=e=>{var t;if(e==null||!("domain"in e))return Dse;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var r=Ky(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e?.domain)!==null&&t!==void 0?t:Dse},Pat=et([iu],$fe),Mat=et([Pat,RSr],gst),PSr=et([ISr,Kx,Ol,Mat],Rat,{memoizeOptions:{resultEqualityCheck:xz}}),Ffe=e=>e.errorBars,MSr=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>Aat(r,n)),M5=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var s=r.filter(Boolean);if(s.length!==0){var a=s.flat(),i=Math.min(...a),l=Math.max(...a);return[i,l]}},Dat=(e,t,r,n,s)=>{var a,i;if(r.length>0&&e.forEach(l=>{r.forEach(c=>{var u,d,f=(u=n[c.id])===null||u===void 0?void 0:u.filter(x=>Aat(s,x)),h=Gl(l,(d=t.dataKey)!==null&&d!==void 0?d:c.dataKey),p=NSr(l,h,f);if(p.length>=2){var m=Math.min(...p),g=Math.max(...p);(a==null||m<a)&&(a=m),(i==null||g>i)&&(i=g)}var y=lTe(h);y!=null&&(a=a==null?y[0]:Math.min(a,y[0]),i=i==null?y[1]:Math.max(i,y[1]))})}),t?.dataKey!=null&&e.forEach(l=>{var c=lTe(Gl(l,t.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),i=i==null?c[1]:Math.max(i,c[1]))}),$s(a)&&$s(i))return[a,i]},DSr=et([Lfe,iu,ESr,Ffe,Ol],Dat,{memoizeOptions:{resultEqualityCheck:xz}});function LSr(e){var{value:t}=e;if(eg(t)||t instanceof Date)return t}var $Sr=(e,t,r)=>{var n=e.map(LSr).filter(s=>s!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&Grt(n))?mst(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},Lat=e=>e.referenceElements.dots,NE=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),FSr=et([Lat,Ol,bz],NE),$at=e=>e.referenceElements.areas,zSr=et([$at,Ol,bz],NE),Fat=e=>e.referenceElements.lines,BSr=et([Fat,Ol,bz],NE),zat=(e,t)=>{if(e!=null){var r=Ky(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},USr=et(FSr,Ol,zat),Bat=(e,t)=>{if(e!=null){var r=Ky(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},VSr=et([zSr,Ol],Bat);function qSr(e){var t;if(e.x!=null)return Ky([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:Ky(r)}function HSr(e){var t;if(e.y!=null)return Ky([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:Ky(r)}var Uat=(e,t)=>{if(e!=null){var r=e.flatMap(n=>t==="xAxis"?qSr(n):HSr(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},QSr=et([BSr,Ol],Uat),WSr=et(USr,QSr,VSr,(e,t,r)=>M5(e,r,t)),Vat=(e,t,r,n,s,a,i,l)=>{if(r!=null)return r;var c=i==="vertical"&&l==="xAxis"||i==="horizontal"&&l==="yAxis",u=c?M5(n,a,s):M5(a,s);return wxr(t,u,e.allowDataOverflow)},GSr=et([iu,Pat,Mat,PSr,DSr,WSr,Pi,Ol],Vat,{memoizeOptions:{resultEqualityCheck:xz}}),ZSr=[0,1],qat=(e,t,r,n,s,a,i)=>{if(!((e==null||r==null||r.length===0)&&i===void 0)){var{dataKey:l,type:c}=e,u=gv(t,a);if(u&&l==null){var d;return mst(0,(d=r?.length)!==null&&d!==void 0?d:0)}return c==="category"?$Sr(n,e,u):s==="expand"?ZSr:i}},zfe=et([iu,Pi,Lfe,KR,mz,Ol,GSr],qat),AE=et([iu,Sat,sfe],vat),Hat=(e,t,r)=>{var{niceTicks:n}=t;if(n!=="none"){var s=$fe(t),a=Array.isArray(s)&&(s[0]==="auto"||s[1]==="auto");if((n==="snap125"||n==="adaptive")&&t!=null&&t.tickCount&&Hm(e)){if(a)return yje(e,t.tickCount,t.allowDecimals,n);if(t.type==="number")return vje(e,t.tickCount,t.allowDecimals,n)}if(n==="auto"&&r==="linear"&&t!=null&&t.tickCount){if(a&&Hm(e))return yje(e,t.tickCount,t.allowDecimals,"adaptive");if(t.type==="number"&&Hm(e))return vje(e,t.tickCount,t.allowDecimals,"adaptive")}}},Bfe=et([zfe,YR,AE],Hat),Qat=(e,t,r,n)=>{if(n!=="angleAxis"&&e?.type==="number"&&Hm(t)&&Array.isArray(r)&&r.length>0){var s,a,i=t[0],l=(s=r[0])!==null&&s!==void 0?s:0,c=t[1],u=(a=r[r.length-1])!==null&&a!==void 0?a:0;return[Math.min(i,l),Math.max(c,u)]}return t},YSr=et([iu,zfe,Bfe,Ol],Qat),XSr=et(KR,iu,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(Ky(e.map(f=>f.value))).sort((f,h)=>f-h),s=n[0],a=n[n.length-1];if(s==null||a==null)return 1/0;var i=a-s;if(i===0)return 1/0;for(var l=0;l<n.length-1;l++){var c=n[l],u=n[l+1];if(!(c==null||u==null)){var d=u-c;r=Math.min(r,d)}}return r/i}}),Wat=et(XSr,Pi,Exr,Kl,(e,t,r,n,s)=>s,(e,t,r,n,s)=>{if(!$s(e))return 0;var a=t==="vertical"?n.height:n.width;if(s==="gap")return e*a/2;if(s==="no-gap"){var i=_x(r,e*a),l=e*a/2;return l-i-(l-i)/a*i}return 0}),KSr=(e,t,r)=>{var n=xv(e,t);return n==null||typeof n.padding!="string"?0:Wat(e,"xAxis",t,r,n.padding)},JSr=(e,t,r)=>{var n=wv(e,t);return n==null||typeof n.padding!="string"?0:Wat(e,"yAxis",t,r,n.padding)},e1r=et(xv,KSr,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:s}=e;return typeof s=="string"?{left:t,right:t}:{left:((r=s.left)!==null&&r!==void 0?r:0)+t,right:((n=s.right)!==null&&n!==void 0?n:0)+t}}),t1r=et(wv,JSr,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:s}=e;return typeof s=="string"?{top:t,bottom:t}:{top:((r=s.top)!==null&&r!==void 0?r:0)+t,bottom:((n=s.bottom)!==null&&n!==void 0?n:0)+t}}),r1r=et([Kl,e1r,cz,lz,(e,t,r)=>r],(e,t,r,n,s)=>{var{padding:a}=n;return s?[a.left,r.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),n1r=et([Kl,Pi,t1r,cz,lz,(e,t,r)=>r],(e,t,r,n,s,a)=>{var{padding:i}=s;return a?[n.height-i.bottom,i.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),eP=(e,t,r,n)=>{var s;switch(t){case"xAxis":return r1r(e,r,n);case"yAxis":return n1r(e,r,n);case"zAxis":return(s=Dfe(e,r))===null||s===void 0?void 0:s.range;case"angleAxis":return Ast(e);case"radiusAxis":return Ist(e,r);default:return}},Gat=et([iu,eP],gz),s1r=et([AE,YSr],Pxr),Ufe=et([iu,AE,s1r,Gat],Mfe),Zat=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:s,scale:a}=r,i=gv(e,n);if(i&&(s==="number"||a!=="auto"))return t.map(l=>l.value)}},Vfe=et([Pi,KR,YR,Ol],Zat),jz=et([Ufe],dfe);et([Ufe],bSr);et([Ufe,TSr],bat);et([XR,Ffe,Ol],MSr);function Yat(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var Tz=(e,t)=>t,Nz=(e,t,r)=>r,a1r=et(iz,Tz,Nz,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(Yat)),i1r=et(oz,Tz,Nz,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(Yat)),Xat=(e,t)=>({width:e.width,height:t.height}),o1r=(e,t)=>{var r=typeof t.width=="number"?t.width:UR;return{width:r,height:e.height}},l1r=et(Kl,xv,Xat),c1r=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},u1r=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},d1r=et(vv,Kl,a1r,Tz,Nz,(e,t,r,n,s)=>{var a={},i;return r.forEach(l=>{var c=Xat(t,l);i==null&&(i=c1r(t,n,e));var u=n==="top"&&!s||n==="bottom"&&s;a[l.id]=i-Number(u)*c.height,i+=(u?-1:1)*c.height}),a}),f1r=et(yv,Kl,i1r,Tz,Nz,(e,t,r,n,s)=>{var a={},i;return r.forEach(l=>{var c=o1r(t,l);i==null&&(i=u1r(t,n,e));var u=n==="left"&&!s||n==="right"&&s;a[l.id]=i-Number(u)*c.width,i+=(u?-1:1)*c.width}),a}),h1r=(e,t)=>{var r=xv(e,t);if(r!=null)return d1r(e,r.orientation,r.mirror)},p1r=et([Kl,xv,h1r,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var s=r?.[n];return s==null?{x:e.left,y:0}:{x:e.left,y:s}}}),m1r=(e,t)=>{var r=wv(e,t);if(r!=null)return f1r(e,r.orientation,r.mirror)},g1r=et([Kl,wv,m1r,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var s=r?.[n];return s==null?{x:0,y:e.top}:{x:s,y:e.top}}}),y1r=et(Kl,wv,(e,t)=>{var r=typeof t.width=="number"?t.width:UR;return{width:r,height:e.height}}),Kat=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:s,type:a,dataKey:i}=r,l=gv(e,n),c=t.map(u=>u.value);if(i&&l&&a==="category"&&s&&Grt(c))return c}},qfe=et([Pi,KR,iu,Ol],Kat),cTe=et([Pi,kSr,AE,jz,qfe,Vfe,eP,Bfe,Ol],(e,t,r,n,s,a,i,l,c)=>{if(t!=null){var u=gv(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:s,isCategorical:u,niceTicks:l,range:i,realScaleType:r,scale:n}}}),v1r=(e,t,r,n,s,a,i,l,c)=>{if(!(t==null||n==null)){var u=gv(e,c),{type:d,ticks:f,tickCount:h}=t,p=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,m=d==="category"&&n.bandwidth?n.bandwidth()/p:0;m=c==="angleAxis"&&a!=null&&a.length>=2?ih(a[0]-a[1])*2*m:m;var g=f||s;return g?g.map((y,x)=>{var w=i?i.indexOf(y):y,O=n.map(w);return $s(O)?{index:x,coordinate:O+m,value:y,offset:m}:null}).filter(Mu):u&&l?l.map((y,x)=>{var w=n.map(y);return $s(w)?{coordinate:w+m,value:y,index:x,offset:m}:null}).filter(Mu):n.ticks?n.ticks(h).map((y,x)=>{var w=n.map(y);return $s(w)?{coordinate:w+m,value:y,index:x,offset:m}:null}).filter(Mu):n.domain().map((y,x)=>{var w=n.map(y);return $s(w)?{coordinate:w+m,value:i?i[y]:y,index:x,offset:m}:null}).filter(Mu)}},Jat=et([Pi,YR,AE,jz,Bfe,eP,qfe,Vfe,Ol],v1r),b1r=(e,t,r,n,s,a,i)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var l=gv(e,i),{tickCount:c}=t,u=0;return u=i==="angleAxis"&&n?.length>=2?ih(n[0]-n[1])*2*u:u,l&&a?a.map((d,f)=>{var h=r.map(d);return $s(h)?{coordinate:h+u,value:d,index:f,offset:u}:null}).filter(Mu):r.ticks?r.ticks(c).map((d,f)=>{var h=r.map(d);return $s(h)?{coordinate:h+u,value:d,index:f,offset:u}:null}).filter(Mu):r.domain().map((d,f)=>{var h=r.map(d);return $s(h)?{coordinate:h+u,value:s?s[d]:d,index:f,offset:u}:null}).filter(Mu)}},eit=et([Pi,YR,jz,eP,qfe,Vfe,Ol],b1r),tit=et(iu,jz,(e,t)=>{if(!(e==null||t==null))return P5(P5({},e),{},{scale:t})}),x1r=et([iu,AE,zfe,Gat],Mfe),w1r=et([x1r],dfe);et((e,t,r)=>Dfe(e,r),w1r,(e,t)=>{if(!(e==null||t==null))return P5(P5({},e),{},{scale:t})});var S1r=et([Pi,iz,oz],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),O1r=(e,t,r)=>{var n;return(n=e.renderedTicks[t])===null||n===void 0?void 0:n[r]};et([O1r],e=>{if(!(!e||e.length===0))return t=>{var r,n=1/0,s=e[0];for(var a of e){var i=Math.abs(a.coordinate-t);i<n&&(n=i,s=a)}return(r=s)===null||r===void 0?void 0:r.value}});var rit=e=>e.options.defaultTooltipEventType,nit=e=>e.options.validateTooltipEventTypes;function sit(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function Hfe(e,t){var r=rit(e),n=nit(e);return sit(t,r,n)}function k1r(e){return Jr(t=>Hfe(t,e))}var ait=(e,t)=>{var r,n=Number(t);if(!(Wy(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},_1r=e=>e.tooltip.settings,jb={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},E1r={itemInteraction:{click:jb,hover:jb},axisInteraction:{click:jb,hover:jb},keyboardInteraction:jb,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},iit=_c({name:"tooltip",initialState:E1r,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:ai()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,s=oh(e).tooltipItemPayloads.indexOf(r);s>-1&&(e.tooltipItemPayloads[s]=n)},prepare:ai()},removeTooltipEntrySettings:{reducer(e,t){var r=oh(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:ai()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:C1r,replaceTooltipEntrySettings:j1r,removeTooltipEntrySettings:T1r,setTooltipSettingsState:N1r,setActiveMouseOverItemIndex:A1r,mouseLeaveItem:VAn,mouseLeaveChart:oit,setActiveClickItemIndex:qAn,setMouseOverAxisIndex:lit,setMouseClickAxisIndex:I1r,setSyncInteraction:Lse,setKeyboardInteraction:D5}=iit.actions,R1r=iit.reducer;function uTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function w2(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uTe(Object(r),!0).forEach(function(n){P1r(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function P1r(e,t,r){return(t=M1r(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function M1r(e){var t=D1r(e,"string");return typeof t=="symbol"?t:t+""}function D1r(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function L1r(e,t,r){return t==="axis"?r==="click"?e.axisInteraction.click:e.axisInteraction.hover:r==="click"?e.itemInteraction.click:e.itemInteraction.hover}function $1r(e){return e.index!=null}var cit=(e,t,r,n)=>{if(t==null)return jb;var s=L1r(e,t,r);if(s==null)return jb;if(s.active)return s;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if($1r(s)){if(a)return w2(w2({},s),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return w2(w2({},jb),{},{coordinate:s.coordinate})};function F1r(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}function z1r(e,t){var r=F1r(e),n=t[0],s=t[1];if(r===void 0)return!1;var a=Math.min(n,s),i=Math.max(n,s);return r>=a&&r<=i}function B1r(e,t,r){if(r==null||t==null)return!0;var n=Gl(e,t);return n==null||!Hm(r)?!0:z1r(n,r)}var Qfe=(e,t,r,n)=>{var s=e?.index;if(s==null)return null;var a=Number(s);if(!$s(a))return s;var i=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(i,Math.min(a,l)),u=t[c];return u==null||B1r(u,r,n)?String(c):null},uit=(e,t,r,n,s,a,i)=>{if(a!=null){var l=i[0],c=l?.getPosition(a);if(c!=null)return c;var u=s?.[Number(a)];if(u)return r==="horizontal"?{x:u.coordinate,y:(n.top+t)/2}:{x:(n.left+e)/2,y:u.coordinate}}},dit=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var s;if(r==="hover"?s=e.itemInteraction.hover.graphicalItemId:s=e.itemInteraction.click.graphicalItemId,e.syncInteraction.active&&s==null)return e.tooltipItemPayloads;if(s==null&&n!=null){var a=e.tooltipItemPayloads[0];return a!=null?[a]:[]}return e.tooltipItemPayloads.filter(i=>{var l;return((l=i.settings)===null||l===void 0?void 0:l.graphicalItemId)===s})},fit=e=>e.options.tooltipPayloadSearcher,IE=e=>e.tooltip;function dTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function fTe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dTe(Object(r),!0).forEach(function(n){U1r(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function U1r(e,t,r){return(t=V1r(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V1r(e){var t=q1r(e,"string");return typeof t=="symbol"?t:t+""}function q1r(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function H1r(e){if(typeof e=="string"||typeof e=="number")return e}function Q1r(e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}function W1r(e){if(typeof e=="string"||typeof e=="number")return e;if(typeof e=="function")return t=>e(t)}function hTe(e){if(typeof e=="string")return e}function G1r(e){if(!(e==null||typeof e!="object")){var t="name"in e?H1r(e.name):void 0,r="unit"in e?Q1r(e.unit):void 0,n="dataKey"in e?W1r(e.dataKey):void 0,s="payload"in e?e.payload:void 0,a="color"in e?hTe(e.color):void 0,i="fill"in e?hTe(e.fill):void 0;return{name:t,unit:r,dataKey:n,payload:s,color:a,fill:i}}}function Z1r(e,t){return e??t}var hit=(e,t,r,n,s,a,i)=>{if(!(t==null||a==null)){var{chartData:l,computedData:c,dataStartIndex:u,dataEndIndex:d}=r,f=[];return e.reduce((h,p)=>{var m,{dataDefinedOnItem:g,settings:y}=p,x=Z1r(g,l),w=Array.isArray(x)?Lnt(x,u,d):x,O=(m=y?.dataKey)!==null&&m!==void 0?m:n,k=y?.nameKey,_;if(n&&Array.isArray(w)&&!Array.isArray(w[0])&&i==="axis"?_=Zrt(w,n,s):_=a(w,t,c,k),Array.isArray(_))_.forEach(T=>{var j,A,I=G1r(T),P=I?.name,R=I?.dataKey,B=I?.payload,D=fTe(fTe({},y),{},{name:P,unit:I?.unit,color:(j=I?.color)!==null&&j!==void 0?j:y?.color,fill:(A=I?.fill)!==null&&A!==void 0?A:y?.fill});h.push(dCe({tooltipEntrySettings:D,dataKey:R,payload:B,value:Gl(B,R),name:P==null?void 0:String(P)}))});else{var E;h.push(dCe({tooltipEntrySettings:y,dataKey:O,payload:_,value:Gl(_,O),name:(E=Gl(_,k))!==null&&E!==void 0?E:y?.name}))}return h},f)}},Wfe=et([rl,Sat,sfe],vat),Y1r=et([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),X1r=et([kl,TE],Oat),RE=et([Y1r,rl,X1r],_at,{memoizeOptions:{resultEqualityCheck:wz}}),K1r=et([RE],e=>e.filter(ufe)),J1r=et([RE],jat,{memoizeOptions:{resultEqualityCheck:wz}}),PE=et([J1r,Kx],Tat),eOr=et([K1r,Kx,rl],Mst),Gfe=et([PE,rl,RE],Nat),pit=et([rl],$fe),tOr=et([rl],e=>e.allowDataOverflow),mit=et([pit,tOr],gst),rOr=et([RE],e=>e.filter(ufe)),nOr=et([eOr,rOr,mz,Cst],Iat),sOr=et([nOr,Kx,kl,mit],Rat),aOr=et([RE],Cat),iOr=et([PE,rl,aOr,Ffe,kl],Dat,{memoizeOptions:{resultEqualityCheck:xz}}),oOr=et([Lat,kl,TE],NE),lOr=et([oOr,kl],zat),cOr=et([$at,kl,TE],NE),uOr=et([cOr,kl],Bat),dOr=et([Fat,kl,TE],NE),fOr=et([dOr,kl],Uat),hOr=et([lOr,fOr,uOr],M5),pOr=et([rl,pit,mit,sOr,iOr,hOr,Pi,kl],Vat),tP=et([rl,Pi,PE,Gfe,mz,kl,pOr],qat),mOr=et([tP,rl,Wfe],Hat),gOr=et([rl,tP,mOr,kl],Qat),git=e=>{var t=kl(e),r=TE(e),n=!1;return eP(e,t,r,n)},yit=et([rl,git],gz),yOr=et([rl,Wfe,gOr,yit],Mfe),vit=et([yOr],dfe),vOr=et([Pi,Gfe,rl,kl],Kat),bOr=et([Pi,Gfe,rl,kl],Zat),xOr=(e,t,r,n,s,a,i,l)=>{if(t){var{type:c}=t,u=gv(e,l);if(n){var d=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,f=c==="category"&&n.bandwidth?n.bandwidth()/d:0;return f=l==="angleAxis"&&s!=null&&s?.length>=2?ih(s[0]-s[1])*2*f:f,u&&i?i.map((h,p)=>{var m=n.map(h);return $s(m)?{coordinate:m+f,value:h,index:p,offset:f}:null}).filter(Mu):n.domain().map((h,p)=>{var m=n.map(h);return $s(m)?{coordinate:m+f,value:a?a[h]:h,index:p,offset:f}:null}).filter(Mu)}}},Sv=et([Pi,rl,Wfe,vit,git,vOr,bOr,kl],xOr),Zfe=et([rit,nit,_1r],(e,t,r)=>sit(r.shared,e,t)),bit=e=>e.tooltip.settings.trigger,Yfe=e=>e.tooltip.settings.defaultIndex,rP=et([IE,Zfe,bit,Yfe],cit),EA=et([rP,PE,JR,tP],Qfe),xit=et([Sv,EA],ait),wOr=et([rP],e=>{if(e)return e.dataKey}),SOr=et([rP],e=>{if(e)return e.graphicalItemId}),wit=et([IE,Zfe,bit,Yfe],dit),OOr=et([yv,vv,Pi,Kl,Sv,Yfe,wit],uit),kOr=et([rP,OOr],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),_Or=et([rP],e=>{var t;return(t=e?.active)!==null&&t!==void 0?t:!1}),EOr=et([wit,EA,Kx,JR,xit,fit,Zfe],hit),COr=et([EOr],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function pTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function mTe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pTe(Object(r),!0).forEach(function(n){jOr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jOr(e,t,r){return(t=TOr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function TOr(e){var t=NOr(e,"string");return typeof t=="symbol"?t:t+""}function NOr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var AOr=()=>Jr(rl),IOr=()=>{var e=AOr(),t=Jr(Sv),r=Jr(vit);return f5(!e||!r?void 0:mTe(mTe({},e),{},{scale:r}),t)};function gTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function aO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gTe(Object(r),!0).forEach(function(n){ROr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ROr(e,t,r){return(t=POr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function POr(e){var t=MOr(e,"string");return typeof t=="symbol"?t:t+""}function MOr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var DOr=(e,t,r,n)=>{var s=t.find(a=>a&&a.index===r);if(s){if(e==="horizontal")return{x:s.coordinate,y:n.relativeY};if(e==="vertical")return{x:n.relativeX,y:s.coordinate}}return{x:0,y:0}},LOr=(e,t,r,n)=>{var s=t.find(u=>u&&u.index===r);if(s){if(e==="centric"){var a=s.coordinate,{radius:i}=n;return aO(aO(aO({},n),Vl(n.cx,n.cy,i,a)),{},{angle:a,radius:i})}var l=s.coordinate,{angle:c}=n;return aO(aO(aO({},n),Vl(n.cx,n.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function $Or(e,t){var{relativeX:r,relativeY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var Sit=(e,t,r,n,s)=>{var a,i=(a=t?.length)!==null&&a!==void 0?a:0;if(i<=1||e==null)return 0;if(n==="angleAxis"&&s!=null&&Math.abs(Math.abs(s[1]-s[0])-360)<=1e-6)for(var l=0;l<i;l++){var c,u,d,f,h,p=l>0?(c=r[l-1])===null||c===void 0?void 0:c.coordinate:(u=r[i-1])===null||u===void 0?void 0:u.coordinate,m=(d=r[l])===null||d===void 0?void 0:d.coordinate,g=l>=i-1?(f=r[0])===null||f===void 0?void 0:f.coordinate:(h=r[l+1])===null||h===void 0?void 0:h.coordinate,y=void 0;if(!(p==null||m==null||g==null))if(ih(m-p)!==ih(g-m)){var x=[];if(ih(g-m)===ih(s[1]-s[0])){y=g;var w=m+s[1]-s[0];x[0]=Math.min(w,(w+p)/2),x[1]=Math.max(w,(w+p)/2)}else{y=p;var O=g+s[1]-s[0];x[0]=Math.min(m,(O+m)/2),x[1]=Math.max(m,(O+m)/2)}var k=[Math.min(m,(y+m)/2),Math.max(m,(y+m)/2)];if(e>k[0]&&e<=k[1]||e>=x[0]&&e<=x[1]){var _;return(_=r[l])===null||_===void 0?void 0:_.index}}else{var E=Math.min(p,g),T=Math.max(p,g);if(e>(E+m)/2&&e<=(T+m)/2){var j;return(j=r[l])===null||j===void 0?void 0:j.index}}}else if(t)for(var A=0;A<i;A++){var I=t[A];if(I!=null){var P=t[A+1],R=t[A-1];if(A===0&&P!=null&&e<=(I.coordinate+P.coordinate)/2||A===i-1&&R!=null&&e>(I.coordinate+R.coordinate)/2||A>0&&A<i-1&&R!=null&&P!=null&&e>(I.coordinate+R.coordinate)/2&&e<=(I.coordinate+P.coordinate)/2)return I.index}}return-1},FOr=()=>Jr(sfe),Xfe=(e,t)=>t,Oit=(e,t,r)=>r,Kfe=(e,t,r,n)=>n,zOr=et(Sv,e=>YF(e,t=>t.coordinate)),Jfe=et([IE,Xfe,Oit,Kfe],cit),ehe=et([Jfe,PE,JR,tP],Qfe),BOr=(e,t,r)=>{if(t!=null){var n=IE(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},kit=et([IE,Xfe,Oit,Kfe],dit),L5=et([yv,vv,Pi,Kl,Sv,Kfe,kit],uit),UOr=et([Jfe,L5],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),_it=et([Sv,ehe],ait),VOr=et([kit,ehe,Kx,JR,_it,fit,Xfe],hit),qOr=et([Jfe,ehe],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),HOr=(e,t,r,n,s,a,i)=>{if(!(!e||!r||!n||!s)&&$Or(e,i)){var l=Zyr(e,t),c=Sit(l,a,s,r,n),u=DOr(t,s,c,e);return{activeIndex:String(c),activeCoordinate:u}}},QOr=(e,t,r,n,s,a,i)=>{if(!(!e||!n||!s||!a||!r)){var l=uxr(e,r);if(l){var c=Yyr(l,t),u=Sit(c,i,a,n,s),d=LOr(t,a,u,l);return{activeIndex:String(u),activeCoordinate:d}}}},WOr=(e,t,r,n,s,a,i,l)=>{if(!(!e||!t||!n||!s||!a))return t==="horizontal"||t==="vertical"?HOr(e,t,n,s,a,i,l):QOr(e,t,r,n,s,a,i)},GOr=et(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElement:n.element}}),ZOr=et(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(Qc)),r=Array.from(new Set(t));return r.sort((n,s)=>n-s)},{memoizeOptions:{resultEqualityCheck:Rxr}});function yTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function vTe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yTe(Object(r),!0).forEach(function(n){YOr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function YOr(e,t,r){return(t=XOr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function XOr(e){var t=KOr(e,"string");return typeof t=="symbol"?t:t+""}function KOr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var JOr={},ekr={zIndexMap:Object.values(Qc).reduce((e,t)=>vTe(vTe({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),JOr)},tkr=new Set(Object.values(Qc));function rkr(e){return tkr.has(e)}var Eit=_c({name:"zIndex",initialState:ekr,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:ai()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!rkr(r)&&delete e.zIndexMap[r])},prepare:ai()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r,element:n,isPanorama:s}=t.payload;e.zIndexMap[r]?s?e.zIndexMap[r].panoramaElement=n:e.zIndexMap[r].element=n:e.zIndexMap[r]={consumers:0,element:s?void 0:n,panoramaElement:s?n:void 0}},prepare:ai()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElement=void 0:e.zIndexMap[r].element=void 0)},prepare:ai()}}}),{registerZIndexPortal:nkr,unregisterZIndexPortal:skr,registerZIndexPortalElement:akr,unregisterZIndexPortalElement:ikr}=Eit.actions,okr=Eit.reducer;function Ov(e){var{zIndex:t,children:r}=e,n=Tvr(),s=n&&t!==void 0&&t!==0,a=rd(),i=Fo();b.useLayoutEffect(()=>s?(i(nkr({zIndex:t})),()=>{i(skr({zIndex:t}))}):JS,[i,t,s]);var l=Jr(c=>GOr(c,t,a));return s?l?au.createPortal(r,l):null:r}function $se(){return $se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$se.apply(null,arguments)}function bTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function S2(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bTe(Object(r),!0).forEach(function(n){lkr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lkr(e,t,r){return(t=ckr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ckr(e){var t=ukr(e,"string");return typeof t=="symbol"?t:t+""}function ukr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dkr(e){var{cursor:t,cursorComp:r,cursorProps:n}=e;return b.isValidElement(t)?b.cloneElement(t,n):b.createElement(r,n)}function fkr(e){var t,{coordinate:r,payload:n,index:s,offset:a,tooltipAxisBandSize:i,layout:l,cursor:c,tooltipEventType:u,chartName:d}=e,f=r,h=n,p=s;if(!c||!f||d!=="ScatterChart"&&u!=="axis")return null;var m,g,y;if(d==="ScatterChart")m=f,g=kbr,y=Qc.cursorLine;else if(d==="BarChart")m=_br(l,f,a,i),g=dst,y=Qc.cursorRectangle;else if(l==="radial"&&Krt(f)){var{cx:x,cy:w,radius:O,startAngle:k,endAngle:_}=fst(f);m={cx:x,cy:w,startAngle:k,endAngle:_,innerRadius:O,outerRadius:O},g=pst,y=Qc.cursorLine}else m={points:pxr(l,f,a)},g=ist,y=Qc.cursorLine;var E=typeof c=="object"&&"className"in c?c.className:void 0,T=S2(S2(S2(S2({stroke:"#ccc",pointerEvents:"none"},a),m),HF(c)),{},{payload:h,payloadIndex:p,className:ya("recharts-tooltip-cursor",E)});return b.createElement(Ov,{zIndex:(t=e.zIndex)!==null&&t!==void 0?t:y},b.createElement(dkr,{cursor:c,cursorComp:g,cursorProps:T}))}function hkr(e){var t=IOr(),r=Qnt(),n=EE(),s=FOr();return t==null||r==null||n==null||s==null?null:b.createElement(fkr,$se({},e,{offset:r,layout:n,tooltipAxisBandSize:t,chartName:s}))}var Cit=b.createContext(null),pkr=()=>b.useContext(Cit),Dq={exports:{}},xTe;function mkr(){return xTe||(xTe=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,f||c,h),m=r?r+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],p]:c._events[m].push(p):(c._events[m]=p,c._eventsCount++),c}function i(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=r?r+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,p=f.length,m=new Array(p);h<p;h++)m[h]=f[h].fn;return m},l.prototype.listenerCount=function(u){var d=r?r+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,h,p,m){var g=r?r+u:u;if(!this._events[g])return!1;var y=this._events[g],x=arguments.length,w,O;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),x){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,d),!0;case 3:return y.fn.call(y.context,d,f),!0;case 4:return y.fn.call(y.context,d,f,h),!0;case 5:return y.fn.call(y.context,d,f,h,p),!0;case 6:return y.fn.call(y.context,d,f,h,p,m),!0}for(O=1,w=new Array(x-1);O<x;O++)w[O-1]=arguments[O];y.fn.apply(y.context,w)}else{var k=y.length,_;for(O=0;O<k;O++)switch(y[O].once&&this.removeListener(u,y[O].fn,void 0,!0),x){case 1:y[O].fn.call(y[O].context);break;case 2:y[O].fn.call(y[O].context,d);break;case 3:y[O].fn.call(y[O].context,d,f);break;case 4:y[O].fn.call(y[O].context,d,f,h);break;default:if(!w)for(_=1,w=new Array(x-1);_<x;_++)w[_-1]=arguments[_];y[O].fn.apply(y[O].context,w)}}return!0},l.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,h){var p=r?r+u:u;if(!this._events[p])return this;if(!d)return i(this,p),this;var m=this._events[p];if(m.fn)m.fn===d&&(!h||m.once)&&(!f||m.context===f)&&i(this,p);else{for(var g=0,y=[],x=m.length;g<x;g++)(m[g].fn!==d||h&&!m[g].once||f&&m[g].context!==f)&&y.push(m[g]);y.length?this._events[p]=y.length===1?y[0]:y:i(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=r?r+u:u,this._events[d]&&i(this,d)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(Dq)),Dq.exports}var gkr=mkr();const ykr=$o(gkr);var CA=new ykr,Fse="recharts.syncEvent.tooltip",wTe="recharts.syncEvent.brush",vkr=(e,t)=>{if(t&&Array.isArray(e)){var r=Number.parseInt(t,10);if(!Wy(r))return e[r]}},bkr={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},jit=_c({name:"options",initialState:bkr,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),xkr=jit.reducer,{createEventEmitter:wkr}=jit.actions;function Skr(e){return e.tooltip.syncInteraction}var Okr={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},Tit=_c({name:"chartData",initialState:Okr,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:STe,setDataStartEndIndexes:kkr,setComputedData:HAn}=Tit.actions,_kr=Tit.reducer,Ekr=["x","y"];function OTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function iO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?OTe(Object(r),!0).forEach(function(n){Ckr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):OTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ckr(e,t,r){return(t=jkr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jkr(e){var t=Tkr(e,"string");return typeof t=="symbol"?t:t+""}function Tkr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nkr(e,t){if(e==null)return{};var r,n,s=Akr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Akr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ikr(){var e=Jr(afe),t=Jr(ife),r=Fo(),n=Jr(jst),s=Jr(Sv),a=EE(),i=uz(),l=Jr(c=>c.rootProps.className);b.useEffect(()=>{if(e==null)return JS;var c=(u,d,f)=>{if(t!==f&&e===u){if(n==="index"){var h;if(i&&d!==null&&d!==void 0&&(h=d.payload)!==null&&h!==void 0&&h.coordinate&&d.payload.sourceViewBox){var p=d.payload.coordinate,{x:m,y:g}=p,y=Nkr(p,Ekr),{x,y:w,width:O,height:k}=d.payload.sourceViewBox,_=iO(iO({},y),{},{x:i.x+(O?(m-x)/O:0)*i.width,y:i.y+(k?(g-w)/k:0)*i.height});r(iO(iO({},d),{},{payload:iO(iO({},d.payload),{},{coordinate:_})}))}else r(d);return}if(s!=null){var E;if(typeof n=="function"){var T={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},j=n(s,T);E=s[j]}else n==="value"&&(E=s.find(U=>String(U.value)===d.payload.label));var{coordinate:A}=d.payload;if(E==null||d.payload.active===!1||A==null||i==null){r(Lse({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:I,y:P}=A,R=Math.min(I,i.x+i.width),B=Math.min(P,i.y+i.height),D={x:a==="horizontal"?E.coordinate:R,y:a==="horizontal"?B:E.coordinate},F=Lse({active:d.payload.active,coordinate:D,dataKey:d.payload.dataKey,index:String(E.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});r(F)}}};return CA.on(Fse,c),()=>{CA.off(Fse,c)}},[l,r,t,e,n,s,a,i])}function Rkr(){var e=Jr(afe),t=Jr(ife),r=Fo();b.useEffect(()=>{if(e==null)return JS;var n=(s,a,i)=>{t!==i&&e===s&&r(kkr(a))};return CA.on(wTe,n),()=>{CA.off(wTe,n)}},[r,t,e])}function Pkr(){var e=Fo();b.useEffect(()=>{e(wkr())},[e]),Ikr(),Rkr()}function Mkr(e,t,r,n,s,a){var i=Jr(m=>BOr(m,e,t)),l=Jr(SOr),c=Jr(ife),u=Jr(afe),d=Jr(jst),f=Jr(Skr),h=f?.active,p=uz();b.useEffect(()=>{if(!h&&u!=null&&c!=null){var m=Lse({active:a,coordinate:r,dataKey:i,index:s,label:typeof n=="number"?String(n):n,sourceViewBox:p,graphicalItemId:l});CA.emit(Fse,u,m,c)}},[h,r,i,l,s,n,c,u,d,a,p])}function kTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function _Te(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kTe(Object(r),!0).forEach(function(n){Dkr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dkr(e,t,r){return(t=Lkr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lkr(e){var t=$kr(e,"string");return typeof t=="symbol"?t:t+""}function $kr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fkr(e){return e.dataKey}function zkr(e,t){return b.isValidElement(e)?b.cloneElement(e,t):typeof e=="function"?b.createElement(e,t):b.createElement(Jvr,t)}var ETe=[],Bkr={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function Ukr(e){var t,r,n=td(e,Bkr),{active:s,allowEscapeViewBox:a,animationDuration:i,animationEasing:l,content:c,filterNull:u,isAnimationActive:d,offset:f,payloadUniqBy:h,position:p,reverseDirection:m,useTranslate3d:g,wrapperStyle:y,cursor:x,shared:w,trigger:O,defaultIndex:k,portal:_,axisId:E}=n,T=Fo(),j=typeof k=="number"?String(k):k;b.useEffect(()=>{T(N1r({shared:w,trigger:O,axisId:E,active:s,defaultIndex:j}))},[T,w,O,E,s,j]);var A=uz(),I=ast(),P=k1r(w),{activeIndex:R,isActive:B}=(t=Jr(te=>qOr(te,P,O,j)))!==null&&t!==void 0?t:{},D=Jr(te=>VOr(te,P,O,j)),F=Jr(te=>_it(te,P,O,j)),U=Jr(te=>UOr(te,P,O,j)),z=D,V=pkr(),W=(r=s??B)!==null&&r!==void 0?r:!1,[L,Y]=Bgr([z,W]),q=P==="axis"?F:void 0;Mkr(P,O,U,q,R,W);var M=_??V;if(M==null||A==null||P==null)return null;var Q=z??ETe;W||(Q=ETe),u&&Q.length&&(Q=jgr(Q.filter(te=>te.value!=null&&(te.hide!==!0||n.includeHidden)),h,Fkr));var G=Q.length>0,J=_Te(_Te({},n),{},{payload:Q,label:q,active:W,activeIndex:R,coordinate:U,accessibilityLayer:I}),ie=b.createElement(ubr,{allowEscapeViewBox:a,animationDuration:i,animationEasing:l,isAnimationActive:d,active:W,coordinate:U,hasPayload:G,offset:f,position:p,reverseDirection:m,useTranslate3d:g,viewBox:A,wrapperStyle:y,lastBoundingBox:L,innerRef:Y,hasPortalFromProps:!!_},zkr(c,J));return b.createElement(b.Fragment,null,au.createPortal(ie,M),W&&b.createElement(hkr,{cursor:x,tooltipEventType:P,coordinate:U,payload:Q,index:R}))}function Vkr(e,t,r){return(t=qkr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qkr(e){var t=Hkr(e,"string");return typeof t=="symbol"?t:t+""}function Hkr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class Qkr{constructor(t){Vkr(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function CTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Wkr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?CTe(Object(r),!0).forEach(function(n){Gkr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Gkr(e,t,r){return(t=Zkr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zkr(e){var t=Ykr(e,"string");return typeof t=="symbol"?t:t+""}function Ykr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xkr={cacheSize:2e3,enableCache:!0},Nit=Wkr({},Xkr),jTe=new Qkr(Nit.cacheSize),Kkr={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},TTe="recharts_measurement_span";function Jkr(e,t){var r=t.fontSize||"",n=t.fontFamily||"",s=t.fontWeight||"",a=t.fontStyle||"",i=t.letterSpacing||"",l=t.textTransform||"";return"".concat(e,"|").concat(r,"|").concat(n,"|").concat(s,"|").concat(a,"|").concat(i,"|").concat(l)}var NTe=(e,t)=>{try{var r=document.getElementById(TTe);r||(r=document.createElement("span"),r.setAttribute("id",TTe),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,Kkr,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},YT=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||HR.isSsr)return{width:0,height:0};if(!Nit.enableCache)return NTe(t,r);var n=Jkr(t,r),s=jTe.get(n);if(s)return s;var a=NTe(t,r);return jTe.set(n,a),a},Ait;function e_r(e,t,r){return(t=t_r(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t_r(e){var t=r_r(e,"string");return typeof t=="symbol"?t:t+""}function r_r(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ATe=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,ITe=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,n_r=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,s_r=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,a_r={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},i_r=["cm","mm","pt","pc","in","Q","px"];function o_r(e){return i_r.includes(e)}var HO="NaN";function l_r(e,t){return e*a_r[t]}class Rl{static parse(t){var r,[,n,s]=(r=s_r.exec(t))!==null&&r!==void 0?r:[];return n==null?Rl.NaN:new Rl(parseFloat(n),s??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,Wy(t)&&(this.unit=""),r!==""&&!n_r.test(r)&&(this.num=NaN,this.unit=""),o_r(r)&&(this.num=l_r(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new Rl(NaN,""):new Rl(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new Rl(NaN,""):new Rl(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Rl(NaN,""):new Rl(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Rl(NaN,""):new Rl(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Wy(this.num)}}Ait=Rl;e_r(Rl,"NaN",new Ait(NaN,""));function Iit(e){if(e==null||e.includes(HO))return HO;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,s,a]=(r=ATe.exec(t))!==null&&r!==void 0?r:[],i=Rl.parse(n??""),l=Rl.parse(a??""),c=s==="*"?i.multiply(l):i.divide(l);if(c.isNaN())return HO;t=t.replace(ATe,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var u,[,d,f,h]=(u=ITe.exec(t))!==null&&u!==void 0?u:[],p=Rl.parse(d??""),m=Rl.parse(h??""),g=f==="+"?p.add(m):p.subtract(m);if(g.isNaN())return HO;t=t.replace(ITe,g.toString())}return t}var RTe=/\(([^()]*)\)/;function c_r(e){for(var t=e,r;(r=RTe.exec(t))!=null;){var[,n]=r;t=t.replace(RTe,Iit(n))}return t}function u_r(e){var t=e.replace(/\s+/g,"");return t=c_r(t),t=Iit(t),t}function d_r(e){try{return u_r(e)}catch{return HO}}function Lq(e){var t=d_r(e.slice(5,-1));return t===HO?"":t}var f_r=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],h_r=["dx","dy","angle","className","breakAll"];function zse(){return zse=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zse.apply(null,arguments)}function PTe(e,t){if(e==null)return{};var r,n,s=p_r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function p_r(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Rit=/[ \f\n\r\t\v\u2028\u2029]+/,Pit=e=>{var{children:t,breakAll:r,style:n}=e;try{var s=[];wl(t)||(r?s=t.toString().split(""):s=t.toString().split(Rit));var a=s.map(l=>({word:l,width:YT(l,n).width})),i=r?0:YT(" ",n).width;return{wordsWithComputedWidth:a,spaceWidth:i}}catch{return null}};function Mit(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function m_r(e){return wl(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var Dit=(e,t,r,n)=>e.reduce((s,a)=>{var{word:i,width:l}=a,c=s[s.length-1];if(c&&l!=null&&(t==null||n||c.width+l+r<Number(t)))c.words.push(i),c.width+=l+r;else{var u={words:[i],width:l};s.push(u)}return s},[]),Lit=e=>e.reduce((t,r)=>t.width>r.width?t:r),g_r="…",MTe=(e,t,r,n,s,a,i,l)=>{var c=e.slice(0,t),u=Pit({breakAll:r,style:n,children:c+g_r});if(!u)return[!1,[]];var d=Dit(u.wordsWithComputedWidth,a,i,l),f=d.length>s||Lit(d).width>Number(a);return[f,d]},y_r=(e,t,r,n,s)=>{var{maxLines:a,children:i,style:l,breakAll:c}=e,u=Ur(a),d=String(i),f=Dit(t,n,r,s);if(!u||s)return f;var h=f.length>a||Lit(f).width>Number(n);if(!h)return f;for(var p=0,m=d.length-1,g=0,y;p<=m&&g<=d.length-1;){var x=Math.floor((p+m)/2),w=x-1,[O,k]=MTe(d,w,c,l,a,n,r,s),[_]=MTe(d,x,c,l,a,n,r,s);if(!O&&!_&&(p=x+1),O&&_&&(m=x-1),!O&&_){y=k;break}g++}return y||f},DTe=e=>{var t=wl(e)?[]:e.toString().split(Rit);return[{words:t,width:void 0}]},v_r=e=>{var{width:t,scaleToFit:r,children:n,style:s,breakAll:a,maxLines:i}=e;if((t||r)&&!HR.isSsr){var l,c,u=Pit({breakAll:a,children:n,style:s});if(u){var{wordsWithComputedWidth:d,spaceWidth:f}=u;l=d,c=f}else return DTe(n);return y_r({breakAll:a,children:n,maxLines:i,style:s},l,c,t,!!r)}return DTe(n)},$it="#808080",b_r={angle:0,breakAll:!1,capHeight:"0.71em",fill:$it,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},the=b.forwardRef((e,t)=>{var r=td(e,b_r),{x:n,y:s,lineHeight:a,capHeight:i,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,f=PTe(r,f_r),h=b.useMemo(()=>v_r({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:p,dy:m,angle:g,className:y,breakAll:x}=f,w=PTe(f,h_r);if(!eg(n)||!eg(s)||h.length===0)return null;var O=Number(n)+(Ur(p)?p:0),k=Number(s)+(Ur(m)?m:0);if(!$s(O)||!$s(k))return null;var _;switch(d){case"start":_=Lq("calc(".concat(i,")"));break;case"middle":_=Lq("calc(".concat((h.length-1)/2," * -").concat(a," + (").concat(i," / 2))"));break;default:_=Lq("calc(".concat(h.length-1," * -").concat(a,")"));break}var E=[],T=h[0];if(c&&T!=null){var j=T.width,{width:A}=f;E.push("scale(".concat(Ur(A)&&Ur(j)?A/j:1,")"))}return g&&E.push("rotate(".concat(g,", ").concat(O,", ").concat(k,")")),E.length&&(w.transform=E.join(" ")),b.createElement("text",zse({},eu(w),{ref:t,x:O,y:k,className:ya("recharts-text",y),textAnchor:u,fill:l.includes("url")?$it:l}),h.map((I,P)=>{var R=I.words.join(x?"":" ");return b.createElement("tspan",{x:O,dy:P===0?_:a,key:"".concat(R,"-").concat(P)},R)}))});the.displayName="Text";function LTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function im(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LTe(Object(r),!0).forEach(function(n){x_r(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function x_r(e,t,r){return(t=w_r(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w_r(e){var t=S_r(e,"string");return typeof t=="symbol"?t:t+""}function S_r(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var O_r=e=>{var{viewBox:t,position:r,offset:n=0,parentViewBox:s}=e,{x:a,y:i,height:l,upperWidth:c,lowerWidth:u}=Zde(t),d=a,f=a+(c-u)/2,h=(d+f)/2,p=(c+u)/2,m=d+c/2,g=l>=0?1:-1,y=g*n,x=g>0?"end":"start",w=g>0?"start":"end",O=c>=0?1:-1,k=O*n,_=O>0?"end":"start",E=O>0?"start":"end",T=s;if(r==="top"){var j={x:d+c/2,y:i-y,horizontalAnchor:"middle",verticalAnchor:x};return T&&(j.height=Math.max(i-T.y,0),j.width=c),j}if(r==="bottom"){var A={x:f+u/2,y:i+l+y,horizontalAnchor:"middle",verticalAnchor:w};return T&&(A.height=Math.max(T.y+T.height-(i+l),0),A.width=u),A}if(r==="left"){var I={x:h-k,y:i+l/2,horizontalAnchor:_,verticalAnchor:"middle"};return T&&(I.width=Math.max(I.x-T.x,0),I.height=l),I}if(r==="right"){var P={x:h+p+k,y:i+l/2,horizontalAnchor:E,verticalAnchor:"middle"};return T&&(P.width=Math.max(T.x+T.width-P.x,0),P.height=l),P}var R=T?{width:p,height:l}:{};return r==="insideLeft"?im({x:h+k,y:i+l/2,horizontalAnchor:E,verticalAnchor:"middle"},R):r==="insideRight"?im({x:h+p-k,y:i+l/2,horizontalAnchor:_,verticalAnchor:"middle"},R):r==="insideTop"?im({x:d+c/2,y:i+y,horizontalAnchor:"middle",verticalAnchor:w},R):r==="insideBottom"?im({x:f+u/2,y:i+l-y,horizontalAnchor:"middle",verticalAnchor:x},R):r==="insideTopLeft"?im({x:d+k,y:i+y,horizontalAnchor:E,verticalAnchor:w},R):r==="insideTopRight"?im({x:d+c-k,y:i+y,horizontalAnchor:_,verticalAnchor:w},R):r==="insideBottomLeft"?im({x:f+k,y:i+l-y,horizontalAnchor:E,verticalAnchor:x},R):r==="insideBottomRight"?im({x:f+u-k,y:i+l-y,horizontalAnchor:_,verticalAnchor:x},R):r&&typeof r=="object"&&(Ur(r.x)||cS(r.x))&&(Ur(r.y)||cS(r.y))?im({x:a+_x(r.x,p),y:i+_x(r.y,l),horizontalAnchor:"end",verticalAnchor:"end"},R):im({x:m,y:i+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},R)},k_r=["labelRef"],__r=["content"];function $Te(e,t){if(e==null)return{};var r,n,s=E_r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function E_r(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function FTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function uT(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?FTe(Object(r),!0).forEach(function(n){C_r(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function C_r(e,t,r){return(t=j_r(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j_r(e){var t=T_r(e,"string");return typeof t=="symbol"?t:t+""}function T_r(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function by(){return by=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},by.apply(null,arguments)}var Fit=b.createContext(null),N_r=e=>{var{x:t,y:r,upperWidth:n,lowerWidth:s,width:a,height:i,children:l}=e,c=b.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:s,width:a,height:i}),[t,r,n,s,a,i]);return b.createElement(Fit.Provider,{value:c},l)},zit=()=>{var e=b.useContext(Fit),t=uz();return e||(t?Zde(t):void 0)},A_r=b.createContext(null),I_r=()=>{var e=b.useContext(A_r),t=Jr(Rst);return e||t},R_r=e=>{var{value:t,formatter:r}=e,n=wl(e.children)?t:e.children;return typeof r=="function"?r(n):n},rhe=e=>e!=null&&typeof e=="function",P_r=(e,t)=>{var r=ih(t-e),n=Math.min(Math.abs(t-e),360);return r*n},M_r=(e,t,r,n,s)=>{var{offset:a,className:i}=e,{cx:l,cy:c,innerRadius:u,outerRadius:d,startAngle:f,endAngle:h,clockWise:p}=s,m=(u+d)/2,g=P_r(f,h),y=g>=0?1:-1,x,w;switch(t){case"insideStart":x=f+y*a,w=p;break;case"insideEnd":x=h-y*a,w=!p;break;case"end":x=h+y*a,w=p;break;default:throw new Error("Unsupported position ".concat(t))}w=g<=0?w:!w;var O=Vl(l,c,m,x),k=Vl(l,c,m,x+(w?1:-1)*359),_="M".concat(O.x,",").concat(O.y,`
286
286
  A`).concat(m,",").concat(m,",0,1,").concat(w?0:1,`,
287
- `).concat(k.x,",").concat(k.y),E=wl(e.id)?pA("recharts-radial-line-"):e.id;return b.createElement("text",by({},n,{dominantBaseline:"central",className:ya("recharts-radial-bar-label",i)}),b.createElement("defs",null,b.createElement("path",{id:E,d:_})),b.createElement("textPath",{xlinkHref:"#".concat(E)},r))},D_r=(e,t,r)=>{var{cx:n,cy:s,innerRadius:a,outerRadius:i,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(r==="outside"){var{x:d,y:f}=Vl(n,s,i+t,u);return{x:d,y:f,textAnchor:d>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"end"};var h=(a+i)/2,{x:p,y:m}=Vl(n,s,h,u);return{x:p,y:m,textAnchor:"middle",verticalAnchor:"middle"}},WL=e=>e!=null&&"cx"in e&&Ur(e.cx),L_r={angle:0,offset:5,zIndex:Qc.label,position:"middle",textBreakAll:!1};function $_r(e){if(!WL(e))return e;var{cx:t,cy:r,outerRadius:n}=e,s=n*2;return{x:t-n,y:r-n,width:s,upperWidth:s,lowerWidth:s,height:s}}function _b(e){var t=td(e,L_r),{viewBox:r,parentViewBox:n,position:s,value:a,children:i,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=I_r(),h=zit(),p=s==="center"?h:f??h,m,g,y;r==null?m=p:WL(r)?m=r:m=Zde(r);var x=$_r(m);if(!m||wl(a)&&wl(i)&&!b.isValidElement(l)&&typeof l!="function")return null;var w=uT(uT({},t),{},{viewBox:m});if(b.isValidElement(l)){var{labelRef:O}=w,k=$Te(w,k_r);return b.cloneElement(l,k)}if(typeof l=="function"){var{content:_}=w,E=$Te(w,__r);if(g=b.createElement(l,E),b.isValidElement(g))return g}else g=R_r(t);var T=eu(t);if(WL(m)){if(s==="insideStart"||s==="insideEnd"||s==="end")return M_r(t,s,g,T,m);y=D_r(m,t.offset,t.position)}else{if(!x)return null;var j=O_r({viewBox:x,position:s,offset:t.offset,parentViewBox:WL(n)?void 0:n});y=uT(uT({x:j.x,y:j.y,textAnchor:j.horizontalAnchor,verticalAnchor:j.verticalAnchor},j.width!==void 0?{width:j.width}:{}),j.height!==void 0?{height:j.height}:{})}return b.createElement(Ov,{zIndex:t.zIndex},b.createElement(the,by({ref:d,className:ya("recharts-label",c)},T,y,{textAnchor:Mit(T.textAnchor)?T.textAnchor:y.textAnchor,breakAll:u}),g))}_b.displayName="Label";var F_r=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?b.createElement(_b,by({key:"label-implicit"},n)):eg(e)?b.createElement(_b,by({key:"label-implicit",value:e},n)):b.isValidElement(e)?e.type===_b?b.cloneElement(e,uT({key:"label-implicit"},n)):b.createElement(_b,by({key:"label-implicit",content:e},n)):rhe(e)?b.createElement(_b,by({key:"label-implicit",content:e},n)):e&&typeof e=="object"?b.createElement(_b,by({},e,{key:"label-implicit"},n)):null};function z_r(e){var{label:t,labelRef:r}=e,n=zit();return F_r(t,n,r)||null}var B_r=["valueAccessor"],U_r=["dataKey","clockWise","id","textBreakAll","zIndex"];function $5(){return $5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$5.apply(null,arguments)}function zTe(e,t){if(e==null)return{};var r,n,s=V_r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function V_r(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var q_r=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(m_r(t))return t},Bit=b.createContext(void 0),H_r=Bit.Provider,Uit=b.createContext(void 0);Uit.Provider;function Q_r(){return b.useContext(Bit)}function W_r(){return b.useContext(Uit)}function GL(e){var{valueAccessor:t=q_r}=e,r=zTe(e,B_r),{dataKey:n,clockWise:s,id:a,textBreakAll:i,zIndex:l}=r,c=zTe(r,U_r),u=Q_r(),d=W_r(),f=u||d;return!f||!f.length?null:b.createElement(Ov,{zIndex:l??Qc.label},b.createElement(Qy,{className:"recharts-label-list"},f.map((h,p)=>{var m,g=wl(n)?t(h,p):Gl(h.payload,n),y=wl(a)?{}:{id:"".concat(a,"-").concat(p)};return b.createElement(_b,$5({key:"label-".concat(p)},eu(h),c,y,{fill:(m=r.fill)!==null&&m!==void 0?m:h.fill,parentViewBox:h.parentViewBox,value:g,textBreakAll:i,viewBox:h.viewBox,index:p,zIndex:0}))})))}GL.displayName="LabelList";function G_r(e){var{label:t}=e;return t?t===!0?b.createElement(GL,{key:"labelList-implicit"}):b.isValidElement(t)||rhe(t)?b.createElement(GL,{key:"labelList-implicit",content:t}):typeof t=="object"?b.createElement(GL,$5({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Bse(){return Bse=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bse.apply(null,arguments)}var Vit=e=>{var{cx:t,cy:r,r:n,className:s}=e,a=ya("recharts-dot",s);return Ur(t)&&Ur(r)&&Ur(n)?b.createElement("circle",Bse({},Jm(e),zde(e),{className:a,cx:t,cy:r,r:n})):null},Z_r={radiusAxis:{},angleAxis:{}},qit=_c({name:"polarAxis",initialState:Z_r,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:QAn,removeRadiusAxis:WAn,addAngleAxis:GAn,removeAngleAxis:ZAn}=qit.actions,Y_r=qit.reducer;function X_r(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var $q={exports:{}},Ks={};var BTe;function K_r(){if(BTe)return Ks;BTe=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function g(y){if(typeof y=="object"&&y!==null){var x=y.$$typeof;switch(x){case e:switch(y=y.type,y){case r:case s:case n:case u:case d:return y;default:switch(y=y&&y.$$typeof,y){case l:case i:case c:case h:case f:case a:return y;default:return x}}case t:return x}}}return Ks.ContextConsumer=i,Ks.ContextProvider=a,Ks.Element=e,Ks.ForwardRef=c,Ks.Fragment=r,Ks.Lazy=h,Ks.Memo=f,Ks.Portal=t,Ks.Profiler=s,Ks.StrictMode=n,Ks.Suspense=u,Ks.SuspenseList=d,Ks.isAsyncMode=function(){return!1},Ks.isConcurrentMode=function(){return!1},Ks.isContextConsumer=function(y){return g(y)===i},Ks.isContextProvider=function(y){return g(y)===a},Ks.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},Ks.isForwardRef=function(y){return g(y)===c},Ks.isFragment=function(y){return g(y)===r},Ks.isLazy=function(y){return g(y)===h},Ks.isMemo=function(y){return g(y)===f},Ks.isPortal=function(y){return g(y)===t},Ks.isProfiler=function(y){return g(y)===s},Ks.isStrictMode=function(y){return g(y)===n},Ks.isSuspense=function(y){return g(y)===u},Ks.isSuspenseList=function(y){return g(y)===d},Ks.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===r||y===s||y===n||y===u||y===d||y===p||typeof y=="object"&&y!==null&&(y.$$typeof===h||y.$$typeof===f||y.$$typeof===a||y.$$typeof===i||y.$$typeof===c||y.$$typeof===m||y.getModuleId!==void 0)},Ks.typeOf=g,Ks}var UTe;function J_r(){return UTe||(UTe=1,$q.exports=K_r()),$q.exports}J_r();var Hit=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,Fq={},VTe;function eEr(){return VTe||(VTe=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const s=r[Symbol.toStringTag];return s==null||!Object.getOwnPropertyDescriptor(r,Symbol.toStringTag)?.writable?!1:r.toString()===`[object ${s}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(Fq)),Fq}var zq,qTe;function tEr(){return qTe||(qTe=1,zq=eEr().isPlainObject),zq}var rEr=tEr();const nEr=$o(rEr);var HTe,QTe,WTe,GTe,ZTe;function YTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function XTe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YTe(Object(r),!0).forEach(function(n){sEr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sEr(e,t,r){return(t=aEr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aEr(e){var t=iEr(e,"string");return typeof t=="symbol"?t:t+""}function iEr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function F5(){return F5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},F5.apply(null,arguments)}function Oj(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var KTe=(e,t,r,n,s)=>{var a=r-n,i;return i=Ui(HTe||(HTe=Oj(["M ",",",""])),e,t),i+=Ui(QTe||(QTe=Oj(["L ",",",""])),e+r,t),i+=Ui(WTe||(WTe=Oj(["L ",",",""])),e+r-a/2,t+s),i+=Ui(GTe||(GTe=Oj(["L ",",",""])),e+r-a/2-n,t+s),i+=Ui(ZTe||(ZTe=Oj(["L ",","," Z"])),e,t),i},oEr={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},lEr=e=>{var t=td(e,oEr),{x:r,y:n,upperWidth:s,lowerWidth:a,height:i,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,h=b.useRef(null),[p,m]=b.useState(-1),g=b.useRef(s),y=b.useRef(a),x=b.useRef(i),w=b.useRef(r),O=b.useRef(n),k=Jde(e,"trapezoid-");if(b.useEffect(()=>{if(h.current&&h.current.getTotalLength)try{var D=h.current.getTotalLength();D&&m(D)}catch{}},[]),r!==+r||n!==+n||s!==+s||a!==+a||i!==+i||s===0&&a===0||i===0)return null;var _=ya("recharts-trapezoid",l);if(!f)return b.createElement("g",null,b.createElement("path",F5({},eu(t),{className:_,d:KTe(r,n,s,a,i)})));var E=g.current,T=y.current,j=x.current,A=w.current,I=O.current,P="0px ".concat(p===-1?1:p,"px"),R="".concat(p,"px ").concat(p,"px"),B=ost(["strokeDasharray"],u,c);return b.createElement(Kde,{animationId:k,key:k,canBegin:p>0,duration:u,easing:c,isActive:f,begin:d},D=>{var F=Au(E,s,D),U=Au(T,a,D),z=Au(j,i,D),V=Au(A,r,D),W=Au(I,n,D);h.current&&(g.current=F,y.current=U,x.current=z,w.current=V,O.current=W);var L=D>0?{transition:B,strokeDasharray:R}:{strokeDasharray:P};return b.createElement("path",F5({},eu(t),{className:_,d:KTe(V,W,F,U,z),ref:h,style:XTe(XTe({},L),t.style)}))})},cEr=["option","shapeType","activeClassName","inActiveClassName"];function uEr(e,t){if(e==null)return{};var r,n,s=dEr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function dEr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function JTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function z5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?JTe(Object(r),!0).forEach(function(n){fEr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fEr(e,t,r){return(t=hEr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hEr(e){var t=pEr(e,"string");return typeof t=="symbol"?t:t+""}function pEr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mEr(e,t){return z5(z5({},t),e)}function gEr(e,t){return e==="symbols"}function eNe(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return b.createElement(dst,r);case"trapezoid":return b.createElement(lEr,r);case"sector":return b.createElement(pst,r);case"symbols":if(gEr(t))return b.createElement(Xrt,r);break;case"curve":return b.createElement(ist,r);default:return null}}function yEr(e){return b.isValidElement(e)?e.props:e}function vEr(e){var{option:t,shapeType:r,activeClassName:n="recharts-active-shape",inActiveClassName:s="recharts-shape"}=e,a=uEr(e,cEr),i;if(b.isValidElement(t))i=b.cloneElement(t,z5(z5({},a),yEr(t)));else if(typeof t=="function")i=t(a,a.index);else if(nEr(t)&&typeof t!="boolean"){var l=mEr(t,a);i=b.createElement(eNe,{shapeType:r,elementProps:l})}else{var c=a;i=b.createElement(eNe,{shapeType:r,elementProps:c})}return a.isActive?b.createElement(Qy,{className:n},i):b.createElement(Qy,{className:s},i)}function bEr(e){var{tooltipEntrySettings:t}=e,r=Fo(),n=rd(),s=b.useRef(null);return b.useLayoutEffect(()=>{n||(s.current===null?r(C1r(t)):s.current!==t&&r(j1r({prev:s.current,next:t})),s.current=t)},[t,r,n]),b.useLayoutEffect(()=>()=>{s.current&&(r(T1r(s.current)),s.current=null)},[r]),null}function xEr(e){var{legendPayload:t}=e,r=Fo(),n=rd(),s=b.useRef(null);return b.useLayoutEffect(()=>{n||(s.current===null?r(Uvr(t)):s.current!==t&&r(Vvr({prev:s.current,next:t})),s.current=t)},[r,n,t]),b.useLayoutEffect(()=>()=>{s.current&&(r(qvr(s.current)),s.current=null)},[r]),null}var Bq,wEr=()=>{var[e]=b.useState(()=>pA("uid-"));return e},SEr=(Bq=LS.useId)!==null&&Bq!==void 0?Bq:wEr;function OEr(e,t){var r=SEr();return t||(e?"".concat(e,"-").concat(r):r)}var kEr=b.createContext(void 0),_Er=e=>{var{id:t,type:r,children:n}=e,s=OEr("recharts-".concat(r),t);return b.createElement(kEr.Provider,{value:s},n(s))},EEr={cartesianItems:[],polarItems:[]},Qit=_c({name:"graphicalItems",initialState:EEr,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:ai()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,s=oh(e).cartesianItems.indexOf(r);s>-1&&(e.cartesianItems[s]=n)},prepare:ai()},removeCartesianGraphicalItem:{reducer(e,t){var r=oh(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:ai()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:ai()},removePolarGraphicalItem:{reducer(e,t){var r=oh(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:ai()},replacePolarGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,s=oh(e).polarItems.indexOf(r);s>-1&&(e.polarItems[s]=n)},prepare:ai()}}}),{addCartesianGraphicalItem:CEr,replaceCartesianGraphicalItem:jEr,removeCartesianGraphicalItem:TEr,addPolarGraphicalItem:YAn,removePolarGraphicalItem:XAn,replacePolarGraphicalItem:KAn}=Qit.actions,NEr=Qit.reducer,AEr=e=>{var t=Fo(),r=b.useRef(null);return b.useLayoutEffect(()=>{r.current===null?t(CEr(e)):r.current!==e&&t(jEr({prev:r.current,next:e})),r.current=e},[t,e]),b.useLayoutEffect(()=>()=>{r.current&&(t(TEr(r.current)),r.current=null)},[t]),null},IEr=b.memo(AEr),REr=["points"];function tNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Uq(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tNe(Object(r),!0).forEach(function(n){PEr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PEr(e,t,r){return(t=MEr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MEr(e){var t=DEr(e,"string");return typeof t=="symbol"?t:t+""}function DEr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function B5(){return B5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},B5.apply(null,arguments)}function LEr(e,t){if(e==null)return{};var r,n,s=$Er(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function $Er(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function FEr(e){var{option:t,dotProps:r,className:n}=e;if(b.isValidElement(t))return b.cloneElement(t,r);if(typeof t=="function")return t(r);var s=ya(n,typeof t!="boolean"?t.className:""),a=r??{},{points:i}=a,l=LEr(a,REr);return b.createElement(Vit,B5({},l,{className:s}))}function zEr(e,t){return e==null?!1:t?!0:e.length===1}function BEr(e){var{points:t,dot:r,className:n,dotClassName:s,dataKey:a,baseProps:i,needClip:l,clipPathId:c,zIndex:u=Qc.scatter}=e;if(!zEr(t,r))return null;var d=Hit(r),f=Jpr(r),h=t.map((m,g)=>{var y,x,w=Uq(Uq(Uq({r:3},i),f),{},{index:g,cx:(y=m.x)!==null&&y!==void 0?y:void 0,cy:(x=m.y)!==null&&x!==void 0?x:void 0,dataKey:a,value:m.value,payload:m.payload,points:t});return b.createElement(FEr,{key:"dot-".concat(g),option:r,dotProps:w,className:s})}),p={};return l&&c!=null&&(p.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),b.createElement(Ov,{zIndex:u},b.createElement(Qy,B5({className:n},p),h))}function rNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function nNe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rNe(Object(r),!0).forEach(function(n){UEr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function UEr(e,t,r){return(t=VEr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VEr(e){var t=qEr(e,"string");return typeof t=="symbol"?t:t+""}function qEr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var HEr={xAxis:{},yAxis:{},zAxis:{}},Wit=_c({name:"cartesianAxis",initialState:HEr,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:ai()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.xAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:ai()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:ai()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:ai()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.yAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:ai()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:ai()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:ai()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.zAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:ai()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:ai()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,s=e.yAxis[r];if(s){var a,i=s.widthHistory||[];if(i.length===3&&i[0]===i[2]&&n===i[1]&&n!==s.width&&Math.abs(n-((a=i[0])!==null&&a!==void 0?a:0))<=1)return;var l=[...i,n].slice(-3);e.yAxis[r]=nNe(nNe({},s),{},{width:n,widthHistory:l})}}}}),{addXAxis:QEr,replaceXAxis:WEr,removeXAxis:GEr,addYAxis:ZEr,replaceYAxis:YEr,removeYAxis:XEr,addZAxis:JAn,replaceZAxis:eIn,removeZAxis:tIn,updateYAxisWidth:KEr}=Wit.actions,JEr=Wit.reducer,eCr=et([Kl],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),tCr=et([eCr,yv,vv],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),nhe=()=>Jr(tCr),rCr=()=>Jr(COr);function sNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Vq(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sNe(Object(r),!0).forEach(function(n){nCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function nCr(e,t,r){return(t=sCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sCr(e){var t=aCr(e,"string");return typeof t=="symbol"?t:t+""}function aCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iCr=e=>{var{point:t,childIndex:r,mainColor:n,activeDot:s,dataKey:a,clipPath:i}=e;if(s===!1||t.x==null||t.y==null)return null;var l={index:r,dataKey:a,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=Vq(Vq(Vq({},l),HF(s)),zde(s)),u;return b.isValidElement(s)?u=b.cloneElement(s,c):typeof s=="function"?u=s(c):u=b.createElement(Vit,c),b.createElement(Qy,{className:"recharts-active-dot",clipPath:i},u)};function oCr(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:s,clipPath:a,zIndex:i=Qc.activeDot}=e,l=Jr(EA),c=rCr();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return wl(u)?null:b.createElement(Ov,{zIndex:i},b.createElement(iCr,{point:u,childIndex:Number(l),mainColor:r,dataKey:s,activeDot:n,clipPath:a}))}var lCr=e=>{var{chartData:t}=e,r=Fo(),n=rd();return b.useEffect(()=>n?()=>{}:(r(STe(t)),()=>{r(STe(void 0))}),[t,r,n]),null},aNe={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Git=_c({name:"brush",initialState:aNe,reducers:{setBrushSettings(e,t){return t.payload==null?aNe:t.payload}}}),{setBrushSettings:rIn}=Git.actions,cCr=Git.reducer;function uCr(e){return(e%180+180)%180}var dCr=function(t){var{width:r,height:n}=t,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=uCr(s),i=a*Math.PI/180,l=Math.atan(n/r),c=i>l&&i<Math.PI-l?n/Math.sin(i):r/Math.cos(i);return Math.abs(c)},fCr={dots:[],areas:[],lines:[]},Zit=_c({name:"referenceElements",initialState:fCr,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=oh(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=oh(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=oh(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:nIn,removeDot:sIn,addArea:aIn,removeArea:iIn,addLine:oIn,removeLine:lIn}=Zit.actions,hCr=Zit.reducer,pCr=b.createContext(void 0),mCr=e=>{var{children:t}=e,[r]=b.useState("".concat(pA("recharts"),"-clip")),n=nhe();if(n==null)return null;var{x:s,y:a,width:i,height:l}=n;return b.createElement(pCr.Provider,{value:r},b.createElement("defs",null,b.createElement("clipPath",{id:r},b.createElement("rect",{x:s,y:a,height:l,width:i}))),t)};function Yit(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t){var s=e[n];s!==void 0&&r.push(s)}return r}function gCr(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return dCr(n,r)}function yCr(e,t,r){var n=r==="width",{x:s,y:a,width:i,height:l}=e;return t===1?{start:n?s:a,end:n?s+i:a+l}:{start:n?s+i:a+l,end:n?s:a}}function jA(e,t,r,n,s){if(e*t<e*n||e*t>e*s)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-s)<=0}function vCr(e,t){return Yit(e,t+1)}function bCr(e,t,r,n,s){for(var a=(n||[]).slice(),{start:i,end:l}=t,c=0,u=1,d=i,f=function(){var m=n?.[c];if(m===void 0)return{v:Yit(n,u)};var g=c,y,x=()=>(y===void 0&&(y=r(m,g)),y),w=m.coordinate,O=c===0||jA(e,w,x,d,l);O||(c=0,d=i,u+=1),O&&(d=w+e*(x()/2+s),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function xCr(e,t,r,n,s){var a=(n||[]).slice(),i=a.length;if(i===0)return[];for(var{start:l,end:c}=t,u=1;u<=i;u++){for(var d=(i-1)%u,f=l,h=!0,p=function(){var k=n[g];if(k==null)return 0;var _=g,E,T=()=>(E===void 0&&(E=r(k,_)),E),j=k.coordinate,A=g===d||jA(e,j,T,f,c);if(!A)return h=!1,1;A&&(f=j+e*(T()/2+s))},m,g=d;g<i&&(m=p(),!(m!==0&&m===1));g+=u);if(h){for(var y=[],x=d;x<i;x+=u){var w=n[x];w!=null&&y.push(w)}return y}}return[]}function iNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function nc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iNe(Object(r),!0).forEach(function(n){wCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wCr(e,t,r){return(t=SCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SCr(e){var t=OCr(e,"string");return typeof t=="symbol"?t:t+""}function OCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kCr(e,t,r,n,s){for(var a=(n||[]).slice(),i=a.length,{start:l}=t,{end:c}=t,u=function(h){var p=a[h];if(p==null)return 1;var m=p,g,y=()=>(g===void 0&&(g=r(p,h)),g);if(h===i-1){var x=e*(m.coordinate+e*y()/2-c);a[h]=m=nc(nc({},m),{},{tickCoord:x>0?m.coordinate-x*e:m.coordinate})}else a[h]=m=nc(nc({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var w=jA(e,m.tickCoord,y,l,c);w&&(c=m.tickCoord-e*(y()/2+s),a[h]=nc(nc({},m),{},{isShow:!0}))}},d=i-1;d>=0;d--)u(d);return a}function _Cr(e,t,r,n,s,a){var i=(n||[]).slice(),l=i.length,{start:c,end:u}=t;if(a){var d=n[l-1];if(d!=null){var f=r(d,l-1),h=e*(d.coordinate+e*f/2-u);if(i[l-1]=d=nc(nc({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate}),d.tickCoord!=null){var p=jA(e,d.tickCoord,()=>f,c,u);p&&(u=d.tickCoord-e*(f/2+s),i[l-1]=nc(nc({},d),{},{isShow:!0}))}}}for(var m=a?l-1:l,g=function(w){var O=i[w];if(O==null)return 1;var k=O,_,E=()=>(_===void 0&&(_=r(O,w)),_);if(w===0){var T=e*(k.coordinate-e*E()/2-c);i[w]=k=nc(nc({},k),{},{tickCoord:T<0?k.coordinate-T*e:k.coordinate})}else i[w]=k=nc(nc({},k),{},{tickCoord:k.coordinate});if(k.tickCoord!=null){var j=jA(e,k.tickCoord,E,c,u);j&&(c=k.tickCoord+e*(E()/2+s),i[w]=nc(nc({},k),{},{isShow:!0}))}},y=0;y<m;y++)g(y);return i}function she(e,t,r){var{tick:n,ticks:s,viewBox:a,minTickGap:i,orientation:l,interval:c,tickFormatter:u,unit:d,angle:f}=e;if(!s||!s.length||!n)return[];if(Ur(c)||HR.isSsr){var h;return(h=vCr(s,Ur(c)?c:0))!==null&&h!==void 0?h:[]}var p=[],m=l==="top"||l==="bottom"?"width":"height",g=d&&m==="width"?YT(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},y=(_,E)=>{var T=typeof u=="function"?u(_.value,E):_.value;return m==="width"?gCr(YT(T,{fontSize:t,letterSpacing:r}),g,f):YT(T,{fontSize:t,letterSpacing:r})[m]},x=s[0],w=s[1],O=s.length>=2&&x!=null&&w!=null?ih(w.coordinate-x.coordinate):1,k=yCr(a,O,m);return c==="equidistantPreserveStart"?bCr(O,k,y,s,i):c==="equidistantPreserveEnd"?xCr(O,k,y,s,i):(c==="preserveStart"||c==="preserveStartEnd"?p=_Cr(O,k,y,s,i,c==="preserveStartEnd"):p=kCr(O,k,y,s,i),p.filter(_=>_.isShow))}var ECr=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:s=0,tickMargin:a=0}=e,i=0;if(t){Array.from(t).forEach(d=>{if(d){var f=d.getBoundingClientRect();f.width>i&&(i=f.width)}});var l=r?r.getBoundingClientRect().width:0,c=s+a,u=i+c+l+(r?n:0);return Math.round(u)}return 0},CCr={xAxis:{},yAxis:{}},Xit=_c({name:"renderedTicks",initialState:CCr,reducers:{setRenderedTicks:(e,t)=>{var{axisType:r,axisId:n,ticks:s}=t.payload;e[r][n]=s},removeRenderedTicks:(e,t)=>{var{axisType:r,axisId:n}=t.payload;delete e[r][n]}}}),{setRenderedTicks:jCr,removeRenderedTicks:TCr}=Xit.actions,NCr=Xit.reducer,ACr=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function ICr(e,t){if(e==null)return{};var r,n,s=RCr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function RCr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function mS(){return mS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mS.apply(null,arguments)}function oNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Bi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oNe(Object(r),!0).forEach(function(n){PCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PCr(e,t,r){return(t=MCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MCr(e){var t=DCr(e,"string");return typeof t=="symbol"?t:t+""}function DCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var My={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Qc.axis};function LCr(e){var{x:t,y:r,width:n,height:s,orientation:a,mirror:i,axisLine:l,otherSvgProps:c}=e;if(!l)return null;var u=Bi(Bi(Bi({},c),Jm(l)),{},{fill:"none"});if(a==="top"||a==="bottom"){var d=+(a==="top"&&!i||a==="bottom"&&i);u=Bi(Bi({},u),{},{x1:t,y1:r+d*s,x2:t+n,y2:r+d*s})}else{var f=+(a==="left"&&!i||a==="right"&&i);u=Bi(Bi({},u),{},{x1:t+f*n,y1:r,x2:t+f*n,y2:r+s})}return b.createElement("line",mS({},u,{className:ya("recharts-cartesian-axis-line",ZF(l,"className"))}))}function $Cr(e,t,r,n,s,a,i,l,c){var u,d,f,h,p,m,g=l?-1:1,y=e.tickSize||i,x=Ur(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":u=d=e.coordinate,h=r+ +!l*s,f=h-g*y,m=f-g*c,p=x;break;case"left":f=h=e.coordinate,d=t+ +!l*n,u=d-g*y,p=u-g*c,m=x;break;case"right":f=h=e.coordinate,d=t+ +l*n,u=d+g*y,p=u+g*c,m=x;break;default:u=d=e.coordinate,h=r+ +l*s,f=h+g*y,m=f+g*c,p=x;break}return{line:{x1:u,y1:f,x2:d,y2:h},tick:{x:p,y:m}}}function FCr(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function zCr(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function BCr(e){var{option:t,tickProps:r,value:n}=e,s,a=ya(r.className,"recharts-cartesian-axis-tick-value");if(b.isValidElement(t))s=b.cloneElement(t,Bi(Bi({},r),{},{className:a}));else if(typeof t=="function")s=t(Bi(Bi({},r),{},{className:a}));else{var i="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(i=ya(i,X_r(t))),s=b.createElement(the,mS({},r,{className:i}),n)}return s}function UCr(e){var{ticks:t,axisType:r,axisId:n}=e,s=Fo();return b.useEffect(()=>{if(n==null||r==null)return JS;var a=t.map(i=>({value:i.value,coordinate:i.coordinate,offset:i.offset,index:i.index}));return s(jCr({ticks:a,axisId:n,axisType:r})),()=>{s(TCr({axisId:n,axisType:r}))}},[s,t,n,r]),null}var VCr=b.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:s,stroke:a,tickFormatter:i,unit:l,padding:c,tickTextProps:u,orientation:d,mirror:f,x:h,y:p,width:m,height:g,tickSize:y,tickMargin:x,fontSize:w,letterSpacing:O,getTicksConfig:k,events:_,axisType:E,axisId:T}=e,j=she(Bi(Bi({},k),{},{ticks:r}),w,O),A=Jm(k),I=HF(n),P=Mit(A.textAnchor)?A.textAnchor:FCr(d,f),R=zCr(d,f),B={};typeof s=="object"&&(B=s);var D=Bi(Bi({},A),{},{fill:"none"},B),F=j.map(V=>Bi({entry:V},$Cr(V,h,p,m,g,d,y,f,x))),U=F.map(V=>{var{entry:W,line:L}=V;return b.createElement(Qy,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)},s&&b.createElement("line",mS({},D,L,{className:ya("recharts-cartesian-axis-tick-line",ZF(s,"className"))})))}),z=F.map((V,W)=>{var L,Y,{entry:q,tick:M}=V,Q=Bi(Bi(Bi(Bi({verticalAnchor:R},A),{},{textAnchor:P,stroke:"none",fill:a},M),{},{index:W,payload:q,visibleTicksCount:j.length,tickFormatter:i,padding:c},u),{},{angle:(L=(Y=u?.angle)!==null&&Y!==void 0?Y:A.angle)!==null&&L!==void 0?L:0}),G=Bi(Bi({},Q),I);return b.createElement(Qy,mS({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(q.value,"-").concat(q.coordinate,"-").concat(q.tickCoord)},ngr(_,q,W)),n&&b.createElement(BCr,{option:n,tickProps:G,value:"".concat(typeof i=="function"?i(q.value,W):q.value).concat(l||"")}))});return b.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(E,"-ticks")},b.createElement(UCr,{ticks:j,axisId:T,axisType:E}),z.length>0&&b.createElement(Ov,{zIndex:Qc.label},b.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(E,"-tick-labels"),ref:t},z)),U.length>0&&b.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(E,"-tick-lines")},U))}),qCr=b.forwardRef((e,t)=>{var{axisLine:r,width:n,height:s,className:a,hide:i,ticks:l,axisType:c,axisId:u}=e,d=ICr(e,ACr),[f,h]=b.useState(""),[p,m]=b.useState(""),g=b.useRef(null);b.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var x;return ECr({ticks:g.current,label:(x=e.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var y=b.useCallback(x=>{if(x){var w=x.getElementsByClassName("recharts-cartesian-axis-tick-value");g.current=w;var O=w[0];if(O){var k=window.getComputedStyle(O),_=k.fontSize,E=k.letterSpacing;(_!==f||E!==p)&&(h(_),m(E))}}},[f,p]);return i||n!=null&&n<=0||s!=null&&s<=0?null:b.createElement(Ov,{zIndex:e.zIndex},b.createElement(Qy,{className:ya("recharts-cartesian-axis",a)},b.createElement(LCr,{x:e.x,y:e.y,width:n,height:s,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:Jm(e)}),b.createElement(VCr,{ref:y,axisType:c,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:u}),b.createElement(N_r,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},b.createElement(z_r,{label:e.label,labelRef:e.labelRef}),e.children)))}),ahe=b.forwardRef((e,t)=>{var r=td(e,My);return b.createElement(qCr,mS({},r,{ref:t}))});ahe.displayName="CartesianAxis";var HCr=["x1","y1","x2","y2","key"],QCr=["offset"],WCr=["xAxisId","yAxisId"],GCr=["xAxisId","yAxisId"];function lNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function cc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lNe(Object(r),!0).forEach(function(n){ZCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ZCr(e,t,r){return(t=YCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function YCr(e){var t=XCr(e,"string");return typeof t=="symbol"?t:t+""}function XCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yw(){return yw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yw.apply(null,arguments)}function U5(e,t){if(e==null)return{};var r,n,s=KCr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function KCr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var JCr=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:s,width:a,height:i,ry:l}=e;return b.createElement("rect",{x:n,y:s,ry:l,width:a,height:i,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Kit(e){var{option:t,lineItemProps:r}=e,n;if(b.isValidElement(t))n=b.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var s,{x1:a,y1:i,x2:l,y2:c,key:u}=r,d=U5(r,HCr),f=(s=Jm(d))!==null&&s!==void 0?s:{},{offset:h}=f,p=U5(f,QCr);n=b.createElement("line",yw({},p,{x1:a,y1:i,x2:l,y2:c,fill:"none",key:u}))}return n}function ejr(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:s}=e;if(!n||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,l=U5(e,WCr),c=s.map((u,d)=>{var f=cc(cc({},l),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(d),index:d});return b.createElement(Kit,{key:"line-".concat(d),option:n,lineItemProps:f})});return b.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function tjr(e){var{y:t,height:r,vertical:n=!0,verticalPoints:s}=e;if(!n||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,l=U5(e,GCr),c=s.map((u,d)=>{var f=cc(cc({},l),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(d),index:d});return b.createElement(Kit,{option:n,lineItemProps:f,key:"line-".concat(d)})});return b.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function rjr(e){var{horizontalFill:t,fillOpacity:r,x:n,y:s,width:a,height:i,horizontalPoints:l,horizontal:c=!0}=e;if(!c||!t||!t.length||l==null)return null;var u=l.map(f=>Math.round(f+s-s)).sort((f,h)=>f-h);s!==u[0]&&u.unshift(0);var d=u.map((f,h)=>{var p=u[h+1],m=p==null,g=m?s+i-f:p-f;if(g<=0)return null;var y=h%t.length;return b.createElement("rect",{key:"react-".concat(h),y:f,x:n,height:g,width:a,stroke:"none",fill:t[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return b.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function njr(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:s,y:a,width:i,height:l,verticalPoints:c}=e;if(!t||!r||!r.length)return null;var u=c.map(f=>Math.round(f+s-s)).sort((f,h)=>f-h);s!==u[0]&&u.unshift(0);var d=u.map((f,h)=>{var p=u[h+1],m=p==null,g=m?s+i-f:p-f;if(g<=0)return null;var y=h%r.length;return b.createElement("rect",{key:"react-".concat(h),x:f,y:a,width:g,height:l,stroke:"none",fill:r[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return b.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var sjr=(e,t)=>{var{xAxis:r,width:n,height:s,offset:a}=e;return $nt(she(cc(cc(cc({},My),r),{},{ticks:Fnt(r),viewBox:{x:0,y:0,width:n,height:s}})),a.left,a.left+a.width,t)},ajr=(e,t)=>{var{yAxis:r,width:n,height:s,offset:a}=e;return $nt(she(cc(cc(cc({},My),r),{},{ticks:Fnt(r),viewBox:{x:0,y:0,width:n,height:s}})),a.top,a.top+a.height,t)},ijr={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Qc.grid};function Jit(e){var t=Wnt(),r=Gnt(),n=Qnt(),s=cc(cc({},td(e,ijr)),{},{x:Ur(e.x)?e.x:n.left,y:Ur(e.y)?e.y:n.top,width:Ur(e.width)?e.width:n.width,height:Ur(e.height)?e.height:n.height}),{xAxisId:a,yAxisId:i,x:l,y:c,width:u,height:d,syncWithTicks:f,horizontalValues:h,verticalValues:p}=s,m=rd(),g=Jr(A=>cTe(A,"xAxis",a,m)),y=Jr(A=>cTe(A,"yAxis",i,m));if(!tg(u)||!tg(d)||!Ur(l)||!Ur(c))return null;var x=s.verticalCoordinatesGenerator||sjr,w=s.horizontalCoordinatesGenerator||ajr,{horizontalPoints:O,verticalPoints:k}=s;if((!O||!O.length)&&typeof w=="function"){var _=h&&h.length,E=w({yAxis:y?cc(cc({},y),{},{ticks:_?h:y.ticks}):void 0,width:t??u,height:r??d,offset:n},_?!0:f);h5(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(O=E)}if((!k||!k.length)&&typeof x=="function"){var T=p&&p.length,j=x({xAxis:g?cc(cc({},g),{},{ticks:T?p:g.ticks}):void 0,width:t??u,height:r??d,offset:n},T?!0:f);h5(Array.isArray(j),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(k=j)}return b.createElement(Ov,{zIndex:s.zIndex},b.createElement("g",{className:"recharts-cartesian-grid"},b.createElement(JCr,{fill:s.fill,fillOpacity:s.fillOpacity,x:s.x,y:s.y,width:s.width,height:s.height,ry:s.ry}),b.createElement(rjr,yw({},s,{horizontalPoints:O})),b.createElement(njr,yw({},s,{verticalPoints:k})),b.createElement(ejr,yw({},s,{offset:n,horizontalPoints:O,xAxis:g,yAxis:y})),b.createElement(tjr,yw({},s,{offset:n,verticalPoints:k,xAxis:g,yAxis:y}))))}Jit.displayName="CartesianGrid";var ojr={},eot=_c({name:"errorBars",initialState:ojr,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:s}=t.payload;e[r]&&(e[r]=e[r].map(a=>a.dataKey===n.dataKey&&a.direction===n.direction?s:a))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(s=>s.dataKey!==n.dataKey||s.direction!==n.direction))}}}),{addErrorBar:cIn,replaceErrorBar:uIn,removeErrorBar:dIn}=eot.actions,ljr=eot.reducer,cjr=["children"];function ujr(e,t){if(e==null)return{};var r,n,s=djr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function djr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var fjr={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},hjr=b.createContext(fjr);function pjr(e){var{children:t}=e,r=ujr(e,cjr);return b.createElement(hjr.Provider,{value:r},t)}function tot(e,t){var r,n,s=Jr(u=>xv(u,e)),a=Jr(u=>wv(u,t)),i=(r=s?.allowDataOverflow)!==null&&r!==void 0?r:Qo.allowDataOverflow,l=(n=a?.allowDataOverflow)!==null&&n!==void 0?n:Wo.allowDataOverflow,c=i||l;return{needClip:c,needClipX:i,needClipY:l}}function mjr(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,s=nhe(),{needClipX:a,needClipY:i,needClip:l}=tot(t,r);if(!l||!s)return null;var{x:c,y:u,width:d,height:f}=s;return b.createElement("clipPath",{id:"clipPath-".concat(n)},b.createElement("rect",{x:a?c:c-d/2,y:i?u:u-f/2,width:a?d:d*2,height:i?f:f*2}))}var rot=(e,t,r,n)=>tit(e,"xAxis",t,n),not=(e,t,r,n)=>eit(e,"xAxis",t,n),sot=(e,t,r,n)=>tit(e,"yAxis",r,n),aot=(e,t,r,n)=>eit(e,"yAxis",r,n),gjr=et([Pi,rot,sot,not,aot],(e,t,r,n,s)=>gv(e,"xAxis")?f5(t,n,!1):f5(r,s,!1)),yjr=(e,t,r,n,s)=>s;function vjr(e){return e.type==="line"}var bjr=et([kat,yjr],(e,t)=>e.filter(vjr).find(r=>r.id===t)),xjr=et([Pi,rot,sot,not,aot,bjr,gjr,efe],(e,t,r,n,s,a,i,l)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:d}=l;if(!(a==null||t==null||r==null||n==null||s==null||n.length===0||s.length===0||i==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:f,data:h}=a,p;if(h!=null&&h.length>0?p=h:p=c?.slice(u,d+1),p!=null)return Bjr({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:s,dataKey:f,bandSize:i,displayedData:p})}});function wjr(e){var t=HF(e),r=3,n=2;if(t!=null){var{r:s,strokeWidth:a}=t,i=Number(s),l=Number(a);return(Number.isNaN(i)||i<0)&&(i=r),(Number.isNaN(l)||l<0)&&(l=n),{r:i,strokeWidth:l}}return{r,strokeWidth:n}}var Sjr=["id"],Ojr=["type","layout","connectNulls","needClip","shape"],kjr=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function TA(){return TA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},TA.apply(null,arguments)}function cNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function bm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cNe(Object(r),!0).forEach(function(n){_jr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _jr(e,t,r){return(t=Ejr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ejr(e){var t=Cjr(e,"string");return typeof t=="symbol"?t:t+""}function Cjr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ihe(e,t){if(e==null)return{};var r,n,s=jjr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function jjr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Tjr=e=>{var{dataKey:t,name:r,stroke:n,legendType:s,hide:a}=e;return[{inactive:a,dataKey:t,type:s,color:n,value:znt(r,t),payload:e}]},Njr=b.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:s,fill:a,name:i,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r,getPosition:JS,settings:{stroke:n,strokeWidth:s,fill:a,dataKey:t,nameKey:void 0,name:znt(i,t),hide:l,type:u,color:n,unit:c,graphicalItemId:d}};return b.createElement(bEr,{tooltipEntrySettings:f})}),iot=(e,t)=>"".concat(t,"px ").concat(e,"px");function Ajr(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],s=0;s<t;++s)n.push(...r);return n}var Ijr=(e,t,r)=>{var n=r.reduce((h,p)=>h+p,0);if(!n)return iot(t,e);for(var s=Math.floor(e/n),a=e%n,i=[],l=0,c=0;l<r.length;c+=(u=r[l])!==null&&u!==void 0?u:0,++l){var u,d=r[l];if(d!=null&&c+d>a){i=[...r.slice(0,l),a-c];break}}var f=i.length%2===0?[0,t]:[t];return[...Ajr(r,s),...i,...f].map(h=>"".concat(h,"px")).join(", ")};function Rjr(e){var{clipPathId:t,points:r,props:n}=e,{dot:s,dataKey:a,needClip:i}=n,{id:l}=n,c=ihe(n,Sjr),u=Jm(c);return b.createElement(BEr,{points:r,dot:s,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:u,needClip:i,clipPathId:t})}function Pjr(e){var{showLabels:t,children:r,points:n}=e,s=b.useMemo(()=>n?.map(a=>{var i,l,c={x:(i=a.x)!==null&&i!==void 0?i:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return bm(bm({},c),{},{value:a.value,payload:a.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[n]);return b.createElement(H_r,{value:t?s:void 0},r)}function uNe(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:s,props:a}=e,{type:i,layout:l,connectNulls:c,needClip:u,shape:d}=a,f=ihe(a,Ojr),h=bm(bm({},eu(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:u?"url(#clipPath-".concat(t,")"):void 0,points:n,type:i,layout:l,connectNulls:c,strokeDasharray:s??a.strokeDasharray});return b.createElement(b.Fragment,null,n?.length>1&&b.createElement(vEr,TA({shapeType:"curve",option:d},h,{pathRef:r})),b.createElement(Rjr,{points:n,clipPathId:t,props:a}))}function Mjr(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Djr(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:s,longestAnimatedLengthRef:a}=e,{points:i,strokeDasharray:l,isAnimationActive:c,animationBegin:u,animationDuration:d,animationEasing:f,animateNewValues:h,width:p,height:m,onAnimationEnd:g,onAnimationStart:y}=r,x=s.current,w=Jde(i,"recharts-line-"),O=b.useRef(w),[k,_]=b.useState(!1),E=!k,T=b.useCallback(()=>{typeof g=="function"&&g(),_(!1)},[g]),j=b.useCallback(()=>{typeof y=="function"&&y(),_(!0)},[y]),A=Mjr(n.current),I=b.useRef(0);O.current!==w&&(I.current=a.current,O.current=w);var P=I.current;return b.createElement(Pjr,{points:i,showLabels:E},r.children,b.createElement(Kde,{animationId:w,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:T,onAnimationStart:j,key:w},R=>{var B=Au(P,A+P,R),D=Math.min(B,A),F;if(c)if(l){var U="".concat(l).split(/[,\s]+/gim).map(W=>parseFloat(W));F=Ijr(D,A,U)}else F=iot(A,D);else F=l==null?void 0:String(l);if(R>0&&A>0&&(s.current=i,a.current=Math.max(a.current,D)),x){var z=x.length/i.length,V=R===1?i:i.map((W,L)=>{var Y=Math.floor(L*z);if(x[Y]){var q=x[Y];return bm(bm({},W),{},{x:Au(q.x,W.x,R),y:Au(q.y,W.y,R)})}return h?bm(bm({},W),{},{x:Au(p*2,W.x,R),y:Au(m/2,W.y,R)}):bm(bm({},W),{},{x:W.x,y:W.y})});return s.current=V,b.createElement(uNe,{props:r,points:V,clipPathId:t,pathRef:n,strokeDasharray:F})}return b.createElement(uNe,{props:r,points:i,clipPathId:t,pathRef:n,strokeDasharray:F})}),b.createElement(G_r,{label:r.label}))}function Ljr(e){var{clipPathId:t,props:r}=e,n=b.useRef(null),s=b.useRef(0),a=b.useRef(null);return b.createElement(Djr,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:s,pathRef:a})}var $jr=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Gl(e.payload,t)}};class Fjr extends b.Component{render(){var{hide:t,dot:r,points:n,className:s,xAxisId:a,yAxisId:i,top:l,left:c,width:u,height:d,id:f,needClip:h,zIndex:p}=this.props;if(t)return null;var m=ya("recharts-line",s),g=f,{r:y,strokeWidth:x}=wjr(r),w=Hit(r),O=y*2+x,k=h?"url(#clipPath-".concat(w?"":"dots-").concat(g,")"):void 0;return b.createElement(Ov,{zIndex:p},b.createElement(Qy,{className:m},h&&b.createElement("defs",null,b.createElement(mjr,{clipPathId:g,xAxisId:a,yAxisId:i}),!w&&b.createElement("clipPath",{id:"clipPath-dots-".concat(g)},b.createElement("rect",{x:c-O/2,y:l-O/2,width:u+O,height:d+O}))),b.createElement(pjr,{xAxisId:a,yAxisId:i,data:n,dataPointFormatter:$jr,errorBarOffset:0},b.createElement(Ljr,{props:this.props,clipPathId:g}))),b.createElement(oCr,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:k}))}}var oot={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Qc.line,type:"linear"};function zjr(e){var t=td(e,oot),{activeDot:r,animateNewValues:n,animationBegin:s,animationDuration:a,animationEasing:i,connectNulls:l,dot:c,hide:u,isAnimationActive:d,label:f,legendType:h,xAxisId:p,yAxisId:m,id:g}=t,y=ihe(t,kjr),{needClip:x}=tot(p,m),w=nhe(),O=EE(),k=rd(),_=Jr(I=>xjr(I,p,m,k,g));if(O!=="horizontal"&&O!=="vertical"||_==null||w==null)return null;var{height:E,width:T,x:j,y:A}=w;return b.createElement(Fjr,TA({},y,{id:g,connectNulls:l,dot:c,activeDot:r,animateNewValues:n,animationBegin:s,animationDuration:a,animationEasing:i,isAnimationActive:d,hide:u,label:f,legendType:h,xAxisId:p,yAxisId:m,points:_,layout:O,height:E,width:T,left:j,top:A,needClip:x}))}function Bjr(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:s,yAxisTicks:a,dataKey:i,bandSize:l,displayedData:c}=e;return c.map((u,d)=>{var f=Gl(u,i);if(t==="horizontal"){var h=lCe({axis:r,ticks:s,bandSize:l,entry:u,index:d}),p=wl(f)?null:n.scale.map(f);return{x:h,y:p??null,value:f,payload:u}}var m=wl(f)?null:r.scale.map(f),g=lCe({axis:n,ticks:a,bandSize:l,entry:u,index:d});return m==null||g==null?null:{x:m,y:g,value:f,payload:u}}).filter(Boolean)}function Ujr(e){var t=td(e,oot),r=rd();return b.createElement(_Er,{id:t.id,type:"line"},n=>b.createElement(b.Fragment,null,b.createElement(xEr,{legendPayload:Tjr(t)}),b.createElement(Njr,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),b.createElement(IEr,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),b.createElement(zjr,TA({},t,{id:n}))))}var lot=b.memo(Ujr,pz);lot.displayName="Line";var Vjr=["domain","range"],qjr=["domain","range"];function dNe(e,t){if(e==null)return{};var r,n,s=Hjr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Hjr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function fNe(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function cot(e,t){if(e===t)return!0;var{domain:r,range:n}=e,s=dNe(e,Vjr),{domain:a,range:i}=t,l=dNe(t,qjr);return!fNe(r,a)||!fNe(n,i)?!1:pz(s,l)}var Qjr=["type"],Wjr=["dangerouslySetInnerHTML","ticks","scale"],Gjr=["id","scale"];function Use(){return Use=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Use.apply(null,arguments)}function hNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function pNe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hNe(Object(r),!0).forEach(function(n){Zjr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zjr(e,t,r){return(t=Yjr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yjr(e){var t=Xjr(e,"string");return typeof t=="symbol"?t:t+""}function Xjr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vse(e,t){if(e==null)return{};var r,n,s=Kjr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Kjr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Jjr(e){var t=Fo(),r=b.useRef(null),n=Znt(),{type:s}=e,a=Vse(e,Qjr),i=yz(n,"xAxis",s),l=b.useMemo(()=>{if(i!=null)return pNe(pNe({},a),{},{type:i})},[a,i]);return b.useLayoutEffect(()=>{l!=null&&(r.current===null?t(QEr(l)):r.current!==l&&t(WEr({prev:r.current,next:l})),r.current=l)},[l,t]),b.useLayoutEffect(()=>()=>{r.current&&(t(GEr(r.current)),r.current=null)},[t]),null}var eTr=e=>{var{xAxisId:t,className:r}=e,n=Jr(Unt),s=rd(),a="xAxis",i=Jr(x=>Jat(x,a,t,s)),l=Jr(x=>l1r(x,t)),c=Jr(x=>p1r(x,t)),u=Jr(x=>xat(x,t));if(l==null||c==null||u==null)return null;var{dangerouslySetInnerHTML:d,ticks:f,scale:h}=e,p=Vse(e,Wjr),{id:m,scale:g}=u,y=Vse(u,Gjr);return b.createElement(ahe,Use({},p,y,{x:c.x,y:c.y,width:l.width,height:l.height,className:ya("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:i,axisType:a,axisId:t}))},tTr={allowDataOverflow:Qo.allowDataOverflow,allowDecimals:Qo.allowDecimals,allowDuplicatedCategory:Qo.allowDuplicatedCategory,angle:Qo.angle,axisLine:My.axisLine,height:Qo.height,hide:!1,includeHidden:Qo.includeHidden,interval:Qo.interval,label:!1,minTickGap:Qo.minTickGap,mirror:Qo.mirror,orientation:Qo.orientation,padding:Qo.padding,reversed:Qo.reversed,scale:Qo.scale,tick:Qo.tick,tickCount:Qo.tickCount,tickLine:My.tickLine,tickSize:My.tickSize,type:Qo.type,niceTicks:Qo.niceTicks,xAxisId:0},rTr=e=>{var t=td(e,tTr);return b.createElement(b.Fragment,null,b.createElement(Jjr,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),b.createElement(eTr,t))},uot=b.memo(rTr,cot);uot.displayName="XAxis";var nTr=["type"],sTr=["dangerouslySetInnerHTML","ticks","scale"],aTr=["id","scale"];function qse(){return qse=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qse.apply(null,arguments)}function mNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function gNe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mNe(Object(r),!0).forEach(function(n){iTr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iTr(e,t,r){return(t=oTr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oTr(e){var t=lTr(e,"string");return typeof t=="symbol"?t:t+""}function lTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hse(e,t){if(e==null)return{};var r,n,s=cTr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function cTr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function uTr(e){var t=Fo(),r=b.useRef(null),n=Znt(),{type:s}=e,a=Hse(e,nTr),i=yz(n,"yAxis",s),l=b.useMemo(()=>{if(i!=null)return gNe(gNe({},a),{},{type:i})},[i,a]);return b.useLayoutEffect(()=>{l!=null&&(r.current===null?t(ZEr(l)):r.current!==l&&t(YEr({prev:r.current,next:l})),r.current=l)},[l,t]),b.useLayoutEffect(()=>()=>{r.current&&(t(XEr(r.current)),r.current=null)},[t]),null}function dTr(e){var{yAxisId:t,className:r,width:n,label:s}=e,a=b.useRef(null),i=b.useRef(null),l=Jr(Unt),c=rd(),u=Fo(),d="yAxis",f=Jr(E=>y1r(E,t)),h=Jr(E=>g1r(E,t)),p=Jr(E=>Jat(E,d,t,c)),m=Jr(E=>wat(E,t));if(b.useLayoutEffect(()=>{if(!(n!=="auto"||!f||rhe(s)||b.isValidElement(s)||m==null)){var E=a.current;if(E){var T=E.getCalculatedWidth();Math.round(f.width)!==Math.round(T)&&u(KEr({id:t,width:T}))}}},[p,f,u,s,t,n,m]),f==null||h==null||m==null)return null;var{dangerouslySetInnerHTML:g,ticks:y,scale:x}=e,w=Hse(e,sTr),{id:O,scale:k}=m,_=Hse(m,aTr);return b.createElement(ahe,qse({},w,_,{ref:a,labelRef:i,x:h.x,y:h.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:f.width,height:f.height,className:ya("recharts-".concat(d," ").concat(d),r),viewBox:l,ticks:p,axisType:d,axisId:t}))}var fTr={allowDataOverflow:Wo.allowDataOverflow,allowDecimals:Wo.allowDecimals,allowDuplicatedCategory:Wo.allowDuplicatedCategory,angle:Wo.angle,axisLine:My.axisLine,hide:!1,includeHidden:Wo.includeHidden,interval:Wo.interval,label:!1,minTickGap:Wo.minTickGap,mirror:Wo.mirror,orientation:Wo.orientation,padding:Wo.padding,reversed:Wo.reversed,scale:Wo.scale,tick:Wo.tick,tickCount:Wo.tickCount,tickLine:My.tickLine,tickSize:My.tickSize,type:Wo.type,niceTicks:Wo.niceTicks,width:Wo.width,yAxisId:0},hTr=e=>{var t=td(e,fTr);return b.createElement(b.Fragment,null,b.createElement(uTr,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),b.createElement(dTr,t))},dot=b.memo(hTr,cot);dot.displayName="YAxis";var pTr=(e,t)=>t,ohe=et([pTr,Pi,Rst,kl,yit,Sv,zOr,Kl],WOr);function mTr(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function lhe(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(mTr(e)){var s=e.currentTarget.getBBox();r=s.width>0?t.width/s.width:1,n=s.height>0?t.height/s.height:1}else{var a=e.currentTarget;r=a.offsetWidth>0?t.width/a.offsetWidth:1,n=a.offsetHeight>0?t.height/a.offsetHeight:1}var i=(l,c)=>({relativeX:Math.round((l-t.left)/r),relativeY:Math.round((c-t.top)/n)});return"touches"in e?Array.from(e.touches).map(l=>i(l.clientX,l.clientY)):i(e.clientX,e.clientY)}var fot=rf("mouseClick"),hot=BR();hot.startListening({actionCreator:fot,effect:(e,t)=>{var r=e.payload,n=ohe(t.getState(),lhe(r));n?.activeIndex!=null&&t.dispatch(I1r({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Qse=rf("mouseMove"),pot=BR(),oO=null,I0=null,qq=null;pot.startListening({actionCreator:Qse,effect:(e,t)=>{var r=e.payload,n=t.getState(),{throttleDelay:s,throttledEvents:a}=n.eventSettings,i=a==="all"||a?.includes("mousemove");oO!==null&&(cancelAnimationFrame(oO),oO=null),I0!==null&&(typeof s!="number"||!i)&&(clearTimeout(I0),I0=null),qq=lhe(r);var l=()=>{var c=t.getState(),u=Hfe(c,c.tooltip.settings.shared);if(!qq){oO=null,I0=null;return}if(u==="axis"){var d=ohe(c,qq);d?.activeIndex!=null?t.dispatch(lit({activeIndex:d.activeIndex,activeDataKey:void 0,activeCoordinate:d.activeCoordinate})):t.dispatch(oit())}oO=null,I0=null};if(!i){l();return}s==="raf"?oO=requestAnimationFrame(l):typeof s=="number"&&I0===null&&(I0=setTimeout(l,s))}});function gTr(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var yNe={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},mot=_c({name:"rootProps",initialState:yNe,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:yNe.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),yTr=mot.reducer,{updateOptions:vTr}=mot.actions,bTr=null,xTr={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},got=_c({name:"polarOptions",initialState:bTr,reducers:xTr}),{updatePolarOptions:fIn}=got.actions,wTr=got.reducer,yot=rf("keyDown"),vot=rf("focus"),bot=rf("blur"),Az=BR(),lO=null,R0=null,O2=null;Az.startListening({actionCreator:yot,effect:(e,t)=>{O2=e.payload,lO!==null&&(cancelAnimationFrame(lO),lO=null);var r=t.getState(),{throttleDelay:n,throttledEvents:s}=r.eventSettings,a=s==="all"||s.includes("keydown");R0!==null&&(typeof n!="number"||!a)&&(clearTimeout(R0),R0=null);var i=()=>{try{var l=t.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var{keyboardInteraction:u}=l.tooltip,d=O2;if(d!=="ArrowRight"&&d!=="ArrowLeft"&&d!=="Enter")return;var f=Qfe(u,PE(l),JR(l),tP(l)),h=f==null?-1:Number(f);if(!Number.isFinite(h)||h<0)return;var p=Sv(l);if(d==="Enter"){var m=L5(l,"axis","hover",String(u.index));t.dispatch(D5({active:!u.active,activeIndex:u.index,activeCoordinate:m}));return}var g=S1r(l),y=g==="left-to-right"?1:-1,x=d==="ArrowRight"?1:-1,w=h+x*y;if(p==null||w>=p.length||w<0)return;var O=L5(l,"axis","hover",String(w));t.dispatch(D5({active:!0,activeIndex:w.toString(),activeCoordinate:O}))}finally{lO=null,R0=null}};if(!a){i();return}n==="raf"?lO=requestAnimationFrame(i):typeof n=="number"&&R0===null&&(i(),O2=null,R0=setTimeout(()=>{O2?i():(R0=null,lO=null)},n))}});Az.startListening({actionCreator:vot,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;if(!s.active&&s.index==null){var a="0",i=L5(r,"axis","hover",String(a));t.dispatch(D5({active:!0,activeIndex:a,activeCoordinate:i}))}}}});Az.startListening({actionCreator:bot,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;s.active&&t.dispatch(D5({active:!1,activeIndex:s.index,activeCoordinate:s.coordinate}))}}});function xot(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var s=Reflect.get(r,n);return typeof s=="function"?s.bind(r):s}})}var Vf=rf("externalEvent"),wot=BR(),k2=new Map,kj=new Map,Hq=new Map;wot.startListening({actionCreator:Vf,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){var s=n.type,a=xot(n);Hq.set(s,{handler:r,reactEvent:a});var i=k2.get(s);i!==void 0&&(cancelAnimationFrame(i),k2.delete(s));var l=t.getState(),{throttleDelay:c,throttledEvents:u}=l.eventSettings,d=u,f=d==="all"||d?.includes(s),h=kj.get(s);h!==void 0&&(typeof c!="number"||!f)&&(clearTimeout(h),kj.delete(s));var p=()=>{var y=Hq.get(s);try{if(!y)return;var{handler:x,reactEvent:w}=y,O=t.getState(),k={activeCoordinate:kOr(O),activeDataKey:wOr(O),activeIndex:EA(O),activeLabel:xit(O),activeTooltipIndex:EA(O),isTooltipActive:_Or(O)};x&&x(k,w)}finally{k2.delete(s),kj.delete(s),Hq.delete(s)}};if(!f){p();return}if(c==="raf"){var m=requestAnimationFrame(p);k2.set(s,m)}else if(typeof c=="number"){if(!kj.has(s)){p();var g=setTimeout(p,c);kj.set(s,g)}}else p()}}});var STr=et([IE],e=>e.tooltipItemPayloads),OTr=et([STr,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(a=>a.settings.graphicalItemId===r);if(n!=null){var{getPosition:s}=n;if(s!=null)return s(t)}}}),Sot=rf("touchMove"),Oot=BR(),P0=null,cb=null,vNe=null,_j=null;Oot.startListening({actionCreator:Sot,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){_j=xot(r);var n=t.getState(),{throttleDelay:s,throttledEvents:a}=n.eventSettings,i=a==="all"||a.includes("touchmove");P0!==null&&(cancelAnimationFrame(P0),P0=null),cb!==null&&(typeof s!="number"||!i)&&(clearTimeout(cb),cb=null),vNe=Array.from(r.touches).map(c=>lhe({clientX:c.clientX,clientY:c.clientY,currentTarget:r.currentTarget}));var l=()=>{if(_j!=null){var c=t.getState(),u=Hfe(c,c.tooltip.settings.shared);if(u==="axis"){var d,f=(d=vNe)===null||d===void 0?void 0:d[0];if(f==null){P0=null,cb=null;return}var h=ohe(c,f);h?.activeIndex!=null&&t.dispatch(lit({activeIndex:h.activeIndex,activeDataKey:void 0,activeCoordinate:h.activeCoordinate}))}else if(u==="item"){var p,m=_j.touches[0];if(document.elementFromPoint==null||m==null)return;var g=document.elementFromPoint(m.clientX,m.clientY);if(!g||!g.getAttribute)return;var y=g.getAttribute(Kyr),x=(p=g.getAttribute(Jyr))!==null&&p!==void 0?p:void 0,w=RE(c).find(_=>_.id===x);if(y==null||w==null||x==null)return;var{dataKey:O}=w,k=OTr(c,y,x);t.dispatch(A1r({activeDataKey:O,activeIndex:y,activeCoordinate:k,activeGraphicalItemId:x}))}P0=null,cb=null}};if(!i){l();return}s==="raf"?P0=requestAnimationFrame(l):typeof s=="number"&&cb===null&&(l(),_j=null,cb=setTimeout(()=>{_j?l():(cb=null,P0=null)},s))}}});var kot={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},_ot=_c({name:"eventSettings",initialState:kot,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:kTr}=_ot.actions,_Tr=_ot.reducer,ETr=ttt({brush:cCr,cartesianAxis:JEr,chartData:_kr,errorBars:ljr,eventSettings:_Tr,graphicalItems:NEr,layout:Lyr,legend:Hvr,options:xkr,polarAxis:Y_r,polarOptions:wTr,referenceElements:hCr,renderedTicks:NCr,rootProps:yTr,tooltip:R1r,zIndex:okr}),CTr=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return lyr({reducer:ETr,preloadedState:t,middleware:n=>{var s;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((s="es6")!==null&&s!==void 0?s:"")}).concat([hot.middleware,pot.middleware,Az.middleware,wot.middleware,Oot.middleware])},enhancers:n=>{var s=n;return typeof n=="function"&&(s=n()),s.concat(knt({type:"raf"}))},devTools:{serialize:{replacer:gTr},name:"recharts-".concat(r)}})};function jTr(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,s=rd(),a=b.useRef(null);if(s)return r;a.current==null&&(a.current=CTr(t,n));var i=Ude;return b.createElement(utt,{context:i,store:a.current},r)}function TTr(e){var{layout:t,margin:r}=e,n=Fo(),s=rd();return b.useEffect(()=>{s||(n(Pyr(t)),n(Ryr(r)))},[n,s,t,r]),null}var NTr=b.memo(TTr,pz);function ATr(e){var t=Fo();return b.useEffect(()=>{t(vTr(e))},[t,e]),null}var ITr=e=>{var t=Fo();return b.useEffect(()=>{t(kTr(e))},[t,e]),null},RTr=b.memo(ITr,pz);function bNe(e){var{zIndex:t,isPanorama:r}=e,n=b.useRef(null),s=Fo();return b.useLayoutEffect(()=>(n.current&&s(akr({zIndex:t,element:n.current,isPanorama:r})),()=>{s(ikr({zIndex:t,isPanorama:r}))}),[s,t,r]),b.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function xNe(e){var{children:t,isPanorama:r}=e,n=Jr(ZOr);if(!n||n.length===0)return t;var s=n.filter(i=>i<0),a=n.filter(i=>i>0);return b.createElement(b.Fragment,null,s.map(i=>b.createElement(bNe,{key:i,zIndex:i,isPanorama:r})),t,a.map(i=>b.createElement(bNe,{key:i,zIndex:i,isPanorama:r})))}var PTr=["children"];function MTr(e,t){if(e==null)return{};var r,n,s=DTr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function DTr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function V5(){return V5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},V5.apply(null,arguments)}var LTr={width:"100%",height:"100%",display:"block"},$Tr=b.forwardRef((e,t)=>{var r=Wnt(),n=Gnt(),s=ast();if(!tg(r)||!tg(n))return null;var{children:a,otherAttributes:i,title:l,desc:c}=e,u,d;return i!=null&&(typeof i.tabIndex=="number"?u=i.tabIndex:u=s?0:void 0,typeof i.role=="string"?d=i.role:d=s?"application":void 0),b.createElement(Nrt,V5({},i,{title:l,desc:c,role:d,tabIndex:u,width:r,height:n,style:LTr,ref:t}),a)}),FTr=e=>{var{children:t}=e,r=Jr(cz);if(!r)return null;var{width:n,height:s,y:a,x:i}=r;return b.createElement(Nrt,{width:n,height:s,x:i,y:a},t)},wNe=b.forwardRef((e,t)=>{var{children:r}=e,n=MTr(e,PTr),s=rd();return s?b.createElement(FTr,null,b.createElement(xNe,{isPanorama:!0},r)):b.createElement($Tr,V5({ref:t},n),b.createElement(xNe,{isPanorama:!1},r))});function zTr(){var e=Fo(),[t,r]=b.useState(null),n=Jr(Xyr);return b.useEffect(()=>{if(t!=null){var s=t.getBoundingClientRect(),a=s.width/t.offsetWidth;$s(a)&&a!==n&&e(Dyr(a))}},[t,e,n]),r}function SNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function BTr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?SNe(Object(r),!0).forEach(function(n){UTr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function UTr(e,t,r){return(t=VTr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VTr(e){var t=qTr(e,"string");return typeof t=="symbol"?t:t+""}function qTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zb(){return Zb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zb.apply(null,arguments)}var HTr=()=>(Pkr(),null);function q5(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var QTr=b.forwardRef((e,t)=>{var r,n,s=b.useRef(null),[a,i]=b.useState({containerWidth:q5((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:q5((n=e.style)===null||n===void 0?void 0:n.height)}),l=b.useCallback((u,d)=>{i(f=>{var h=Math.round(u),p=Math.round(d);return f.containerWidth===h&&f.containerHeight===p?f:{containerWidth:h,containerHeight:p}})},[]),c=b.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var h=m=>{var g=m[0];if(g!=null){var{width:y,height:x}=g.contentRect;l(y,x)}},p=new ResizeObserver(h);p.observe(u),s.current=p}},[t,l]);return b.useEffect(()=>()=>{var u=s.current;u?.disconnect()},[l]),b.createElement(b.Fragment,null,b.createElement(VR,{width:a.containerWidth,height:a.containerHeight}),b.createElement("div",Zb({ref:c},e)))}),WTr=b.forwardRef((e,t)=>{var{width:r,height:n}=e,[s,a]=b.useState({containerWidth:q5(r),containerHeight:q5(n)}),i=b.useCallback((c,u)=>{a(d=>{var f=Math.round(c),h=Math.round(u);return d.containerWidth===f&&d.containerHeight===h?d:{containerWidth:f,containerHeight:h}})},[]),l=b.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();i(u,d)}},[t,i]);return b.createElement(b.Fragment,null,b.createElement(VR,{width:s.containerWidth,height:s.containerHeight}),b.createElement("div",Zb({ref:l},e)))}),GTr=b.forwardRef((e,t)=>{var{width:r,height:n}=e;return b.createElement(b.Fragment,null,b.createElement(VR,{width:r,height:n}),b.createElement("div",Zb({ref:t},e)))}),ZTr=b.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?b.createElement(WTr,Zb({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?b.createElement(GTr,Zb({},e,{width:r,height:n,ref:t})):b.createElement(b.Fragment,null,b.createElement(VR,{width:r,height:n}),b.createElement("div",Zb({ref:t},e)))});function YTr(e){return e?QTr:ZTr}var XTr=b.forwardRef((e,t)=>{var{children:r,className:n,height:s,onClick:a,onContextMenu:i,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:h,onTouchEnd:p,onTouchMove:m,onTouchStart:g,style:y,width:x,responsive:w,dispatchTouchEvents:O=!0}=e,k=b.useRef(null),_=Fo(),[E,T]=b.useState(null),[j,A]=b.useState(null),I=zTr(),P=Gde(),R=P?.width>0?P.width:x,B=P?.height>0?P.height:s,D=b.useCallback(oe=>{I(oe),typeof t=="function"&&t(oe),T(oe),A(oe),oe!=null&&(k.current=oe)},[I,t,T,A]),F=b.useCallback(oe=>{_(fot(oe)),_(Vf({handler:a,reactEvent:oe}))},[_,a]),U=b.useCallback(oe=>{_(Qse(oe)),_(Vf({handler:u,reactEvent:oe}))},[_,u]),z=b.useCallback(oe=>{_(oit()),_(Vf({handler:d,reactEvent:oe}))},[_,d]),V=b.useCallback(oe=>{_(Qse(oe)),_(Vf({handler:f,reactEvent:oe}))},[_,f]),W=b.useCallback(()=>{_(vot())},[_]),L=b.useCallback(()=>{_(bot())},[_]),Y=b.useCallback(oe=>{_(yot(oe.key))},[_]),q=b.useCallback(oe=>{_(Vf({handler:i,reactEvent:oe}))},[_,i]),M=b.useCallback(oe=>{_(Vf({handler:l,reactEvent:oe}))},[_,l]),Q=b.useCallback(oe=>{_(Vf({handler:c,reactEvent:oe}))},[_,c]),G=b.useCallback(oe=>{_(Vf({handler:h,reactEvent:oe}))},[_,h]),J=b.useCallback(oe=>{_(Vf({handler:g,reactEvent:oe}))},[_,g]),ie=b.useCallback(oe=>{O&&_(Sot(oe)),_(Vf({handler:m,reactEvent:oe}))},[_,O,m]),te=b.useCallback(oe=>{_(Vf({handler:p,reactEvent:oe}))},[_,p]),se=YTr(w);return b.createElement(Cit.Provider,{value:E},b.createElement(imr.Provider,{value:j},b.createElement(se,{width:R??y?.width,height:B??y?.height,className:ya("recharts-wrapper",n),style:BTr({position:"relative",cursor:"default",width:R,height:B},y),onClick:F,onContextMenu:q,onDoubleClick:M,onFocus:W,onBlur:L,onKeyDown:Y,onMouseDown:Q,onMouseEnter:U,onMouseLeave:z,onMouseMove:V,onMouseUp:G,onTouchEnd:te,onTouchMove:ie,onTouchStart:J,ref:D},b.createElement(HTr,null),r)))}),KTr=["width","height","responsive","children","className","style","compact","title","desc"];function JTr(e,t){if(e==null)return{};var r,n,s=eNr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function eNr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var tNr=b.forwardRef((e,t)=>{var{width:r,height:n,responsive:s,children:a,className:i,style:l,compact:c,title:u,desc:d}=e,f=JTr(e,KTr),h=Jm(f);return c?b.createElement(b.Fragment,null,b.createElement(VR,{width:r,height:n}),b.createElement(wNe,{otherAttributes:h,title:u,desc:d},a)):b.createElement(XTr,{className:i,style:l,width:r,height:n,responsive:s??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},b.createElement(wNe,{otherAttributes:h,title:u,desc:d,ref:t},b.createElement(mCr,null,a)))});function Wse(){return Wse=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wse.apply(null,arguments)}function ONe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function rNr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ONe(Object(r),!0).forEach(function(n){nNr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ONe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function nNr(e,t,r){return(t=sNr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sNr(e){var t=aNr(e,"string");return typeof t=="symbol"?t:t+""}function aNr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iNr={top:5,right:5,bottom:5,left:5},oNr=rNr({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:iNr,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},kot),lNr=b.forwardRef(function(t,r){var n,s=td(t.categoricalChartProps,oNr),{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:u}=t,d={chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return b.createElement(jTr,{preloadedState:{options:d},reduxStoreName:(n=u.id)!==null&&n!==void 0?n:a},b.createElement(lCr,{chartData:u.data}),b.createElement(NTr,{layout:s.layout,margin:s.margin}),b.createElement(RTr,{throttleDelay:s.throttleDelay,throttledEvents:s.throttledEvents}),b.createElement(ATr,{baseValue:s.baseValue,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),b.createElement(tNr,Wse({},s,{ref:r})))}),cNr=["axis"],uNr=b.forwardRef((e,t)=>b.createElement(lNr,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:cNr,tooltipPayloadSearcher:vkr,categoricalChartProps:e,ref:t}));function dNr(e,t){const r=getComputedStyle(e),n=parseFloat(r.fontSize);return t*n}function fNr(e,t){const r=getComputedStyle(e.ownerDocument.body),n=parseFloat(r.fontSize);return t*n}function hNr(e){return e/100*window.innerHeight}function pNr(e){return e/100*window.innerWidth}function mNr(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function dT({groupSize:e,panelElement:t,styleProp:r}){let n;const[s,a]=mNr(r);switch(a){case"%":{n=s/100*e;break}case"px":{n=s;break}case"rem":{n=fNr(t,s);break}case"em":{n=dNr(t,s);break}case"vh":{n=hNr(s);break}case"vw":{n=pNr(s);break}}return n}function Lu(e){return parseFloat(e.toFixed(3))}function O_({group:e}){const{orientation:t,panels:r}=e;return r.reduce((n,s)=>(n+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,n),0)}function Gse(e){const{panels:t}=e,r=O_({group:e});return r===0?t.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):t.map(n=>{const{element:s,panelConstraints:a}=n;let i=0;if(a.collapsedSize!==void 0){const d=dT({groupSize:r,panelElement:s,styleProp:a.collapsedSize});i=Lu(d/r*100)}let l;if(a.defaultSize!==void 0){const d=dT({groupSize:r,panelElement:s,styleProp:a.defaultSize});l=Lu(d/r*100)}let c=0;if(a.minSize!==void 0){const d=dT({groupSize:r,panelElement:s,styleProp:a.minSize});c=Lu(d/r*100)}let u=100;if(a.maxSize!==void 0){const d=dT({groupSize:r,panelElement:s,styleProp:a.maxSize});u=Lu(d/r*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:i,collapsible:a.collapsible===!0,defaultSize:l,disabled:a.disabled,minSize:c,maxSize:u,panelId:n.id}})}function _a(e,t="Assertion error"){if(!e)throw Error(t)}function Zse(e,t){return Array.from(t).sort(e==="horizontal"?gNr:yNr)}function gNr(e,t){const r=e.element.offsetLeft-t.element.offsetLeft;return r!==0?r:e.element.offsetWidth-t.element.offsetWidth}function yNr(e,t){const r=e.element.offsetTop-t.element.offsetTop;return r!==0?r:e.element.offsetHeight-t.element.offsetHeight}function Eot(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Cot(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function vNr({orientation:e,rects:t,targetRect:r}){const n={x:r.x+r.width/2,y:r.y+r.height/2};let s,a=Number.MAX_VALUE;for(const i of t){const{x:l,y:c}=Cot(n,i),u=e==="horizontal"?l:c;u<a&&(a=u,s=i)}return _a(s,"No rect found"),s}let _2;function bNr(){return _2===void 0&&(typeof matchMedia=="function"?_2=!!matchMedia("(pointer:coarse)").matches:_2=!1),_2}function jot(e){const{element:t,orientation:r,panels:n,separators:s}=e,a=Zse(r,Array.from(t.children).filter(Eot).map(m=>({element:m}))).map(({element:m})=>m),i=[];let l=!1,c=!1,u=-1,d=-1,f=0,h,p=[];{let m=-1;for(const g of a)g.hasAttribute("data-panel")&&(m++,g.ariaDisabled===null&&(f++,u===-1&&(u=m),d=m))}if(f>1){let m=-1;for(const g of a)if(g.hasAttribute("data-panel")){m++;const y=n.find(x=>x.element===g);if(y){if(h){const x=h.element.getBoundingClientRect(),w=g.getBoundingClientRect();let O;if(c){const k=r==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),_=r==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(p.length){case 0:{O=[k,_];break}case 1:{const E=p[0],T=vNr({orientation:r,rects:[x,w],targetRect:E.element.getBoundingClientRect()});O=[E,T===x?_:k];break}default:{O=p;break}}}else p.length?O=p:O=[r==="horizontal"?new DOMRect(x.right,w.top,w.left-x.right,w.height):new DOMRect(w.left,x.bottom,w.width,w.top-x.bottom)];for(const k of O){let _="width"in k?k:k.element.getBoundingClientRect();const E=bNr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(_.width<E){const j=E-_.width;_=new DOMRect(_.x-j/2,_.y,_.width+j,_.height)}if(_.height<E){const j=E-_.height;_=new DOMRect(_.x,_.y-j/2,_.width,_.height+j)}const T=m<=u||m>d;!l&&!T&&i.push({group:e,groupSize:O_({group:e}),panels:[h,y],separator:"width"in k?void 0:k,rect:_}),l=!1}}c=!1,h=y,p=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(l=!0);const y=s.find(x=>x.element===g);y?p.push(y):(h=void 0,p=[])}else c=!0}return i}let Tot=class{#e={};addListener(t,r){const n=this.#e[t];return n===void 0?this.#e[t]=[r]:n.includes(r)||n.push(r),()=>{this.removeListener(t,r)}}emit(t,r){const n=this.#e[t];if(n!==void 0)if(n.length===1)n[0].call(null,r);else{let s=!1,a=null;const i=Array.from(n);for(let l=0;l<i.length;l++){const c=i[l];try{c.call(null,r)}catch(u){a===null&&(s=!0,a=u)}}if(s)throw a}}removeAllListeners(){this.#e={}}removeListener(t,r){const n=this.#e[t];if(n!==void 0){const s=n.indexOf(r);s>=0&&n.splice(s,1)}}},Lm=new Map;const Not=new Tot;function xNr(e){Lm=new Map(Lm),Lm.delete(e)}function kNe(e,t){for(const[r]of Lm)if(r.id===e)return r}function Yb(e,t){for(const[r,n]of Lm)if(r.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function r1(){return Lm}function che(e,t){return Not.addListener("groupChange",r=>{r.group.id===e&&t(r)})}function Jy(e,t){const r=Lm.get(e);Lm=new Map(Lm),Lm.set(e,t),Not.emit("groupChange",{group:e,prev:r,next:t})}function wNr(e,t,r){let n,s={x:1/0,y:1/0};for(const a of t){const i=Cot(r,a.rect);switch(e){case"horizontal":{i.x<=s.x&&(n=a,s=i);break}case"vertical":{i.y<=s.y&&(n=a,s=i);break}}}return n?{distance:s,hitRegion:n}:void 0}function SNr(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ONr(e,t){if(e===t)throw new Error("Cannot compare node with itself");const r={a:CNe(e),b:CNe(t)};let n;for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();_a(n,"Stacking order can only be calculated for elements with a common ancestor");const s={a:ENe(_Ne(r.a)),b:ENe(_Ne(r.b))};if(s.a===s.b){const a=n.childNodes,i={a:r.a.at(-1),b:r.b.at(-1)};let l=a.length;for(;l--;){const c=a[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(s.a-s.b)}const kNr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function _Nr(e){const t=getComputedStyle(Aot(e)??e).display;return t==="flex"||t==="inline-flex"}function ENr(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||_Nr(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||kNr.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function _Ne(e){let t=e.length;for(;t--;){const r=e[t];if(_a(r,"Missing node"),ENr(r))return r}return null}function ENe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function CNe(e){const t=[];for(;e;)t.push(e),e=Aot(e);return t}function Aot(e){const{parentNode:t}=e;return SNr(t)?t.host:t}function CNr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function jNr({groupElement:e,hitRegion:t,pointerEventTarget:r}){if(!Eot(r)||r.contains(e)||e.contains(r))return!0;if(ONr(r,e)>0){let n=r;for(;n;){if(n.contains(e))return!0;if(CNr(n.getBoundingClientRect(),t))return!1;n=n.parentElement}}return!0}function uhe(e,t){const r=[];return t.forEach((n,s)=>{if(s.disabled)return;const a=jot(s),i=wNr(s.orientation,a,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&jNr({groupElement:s.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&r.push(i.hitRegion)}),r}function TNr(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function Bc(e,t,r=0){return Math.abs(Lu(e)-Lu(t))<=r}function hm(e,t){return Bc(e,t)?0:e>t?1:-1}function QO({overrideDisabledPanels:e,panelConstraints:t,prevSize:r,size:n}){const{collapsedSize:s=0,collapsible:a,disabled:i,maxSize:l=100,minSize:c=0}=t;if(i&&!e)return r;if(hm(n,c)<0)if(a){const u=(s+c)/2;hm(n,u)<0?n=s:n=c}else n=c;return n=Math.min(l,n),n=Lu(n),n}function NA({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:s,trigger:a}){if(Bc(e,0))return t;const i=a==="imperative-api",l=Object.values(t),c=Object.values(s),u=[...l],[d,f]=n;_a(d!=null,"Invalid first pivot index"),_a(f!=null,"Invalid second pivot index");let h=0;switch(a){case"keyboard":{{const g=e<0?f:d,y=r[g];_a(y,`Panel constraints not found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:O=0}=y;if(w){const k=l[g];if(_a(k!=null,`Previous layout not found for panel index ${g}`),Bc(k,x)){const _=O-k;hm(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const g=e<0?d:f,y=r[g];_a(y,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:O=0}=y;if(w){const k=l[g];if(_a(k!=null,`Previous layout not found for panel index ${g}`),Bc(k,O)){const _=k-x;hm(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}break}default:{const g=e<0?f:d,y=r[g];_a(y,`Panel constraints not found for index ${g}`);const x=l[g],{collapsible:w,collapsedSize:O,minSize:k}=y;if(w&&hm(x,k)<0)if(e>0){const _=k-O,E=_/2,T=x+e;hm(T,k)<0&&(e=hm(e,E)<=0?0:_)}else{const _=k-O,E=100-_/2,T=x-e;hm(T,k)<0&&(e=hm(100+e,E)>0?0:-_)}break}}{const g=e<0?1:-1;let y=e<0?f:d,x=0;for(;;){const O=l[y];_a(O!=null,`Previous layout not found for panel index ${y}`);const k=QO({overrideDisabledPanels:i,panelConstraints:r[y],prevSize:O,size:100})-O;if(x+=k,y+=g,y<0||y>=r.length)break}const w=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-w:w}{let g=e<0?d:f;for(;g>=0&&g<r.length;){const y=Math.abs(e)-Math.abs(h),x=l[g];_a(x!=null,`Previous layout not found for panel index ${g}`);const w=x-y,O=QO({overrideDisabledPanels:i,panelConstraints:r[g],prevSize:x,size:w});if(!Bc(x,O)&&(h+=x-O,u[g]=O,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(TNr(c,u))return s;{const g=e<0?f:d,y=l[g];_a(y!=null,`Previous layout not found for panel index ${g}`);const x=y+h,w=QO({overrideDisabledPanels:i,panelConstraints:r[g],prevSize:y,size:x});if(u[g]=w,!Bc(w,x)){let O=x-w,k=e<0?f:d;for(;k>=0&&k<r.length;){const _=u[k];_a(_!=null,`Previous layout not found for panel index ${k}`);const E=_+O,T=QO({overrideDisabledPanels:i,panelConstraints:r[k],prevSize:_,size:E});if(Bc(_,T)||(O-=T-_,u[k]=T),Bc(O,0))break;e>0?k--:k++}}}const p=Object.values(u).reduce((g,y)=>y+g,0);if(!Bc(p,100,.1))return s;const m=Object.keys(s);return u.reduce((g,y,x)=>(g[m[x]]=y,g),{})}function gS(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(t[r]===void 0||hm(e[r],t[r])!==0)return!1;return!0}function yS({layout:e,panelConstraints:t}){const r=Object.values(e),n=[...r],s=n.reduce((l,c)=>l+c,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(l=>`${l}%`).join(", ")}`);if(!Bc(s,100)&&n.length>0)for(let l=0;l<t.length;l++){const c=n[l];_a(c!=null,`No layout data found for index ${l}`);const u=100/s*c;n[l]=u}let a=0;for(let l=0;l<t.length;l++){const c=r[l];_a(c!=null,`No layout data found for index ${l}`);const u=n[l];_a(u!=null,`No layout data found for index ${l}`);const d=QO({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:u});u!=d&&(a+=u-d,n[l]=d)}if(!Bc(a,0))for(let l=0;l<t.length;l++){const c=n[l];_a(c!=null,`No layout data found for index ${l}`);const u=c+a,d=QO({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:u});if(c!==d&&(a-=d-c,n[l]=d,Bc(a,0)))break}const i=Object.keys(e);return n.reduce((l,c,u)=>(l[i[u]]=c,l),{})}function Iot({groupId:e,panelId:t}){const r=()=>{const l=r1();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:h,separatorToPanels:p}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:h,layout:f,separatorToPanels:p};throw Error(`Group ${e} not found`)},n=()=>{const l=r().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const l=r().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const l=r().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},i=l=>{const c=a();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:h,layout:p,separatorToPanels:m}=r(),g=f.panels.findIndex(O=>O.id===t),y=g===f.panels.length-1,x=NA({delta:y?c-l:l-c,initialLayout:p,panelConstraints:d,pivotIndices:y?[g-1,g]:[g,g+1],prevLayout:p,trigger:"imperative-api"}),w=yS({layout:x,panelConstraints:d});gS(p,w)||Jy(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:h,layout:w,separatorToPanels:m})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=n(),{mutableValues:u}=s(),d=a();l&&d!==c&&(u.expandToSize=d,i(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=n(),{mutableValues:d}=s(),f=a();if(l&&f===c){let h=d.expandToSize??u;h===0&&(h=1),i(h)}},getSize:()=>{const{group:l}=r(),c=a(),{element:u}=s(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=n(),u=a();return l&&Bc(c,u)},resize:l=>{const{group:c}=r(),{element:u}=s(),d=O_({group:c}),f=dT({groupSize:d,panelElement:u,styleProp:l}),h=Lu(f/d*100);i(h)}}}function jNe(e){if(e.defaultPrevented)return;const t=r1();uhe(e,t).forEach(r=>{if(r.separator){const n=r.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(n){const s=n.panelConstraints.defaultSize,a=Iot({groupId:r.group.id,panelId:n.id});a&&s!==void 0&&(a.resize(s),e.preventDefault())}}})}function ZL(e){const t=r1();for(const[r]of t)if(r.separators.some(n=>n.element===e))return r;throw Error("Could not find parent Group for separator element")}function Rot({groupId:e}){const t=()=>{const r=r1();for(const[n,s]of r)if(n.id===e)return{group:n,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:r,layout:n}=t();return r?{}:n},setLayout(r){const{defaultLayoutDeferred:n,derivedPanelConstraints:s,group:a,groupSize:i,layout:l,separatorToPanels:c}=t(),u=yS({layout:r,panelConstraints:s});return n?l:(gS(l,u)||Jy(a,{defaultLayoutDeferred:n,derivedPanelConstraints:s,groupSize:i,layout:u,separatorToPanels:c}),u)}}}function M0(e,t){const r=ZL(e),n=Yb(r.id,!0),s=r.separators.find(d=>d.element===e);_a(s,"Matching separator not found");const a=n.separatorToPanels.get(s);_a(a,"Matching panels not found");const i=a.map(d=>r.panels.indexOf(d)),l=Rot({groupId:r.id}).getLayout(),c=NA({delta:t,initialLayout:l,panelConstraints:n.derivedPanelConstraints,pivotIndices:i,prevLayout:l,trigger:"keyboard"}),u=yS({layout:c,panelConstraints:n.derivedPanelConstraints});gS(l,u)||Jy(r,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:u,separatorToPanels:n.separatorToPanels})}function TNe(e){if(e.defaultPrevented)return;const t=e.currentTarget,r=ZL(t);if(!r.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),r.orientation==="vertical"&&M0(t,5);break}case"ArrowLeft":{e.preventDefault(),r.orientation==="horizontal"&&M0(t,-5);break}case"ArrowRight":{e.preventDefault(),r.orientation==="horizontal"&&M0(t,5);break}case"ArrowUp":{e.preventDefault(),r.orientation==="vertical"&&M0(t,-5);break}case"End":{e.preventDefault(),M0(t,100);break}case"Enter":{e.preventDefault();const n=ZL(t),s=Yb(n.id,!0),{derivedPanelConstraints:a,layout:i,separatorToPanels:l}=s,c=n.separators.find(h=>h.element===t);_a(c,"Matching separator not found");const u=l.get(c);_a(u,"Matching panels not found");const d=u[0],f=a.find(h=>h.panelId===d.id);if(_a(f,"Panel metadata not found"),f.collapsible){const h=i[d.id],p=f.collapsedSize===h?n.mutableState.expandedPanelSizes[d.id]??f.minSize:f.collapsedSize;M0(t,p-h)}break}case"F6":{e.preventDefault();const n=ZL(t).separators.map(i=>i.element),s=Array.from(n).findIndex(i=>i===e.currentTarget);_a(s!==null,"Index not found");const a=e.shiftKey?s>0?s-1:n.length-1:s+1<n.length?s+1:0;n[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),M0(t,-100);break}}}let Tk={cursorFlags:0,state:"inactive"};const dhe=new Tot;function vS(){return Tk}function NNr(e){return dhe.addListener("change",e)}function ANr(e){const t=Tk,r={...Tk};r.cursorFlags=e,Tk=r,dhe.emit("change",{prev:t,next:r})}function Nk(e){const t=Tk;Tk=e,dhe.emit("change",{prev:t,next:e})}function NNe(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=r1(),r=uhe(e,t),n=new Map;let s=!1;r.forEach(a=>{a.separator&&(s||(s=!0,a.separator.element.focus({preventScroll:!0})));const i=t.get(a.group);i&&n.set(a.group,i.layout)}),Nk({cursorFlags:0,hitRegions:r,initialLayoutMap:n,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),r.length&&e.preventDefault()}const INr=e=>e,Qq=()=>{},Pot=1,Mot=2,Dot=4,Lot=8,ANe=3,INe=12;let E2;function RNe(){return E2===void 0&&(E2=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(E2=!0)),E2}function RNr({cursorFlags:e,groups:t,state:r}){let n=0,s=0;switch(r){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{n++;break}case"vertical":{s++;break}}})}if(!(n===0&&s===0)){switch(r){case"active":{if(e&&RNe()){const a=(e&Pot)!==0,i=(e&Mot)!==0,l=(e&Dot)!==0,c=(e&Lot)!==0;if(a)return l?"se-resize":c?"ne-resize":"e-resize";if(i)return l?"sw-resize":c?"nw-resize":"w-resize";if(l)return"s-resize";if(c)return"n-resize"}break}}return RNe()?n>0&&s>0?"move":n>0?"ew-resize":"ns-resize":n>0&&s>0?"grab":n>0?"col-resize":"row-resize"}}const PNe=new WeakMap;function fhe(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:r}=PNe.get(e)??{};r===void 0&&(r=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(r));const n=vS();switch(n.state){case"active":case"hover":{const s=RNr({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(i=>i.group),state:n.state}),a=`*, *:hover {cursor: ${s} !important; }`;if(t===a)return;t=a,s?r.cssRules.length===0?r.insertRule(a):r.replaceSync(a):r.cssRules.length===1&&r.deleteRule(0);break}case"inactive":{t=void 0,r.cssRules.length===1&&r.deleteRule(0);break}}PNe.set(e,{prevStyle:t,styleSheet:r})}function $ot({document:e,event:t,hitRegions:r,initialLayoutMap:n,mountedGroups:s,pointerDownAtPoint:a,prevCursorFlags:i}){let l=0;r.forEach(u=>{const{group:d,groupSize:f}=u,{orientation:h,panels:p}=d,{disableCursor:m}=d.mutableState;let g=0;a?h==="horizontal"?g=(t.clientX-a.x)/f*100:g=(t.clientY-a.y)/f*100:h==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const y=n.get(d),x=s.get(d);if(!y||!x)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:O,groupSize:k,layout:_,separatorToPanels:E}=x;if(O&&_&&E){const T=NA({delta:g,initialLayout:y,panelConstraints:O,pivotIndices:u.panels.map(j=>p.indexOf(j)),prevLayout:_,trigger:"mouse-or-touch"});if(gS(T,_)){if(g!==0&&!m)switch(h){case"horizontal":{l|=g<0?Pot:Mot;break}case"vertical":{l|=g<0?Dot:Lot;break}}}else Jy(u.group,{defaultLayoutDeferred:w,derivedPanelConstraints:O,groupSize:k,layout:T,separatorToPanels:E})}});let c=0;t.movementX===0?c|=i&ANe:c|=l&ANe,t.movementY===0?c|=i&INe:c|=l&INe,ANr(c),fhe(e)}function MNe(e){const t=r1(),r=vS();r.state==="active"&&$ot({document:e.currentTarget,event:e,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedGroups:t,prevCursorFlags:r.cursorFlags})}function DNe(e){if(e.defaultPrevented)return;const t=vS(),r=r1();switch(t.state){case"active":{if(e.buttons===0){Nk({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(n=>{const s=Yb(n.group.id,!0);Jy(n.group,s)});return}$ot({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:r,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const n=uhe(e,r);n.length===0?t.state!=="inactive"&&Nk({cursorFlags:0,state:"inactive"}):Nk({cursorFlags:0,hitRegions:n,state:"hover"}),fhe(e.currentTarget);break}}}function LNe(e){e.relatedTarget instanceof HTMLIFrameElement&&vS().state==="hover"&&Nk({cursorFlags:0,state:"inactive"})}function $Ne(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=vS();t.state==="active"&&(Nk({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(fhe(e.currentTarget),t.hitRegions.forEach(r=>{const n=Yb(r.group.id,!0);Jy(r.group,n)}),e.preventDefault()))}function FNe(e){let t=0,r=0;const n={};for(const a of e)if(a.defaultSize!==void 0){t++;const i=Lu(a.defaultSize);r+=i,n[a.panelId]=i}else n[a.panelId]=void 0;const s=e.length-t;if(s!==0){const a=Lu((100-r)/s);for(const i of e)i.defaultSize===void 0&&(n[i.panelId]=a)}return n}function PNr(e,t,r){if(!r[0])return;const n=e.panels.find(c=>c.element===t);if(!n||!n.onResize)return;const s=O_({group:e}),a=e.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,i=n.mutableValues.prevSize,l={asPercentage:Lu(a/s*100),inPixels:a};n.mutableValues.prevSize=l,n.onResize(l,n.id,i)}function MNr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function DNr({group:e,nextGroupSize:t,prevGroupSize:r,prevLayout:n}){if(r<=0||t<=0||r===t)return n;let s=0,a=0,i=!1;const l=new Map,c=[];for(const f of e.panels){const h=n[f.id]??0;if(f.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){i=!0;const p=h/100*r,m=Lu(p/t*100);l.set(f.id,m),s+=m}else c.push(f.id),a+=h}if(!i||c.length===0)return n;const u=100-s,d={...n};if(l.forEach((f,h)=>{d[h]=f}),a>0)for(const f of c){const h=n[f]??0;d[f]=Lu(h/a*u)}else{const f=Lu(u/c.length);for(const h of c)d[h]=f}return d}function LNr(e,t){const r=e.map(s=>s.id),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r)if(!n.includes(s))return!1;return!0}const cO=new Map;function $Nr(e){let t=!0;_a(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const r=e.element.ownerDocument.defaultView.ResizeObserver,n=new Set,s=new Set,a=new r(m=>{for(const g of m){const{borderBoxSize:y,target:x}=g;if(x===e.element){if(t){const w=O_({group:e});if(w===0)return;const O=Yb(e.id);if(!O)return;const k=Gse(e),_=O.defaultLayoutDeferred?FNe(k):O.layout,E=DNr({group:e,nextGroupSize:w,prevGroupSize:O.groupSize,prevLayout:_}),T=yS({layout:E,panelConstraints:k});if(!O.defaultLayoutDeferred&&gS(O.layout,T)&&MNr(O.derivedPanelConstraints,k)&&O.groupSize===w)return;Jy(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:k,groupSize:w,layout:T,separatorToPanels:O.separatorToPanels})}}else PNr(e,x,y)}});a.observe(e.element),e.panels.forEach(m=>{_a(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&a.observe(m.element)});const i=O_({group:e}),l=Gse(e),c=e.panels.map(({id:m})=>m).join(",");let u=e.mutableState.defaultLayout;u&&(LNr(e.panels,u)||(u=void 0));const d=e.mutableState.layouts[c]??u??FNe(l),f=yS({layout:d,panelConstraints:l}),h=e.element.ownerDocument;cO.set(h,(cO.get(h)??0)+1);const p=new Map;return jot(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Jy(e,{defaultLayoutDeferred:i===0,derivedPanelConstraints:l,groupSize:i,layout:f,separatorToPanels:p}),e.separators.forEach(m=>{_a(!s.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),s.add(m.id),m.element.addEventListener("keydown",TNe)}),cO.get(h)===1&&(h.addEventListener("dblclick",jNe,!0),h.addEventListener("pointerdown",NNe,!0),h.addEventListener("pointerleave",MNe),h.addEventListener("pointermove",DNe),h.addEventListener("pointerout",LNe),h.addEventListener("pointerup",$Ne,!0)),function(){t=!1,cO.set(h,Math.max(0,(cO.get(h)??0)-1)),xNr(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",TNe)}),cO.get(h)||(h.removeEventListener("dblclick",jNe,!0),h.removeEventListener("pointerdown",NNe,!0),h.removeEventListener("pointerleave",MNe),h.removeEventListener("pointermove",DNe),h.removeEventListener("pointerout",LNe),h.removeEventListener("pointerup",$Ne,!0)),a.disconnect()}}function FNr(){const[e,t]=b.useState({}),r=b.useCallback(()=>t({}),[]);return[e,r]}function hhe(e){const t=b.useId();return`${e??t}`}const n1=typeof window<"u"?b.useLayoutEffect:b.useEffect;function XT(e){const t=b.useRef(e);return n1(()=>{t.current=e},[e]),b.useCallback((...r)=>t.current?.(...r),[t])}function phe(...e){return XT(t=>{e.forEach(r=>{if(r)switch(typeof r){case"function":{r(t);break}case"object":{r.current=t;break}}})})}function mhe(e){const t=b.useRef({...e});return n1(()=>{for(const r in e)t.current[r]=e[r]},[e]),t.current}const Fot=b.createContext(null);function zNr(e,t){const r=b.useRef({getLayout:()=>({}),setLayout:INr});b.useImperativeHandle(t,()=>r.current,[]),n1(()=>{Object.assign(r.current,Rot({groupId:e}))})}function Iz({children:e,className:t,defaultLayout:r,disableCursor:n,disabled:s,elementRef:a,groupRef:i,id:l,onLayoutChange:c,onLayoutChanged:u,orientation:d="horizontal",resizeTargetMinimumSize:f={coarse:20,fine:10},style:h,...p}){const m=b.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=XT(P=>{gS(m.current.onLayoutChange,P)||(m.current.onLayoutChange=P,c?.(P))}),y=XT(P=>{gS(m.current.onLayoutChanged,P)||(m.current.onLayoutChanged=P,u?.(P))}),x=hhe(l),w=b.useRef(null),[O,k]=FNr(),_=b.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:f,separators:[]}),E=phe(w,a);zNr(x,i);const T=XT((P,R)=>{const B=vS(),D=kNe(P),F=Yb(P);if(F){let U=!1;return B.state==="active"&&(U=B.hitRegions.some(z=>z.group===D)),{flexGrow:F.layout[R]??1,pointerEvents:U?"none":void 0}}return{flexGrow:r?.[R]??1}}),j=mhe({defaultLayout:r,disableCursor:n}),A=b.useMemo(()=>({get disableCursor(){return!!j.disableCursor},getPanelStyles:T,id:x,orientation:d,registerPanel:P=>{const R=_.current;return R.panels=Zse(d,[...R.panels,P]),k(),()=>{R.panels=R.panels.filter(B=>B!==P),k()}},registerSeparator:P=>{const R=_.current;return R.separators=Zse(d,[...R.separators,P]),k(),()=>{R.separators=R.separators.filter(B=>B!==P),k()}},togglePanelDisabled:(P,R)=>{const B=_.current.panels.find(U=>U.id===P);B&&(B.panelConstraints.disabled=R);const D=kNe(x),F=Yb(x);D&&F&&Jy(D,{...F,derivedPanelConstraints:Gse(D)})},toggleSeparatorDisabled:(P,R)=>{const B=_.current.separators.find(D=>D.id===P);B&&(B.disabled=R)}}),[T,x,k,d,j]),I=b.useRef(null);return n1(()=>{const P=w.current;if(P===null)return;const R=_.current;let B;if(j.defaultLayout!==void 0&&Object.keys(j.defaultLayout).length===R.panels.length){B={};for(const L of R.panels){const Y=j.defaultLayout[L.id];Y!==void 0&&(B[L.id]=Y)}}const D={disabled:!!s,element:P,id:x,mutableState:{defaultLayout:B,disableCursor:!!j.disableCursor,expandedPanelSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:d,panels:R.panels,resizeTargetMinimumSize:R.resizeTargetMinimumSize,separators:R.separators};I.current=D;const F=$Nr(D),{defaultLayoutDeferred:U,derivedPanelConstraints:z,layout:V}=Yb(D.id,!0);!U&&z.length>0&&(g(V),y(V));const W=che(x,L=>{const{defaultLayoutDeferred:Y,derivedPanelConstraints:q,layout:M}=L.next;if(Y||q.length===0)return;const Q=D.panels.map(({id:J})=>J).join(",");D.mutableState.layouts[Q]=M,q.forEach(J=>{if(J.collapsible){const{layout:ie}=L.prev??{};if(ie){const te=Bc(J.collapsedSize,M[J.panelId]),se=Bc(J.collapsedSize,ie[J.panelId]);te&&!se&&(D.mutableState.expandedPanelSizes[J.panelId]=ie[J.panelId])}}});const G=vS().state!=="active";g(M),G&&y(M)});return()=>{I.current=null,F(),W()}},[s,x,y,g,d,O,j]),b.useEffect(()=>{const P=I.current;P&&(P.mutableState.defaultLayout=r,P.mutableState.disableCursor=!!n)}),o.jsx(Fot.Provider,{value:A,children:o.jsx("div",{...p,className:t,"data-group":!0,"data-testid":x,id:x,ref:E,style:{height:"100%",width:"100%",overflow:"hidden",...h,display:"flex",flexDirection:d==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:d==="horizontal"?"pan-y":"pan-x"},children:e})})}Iz.displayName="Group";function Wq(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function ghe({debounceSaveMs:e=100,panelIds:t,storage:r=localStorage,...n}){const s=t!==void 0,a="id"in n?n.id:n.groupId,i=Wq(a,t??[]),l=b.useSyncExternalStore(BNr,()=>r.getItem(i),()=>r.getItem(i)),c=b.useMemo(()=>l?JSON.parse(l):void 0,[l]),u=b.useRef(null),d=b.useCallback(()=>{const p=u.current;p&&(u.current=null,clearTimeout(p))},[]);b.useLayoutEffect(()=>()=>{d()},[d]);const f=b.useCallback(p=>{d();let m;s?m=Wq(a,Object.keys(p)):m=Wq(a,[]);try{r.setItem(m,JSON.stringify(p))}catch(g){console.error(g)}},[d,s,a,r]),h=b.useCallback(p=>{d(),e===0?f(p):u.current=setTimeout(()=>{f(p)},e)},[d,e,f]);return{defaultLayout:c,onLayoutChange:h,onLayoutChanged:f}}function BNr(){return function(){}}function yhe(){const e=b.useContext(Fot);return _a(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function UNr(e,t){const{id:r}=yhe(),n=b.useRef({collapse:Qq,expand:Qq,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Qq});b.useImperativeHandle(t,()=>n.current,[]),n1(()=>{Object.assign(n.current,Iot({groupId:r,panelId:e}))})}function k_({children:e,className:t,collapsedSize:r="0%",collapsible:n=!1,defaultSize:s,disabled:a,elementRef:i,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:u="100%",minSize:d="0%",onResize:f,panelRef:h,style:p,...m}){const g=!!c,y=hhe(c),x=mhe({disabled:a}),w=b.useRef(null),O=phe(w,i),{getPanelStyles:k,id:_,orientation:E,registerPanel:T,togglePanelDisabled:j}=yhe(),A=f!==null,I=XT((R,B,D)=>{f?.(R,c,D)});n1(()=>{const R=w.current;if(R!==null){const B={element:R,id:y,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:A?I:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:r,collapsible:n,defaultSize:s,disabled:x.disabled,maxSize:u,minSize:d}};return T(B)}},[l,r,n,s,A,y,g,u,d,I,T,x]),b.useEffect(()=>{j(y,!!a)},[a,y,j]),UNr(y,h);const P=b.useSyncExternalStore(R=>che(_,R),()=>JSON.stringify(k(_,y)),()=>JSON.stringify(k(_,y)));return o.jsx("div",{...m,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":y,id:y,ref:O,style:{...VNr,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(P)},children:o.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:E==="horizontal"?"pan-y":"pan-x"},children:e})})}k_.displayName="Panel";const VNr={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function qNr(){return b.useRef(null)}function HNr({layout:e,panelConstraints:t,panelId:r,panelIndex:n}){let s,a;const i=e[r],l=t.find(c=>c.panelId===r);if(l){const c=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,d=[n,n+1];a=yS({layout:NA({delta:u-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[r],s=yS({layout:NA({delta:c-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[r]}return{valueControls:r,valueMax:s,valueMin:a,valueNow:i}}function zot({children:e,className:t,disabled:r,elementRef:n,id:s,style:a,...i}){const l=hhe(s),c=mhe({disabled:r}),[u,d]=b.useState({}),[f,h]=b.useState("inactive"),p=b.useRef(null),m=phe(p,n),{disableCursor:g,id:y,orientation:x,registerSeparator:w,toggleSeparatorDisabled:O}=yhe(),k=x==="horizontal"?"vertical":"horizontal";n1(()=>{const E=p.current;if(E!==null){const T={disabled:c.disabled,element:E,id:l},j=w(T),A=NNr(P=>{h(P.next.state!=="inactive"&&P.next.hitRegions.some(R=>R.separator===T)?P.next.state:"inactive")}),I=che(y,P=>{const{derivedPanelConstraints:R,layout:B,separatorToPanels:D}=P.next,F=D.get(T);if(F){const U=F[0],z=F.indexOf(U);d(HNr({layout:B,panelConstraints:R,panelId:U.id,panelIndex:z}))}});return()=>{A(),I(),j()}}},[y,l,w,c]),b.useEffect(()=>{O(l,!!r)},[r,l,O]);let _;return r&&!g&&(_="not-allowed"),o.jsx("div",{...i,"aria-controls":u.valueControls,"aria-disabled":r||void 0,"aria-orientation":k,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":r?"disabled":f,"data-testid":l,id:l,ref:m,role:"separator",style:{flexBasis:"auto",cursor:_,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:r?void 0:0})}zot.displayName="Separator";const pc={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},nP="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",QNr="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",WNr="rounded-md",vhe="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",bhe="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",xhe="disabled:opacity-50 disabled:cursor-not-allowed";function Bot(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Bot(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Uot(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Bot(e))&&(n&&(n+=" "),n+=t);return n}const GNr=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},ZNr=(e,t)=>({classGroupId:e,validator:t}),Vot=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),H5="-",zNe=[],YNr="arbitrary..",XNr=e=>{const t=JNr(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return KNr(i);const l=i.split(H5),c=l[0]===""&&l.length>1?1:0;return qot(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],u=r[i];return c?u?GNr(u,c):c:u||zNe}return r[i]||zNe}}},qot=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const u=qot(e,t+1,a);if(u)return u}const i=r.validators;if(i===null)return;const l=t===0?e.join(H5):e.slice(t).join(H5),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},KNr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?YNr+n:void 0})(),JNr=e=>{const{theme:t,classGroups:r}=e;return eAr(r,t)},eAr=(e,t)=>{const r=Vot();for(const n in e){const s=e[n];whe(s,r,n,t)}return r},whe=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];tAr(i,t,r,n)}},tAr=(e,t,r,n)=>{if(typeof e=="string"){rAr(e,t,r);return}if(typeof e=="function"){nAr(e,t,r,n);return}sAr(e,t,r,n)},rAr=(e,t,r)=>{const n=e===""?t:Hot(t,e);n.classGroupId=r},nAr=(e,t,r,n)=>{if(aAr(e)){whe(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(ZNr(r,e))},sAr=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];whe(c,Hot(t,l),r,n)}},Hot=(e,t)=>{let r=e;const n=t.split(H5),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=Vot(),r.nextPart.set(i,l)),r=l}return r},aAr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,iAr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},Yse="!",BNe=":",oAr=[],UNe=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),lAr=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,u;const d=s.length;for(let g=0;g<d;g++){const y=s[g];if(i===0&&l===0){if(y===BNe){a.push(s.slice(c,g)),c=g+1;continue}if(y==="/"){u=g;continue}}y==="["?i++:y==="]"?i--:y==="("?l++:y===")"&&l--}const f=a.length===0?s:s.slice(c);let h=f,p=!1;f.endsWith(Yse)?(h=f.slice(0,-1),p=!0):f.startsWith(Yse)&&(h=f.slice(1),p=!0);const m=u&&u>c?u-c:void 0;return UNe(a,p,h,m)};if(t){const s=t+BNe,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):UNe(oAr,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},cAr=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],l=i[0]==="[",c=t.has(i);l||c?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},uAr=e=>({cache:iAr(e.cacheSize),parseClassName:lAr(e),sortModifiers:cAr(e),...XNr(e)}),dAr=/\s+/,fAr=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(dAr);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!g,x=n(y?m.substring(0,g):m);if(!x){if(!y){c=d+(c.length>0?" "+c:c);continue}if(x=n(m),!x){c=d+(c.length>0?" "+c:c);continue}y=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),O=p?w+Yse:w,k=O+x;if(i.indexOf(k)>-1)continue;i.push(k);const _=s(x,y);for(let E=0;E<_.length;++E){const T=_[E];i.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},hAr=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Qot(r))&&(s&&(s+=" "),s+=n);return s},Qot=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Qot(e[n]))&&(r&&(r+=" "),r+=t);return r},VNe=(e,...t)=>{let r,n,s,a;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return r=uAr(u),n=r.cache.get,s=r.cache.set,a=l,l(c)},l=c=>{const u=n(c);if(u)return u;const d=fAr(c,r);return s(c,d),d};return a=i,(...c)=>a(hAr(...c))},pAr=[],qo=e=>{const t=r=>r[e]||pAr;return t.isThemeGetter=!0,t},Wot=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Got=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mAr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gAr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yAr=/\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$/,vAr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bAr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xAr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ub=e=>mAr.test(e),zn=e=>!!e&&!Number.isNaN(Number(e)),db=e=>!!e&&Number.isInteger(Number(e)),Gq=e=>e.endsWith("%")&&zn(e.slice(0,-1)),Jg=e=>gAr.test(e),Zot=()=>!0,wAr=e=>yAr.test(e)&&!vAr.test(e),She=()=>!1,SAr=e=>bAr.test(e),OAr=e=>xAr.test(e),kAr=e=>!br(e)&&!_r(e),_Ar=e=>t0(e,Kot,She),br=e=>Wot.test(e),D0=e=>t0(e,Jot,wAr),qNe=e=>t0(e,RAr,zn),EAr=e=>t0(e,tlt,Zot),CAr=e=>t0(e,elt,She),HNe=e=>t0(e,Yot,She),jAr=e=>t0(e,Xot,OAr),C2=e=>t0(e,rlt,SAr),_r=e=>Got.test(e),Ej=e=>s1(e,Jot),TAr=e=>s1(e,elt),QNe=e=>s1(e,Yot),NAr=e=>s1(e,Kot),AAr=e=>s1(e,Xot),j2=e=>s1(e,rlt,!0),IAr=e=>s1(e,tlt,!0),t0=(e,t,r)=>{const n=Wot.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},s1=(e,t,r=!1)=>{const n=Got.exec(e);return n?n[1]?t(n[1]):r:!1},Yot=e=>e==="position"||e==="percentage",Xot=e=>e==="image"||e==="url",Kot=e=>e==="length"||e==="size"||e==="bg-size",Jot=e=>e==="length",RAr=e=>e==="number",elt=e=>e==="family-name",tlt=e=>e==="number"||e==="weight",rlt=e=>e==="shadow",WNe=()=>{const e=qo("color"),t=qo("font"),r=qo("text"),n=qo("font-weight"),s=qo("tracking"),a=qo("leading"),i=qo("breakpoint"),l=qo("container"),c=qo("spacing"),u=qo("radius"),d=qo("shadow"),f=qo("inset-shadow"),h=qo("text-shadow"),p=qo("drop-shadow"),m=qo("blur"),g=qo("perspective"),y=qo("aspect"),x=qo("ease"),w=qo("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...k(),_r,br],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[_r,br,c],A=()=>[ub,"full","auto",...j()],I=()=>[db,"none","subgrid",_r,br],P=()=>["auto",{span:["full",db,_r,br]},db,_r,br],R=()=>[db,"auto",_r,br],B=()=>["auto","min","max","fr",_r,br],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...j()],z=()=>[ub,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],V=()=>[ub,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[ub,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],L=()=>[e,_r,br],Y=()=>[...k(),QNe,HNe,{position:[_r,br]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",NAr,_Ar,{size:[_r,br]}],Q=()=>[Gq,Ej,D0],G=()=>["","none","full",u,_r,br],J=()=>["",zn,Ej,D0],ie=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[zn,Gq,QNe,HNe],oe=()=>["","none",m,_r,br],he=()=>["none",zn,_r,br],K=()=>["none",zn,_r,br],re=()=>[zn,_r,br],le=()=>[ub,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jg],breakpoint:[Jg],color:[Zot],container:[Jg],"drop-shadow":[Jg],ease:["in","out","in-out"],font:[kAr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jg],shadow:[Jg],spacing:["px",zn],text:[Jg],"text-shadow":[Jg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ub,br,_r,y]}],container:["container"],columns:[{columns:[zn,br,_r,l]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[db,"auto",_r,br]}],basis:[{basis:[ub,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[zn,ub,"auto","initial","none",br]}],grow:[{grow:["",zn,_r,br]}],shrink:[{shrink:["",zn,_r,br]}],order:[{order:[db,"first","last","none",_r,br]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...D(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...D()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...z()]}],"min-w":[{"min-w":[l,"screen","none",...z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",r,Ej,D0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,IAr,EAr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Gq,br]}],"font-family":[{font:[TAr,CAr,t]}],"font-features":[{"font-features":[br]}],"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:[s,_r,br]}],"line-clamp":[{"line-clamp":[zn,"none",_r,qNe]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",_r,br]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_r,br]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[zn,"from-font","auto",_r,D0]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[zn,"auto",_r,br]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_r,br]}],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",_r,br]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},db,_r,br],radial:["",_r,br],conic:[db,_r,br]},AAr,jAr]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[zn,_r,br]}],"outline-w":[{outline:["",zn,Ej,D0]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",d,j2,C2]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",f,j2,C2]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[zn,D0]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",h,j2,C2]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[zn,_r,br]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"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":[zn]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[_r,br]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"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":k()}],"mask-image-conic-pos":[{"mask-conic":[zn]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_r,br]}],filter:[{filter:["","none",_r,br]}],blur:[{blur:oe()}],brightness:[{brightness:[zn,_r,br]}],contrast:[{contrast:[zn,_r,br]}],"drop-shadow":[{"drop-shadow":["","none",p,j2,C2]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",zn,_r,br]}],"hue-rotate":[{"hue-rotate":[zn,_r,br]}],invert:[{invert:["",zn,_r,br]}],saturate:[{saturate:[zn,_r,br]}],sepia:[{sepia:["",zn,_r,br]}],"backdrop-filter":[{"backdrop-filter":["","none",_r,br]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[zn,_r,br]}],"backdrop-contrast":[{"backdrop-contrast":[zn,_r,br]}],"backdrop-grayscale":[{"backdrop-grayscale":["",zn,_r,br]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[zn,_r,br]}],"backdrop-invert":[{"backdrop-invert":["",zn,_r,br]}],"backdrop-opacity":[{"backdrop-opacity":[zn,_r,br]}],"backdrop-saturate":[{"backdrop-saturate":[zn,_r,br]}],"backdrop-sepia":[{"backdrop-sepia":["",zn,_r,br]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_r,br]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[zn,"initial",_r,br]}],ease:[{ease:["linear","initial",x,_r,br]}],delay:[{delay:[zn,_r,br]}],animate:[{animate:["none",w,_r,br]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,_r,br]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[_r,br,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"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",_r,br]}],"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":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",_r,br]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[zn,Ej,D0,qNe]}],stroke:[{stroke:["none",...L()]}],"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"]}},PAr=(e,{cacheSize:t,prefix:r,experimentalParseClassName:n,extend:s={},override:a={}})=>(fT(e,"cacheSize",t),fT(e,"prefix",r),fT(e,"experimentalParseClassName",n),T2(e.theme,a.theme),T2(e.classGroups,a.classGroups),T2(e.conflictingClassGroups,a.conflictingClassGroups),T2(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),fT(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),N2(e.theme,s.theme),N2(e.classGroups,s.classGroups),N2(e.conflictingClassGroups,s.conflictingClassGroups),N2(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),nlt(e,s,"orderSensitiveModifiers"),e),fT=(e,t,r)=>{r!==void 0&&(e[t]=r)},T2=(e,t)=>{if(t)for(const r in t)fT(e,r,t[r])},N2=(e,t)=>{if(t)for(const r in t)nlt(e,t,r)},nlt=(e,t,r)=>{const n=t[r];n!==void 0&&(e[r]=e[r]?e[r].concat(n):n)},MAr=(e,...t)=>typeof e=="function"?VNe(WNe,e,...t):VNe(()=>PAr(WNe(),e),...t),DAr=Object.keys({...Ib,...l_t}),LAr=Object.keys(p_t),$Ar=Object.keys(c_t),FAr=Object.keys(u_t),zAr=Object.keys(o_t),L0=Object.keys(h_t),BAr=Object.keys(d_t).concat(Object.keys(f_t)),UAr=MAr({extend:{theme:{color:DAr,spacing:LAr,radius:zAr,leading:FAr,shadow:BAr},classGroups:{"font-size":[{text:$Ar}],h:[{h:L0}],w:[{w:L0}],size:[{size:L0}],"min-h":[{"min-h":L0}],"min-w":[{"min-w":L0}],"max-h":[{"max-h":L0}],"max-w":[{"max-w":L0}]}}});function Z(...e){return UAr(Uot(e))}const VAr={sm:`${pc.sm} text-ui-sm px-[.75em]`,md:`${pc.md} text-ui-md px-[.75em]`,default:`${pc.default} text-ui-md px-[.85em] `,lg:`${pc.lg} text-ui-lg px-[1em] `},qAr={default:"bg-surface3 border-2 border-border1 hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral5",primary:"bg-surface4 border-2 border-border2 hover:text-neutral6 hover:bg-surface5 active:bg-surface6 text-neutral6",cta:"bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",ghost:"bg-transparent border-2 border-transparent hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral4",inputLike:vhe,light:"",outline:""},HAr=Z("flex items-center justify-center gap-[.75em] leading-0 transition-colors duration-200 ease-out-custom rounded-lg","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100",xhe,bhe),QAr={light:"default",outline:"default"};function WAr(e){return QAr[e]??e}function ME(e){const t=WAr(e?.variant||"default"),r=e?.size||"default";return Z(HAr,qAr[t],VAr[r],e?.iconOnly&&"[&>svg]:opacity-75")}function slt(e){const t=[];return je.Children.forEach(e,r=>{je.isValidElement(r)&&r.type===je.Fragment?t.push(...slt(r.props.children)):t.push(r)}),t}function GAr(e){const t=slt(e);return t.length>0&&t.every(r=>je.isValidElement(r))}const ve=je.forwardRef(({className:e,as:t,size:r="default",variant:n="default",disabled:s,children:a,...i},l)=>{const c=t||"button",u=GAr(a);return o.jsx(c,{ref:l,disabled:s,className:Z(ME({variant:n,size:r,iconOnly:u}),e),...i,children:a})});ve.displayName="Button";const nd=aCt,Yr=iCt,Xr=oCt,Wr=b.forwardRef(({className:e,sideOffset:t=4,children:r,...n},s)=>o.jsx(lCt,{children:o.jsxs(RBe,{ref:s,sideOffset:t,className:Z("z-50 overflow-hidden rounded-md bg-surface3 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=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",e),...n,children:[r,o.jsx(cCt,{className:"fill-surface3"})]})}));Wr.displayName=RBe.displayName;const xs=je.forwardRef(({tooltipContent:e,...t},r)=>o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(ve,{ref:r,...t})}),e&&o.jsx(Wr,{children:e})]}));xs.displayName="ButtonWithTooltip";const ZAr={sm:"[&>svg]:h-icon-sm [&>svg]:w-icon-sm",default:"[&>svg]:h-icon-default [&>svg]:w-icon-default",lg:"[&>svg]:h-icon-lg [&>svg]:w-icon-lg"},Ce=({children:e,className:t,size:r="default",...n})=>o.jsx("span",{className:Z("block",ZAr[r],t),...n,children:e}),nn={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},r0={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},alt=({children:e})=>o.jsx("nav",{className:"bg-surface2 min-h-full overflow-hidden",children:e}),Q5=({children:e,as:t="a",href:r,className:n,prefetch:s,to:a})=>o.jsx(t,{href:r,prefetch:s,to:a,className:Z("text-ui-sm flex h-full w-full flex-col justify-center font-medium cursor-pointer",nn.colors,n),children:e}),ilt=({children:e})=>o.jsx("ol",{"data-testid":"thread-list",children:e}),W5=({children:e,isActive:t,className:r})=>o.jsx("li",{className:Z("border-b border-border1 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",nn.colors,"hover:bg-surface3",t&&"bg-accent1Dark",r),children:e}),olt=({onClick:e})=>o.jsx(ve,{variant:"ghost",className:Z("shrink-0 opacity-0",nn.all,"group-focus-within:opacity-100 group-hover:opacity-100","hover:bg-surface4 hover:text-accent2"),onClick:e,children:o.jsx(Ce,{children:o.jsx(ff,{"aria-label":"delete thread",className:"text-neutral3 hover:text-accent2 transition-colors"})})}),YAr={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-smd":"text-ui-smd leading-ui-smd","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","header-xs":"text-header-xs leading-header-xs","header-sm":"text-header-sm leading-header-sm","header-md":"text-header-md leading-header-md","header-lg":"text-header-lg leading-header-lg","header-xl":"text-header-xl leading-header-xl"},XAr={mono:"font-mono"},me=({as:e="p",className:t,variant:r="ui-md",font:n,...s})=>o.jsx(e,{className:Z(YAr[r],n&&XAr[n],t),...s}),pa=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",fill:"currentColor"}),o.jsx("path",{d:"M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",fill:"currentColor"})]}),KAr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M11.0313 7.97578C11.0313 9.34436 9.92183 10.4538 8.55324 10.4538C7.18466 10.4538 6.0752 9.34436 6.0752 7.97578C6.0752 6.60719 7.18466 5.49773 8.55324 5.49773C9.92183 5.49773 11.0313 6.60719 11.0313 7.97578ZM11.0313 7.97578H14.573",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"}),o.jsx("path",{d:"M12.967 4.46154C11.9273 3.14431 10.3165 2.29883 8.50814 2.29883C5.37277 2.29883 2.83105 4.84055 2.83105 7.97591C2.83105 11.1113 5.37277 13.653 8.50814 13.653C10.3165 13.653 11.9273 12.8075 12.967 11.4903",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"})]}),Ohe=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.97865 4.57004C8.22604 4.75795 8.27426 5.11082 8.08635 5.35821L6.05486 8.03279C5.94873 8.17251 5.78348 8.25471 5.60803 8.25505C5.43257 8.2554 5.267 8.17385 5.16032 8.03454L3.80937 6.27034C3.6205 6.02369 3.66733 5.67063 3.91398 5.48176C4.16063 5.29288 4.51369 5.33972 4.70257 5.58637L5.6051 6.76498L7.19048 4.67774C7.37839 4.43036 7.73126 4.38213 7.97865 4.57004Z",fill:"currentColor"})]}),khe=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.89741 4.10293C8.11707 4.32261 8.11706 4.67877 7.89738 4.89843L6.79517 6.00058L7.8962 7.10155C8.11588 7.32122 8.11589 7.67737 7.89623 7.89705C7.67656 8.11673 7.32041 8.11674 7.10073 7.89707L5.99965 6.79605L4.89856 7.89707C4.67889 8.11673 4.32273 8.11672 4.10307 7.89704C3.88341 7.67737 3.88342 7.32121 4.10309 7.10155L5.20413 6.00058L4.10191 4.89843C3.88224 4.67877 3.88223 4.32262 4.10189 4.10294C4.32155 3.88326 4.67771 3.88325 4.89738 4.10292L5.99965 5.20511L7.10191 4.10291C7.32159 3.88325 7.67774 3.88326 7.89741 4.10293Z",fill:"currentColor"})]}),kv=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.1747 3.18598L7.02554 1.95209C7.11557 1.89207 7.31087 1.87106 7.41016 1.90924L12.4139 3.83377C12.4683 3.85467 12.546 3.96798 12.546 4.03118V13.0167C12.546 13.265 12.7473 13.4663 12.9956 13.4663C13.2439 13.4663 13.4452 13.265 13.4452 13.0167V4.03118C13.4452 3.59605 13.1384 3.14906 12.7367 2.99456L7.73293 1.07004C7.36225 0.927472 6.86056 0.981451 6.52679 1.20396L4.20445 2.75219L3.90419 2.95236L3.90647 2.95824C3.69329 3.05449 3.55469 3.27599 3.55469 3.57581V11.7119C3.55469 12.2084 3.93067 12.7499 4.39251 12.9206L9.89804 14.955C10.3608 15.126 10.7359 14.8596 10.7359 14.3659V5.83295C10.7359 5.33662 10.3498 4.81289 9.88389 4.66643L5.1747 3.18598Z",fill:"currentColor"})}),llt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:o.jsx("path",{d:"M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",fill:"currentColor"})}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_22095",children:o.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),clt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[o.jsx("path",{d:"M13.5037 7.54867C13.5037 7.1144 13.4648 6.69683 13.3924 6.29596H7.62436V8.66776H10.9204C10.7756 9.43052 10.3413 10.0764 9.68994 10.5106V12.0529H11.6776C12.8356 10.9839 13.5037 9.41382 13.5037 7.54867Z",fill:"#4285F4"}),o.jsx("path",{d:"M7.62415 13.5339C9.27773 13.5339 10.6643 12.9882 11.6776 12.0529L9.68994 10.5106C9.14431 10.8781 8.44816 11.1009 7.62415 11.1009C6.03182 11.1009 4.67889 10.0263 4.19451 8.57877H2.15677V10.16C3.1645 12.1587 5.23008 13.5339 7.62415 13.5339Z",fill:"#34A853"}),o.jsx("path",{d:"M4.19472 8.57315C4.07223 8.20569 3.99985 7.81595 3.99985 7.40952C3.99985 7.00308 4.07223 6.61335 4.19472 6.24589V4.66469H2.15698C1.73941 5.4887 1.5 6.41849 1.5 7.40952C1.5 8.40055 1.73941 9.33034 2.15698 10.1543L3.74374 8.91834L4.19472 8.57315Z",fill:"#FBBC05"}),o.jsx("path",{d:"M7.62415 3.72376C8.5261 3.72376 9.32783 4.03555 9.96811 4.63685L11.7219 2.88306C10.6585 1.89202 9.27773 1.28516 7.62415 1.28516C5.23008 1.28516 3.16471 2.66036 2.15698 4.66469L4.19472 6.24589C4.6791 4.79832 6.03182 3.72376 7.62415 3.72376Z",fill:"#EA4335"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_20513",children:o.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),JAr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M4.31445 3.16083C3.78402 3.16083 3.27531 3.37154 2.90024 3.74661C2.52517 4.12169 2.31445 4.63039 2.31445 5.16083V5.66083C2.31445 6.19126 2.52517 6.69997 2.90024 7.07504C3.27531 7.45011 3.78402 7.66083 4.31445 7.66083C4.84489 7.66083 5.35359 7.45011 5.72867 7.07504C6.10374 6.69997 6.31445 6.19126 6.31445 5.66083V5.16083C6.31445 4.63039 6.10374 4.12169 5.72867 3.74661C5.35359 3.37154 4.84489 3.16083 4.31445 3.16083Z",fill:"currentColor"}),o.jsx("path",{d:"M6.76666 9.50235C6.57678 9.28532 6.30244 9.16083 6.01407 9.16083H4.50201C4.10791 9.16078 3.71766 9.23838 3.35356 9.38921C3.11733 9.48706 2.8951 9.6145 2.69205 9.76806C2.48056 9.928 2.38001 10.1888 2.38001 10.454V13.0642C2.38001 13.6165 2.82773 14.0642 3.38001 14.0642H8.55436C9.4135 14.0642 9.87269 13.0523 9.30695 12.4057L6.76666 9.50235Z",fill:"currentColor"}),o.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),Rz=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M3.8674 9.19968L4.14554 10.8649C4.23965 11.4283 4.75254 11.8237 5.32137 11.7713L5.58252 11.7472C6.56555 11.6567 7.43309 12.3868 7.51181 13.3708L7.59308 14.3867C7.60422 14.5259 7.71868 14.6342 7.85825 14.6376L9.91053 14.6876C10.1066 14.6924 10.2434 14.4948 10.17 14.3129L8.90452 11.1782C8.80956 10.9429 8.65085 10.7389 8.44626 10.5889L7.90134 10.1895C7.70604 10.0464 7.55223 9.85411 7.45759 9.63124C7.15011 8.90712 6.6579 7.71234 6.37054 6.88944C6.19204 6.3783 5.79931 6.29158 5.45492 6.21553C4.98179 6.11106 4.5999 6.02673 4.99001 4.88985C5.66408 2.92541 8.06015 2.07904 10.6601 3.33088C12.6488 4.2884 13.1187 6.35416 13.0328 7.58237C13.0297 7.62768 13.0214 7.67186 13.0094 7.71566C12.8829 8.17534 12.368 8.40491 11.9415 8.19169L10.3022 7.37201C10.2069 7.32439 10.0927 7.33657 10.0096 7.40322L8.64809 8.49559C8.55405 8.57104 8.52072 8.69931 8.56615 8.811L10.8995 14.5478C10.9404 14.6483 11.0369 14.715 11.1454 14.7177L12.0572 14.7399C12.2581 14.7448 12.3951 14.5382 12.3124 14.3551L11.8681 13.3706C11.4211 12.3803 11.6047 11.2192 12.3354 10.4151L13.4616 9.17575C13.7473 8.86125 13.9224 8.46187 13.9599 8.03858L13.9763 7.85359C14.2866 4.35298 11.377 1.41272 7.87336 1.68639C6.03919 1.82965 4.45399 3.02228 3.80807 4.74492L3.70275 5.02579C3.5828 5.34571 3.62741 5.70411 3.82213 5.98485L3.88946 6.08192C4.12183 6.41695 4.0958 6.86726 3.82637 7.17328L3.06705 8.03572C2.96261 8.15435 2.98058 8.33664 3.10617 8.43259L3.66059 8.85617C3.77064 8.94026 3.84458 9.06307 3.8674 9.19968Z",fill:"currentColor"})}),_he=e=>o.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.40864 11.9983C7.58064 11.9733 6.84164 11.6153 6.31564 11.0563C6.31464 11.0563 6.31464 11.0553 6.31464 11.0553C5.78864 10.4963 5.47564 9.73633 5.50064 8.90833C5.52564 8.08033 5.88464 7.34133 6.44364 6.81533C7.00264 6.28833 7.76264 5.97633 8.59064 6.00133C9.41864 6.02633 10.1576 6.38433 10.6836 6.94333H10.6846C11.2106 7.50333 11.5236 8.26233 11.4986 9.09033C11.4726 9.91833 11.1146 10.6583 10.5556 11.1843C9.99664 11.7103 9.23664 12.0233 8.40864 11.9983ZM16.1266 8.15033L14.3606 7.74033C14.2316 7.14133 14.0146 6.57633 13.7216 6.05733L14.7726 4.57933C14.9116 4.38533 14.8926 4.12033 14.7296 3.94633L13.9206 3.08733C13.7576 2.91333 13.4946 2.87933 13.2916 3.00533L11.7526 3.96533C11.2526 3.64133 10.7016 3.39033 10.1116 3.22633L9.80964 1.43833C9.76964 1.20333 9.56964 1.02833 9.33164 1.02133L8.15264 0.985326C7.91364 0.978326 7.70364 1.14033 7.64964 1.37233L7.24064 3.13933C6.64164 3.26733 6.07664 3.48433 5.55664 3.77733L4.07864 2.72633C3.88464 2.58833 3.61964 2.60633 3.44664 2.76933L2.58664 3.57833C2.41364 3.74133 2.37964 4.00533 2.50564 4.20733L3.46564 5.74633C3.14164 6.24633 2.89064 6.79833 2.72564 7.38833L0.937635 7.68933C0.702635 7.72933 0.528635 7.92933 0.520635 8.16733L0.485635 9.34733C0.477635 9.58533 0.639635 9.79533 0.872635 9.84933L2.63864 10.2583C2.76764 10.8573 2.98464 11.4233 3.27764 11.9423L2.22564 13.4203C2.08764 13.6143 2.10564 13.8793 2.26964 14.0523L3.07864 14.9123C3.24164 15.0853 3.50464 15.1203 3.70664 14.9933L5.24564 14.0333C5.74663 14.3583 6.29764 14.6093 6.88764 14.7733L7.18964 16.5613C7.22864 16.7963 7.42864 16.9713 7.66764 16.9783L8.84663 17.0143C9.08564 17.0213 9.29564 16.8593 9.34964 16.6273L9.75864 14.8603C10.3576 14.7323 10.9226 14.5153 11.4416 14.2213L12.9206 15.2733C13.1146 15.4113 13.3786 15.3933 13.5526 15.2293L14.4116 14.4213C14.5856 14.2573 14.6196 13.9943 14.4936 13.7923L13.5336 12.2533C13.8576 11.7523 14.1086 11.2013 14.2726 10.6113L16.0616 10.3103C16.2966 10.2703 16.4706 10.0703 16.4776 9.83233L16.5136 8.65233C16.5206 8.41433 16.3586 8.20433 16.1266 8.15033Z",fill:"currentColor"})}),eIr=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),Ai=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",fill:"currentColor"})}),DE=e=>o.jsx(a_t,{...e}),Ii=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",fill:"currentColor"})}),ml=e=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",fill:"currentColor"}),o.jsx("path",{d:"M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",fill:"currentColor"})]}),Pz=e=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});function np(e){return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),o.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),o.jsx("path",{d:"M15 2v2"}),o.jsx("path",{d:"M15 20v2"}),o.jsx("path",{d:"M2 15h2"}),o.jsx("path",{d:"M2 9h2"}),o.jsx("path",{d:"M20 15h2"}),o.jsx("path",{d:"M20 9h2"}),o.jsx("path",{d:"M9 2v2"}),o.jsx("path",{d:"M9 20v2"})]})}const ult=e=>o.jsxs("svg",{className:"h-3 w-3",width:"16",height:"16",viewBox:"0 0 181 108",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_1480_1723)",children:[o.jsx("path",{d:"M51.2203 39.3158C51.2203 41.5066 51.4572 43.2829 51.8717 44.5856C52.3453 45.8882 52.9374 47.3093 53.7664 48.8487C54.0624 49.3224 54.1809 49.7961 54.1809 50.2106C54.1809 50.8027 53.8256 51.3948 53.0559 51.9869L49.3256 54.4737C48.7927 54.829 48.2598 55.0066 47.7861 55.0066C47.194 55.0066 46.6019 54.7106 46.0098 54.1777C45.1809 53.2895 44.4703 52.3422 43.8782 51.3948C43.2861 50.3882 42.694 49.2632 42.0427 47.9014C37.4243 53.3487 31.6217 56.0724 24.6348 56.0724C19.6611 56.0724 15.694 54.6514 12.7927 51.8093C9.8914 48.9672 8.41113 45.1777 8.41113 40.4408C8.41113 35.4079 10.1874 31.3224 13.7993 28.2435C17.4111 25.1645 22.2072 23.6251 28.3059 23.6251C30.319 23.6251 32.3914 23.8027 34.5822 24.0987C36.773 24.3948 39.023 24.8685 41.3914 25.4014V21.079C41.3914 16.579 40.444 13.4408 38.6085 11.6053C36.7138 9.76979 33.5164 8.88163 28.9572 8.88163C26.8848 8.88163 24.7532 9.11847 22.5624 9.65137C20.3717 10.1843 18.2401 10.8356 16.1677 11.6645C15.2203 12.079 14.5098 12.3158 14.0953 12.4343C13.6809 12.5527 13.3848 12.6119 13.148 12.6119C12.319 12.6119 11.9046 12.0198 11.9046 10.7764V7.87505C11.9046 6.92768 12.023 6.21716 12.319 5.80268C12.6151 5.38821 13.148 4.97374 13.9769 4.55926C16.0493 3.49347 18.5361 2.60531 21.4374 1.89479C24.3388 1.12505 27.4177 0.769788 30.6743 0.769788C37.7203 0.769788 42.8717 2.36847 46.1875 5.56584C49.444 8.76321 51.1019 13.6185 51.1019 20.1316V39.3158H51.2203ZM27.1809 48.3158C29.1348 48.3158 31.148 47.9606 33.2796 47.2501C35.4111 46.5395 37.3059 45.2369 38.9046 43.4606C39.8519 42.3356 40.5625 41.0922 40.9177 39.6711C41.273 38.2501 41.5098 36.5329 41.5098 34.5198V32.0329C39.7927 31.6185 37.9572 31.2632 36.0624 31.0264C34.1677 30.7895 32.3322 30.6711 30.4967 30.6711C26.5296 30.6711 23.6282 31.4408 21.6743 33.0395C19.7203 34.6382 18.773 36.8882 18.773 39.8487C18.773 42.6316 19.4835 44.704 20.9638 46.1251C22.3848 47.6053 24.4572 48.3158 27.1809 48.3158ZM74.7269 54.7106C73.6611 54.7106 72.9506 54.5329 72.4769 54.1185C72.0032 53.7632 71.5888 52.9343 71.2335 51.8093L57.319 6.03953C56.9638 4.85531 56.7861 4.08558 56.7861 3.6711C56.7861 2.72374 57.2598 2.19084 58.2072 2.19084H64.0098C65.1348 2.19084 65.9046 2.36847 66.319 2.78295C66.7927 3.13821 67.148 3.96716 67.5032 5.09216L77.4506 44.2895L86.6874 5.09216C86.9835 3.90795 87.3388 3.13821 87.8124 2.78295C88.2861 2.42768 89.1151 2.19084 90.1809 2.19084H94.9177C96.0427 2.19084 96.8124 2.36847 97.2861 2.78295C97.7598 3.13821 98.1743 3.96716 98.4111 5.09216L107.766 44.7632L118.01 5.09216C118.365 3.90795 118.78 3.13821 119.194 2.78295C119.668 2.42768 120.437 2.19084 121.503 2.19084H127.01C127.957 2.19084 128.49 2.66453 128.49 3.6711C128.49 3.96716 128.431 4.26321 128.372 4.61847C128.312 4.97374 128.194 5.44742 127.957 6.09874L113.687 51.8685C113.332 53.0527 112.918 53.8224 112.444 54.1777C111.97 54.5329 111.201 54.7698 110.194 54.7698H105.102C103.977 54.7698 103.207 54.5922 102.733 54.1777C102.26 53.7632 101.845 52.9935 101.608 51.8093L92.4309 13.6185L83.3125 51.7501C83.0164 52.9343 82.6611 53.704 82.1874 54.1185C81.7138 54.5329 80.8848 54.7106 79.819 54.7106H74.7269ZM150.812 56.3093C147.734 56.3093 144.655 55.954 141.694 55.2435C138.733 54.5329 136.424 53.7632 134.885 52.8751C133.937 52.3422 133.286 51.7501 133.049 51.2172C132.812 50.6843 132.694 50.0922 132.694 49.5593V46.5395C132.694 45.2961 133.168 44.704 134.056 44.704C134.411 44.704 134.766 44.7632 135.122 44.8816C135.477 45.0001 136.01 45.2369 136.602 45.4737C138.615 46.3619 140.806 47.0724 143.115 47.5461C145.484 48.0198 147.793 48.2566 150.161 48.2566C153.891 48.2566 156.793 47.6053 158.806 46.3027C160.819 45 161.885 43.1053 161.885 40.6777C161.885 39.0198 161.352 37.6579 160.286 36.5329C159.22 35.4079 157.207 34.4014 154.306 33.454L145.72 30.7895C141.398 29.4277 138.201 27.4145 136.247 24.7501C134.293 22.1448 133.286 19.2435 133.286 16.1645C133.286 13.6777 133.819 11.4869 134.885 9.59216C135.951 7.69742 137.372 6.03953 139.148 4.73689C140.924 3.37505 142.937 2.36847 145.306 1.65795C147.674 0.94742 150.161 0.651367 152.766 0.651367C154.069 0.651367 155.431 0.710578 156.734 0.888209C158.095 1.06584 159.339 1.30268 160.582 1.53953C161.766 1.83558 162.891 2.13163 163.957 2.48689C165.023 2.84216 165.852 3.19742 166.444 3.55268C167.273 4.02637 167.865 4.50005 168.22 5.03295C168.576 5.50663 168.753 6.15795 168.753 6.98689V9.76979C168.753 11.0132 168.28 11.6645 167.391 11.6645C166.918 11.6645 166.148 11.4277 165.141 10.954C161.766 9.41453 157.977 8.64479 153.773 8.64479C150.398 8.64479 147.734 9.17768 145.898 10.3027C144.062 11.4277 143.115 13.1448 143.115 15.5724C143.115 17.2303 143.707 18.6514 144.891 19.7764C146.076 20.9014 148.266 22.0264 151.405 23.0329L159.812 25.6974C164.076 27.0593 167.155 28.954 168.99 31.3816C170.826 33.8093 171.714 36.5922 171.714 39.6711C171.714 42.2172 171.181 44.5264 170.174 46.5395C169.108 48.5527 167.687 50.329 165.852 51.7501C164.016 53.2303 161.826 54.2961 159.28 55.0658C156.615 55.8948 153.832 56.3093 150.812 56.3093Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M162.004 85.0856C142.524 99.4738 114.221 107.112 89.8855 107.112C55.7803 107.112 25.05 94.5001 1.83948 73.5396C0.00394917 71.8817 1.66184 69.6317 3.85263 70.9343C28.9579 85.5001 59.925 94.3225 91.9579 94.3225C113.57 94.3225 137.313 89.8225 159.162 80.5856C162.418 79.1054 165.201 82.7172 162.004 85.0856Z",fill:"#FF9900"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M170.115 75.8487C167.628 72.6513 153.654 74.3092 147.319 75.079C145.424 75.3158 145.128 73.6579 146.845 72.4145C157.976 64.5987 176.272 66.8487 178.404 69.454C180.536 72.1184 177.812 90.4145 167.391 99.1776C165.792 100.539 164.253 99.8289 164.963 98.0526C167.332 92.1908 172.601 78.9868 170.115 75.8487Z",fill:"#FF9900"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_1480_1723",children:o.jsx("rect",{width:"180",height:"107.763",fill:"white",transform:"translate(0.0625)"})})})]}),tIr=e=>o.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:o.jsx("path",{d:"m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"})}),rIr=e=>o.jsx("svg",{className:"h-3 w-3",fill:"white",height:"78",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"78",style:{color:"currentcolor"},...e,children:o.jsx("g",{transform:"translate(0,2)",children:o.jsx("path",{d:"M11.375 0h-2.411L13.352 11.13h2.411L11.375 0ZM4.4 0 0 11.13h2.46l0.9-2.336h4.604l0.9 2.336h2.46L6.924 0H4.4Zm-0.244 6.723 1.506-3.909 1.506 3.909H4.156Z",fill:"currentColor"})})}),dlt=e=>o.jsx("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...e,children:o.jsx("path",{d:"M7.402 13.8777C9.45763 13.4674 11.1555 13.128 11.175 13.1233L11.2104 13.1148L9.2697 10.507C8.2023 9.07276 7.32898 7.8937 7.32898 7.88691C7.32898 7.87404 9.33293 1.63997 9.3442 1.61779C9.34797 1.61037 10.7117 4.27017 12.65 8.06532C14.4647 11.6184 15.9608 14.5479 15.9747 14.5754L16 14.6253L9.83224 14.6244L3.66449 14.6235L7.402 13.8777ZM0 13.0824C0 13.0787 0.914457 11.2855 2.03212 9.09735L4.06425 5.11896L6.43245 2.87384C7.73497 1.63902 8.80417 0.627201 8.80845 0.625356C8.81274 0.623511 8.79561 0.672228 8.77038 0.733617C8.74515 0.795006 7.58796 3.59893 6.19884 6.96455L3.67317 13.0839L1.83659 13.0865C0.826464 13.0879 0 13.0861 0 13.0824Z",fill:"#0089D6",style:{fill:"#0089D6",fillOpacity:1}})}),nIr=e=>o.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"18",fill:"none",...e,children:[o.jsx("mask",{id:"mask0_174_2406",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"17",height:"18",children:o.jsx("path",{d:"M17 0.5H0V17.5H17V0.5Z",fill:"white"})}),o.jsxs("g",{mask:"url(#mask0_174_2406)",children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.50773 10.6219C5.9653 10.6219 6.8755 10.5968 8.13362 10.0788C9.59973 9.47518 12.5166 8.37942 14.6208 7.2539C16.0924 6.46668 16.7375 5.42553 16.7375 4.02344C16.7375 2.07751 15.16 0.5 13.2141 0.5H5.06095C2.26586 0.5 0 2.76586 0 5.56095C0 8.35604 2.12151 10.6219 5.50773 10.6219Z",fill:"#39594D"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.88672 14.107C6.88672 12.7369 7.71155 11.5016 8.97699 10.9764L11.5446 9.9108C14.1417 8.83294 17.0003 10.7415 17.0003 13.5535C17.0003 15.732 15.2339 17.4979 13.0553 17.4973L10.2754 17.4966C8.40372 17.4961 6.88672 15.9787 6.88672 14.107Z",fill:"#D18EE2"}),o.jsx("path",{d:"M2.91749 11.2891C1.30623 11.2891 0 12.5952 0 14.2065V14.5844C0 16.1956 1.30618 17.5018 2.91744 17.5018C4.5287 17.5018 5.83493 16.1956 5.83493 14.5844V14.2065C5.83493 12.5952 4.52875 11.2891 2.91749 11.2891Z",fill:"#FF7759"})]})]}),sIr=e=>o.jsxs("svg",{className:"h-3 w-3","data-testid":"geist-icon",height:"78",strokeLinejoin:"round",viewBox:"0 0 160 59",width:"104",style:{color:"currentcolor"},...e,children:[o.jsx("mask",{id:"mask0_4345_1846",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"160",height:"59",style:{maskType:"luminance"},children:o.jsx("path",{d:"M0.273438 0.219727H159.216V58.1817H0.273438V0.219727Z",fill:"white"})}),o.jsx("g",{mask:"url(#mask0_4345_1846)",children:o.jsx("path",{d:"M95.4635 0.314595C84.4822 0.314595 75.5599 9.19525 75.5599 20.1677C75.5599 31.1402 84.4632 40.0208 95.4635 40.0208C106.464 40.0208 115.367 31.1402 115.367 20.1677C115.348 9.21427 106.445 0.333611 95.4635 0.314595ZM95.4635 32.5664C88.6002 32.5664 83.0333 27.0136 83.0333 20.1677C83.0333 13.3218 88.6002 7.76902 95.4635 7.76902C102.327 7.76902 107.894 13.3218 107.894 20.1677C107.894 27.0136 102.327 32.5664 95.4635 32.5664ZM67.9912 0.39066C67.3049 0.314595 66.6376 0.276562 65.9513 0.276562C65.6081 0.276562 65.284 0.276562 64.9599 0.295578C64.6358 0.314595 64.2926 0.333611 63.9685 0.352628C62.634 0.44771 61.2995 0.675906 60.0031 1.03722C57.3531 1.74082 54.8556 2.99591 52.7013 4.68836C50.4898 6.43787 48.7358 8.68181 47.5347 11.23C46.9437 12.5041 46.5052 13.8543 46.2193 15.2234C46.0858 15.908 45.9905 16.5926 45.9142 17.2772C45.8952 17.6195 45.857 17.9618 45.857 18.3041L45.838 18.8175V19.293L45.8761 32.5854L45.9142 39.2221H53.3685L53.4067 32.5854L53.4448 19.293V18.5893C53.4448 18.3802 53.4829 18.171 53.4829 17.9618C53.5211 17.5434 53.5973 17.1441 53.6736 16.7257C53.8452 15.9271 54.093 15.1474 54.4362 14.4057C55.1225 12.9225 56.152 11.6293 57.4293 10.6025C58.7639 9.53755 60.3081 8.75787 61.9477 8.3205C62.7865 8.0923 63.6635 7.94017 64.5405 7.8641C64.7693 7.84509 64.979 7.82607 65.2078 7.82607C65.4365 7.82607 65.6653 7.80705 65.875 7.80705C66.2944 7.80705 66.7329 7.82607 67.1524 7.8641C68.8491 8.03525 70.4887 8.54869 71.9948 9.38541L75.7124 2.93886C73.3484 1.56968 70.7175 0.694923 67.9912 0.39066ZM20.3484 0.219513C9.36711 0.124431 0.36855 8.92902 0.273226 19.8825C0.177902 30.8359 9.00488 39.8116 19.9862 39.9067H26.8876V32.4713H20.3484C13.4851 32.5474 7.84193 27.0707 7.76567 20.2057C7.68941 13.3408 13.1801 7.73099 20.0624 7.65492H20.3484C27.2117 7.65492 32.7786 13.2077 32.8167 20.0536V38.3284C32.8167 45.1172 27.2689 50.651 20.4819 50.7271C17.2218 50.708 14.1142 49.3959 11.8265 47.0949L6.54553 52.3625C10.206 56.0326 15.1628 58.1244 20.3484 58.1625H20.6153C31.4632 58.0103 40.1757 49.2248 40.2329 38.4044V19.5592C39.966 8.81492 31.1391 0.238529 20.3484 0.219513ZM139.389 0.314595C128.407 0.314595 119.485 9.19525 119.504 20.1677C119.504 31.1212 128.407 40.0018 139.389 40.0018H146.195V32.5664H139.389C132.525 32.5664 126.958 27.0136 126.958 20.1677C126.958 13.3218 132.525 7.76902 139.389 7.76902C145.833 7.76902 151.209 12.6943 151.781 19.1028H151.762V57.2116H159.216V20.1677C159.216 9.21427 150.351 0.314595 139.389 0.314595Z",fill:"currentColor"})})]}),aIr=e=>o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:o.jsx("path",{d:"M4.49805 11.6934C6.98237 11.6934 8.99609 13.7081 8.99609 16.1924C8.9959 18.6765 6.98225 20.6904 4.49805 20.6904C2.01394 20.6903 0.000196352 18.6765 0 16.1924C0 13.7081 2.01382 11.6935 4.49805 11.6934ZM10.3867 0C12.8709 0 14.8846 2.01388 14.8848 4.49805C14.8848 4.8377 14.847 5.16846 14.7755 5.48643C14.4618 6.88139 14.1953 8.4633 14.9928 9.65L16.2575 11.5319C16.3363 11.6491 16.4727 11.7115 16.6137 11.703C16.7369 11.6957 16.8525 11.6343 16.9214 11.5318L18.1876 9.64717C18.9772 8.47198 18.7236 6.90783 18.4205 5.52484C18.3523 5.21392 18.3164 4.89094 18.3164 4.55957C18.3167 2.07546 20.3313 0.0615234 22.8154 0.0615234C25.2994 0.0617476 27.3132 2.0756 27.3135 4.55957C27.3135 4.93883 27.2665 5.30712 27.178 5.65896C26.8547 6.94441 26.5817 8.37932 27.2446 9.52714L28.459 11.6301C28.4819 11.6697 28.5245 11.6934 28.5703 11.6934C31.0545 11.6935 33.0684 13.7081 33.0684 16.1924C33.0682 18.6765 31.0544 20.6903 28.5703 20.6904C26.0861 20.6904 24.0725 18.6765 24.0723 16.1924C24.0723 15.8049 24.1212 15.4288 24.2133 15.0701C24.5458 13.7746 24.8298 12.3251 24.1609 11.1668L23.0044 9.16384C22.9656 9.09659 22.8931 9.05859 22.8154 9.05859C22.7983 9.05859 22.7824 9.06614 22.7728 9.08033L21.4896 10.9895C20.686 12.1851 20.9622 13.781 21.284 15.1851C21.3582 15.5089 21.3975 15.8461 21.3975 16.1924C21.3973 18.6764 19.3834 20.6902 16.8994 20.6904C14.4152 20.6904 12.4006 18.6765 12.4004 16.1924C12.4004 15.932 12.4226 15.6768 12.4651 15.4286C12.6859 14.14 12.8459 12.7122 12.1167 11.6271L11.2419 10.3253C10.6829 9.49347 9.71913 9.05932 8.78286 8.70188C7.0906 8.05584 5.88867 6.41734 5.88867 4.49805C5.88886 2.0139 7.90254 3.29835e-05 10.3867 0Z",fill:e.fill||"currentColor"})}),iIr=e=>o.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"176",height:"162",viewBox:"0 0 176 162",fill:"none",...e,children:[o.jsx("rect",{x:"15",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"47",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"111",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"47",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"79",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"111",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"79",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{y:"1",width:"16",height:"160",fill:"black"}),o.jsx("rect",{x:"63",y:"97",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"95",y:"33",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"127",y:"1",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"127",y:"97",width:"16",height:"64",fill:"black"})]}),oIr=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"128",height:"113",viewBox:"0 0 128 113",children:[o.jsxs("g",{clipPath:"url(#clip0_236_138)",...e,children:[o.jsx("path",{d:"M34.593 94.0509H33.3844L27.3514 88.0179V86.8094L36.5743 77.5866H42.9639L43.8158 78.4385V84.8281L34.593 94.0509Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M27.3514 25.816V24.6074L33.3844 18.5744H34.593L43.8158 27.7972V34.1868L42.9639 35.0388H36.5743L27.3514 25.816Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M80.4594 74.6047H71.6824L70.9493 73.8717V53.3259C70.9493 49.6705 69.5129 46.8372 65.1046 46.7382C62.836 46.6787 60.2405 46.7382 57.4668 46.8471L57.0507 47.2731V73.8618L56.3176 74.5948H47.5406L46.8075 73.8618V38.7636L47.5406 38.0305H67.2939C74.9713 38.0305 81.1925 44.2517 81.1925 51.9291V73.8717L80.4594 74.6047Z",fill:e.fill||"#014847"}),o.jsx("path",{d:"M35.8412 61.4491H0.73307L0 60.716V51.9192L0.73307 51.1861H35.8412L36.5743 51.9192V60.716L35.8412 61.4491Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M127.277 61.4491H92.1687L91.4356 60.716V51.9192L92.1687 51.1861H127.277L128.01 51.9192V60.716L127.277 61.4491Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M58.9428 27.0642V0.73307L59.6759 0H68.4727L69.2058 0.73307V27.0642L68.4727 27.7972H59.6759L58.9428 27.0642Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M58.9428 111.902V85.5711L59.6759 84.838H68.4727L69.2058 85.5711V111.902L68.4727 112.635H59.6759L58.9428 111.902Z",fill:e.fill||"#05BDBA"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_236_138",children:o.jsx("rect",{width:"128",height:"112.635",fill:"white"})})})]}),GNe=e=>o.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:o.jsx("path",{d:"m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"})}),lIr=e=>o.jsx("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1000 1000",width:"78",height:"78",style:{color:"currentcolor"},...e,children:o.jsxs("g",{children:[o.jsx("polygon",{fill:"currentColor",points:"226.83 411.15 501.31 803.15 623.31 803.15 348.82 411.15 226.83 411.15"}),o.jsx("polygon",{fill:"currentColor",points:"348.72 628.87 226.69 803.15 348.77 803.15 409.76 716.05 348.72 628.87"}),o.jsx("polygon",{fill:"currentColor",points:"651.23 196.85 440.28 498.12 501.32 585.29 773.31 196.85 651.23 196.85"}),o.jsx("polygon",{fill:"currentColor",points:"673.31 383.25 673.31 803.15 773.31 803.15 773.31 240.44 673.31 383.25"})]})}),cIr={warning:"bg-accent6Darker border-accent6/30 text-accent6",destructive:"bg-accent2Darker border-accent2/30 text-accent2",info:"bg-accent5Darker border-accent5/30 text-accent5"},uIr={warning:KI,destructive:a6,info:XI},Ll=({children:e,variant:t="destructive",className:r})=>{const n=uIr[t];return o.jsx("div",{className:Z(cIr[t],"p-3 rounded-md border shadow-sm",nn.all,"animate-in fade-in-0 slide-in-from-top-2 duration-200",r),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(Ce,{className:"mt-0.5 shrink-0",children:o.jsx(n,{})}),o.jsx("div",{className:"text-neutral4",children:e})]})})},$l=({children:e,as:t="h5"})=>o.jsx(me,{as:t,variant:"ui-md",className:"font-semibold",children:e}),Iu=({children:e,as:t="p"})=>o.jsx(me,{as:t,variant:"ui-sm",children:e}),dIr={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},flt=({src:e,name:t,size:r="sm",interactive:n=!1})=>o.jsx("div",{className:Z(dIr[r],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",nn.all,n&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?o.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):o.jsx(me,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),fIr={default:"text-neutral3 bg-surface4",success:"text-accent1 bg-accent1Dark",error:"text-accent2 bg-accent2Dark",info:"text-accent5 bg-accent5Dark",warning:"text-accent6 bg-accent6Dark"},hIr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},vt=({icon:e,variant:t="default",className:r,children:n,...s})=>o.jsxs("div",{className:Z("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",nn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":fIr[t],r),...s,children:[e&&o.jsx("span",{className:hIr[t],children:o.jsx(Ce,{children:e})}),n]}),ja=({children:e,label:t})=>o.jsx("nav",{"aria-label":t,children:o.jsx("ol",{className:"gap-0.5 flex items-center",children:e})}),dr=({className:e,as:t,isCurrent:r,action:n,...s})=>{const a=t||"span";return o.jsxs(o.Fragment,{children:[o.jsxs("li",{className:"flex h-full shrink-0 items-center gap-1",children:[o.jsx(a,{"aria-current":r?"page":void 0,className:Z("text-ui-md leading-ui-md flex items-center gap-2",nn.colors,r?"text-white":"text-neutral3 hover:text-neutral5",e),...s}),n]}),!r&&o.jsx("li",{role:"separator",className:"flex h-full items-center",children:o.jsx(Ce,{className:Z("text-neutral2",nn.colors),children:o.jsx(eIr,{})})})]})};function pIr(e,t=5){if(!e?.properties)return[];const r=[];function n(s,a,i){if(i>t)return;const l=Array.isArray(s.type)?s.type.join(" | "):s.type;if(r.push({path:a,label:a,description:s.description??s.title,type:l}),s.properties)for(const[c,u]of Object.entries(s.properties))n(u,`${a}.${c}`,i+1);if(s.items?.properties)for(const[c,u]of Object.entries(s.items.properties))n(u,`${a}[].${c}`,i+1)}for(const[s,a]of Object.entries(e.properties))n(a,s,1);return r}function mIr(e){const t=pIr(e);return ZUe({override:[gIr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function gIr(e){return t=>{const n=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!n)return null;const s=n[1]??"",a=t.pos-s.length,i=s?e.filter(c=>c.path.toLowerCase().startsWith(s.toLowerCase())):e;if(i.length===0)return null;const l=i.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,h)=>{const g=u.state.sliceDoc(h,h+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:h,insert:g},selection:{anchor:f+g.length}})}}));return{from:a,options:l,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const yIr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,vIr=er.mark({class:"cm-variable-highlight"}),ZNe=new cUe({regexp:yIr,decoration:()=>vIr}),bIr=wi.fromClass(class{decorations;constructor(e){this.decorations=ZNe.createDeco(e)}update(e){this.decorations=ZNe.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),xIr=bIr,wIr={duration:5e3,cancel:{label:o.jsx(Ce,{children:o.jsx(ff,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-lg gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card :data-content:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"bg-transparent! hover:bg-surface2! border-none! rounded-md! p-1.5! m-0! text-neutral3! hover:text-neutral6! shrink-0 transition-all",actionButton:"bg-white! flex items-center justify-center font-medium text-black! order-last hover:opacity-80"}};function Zd(e){const{classNames:t,...r}=wIr,{classNames:n,...s}=e||{};return{...r,classNames:{...t,title:Z(t?.title,n?.title),toast:Z(t?.toast,n?.toast),cancelButton:Z(t?.cancelButton,n?.cancelButton),actionButton:Z(t?.actionButton,n?.actionButton),description:Z(t?.description,n?.description)},...s}}const Ue=(e,t={})=>{if(Array.isArray(e))return e.forEach(r=>gc(r,Zd(t)));if(je.isValidElement(e))return gc(e,Zd(t));if(typeof e=="string")return gc(e,Zd(t));throw new Error("Invalid message type")};Ue.success=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent1 shrink-0",children:o.jsx(ikt,{})}),classNames:{...t.classNames,toast:Z("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return gc.success(e,Zd(r));case"object":return e.forEach(n=>gc.success(n,Zd(r)))}};Ue.error=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent2 shrink-0",children:o.jsx(U8e,{})}),classNames:{...t.classNames,toast:Z("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return gc.error(e,Zd(r));case"object":return e.forEach(n=>gc.error(n,Zd(r)))}};Ue.warning=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent6 shrink-0",children:o.jsx(a6,{})}),classNames:{...t.classNames,toast:Z("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return gc.warning(e,Zd(r));case"object":return e.forEach(n=>gc.warning(n,Zd(r)))}};Ue.info=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent3 shrink-0",children:o.jsx(XI,{})}),classNames:{...t.classNames,toast:Z("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return gc.info(e,Zd(r));case"object":return e.forEach(n=>gc.info(n,Zd(r)))}};Ue.custom=(e,t={})=>gc(e,Zd(t));Ue.dismiss=e=>{e&&gc.dismiss(e)};Ue.promise=({myPromise:e,loadingMessage:t,successMessage:r,errorMessage:n,onSuccess:s,onError:a,options:i={}})=>gc.promise(e,{loading:t??"Loading...",success:l=>(s?.(l),r),error:l=>(a?.(l),n||l?.message||"Error..."),...Zd(i)});function sf({text:e,copyMessage:t="Copied to clipboard!"}){const[r,n]=b.useState(!1),s=b.useRef(null),a=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{Ue.success(t),n(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{n(!1)},2e3)}).catch(()=>{Ue.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:r,handleCopy:a}}function Ya({content:e,copyMessage:t,tooltip:r="Copy to clipboard",size:n="sm",className:s}){const[a,i]=b.useState(!1),{handleCopy:l}=sf({text:e,copyMessage:t}),c=()=>{l(),i(!0),setTimeout(()=>i(!1),2e3)};return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(ve,{onClick:c,type:"button",size:n,className:s,"aria-label":a?"Copied!":r,children:a?o.jsx(ov,{}):o.jsx(q8e,{})})}),o.jsx(Wr,{children:a?"Copied!":r})]})}const Hn=Ule()(DLt(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),Xse=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function SIr(e){return Xse?.addEventListener("change",e),()=>Xse?.removeEventListener("change",e)}function OIr(){return Xse?.matches??!0}function sP(){const e=Hn(r=>r.theme),t=b.useSyncExternalStore(SIr,OIr,()=>!0);return e==="system"?t:e==="dark"}function kIr(){const e=cE({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"var(--neutral2)",background:"transparent",foreground:"var(--neutral6)",caret:"var(--neutral6)"},styles:[{tag:[ne.className,ne.propertyName],color:"var(--neutral6)"},{tag:ne.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.heading1,ne.heading2,ne.heading3,ne.heading4,ne.heading5,ne.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:ne.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:ne.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:ne.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ne.url,color:"var(--accent3)"},{tag:ne.monospace,color:"var(--neutral6)"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:ne.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=pt.theme({".cm-editor":{backgroundColor:"transparent"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{color:"var(--neutral3)"},".cm-cursor":{borderLeftColor:"var(--neutral6)"},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:"color-mix(in srgb, var(--accent3) 22%, transparent)"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}});return[e,t]}function _Ir(){const e=pt.theme({"&":{backgroundColor:"transparent",color:"var(--neutral6)",fontSize:"0.8rem"},"&.cm-editor .cm-scroller":{fontFamily:"var(--geist-mono)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--neutral2)",borderRight:"none"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-activeLine":{backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--neutral3)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--neutral6)"},"&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{background:"color-mix(in srgb, var(--accent3) 22%, transparent) !important"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}}),t=Ap.define([{tag:[ne.comment,ne.bracket],color:"var(--neutral2)"},{tag:[ne.string,ne.meta,ne.regexp],color:"var(--accent1)"},{tag:[ne.atom,ne.bool,ne.special(ne.variableName)],color:"var(--accent6)"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"var(--accent2)"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"var(--accent5)"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"var(--accent3)"},{tag:[ne.variableName,ne.number],color:"var(--accent5)"},{tag:[ne.name,ne.quote],color:"var(--accent1)"},{tag:ne.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.heading1,ne.heading2,ne.heading3,ne.heading4,ne.heading5,ne.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[ne.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:ne.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ne.url,color:"var(--accent3)"},{tag:ne.monospace,color:"var(--neutral6)"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:[ne.deleted],color:"var(--accent2)"},{tag:ne.invalid,color:"var(--error)"},{tag:[ne.standard(ne.tagName)],color:"var(--accent1)"}]);return[e,Fx(t)]}const _v=()=>{const e=sP();return b.useMemo(()=>e?kIr():_Ir(),[e])},ds=b.forwardRef(({data:e,value:t,onChange:r,showCopyButton:n=!0,className:s,language:a="json",highlightVariables:i=!1,placeholder:l,schema:c,autoFocus:u,lineNumbers:d=!0,editable:f,...h},p)=>{const m=_v(),g=e?JSON.stringify(e,null,2):t??"",y=b.useMemo(()=>{const x=[];return a==="json"?x.push(Vd):a==="markdown"&&(x.push(Ile({base:Hw,codeLanguages:yqe})),x.push(pt.lineWrapping)),i&&a==="markdown"&&x.push(xIr),c&&a==="markdown"&&x.push(mIr(c)),f===!1&&x.push(Dn.readOnly.of(!0)),x},[a,i,c,f]);return o.jsxs("div",{className:Z("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...h,children:[n&&o.jsx(Ya,{content:g,className:"absolute top-2 right-2 z-20"}),o.jsx(bc,{ref:p,value:g,theme:m,extensions:y,onChange:r,editable:f,"aria-label":"Code editor",placeholder:l,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function EIr(e,t){const{codeToTokens:r,bundledLanguages:n}=await Je(async()=>{const{codeToTokens:a,bundledLanguages:i}=await import("./index-Bd2BWyq9.js");return{codeToTokens:a,bundledLanguages:i}},__vite__mapDeps([23,1]),import.meta.url);if(!(t in n))return null;const{tokens:s}=await r(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}function li({iconSlot:e,titleSlot:t,descriptionSlot:r,actionSlot:n,className:s,as:a="h3"}){return o.jsxs("div",{className:Z("flex flex-col items-center justify-center text-center py-10 px-6","transition-opacity duration-normal ease-out-custom",s),children:[e&&o.jsx("div",{className:"mb-4",children:e}),o.jsx(a,{className:"font-medium text-neutral5 text-ui-md",children:t}),r&&o.jsx("p",{className:"mt-1.5 text-neutral3 text-ui-sm max-w-md",children:r}),n&&o.jsx("div",{className:"mt-5",children:n})]})}const yf=({children:e,className:t,onClick:r})=>o.jsx("div",{tabIndex:r?0:void 0,onKeyDown:n=>{r&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),r?.())},className:Z("flex gap-3 group/entity bg-surface3 rounded-xl border border-border1 py-3 px-4",r&&"cursor-pointer hover:bg-surface4 transition-all",t),onClick:r,children:e}),hlt=({children:e,className:t,style:r})=>o.jsx(Ce,{size:"lg",className:Z("text-neutral3 mt-1 shrink-0",t),style:r,children:e}),vf=({children:e,className:t})=>o.jsx(me,{as:"p",variant:"ui-lg",className:Z("text-neutral6 font-medium",t),children:e}),bf=({children:e,className:t})=>o.jsx(me,{as:"div",variant:"ui-sm",className:Z("text-neutral3",t),children:e}),xf=({children:e,className:t})=>o.jsx("div",{className:Z("flex-1 w-full",t),children:e});function Zs({resource:e,title:t,description:r,actionSlot:n,className:s}){const a="Permission Denied",i=e?`You don't have permission to access ${e}. Contact your administrator for access.`:"You don't have permission to access this resource. Contact your administrator for access.";return o.jsx(li,{className:s,iconSlot:o.jsx(Ce,{size:"lg",className:"text-neutral3",children:o.jsx(qkt,{})}),titleSlot:t??a,descriptionSlot:r??i,actionSlot:n})}function na({title:e,description:t,className:r}){const[n,s]=b.useState(!1),a=Ze(),i=b.useCallback(async()=>{try{s(!0);const{baseUrl:l="",apiPrefix:c}=a.options||{},u=(c||"/api").trim(),d=(u.startsWith("/")?u:`/${u}`).replace(/\/$/,""),f=new URLSearchParams({redirect_uri:window.location.href}),h=`${l}${d}/auth/sso/login?${f}`,p=await fetch(h,{credentials:"include",headers:{"Content-Type":"application/json"}});if(p.ok){const m=await p.json();window.location.href=m.url}}finally{s(!1)}},[a]);return o.jsx(li,{className:r,iconSlot:o.jsx(Ce,{size:"lg",className:"text-neutral3",children:o.jsx($kt,{})}),titleSlot:e??"Session Expired",descriptionSlot:t??"Your session has expired. Please log in again to continue.",actionSlot:o.jsx(ve,{variant:"default",onClick:i,disabled:n,children:n?"Redirecting...":"Log in"})})}const mn=({children:e,border:t=!0,className:r})=>o.jsx("header",{className:Z("h-header-default z-50 flex w-full items-center gap-4 bg-transparent px-3",{"border-b border-border1":t},r),children:e}),Vu=({children:e})=>o.jsx(me,{as:"h1",variant:"ui-md",className:"text-neutral6 flex items-center gap-2",children:e}),Ec=({children:e})=>o.jsx("div",{className:"ml-auto flex items-center gap-3",children:e}),CIr=({children:e})=>o.jsx("div",{className:"gap-2 flex items-center",children:e}),Xb=e=>o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:o.jsx("path",{d:"M4.49805 11.6934C6.98237 11.6934 8.99609 13.7081 8.99609 16.1924C8.9959 18.6765 6.98225 20.6904 4.49805 20.6904C2.01394 20.6903 0.000196352 18.6765 0 16.1924C0 13.7081 2.01382 11.6935 4.49805 11.6934ZM10.3867 0C12.8709 0 14.8846 2.01388 14.8848 4.49805C14.8848 4.8377 14.847 5.16846 14.7755 5.48643C14.4618 6.88139 14.1953 8.4633 14.9928 9.65L16.2575 11.5319C16.3363 11.6491 16.4727 11.7115 16.6137 11.703C16.7369 11.6957 16.8525 11.6343 16.9214 11.5318L18.1876 9.64717C18.9772 8.47198 18.7236 6.90783 18.4205 5.52484C18.3523 5.21392 18.3164 4.89094 18.3164 4.55957C18.3167 2.07546 20.3313 0.0615234 22.8154 0.0615234C25.2994 0.0617476 27.3132 2.0756 27.3135 4.55957C27.3135 4.93883 27.2665 5.30712 27.178 5.65896C26.8547 6.94441 26.5817 8.37932 27.2446 9.52714L28.459 11.6301C28.4819 11.6697 28.5245 11.6934 28.5703 11.6934C31.0545 11.6935 33.0684 13.7081 33.0684 16.1924C33.0682 18.6765 31.0544 20.6903 28.5703 20.6904C26.0861 20.6904 24.0725 18.6765 24.0723 16.1924C24.0723 15.8049 24.1212 15.4288 24.2133 15.0701C24.5458 13.7746 24.8298 12.3251 24.1609 11.1668L23.0044 9.16384C22.9656 9.09659 22.8931 9.05859 22.8154 9.05859C22.7983 9.05859 22.7824 9.06614 22.7728 9.08033L21.4896 10.9895C20.686 12.1851 20.9622 13.781 21.284 15.1851C21.3582 15.5089 21.3975 15.8461 21.3975 16.1924C21.3973 18.6764 19.3834 20.6902 16.8994 20.6904C14.4152 20.6904 12.4006 18.6765 12.4004 16.1924C12.4004 15.932 12.4226 15.6768 12.4651 15.4286C12.6859 14.14 12.8459 12.7122 12.1167 11.6271L11.2419 10.3253C10.6829 9.49347 9.71913 9.05932 8.78286 8.70188C7.0906 8.05584 5.88867 6.41734 5.88867 4.49805C5.88886 2.0139 7.90254 3.29835e-05 10.3867 0Z",fill:"currentColor"})}),jIr={default:"[&>tbody>tr]:h-table-row",small:"[&>tbody>tr]:h-table-row-small"},TIr=({className:e,children:t,size:r="default",style:n})=>o.jsx("table",{className:Z("w-full",jIr[r],e),style:n,children:t}),NIr=({className:e,children:t})=>o.jsx("thead",{children:o.jsx("tr",{className:Z("h-table-header border-b border-border1 bg-surface2/80",e),children:t})}),AIr=({className:e,children:t,...r})=>o.jsx("th",{className:Z("text-neutral2 text-ui-xs h-full whitespace-nowrap text-left font-medium uppercase tracking-wide first:pl-3 last:pr-3",e),...r,children:t}),IIr=({className:e,children:t,...r})=>o.jsx("tbody",{className:Z("",e),...r,children:t}),RIr=b.forwardRef(({className:e,children:t,selected:r=!1,style:n,onClick:s,isActive:a=!1,...i},l)=>{const c=b.useRef(null);b.useEffect(()=>{l&&(typeof l=="function"?l(c.current):l.current=c.current)},[l]),b.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.scrollIntoView({block:"nearest"}))},[a]);const u=d=>{d.key==="Enter"&&s&&s()};return o.jsx("tr",{className:Z("border-b border-border1","transition-colors duration-normal ease-out-custom","hover:bg-surface3","focus:bg-surface3 focus:outline-hidden focus:ring-1 focus:ring-inset focus:ring-accent1/50",r&&"bg-surface4",s&&"cursor-pointer",e),style:n,onClick:s,ref:c,tabIndex:s?0:void 0,onKeyDown:u,"data-active":a||void 0,...i,children:t})}),PIr=({className:e,children:t,...r})=>o.jsx("td",{className:Z("text-neutral5 first:pl-3 last:pr-3",e),...r,children:o.jsx("div",{className:Z("flex h-full w-full shrink-0 items-center"),children:t})}),YNe=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,XNe=Uot,LE=(e,t)=>r=>{var n;if(t?.variants==null)return XNe(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const d=r?.[u],f=a?.[u];if(d===null)return null;const h=YNe(d)||YNe(f);return s[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...a,...l}[g]):{...a,...l}[g]===y})?[...u,f,h]:u},[]);return XNe(e,i,c,r?.class,r?.className)},MIr=LE(Z("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70","min-h-[80px] resize-y"),{variants:{variant:{default:Z(vhe,bhe,xhe),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:"px-2 py-1.5 text-ui-sm",md:"px-3 py-2 text-ui-sm",default:"px-3 py-2 text-ui-md",lg:"px-4 py-3 text-ui-sm"}},defaultVariants:{variant:"default",size:"default"}}),vc=b.forwardRef(({className:e,size:t,testId:r,variant:n,error:s,...a},i)=>o.jsx("textarea",{className:Z(MIr({variant:n,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:i,"aria-invalid":s,...a}));vc.displayName="Textarea";const DIr=kQt,LIr=_Qt,plt=EQt;function $t({open:e,onOpenChange:t,children:r}){return o.jsx(DIr,{open:e,onOpenChange:t,children:r})}const Ehe=b.forwardRef(({className:e,...t},r)=>o.jsx(WGe,{className:Z("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:duration-200","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:duration-150",e),...t,ref:r}));Ehe.displayName=WGe.displayName;const mlt=b.forwardRef(({className:e,...t},r)=>o.jsxs(plt,{children:[o.jsx(Ehe,{}),o.jsx(GGe,{ref:r,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border1 bg-surface3 p-6 shadow-dialog rounded-md","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] data-[state=open]:duration-200","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=closed]:duration-150",e),...t})]}));mlt.displayName=GGe.displayName;const glt=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col space-y-2 text-center sm:text-left",e),...t});glt.displayName="AlertDialogHeader";const ylt=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ylt.displayName="AlertDialogFooter";const vlt=b.forwardRef(({className:e,...t},r)=>o.jsx(XGe,{ref:r,className:Z("text-lg font-semibold",e),...t}));vlt.displayName=XGe.displayName;const blt=b.forwardRef(({className:e,...t},r)=>o.jsx(KGe,{ref:r,className:Z("text-sm text-neutral3",e),...t}));blt.displayName=KGe.displayName;const xlt=b.forwardRef(({className:e,...t},r)=>o.jsx(ZGe,{ref:r,className:Z(ME({variant:"primary",size:"default"}),e),...t}));xlt.displayName=ZGe.displayName;const wlt=b.forwardRef(({className:e,...t},r)=>o.jsx(YGe,{ref:r,className:Z(ME({variant:"default",size:"default"}),"mt-2 sm:mt-0",e),...t}));wlt.displayName=YGe.displayName;$t.Trigger=LIr;$t.Portal=plt;$t.Overlay=Ehe;$t.Content=mlt;$t.Header=glt;$t.Footer=ylt;$t.Title=vlt;$t.Description=blt;$t.Action=xlt;$t.Cancel=wlt;const bi=b.forwardRef(({className:e,...t},r)=>o.jsx(Ice,{ref:r,className:Z("peer h-4 w-4 shrink-0 rounded-sm border border-neutral3","shadow-sm",nn.all,"hover:border-neutral5 hover:shadow-md",nP,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:bg-accent1 data-[state=checked]:border-accent1 data-[state=checked]:text-surface1","data-[state=checked]:shadow-glow-accent1",e),...t,children:o.jsx(rZe,{className:Z("flex items-center justify-center text-current","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:o.jsx(ov,{className:"h-3.5 w-3.5 stroke-3"})})}));bi.displayName=Ice.displayName;const _p=PQt,bh=je.forwardRef(({className:e,children:t,...r},n)=>o.jsx(Pce,{ref:n,className:Z("-outline-offset-2",nn.colors,r0.visible,"hover:text-neutral5","[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom","[&[data-state=open]>svg]:rotate-90",e),...r,children:t}));bh.displayName=Pce.displayName;const xh=je.forwardRef(({className:e,children:t,...r},n)=>o.jsx(Dce,{ref:n,className:Z("overflow-hidden","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-1","duration-normal ease-out-custom",e),...r,children:t}));xh.displayName=Dce.displayName;const yn={root:"flex flex-col gap-1.5",trigger:"w-full min-w-32 justify-between",triggerError:"border-accent2",chevron:"ml-2 h-4 w-4 shrink-0 opacity-50",placeholder:"text-neutral3",popup:Z("min-w-(--anchor-width) w-max max-w-[500px] rounded-md bg-surface3 text-neutral5","shadow-elevated","origin-(--transform-origin)","transition-[transform,scale,opacity] duration-150 ease-out","data-starting-style:scale-95 data-starting-style:opacity-0","data-ending-style:scale-95 data-ending-style:opacity-0"),positioner:"z-50 pointer-events-auto",searchContainer:Z("flex items-center border-b border-border1 px-3 py-2",nn.colors),searchIcon:Z("mr-2 h-4 w-4 shrink-0 text-neutral3",nn.colors),searchInput:Z("flex h-8 w-full rounded-md bg-transparent py-1 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-hidden",nn.colors),empty:"not-empty:block hidden py-6 text-center text-sm text-neutral3",list:"max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",item:Z("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm",nn.colors,"data-highlighted:bg-surface5 data-highlighted:text-neutral5"),itemSelected:"data-selected:bg-accent1Dark data-selected:text-accent1",checkContainer:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center",checkIcon:Z("h-4 w-4 text-accent1",nn.opacity),checkbox:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center rounded border",checkboxSelected:"bg-accent1 border-accent1",checkboxUnselected:"border-border1",checkboxIcon:"h-3 w-3 text-white",optionContent:"flex items-center gap-2 w-full min-w-0",optionText:"flex flex-col gap-0.5 min-w-0",optionLabel:"truncate",optionDescription:"text-xs text-neutral3 truncate",optionEnd:"ml-auto",error:"text-xs text-accent2"};function Zl({options:e,value:t,onValueChange:r,placeholder:n="Select option...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:l=!1,variant:c="inputLike",size:u="default",open:d,onOpenChange:f,container:h,error:p}){const m=e.find(y=>y.value===t)??null,g=y=>{y&&r?.(y.value)};return o.jsxs("div",{className:yn.root,children:[o.jsxs(aYe,{items:e,value:m,onValueChange:g,disabled:l,open:d,onOpenChange:f,children:[o.jsxs(hYe,{className:Z(ME({variant:c,size:u}),yn.trigger,p&&yn.triggerError,i),children:[o.jsxs("span",{className:"truncate flex items-center gap-2",children:[m?.start,o.jsx(dZt,{placeholder:n})]}),o.jsx(B8e,{className:yn.chevron})]}),o.jsx(yYe,{container:h,children:o.jsx(xYe,{align:"start",sideOffset:4,className:yn.positioner,children:o.jsxs(wYe,{className:yn.popup,children:[o.jsxs("div",{className:yn.searchContainer,children:[o.jsx(ix,{className:yn.searchIcon}),o.jsx(fYe,{className:yn.searchInput,placeholder:s})]}),o.jsx(EYe,{className:yn.empty,children:a}),o.jsx(mYe,{className:yn.list,children:y=>o.jsxs(_Ye,{value:y,className:Z(yn.item,yn.itemSelected),children:[o.jsx("span",{className:yn.checkContainer,children:o.jsx(KZt,{children:o.jsx(ov,{className:yn.checkIcon})})}),o.jsxs("span",{className:yn.optionContent,children:[y.start,o.jsxs("span",{className:yn.optionText,children:[o.jsx("span",{className:yn.optionLabel,children:y.label}),y.description&&o.jsx("span",{className:yn.optionDescription,children:y.description})]}),y.end?o.jsx("div",{className:yn.optionEnd,children:y.end}):null]})]},y.value)})]})})})]}),p&&o.jsx("span",{className:yn.error,children:p})]})}function $Ir({options:e,value:t=[],onValueChange:r,placeholder:n="Select options...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:l=!1,variant:c="default",size:u="md",open:d,onOpenChange:f,container:h,error:p}){const m=e.filter(x=>t.includes(x.value)),g=x=>{x&&r?.(x.map(w=>w.value))},y=m.length===0?n:`${m.length} selected`;return o.jsxs("div",{className:yn.root,children:[o.jsxs(aYe,{multiple:!0,items:e,value:m,onValueChange:g,disabled:l,open:d,onOpenChange:f,children:[o.jsxs(hYe,{className:Z(ME({variant:c,size:u}),yn.trigger,p&&yn.triggerError,i),children:[o.jsx("span",{className:Z("truncate",m.length===0&&yn.placeholder),children:y}),o.jsx(B8e,{className:yn.chevron})]}),o.jsx(yYe,{container:h,children:o.jsx(xYe,{align:"start",sideOffset:4,className:yn.positioner,children:o.jsxs(wYe,{className:yn.popup,children:[o.jsxs("div",{className:yn.searchContainer,children:[o.jsx(ix,{className:yn.searchIcon}),o.jsx(fYe,{className:yn.searchInput,placeholder:s})]}),o.jsx(EYe,{className:yn.empty,children:a}),o.jsx(mYe,{className:yn.list,children:x=>{const w=t.includes(x.value);return o.jsxs(_Ye,{value:x,className:yn.item,children:[o.jsx("span",{className:Z(yn.checkbox,w?yn.checkboxSelected:yn.checkboxUnselected),children:w&&o.jsx(ov,{className:yn.checkboxIcon})}),o.jsxs("span",{className:yn.optionContent,children:[x.start,o.jsxs("span",{className:yn.optionText,children:[o.jsx("span",{className:yn.optionLabel,children:x.label}),x.description&&o.jsx("span",{className:yn.optionDescription,children:x.description})]}),x.end?o.jsx("div",{className:yn.optionEnd,children:x.end}):null]})]},x.value)}})]})})})]}),p&&o.jsx("span",{className:yn.error,children:p})]})}const kn=rF,Slt=RGe,FIr=nF,zIr=xR,Olt=b.forwardRef(({className:e,...t},r)=>o.jsx(vR,{ref:r,className:Z("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Olt.displayName=vR.displayName;const wn=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(FIr,{children:[o.jsx(Olt,{}),o.jsxs(bR,{ref:n,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","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","data-[state=closed]:slide-out-to-bottom-4","data-[state=open]:slide-in-from-bottom-4",e),...r,children:[t,o.jsxs(xR,{className:Z("absolute right-4 top-4 rounded-md p-1","text-neutral3 hover:text-neutral6 hover:bg-surface4","transition-all duration-normal ease-out-custom","focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[o.jsx(ff,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wn.displayName=bR.displayName;const _n=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});_n.displayName="DialogHeader";const af=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});af.displayName="DialogFooter";const Vn=({className:e,...t})=>o.jsx("div",{className:Z("overflow-y-auto px-6 max-h-[50vh]",e),...t});Vn.displayName="DialogBody";const Sn=b.forwardRef(({className:e,...t},r)=>o.jsx(sF,{ref:r,className:Z("text-ui-md font-medium",e),...t}));Sn.displayName=sF.displayName;const ea=b.forwardRef(({className:e,...t},r)=>o.jsx(aF,{ref:r,className:Z("sr-only",e),...t}));ea.displayName=aF.displayName;const klt=b.forwardRef(({className:e,...t},r)=>o.jsx(ed,{ref:r,className:Z("flex h-full w-full flex-col overflow-hidden rounded-md bg-surface3 text-neutral5",e),...t}));klt.displayName=ed.displayName;const BIr=({children:e,title:t="Command Palette",description:r="Search for commands and actions",...n})=>{const s=b.useCallback((i,l)=>{const c=i.toLowerCase();return l.toLowerCase().split(/\s+/).filter(Boolean).every(h=>c.includes(h))?1:0},[]),a=b.useCallback(i=>{i.stopPropagation()},[]);return o.jsx(kn,{...n,children:o.jsxs(wn,{className:"overflow-hidden p-0",children:[o.jsx(Sn,{className:"sr-only",children:t}),o.jsx(ea,{className:"sr-only",children:r}),o.jsx(klt,{filter:s,onKeyDown:a,className:Z("**:[[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-neutral3","[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 **:[[cmdk-group]]:px-2","[&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5","**:[[cmdk-input]]:h-12","**:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3","[&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"),children:e})]})})},_lt=b.forwardRef(({className:e,...t},r)=>o.jsxs("div",{className:Z("flex items-center border-b border-border1 px-3",nn.colors),"cmdk-input-wrapper":"",children:[o.jsx(ix,{className:Z("mr-2 h-4 w-4 shrink-0 text-neutral3",nn.colors)}),o.jsx(ed.Input,{ref:r,className:Z("flex h-10 w-full rounded-md bg-transparent py-3 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-hidden",nn.colors,e),...t})]}));_lt.displayName=ed.Input.displayName;const Elt=b.forwardRef(({className:e,...t},r)=>o.jsx(ed.List,{ref:r,className:Z("max-h-dropdown-max-height overflow-y-auto overflow-x-hidden",e),...t}));Elt.displayName=ed.List.displayName;const Clt=b.forwardRef((e,t)=>o.jsx(ed.Empty,{ref:t,className:"py-6 text-center text-sm text-neutral3",...e}));Clt.displayName=ed.Empty.displayName;const vb=b.forwardRef(({className:e,...t},r)=>o.jsx(ed.Group,{ref:r,className:Z("overflow-hidden p-1 text-neutral5","**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-neutral3",e),...t}));vb.displayName=ed.Group.displayName;const tw=b.forwardRef(({className:e,...t},r)=>o.jsx(ed.Separator,{ref:r,className:Z("-mx-1 h-px bg-border1",e),...t}));tw.displayName=ed.Separator.displayName;const Ho=b.forwardRef(({className:e,...t},r)=>o.jsx(ed.Item,{ref:r,className:Z("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden",nn.colors,"data-[selected=true]:bg-surface5 data-[selected=true]:text-neutral5","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Ho.displayName=ed.Item.displayName;const jlt=({className:e,...t})=>o.jsx("span",{className:Z("ml-auto text-xs tracking-widest text-neutral3",e),...t});jlt.displayName="CommandShortcut";function Tlt({children:e,className:t}){return o.jsx("div",{className:Z("border border-border1 rounded-lg p-6 bg-surface2",t),children:e})}const UIr=ZXt,VIr=YXt,qIr=TR,HIr=JXt,QIr=XXt,Nlt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsx(TXe,{ref:n,className:Z("cursor-pointer focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-white/30 focus-visible:rounded-sm",e),...r,children:t}));Nlt.displayName=TXe.displayName;const Alt=b.forwardRef(({className:e,inset:t,children:r,...n},s)=>o.jsxs(DXe,{ref:s,className:Z("hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-[state=open]:bg-surface4 flex cursor-default select-none items-center rounded-md px-2 py-1.5 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 focus-visible:outline-hidden focus-visible:ring-0",t&&"pl-8",e),...n,children:[r,o.jsx($8e,{className:"ml-auto -rotate-90"})]}));Alt.displayName=DXe.displayName;const Ilt=b.forwardRef(({className:e,...t},r)=>o.jsx(NR,{ref:r,className:Z("bg-surface3 backdrop-blur-xl data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 z-50 min-w-32 overflow-auto overflow-x-hidden rounded-lg",e),...t}));Ilt.displayName=NR.displayName;const Rlt=b.forwardRef(({className:e,container:t,sideOffset:r=8,...n},s)=>o.jsx(TR,{container:t,children:o.jsx(NXe,{ref:s,sideOffset:r,className:Z("bg-surface3 data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 backdrop-blur-xl text-neutral4 z-50 min-w-32 overflow-auto rounded-lg p-2 shadow-md",e),...n})}));Rlt.displayName=NXe.displayName;const Plt=b.forwardRef(({className:e,...t},r)=>o.jsx(IXe,{ref:r,className:Z("relative flex cursor-pointer select-none items-center gap-3 rounded-md px-2 py-1.5 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-disabled:pointer-events-none data-disabled:opacity-50 [&>span]:truncate [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-hidden focus-visible:ring-0","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-50 [&>svg]:mx-[-.25em] [&:hover>svg]:opacity-100",e),...t}));Plt.displayName=IXe.displayName;const Mlt=b.forwardRef(({className:e,children:t,checked:r,...n},s)=>o.jsxs(RXe,{ref:s,className:Z("hover:bg-surface4 focus:bg-surface4 active:bg-surface5 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 relative flex w-full cursor-pointer select-none items-center gap-4 rounded-md px-2 py-1.5 text-sm transition-colors text-neutral4 data-disabled:pointer-events-none data-disabled:opacity-50 focus-visible:outline-hidden focus-visible:ring-0",e),checked:r,...n,children:[o.jsx("div",{className:"border dark:border-white/20 border-black/20 flex h-4 w-4 items-center justify-center rounded-sm",children:r&&o.jsx(ov,{})}),t]}));Mlt.displayName=RXe.displayName;const Dlt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(PXe,{ref:n,className:Z("relative flex cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-disabled:pointer-events-none data-disabled:opacity-50 focus-visible:outline-hidden focus-visible:ring-0",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(KXt,{children:o.jsx(V8e,{className:"h-2 w-2 fill-current"})})}),t]}));Dlt.displayName=PXe.displayName;const Llt=b.forwardRef(({className:e,inset:t,...r},n)=>o.jsx(AXe,{ref:n,className:Z("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Llt.displayName=AXe.displayName;const $lt=b.forwardRef(({className:e,...t},r)=>o.jsx(MXe,{ref:r,className:Z("dark:bg-white/10 bg-black/10 -mx-1 my-1 h-px",e),...t}));$lt.displayName=MXe.displayName;const Flt=({className:e,...t})=>o.jsx("span",{className:Z("ml-auto text-xs tracking-widest opacity-60",e),...t});Flt.displayName="DropdownMenuShortcut";function dt({open:e,onOpenChange:t,children:r,modal:n}){return o.jsx(UIr,{modal:n,open:e,onOpenChange:t,children:r})}dt.Trigger=Nlt;dt.Content=Rlt;dt.Group=VIr;dt.Portal=qIr;dt.Item=Plt;dt.CheckboxItem=Mlt;dt.RadioItem=Dlt;dt.Label=Llt;dt.Separator=$lt;dt.Shortcut=Flt;dt.Sub=HIr;dt.SubContent=Ilt;dt.SubTrigger=Alt;dt.RadioGroup=QIr;const A2=({label:e,children:t})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{as:"p",variant:"ui-md",className:"text-neutral3",children:e}),t]});function In({className:e,...t}){return o.jsx("div",{className:Z("rounded-md bg-surface4 relative overflow-hidden","before:absolute before:inset-0","before:-translate-x-full","before:animate-[shimmer_2s_infinite]","before:bg-linear-to-r before:from-transparent before:via-surface5/20 before:to-transparent",e),...t})}const zlt=({icon:e,title:t,isLoading:r,children:n})=>o.jsxs("div",{className:"p-5 w-full overflow-x-hidden",children:[o.jsxs("div",{className:"text-neutral6 flex items-center gap-2",children:[o.jsx(Ce,{size:"lg",className:"bg-surface4 rounded-md p-1",children:e}),r?o.jsx(In,{className:"h-3 w-1/3"}):o.jsx("div",{className:"flex min-w-0 items-center gap-4",children:o.jsx(me,{variant:"header-md",as:"h2",className:"truncate font-medium",children:t})})]}),n&&o.jsx("div",{className:"pt-2",children:n})]});function WIr({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-2 text-neutral4",t),children:e})}function GIr({children:e}){return o.jsxs("p",{className:Z("text-ui-sm text-neutral4 flex items-center gap-2","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-70 [&>svg]:text-red-400"),children:[o.jsx(KI,{})," ",e]})}function ZIr({children:e}){return o.jsx("p",{className:"text-neutral3 text-ui-sm",children:e})}function YIr({children:e,name:t,required:r,size:n="default",className:s}){return o.jsxs("label",{htmlFor:`input-${t}`,className:Z("text-ui-smd text-neutral3 flex justify-between items-center ","in-[.horizontal-field-block]:grid in-[.horizontal-field-block]:content-start",{"text-ui-md":n==="bigger"},s),children:[e,r&&o.jsx("i",{className:"text-neutral2 text-xs",children:"(required)"})]})}function XIr({children:e,className:t,layout:r="vertical",labelColumnWidth:n}){return o.jsx("div",{className:Z("grid gap-2 text-neutral4",{"horizontal-field-block grid-cols-[auto_1fr] items-baseline":r==="horizontal"},t),style:r==="horizontal"&&n?{gridTemplateColumns:`${n} 1fr`}:void 0,children:e})}const lo=Object.assign({},{Layout:XIr,Column:WIr,Label:YIr,HelpText:ZIr,ErrorMsg:GIr});function KIr({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-6 content-start",t),children:e})}function JIr({children:e,className:t,columns:r=1,gap:n}){return o.jsx("div",{className:Z("grid",{"grid-cols-1":r===1,"grid-cols-2":r===2},n??"gap-6",t),children:e})}Object.assign(JIr,{Column:KIr});const eRr=LE(Z("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70"),{variants:{variant:{default:Z(vhe,bhe,xhe),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${pc.sm} text-ui-sm px-[.75em]`,md:`${pc.md} text-ui-md px-[.75em]`,default:`${pc.default} text-ui-md px-[.85em]`,lg:`${pc.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),cr=b.forwardRef(({className:e,size:t,testId:r,variant:n,type:s,error:a,...i},l)=>o.jsx("input",{type:s,className:Z(eRr({variant:n,size:t}),a&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:l,"aria-invalid":a,...i}));cr.displayName="Input";function Ex({name:e,value:t,label:r,labelIsHidden:n=!1,labelColumnWidth:s,helpText:a,errorMsg:i,required:l=!1,disabled:c=!1,labelSize:u,layout:d="vertical",placeholder:f,size:h="default",testId:p,className:m,...g}){return o.jsxs(lo.Layout,{layout:d,labelColumnWidth:s,className:m,children:[d==="horizontal"?o.jsx(lo.Column,{children:o.jsx(lo.Label,{name:e,required:l,size:u||"bigger",children:n?o.jsx(Wu,{children:r}):r})}):null,o.jsxs(lo.Column,{children:[!n&&d==="vertical"?o.jsx(lo.Label,{name:e,required:l,size:u||"default",children:r}):null,o.jsx(cr,{name:e,disabled:c,required:l,value:t,placeholder:f,"data-testid":p,size:h,...g}),a&&o.jsx(lo.HelpText,{children:a}),i&&o.jsx(lo.ErrorMsg,{children:i})]})]})}function Cx({name:e,helpText:t,errorMsg:r,required:n=!1,disabled:s=!1,value:a,label:i,labelIsHidden:l=!1,layout:c="vertical",placeholder:u="Search...",onChange:d,onReset:f,className:h,size:p,isMinimized:m,onMinimizedChange:g}){const y=b.useRef(null);return b.useEffect(()=>{m===!1&&y.current?.focus()},[m]),m?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(ve,{size:p||"sm","aria-label":i||"Search",disabled:s,onClick:()=>g?.(!1),children:o.jsx(ix,{})})}),o.jsx(Wr,{children:i||"Search"})]}):o.jsxs(lo.Layout,{layout:c,className:h,children:[c==="horizontal"?o.jsx(lo.Column,{children:o.jsx(lo.Label,{name:e,required:n,children:l?o.jsx(Wu,{children:i}):i})}):null,o.jsxs(lo.Column,{children:[c==="vertical"&&i&&!l?o.jsx(lo.Label,{name:e,required:n,children:i}):null,o.jsxs("div",{className:"relative group",children:[o.jsx(cr,{ref:y,name:e,disabled:s,value:a,placeholder:u,onChange:d,size:p,className:Z(p==="sm"&&"pl-8 pr-8",p==="md"&&"pl-9 pr-9",(!p||p==="default")&&"pl-10 pr-10",p==="lg"&&"pl-11 pr-11")}),o.jsx(ix,{"aria-hidden":"true",className:Z("text-neutral4 opacity-50 group-has-focus:opacity-100 absolute left-3 top-1/2 -translate-y-1/2",p==="sm"&&"w-3.5 h-3.5",p==="md"&&"w-4 h-4",(!p||p==="default")&&"w-[1.125rem] h-[1.125rem]",p==="lg"&&"w-5 h-5")}),f&&(a||m===!1)&&o.jsx(ve,{variant:"ghost",size:p||"default","aria-label":"Clear search",onClick:()=>{a&&f(),m===!1&&g?.(!0)},className:"absolute top-1/2 right-0 -translate-y-1/2",children:o.jsx(ff,{})})]}),t&&o.jsx(lo.HelpText,{children:t}),r&&o.jsx(lo.ErrorMsg,{children:r})]})]})}const ci=jKt,ui=TKt,Xa=b.forwardRef(({className:e,children:t,variant:r="inputLike",size:n="default",...s},a)=>o.jsxs(oKe,{ref:a,className:Z(ME({variant:r,size:n}),"justify-between [&>svg]:opacity-100",e),...s,children:[t,o.jsx(NKt,{asChild:!0,children:o.jsx($8e,{className:Z("h-4 w-4 text-neutral3",nn.colors)})})]}));Xa.displayName=oKe.displayName;const Ka=b.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>o.jsx(AKt,{children:o.jsx(lKe,{ref:s,className:Z("relative z-50 min-w-32 max-h-dropdown-max-height overflow-y-auto overflow-x-hidden rounded-md border border-border1 bg-surface3 text-neutral5 shadow-md 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 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",r==="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",e),position:r,...n,children:o.jsx(IKt,{className:Z("p-1",r==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"),children:t})})}));Ka.displayName=lKe.displayName;const rs=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(cKe,{ref:n,className:Z("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-neutral5 text-sm",nn.colors,"hover:bg-surface5 hover:text-neutral5","focus:bg-surface5 focus:text-neutral5","data-[state=checked]:bg-accent1Dark data-[state=checked]:text-accent1","data-disabled:pointer-events-none data-disabled:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(PKt,{children:o.jsx(ov,{className:"h-4 w-4 text-accent1"})})}),o.jsx(RKt,{children:t})]}));rs.displayName=cKe.displayName;function Po({name:e,helpText:t,errorMsg:r,required:n=!1,disabled:s=!1,size:a="default",value:i,label:l,labelIsHidden:c=!1,layout:u="vertical",labelColumnWidth:d,options:f,placeholder:h="Select an option",onValueChange:p,className:m}){return o.jsxs(lo.Layout,{layout:u,labelColumnWidth:d,className:m,children:[u==="horizontal"?o.jsx(lo.Column,{children:o.jsx(lo.Label,{name:e,required:n,children:c?o.jsx(Wu,{children:l}):l})}):null,o.jsxs(lo.Column,{children:[u==="vertical"&&l&&!c?o.jsx(lo.Label,{name:e,required:n,children:l}):null,o.jsxs(ci,{"aria-label":c?l:void 0,name:e,value:i,onValueChange:p,disabled:s,children:[o.jsx(Xa,{size:a,children:o.jsx(ui,{placeholder:h})}),o.jsx(Ka,{children:f.map(g=>o.jsx(rs,{value:g.value,children:g.label},g.value))})]}),t&&o.jsx(lo.HelpText,{children:t}),r&&o.jsx(lo.ErrorMsg,{children:r})]})]})}const tRr={sm:`${pc.sm} w-form-sm`,md:`${pc.md} w-form-md`,lg:`${pc.lg} w-form-lg`,default:`${pc.default}`},rRr={sm:"sm",md:"default",lg:"lg",default:"default"},nRr={default:"bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",light:"bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",outline:"bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"bg-transparent border-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-accent1 hover:bg-accent1/90 text-surface1 font-medium hover:shadow-glow-accent1 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none"},sRr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",Rn=je.forwardRef(({className:e,children:t,tooltip:r,size:n="md",variant:s="default",disabled:a,...i},l)=>o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("button",{ref:l,disabled:a,"aria-label":typeof r=="string"?r:void 0,className:Z(sRr,nP,nRr[s],tRr[n],a&&"active:scale-100",e),...i,children:o.jsx(Ce,{size:rRr[n],children:t})})}),o.jsx(Wr,{children:r})]}));Rn.displayName="IconButton";const aRr=LE("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=b.forwardRef(({className:e,...t},r)=>o.jsx(dKe,{ref:r,className:Z(aRr(),e),...t}));xt.displayName=dKe.displayName;function __({children:e}){const t=e.replace(/\\n/g,`
287
+ `).concat(k.x,",").concat(k.y),E=wl(e.id)?pA("recharts-radial-line-"):e.id;return b.createElement("text",by({},n,{dominantBaseline:"central",className:ya("recharts-radial-bar-label",i)}),b.createElement("defs",null,b.createElement("path",{id:E,d:_})),b.createElement("textPath",{xlinkHref:"#".concat(E)},r))},D_r=(e,t,r)=>{var{cx:n,cy:s,innerRadius:a,outerRadius:i,startAngle:l,endAngle:c}=e,u=(l+c)/2;if(r==="outside"){var{x:d,y:f}=Vl(n,s,i+t,u);return{x:d,y:f,textAnchor:d>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:s,textAnchor:"middle",verticalAnchor:"end"};var h=(a+i)/2,{x:p,y:m}=Vl(n,s,h,u);return{x:p,y:m,textAnchor:"middle",verticalAnchor:"middle"}},WL=e=>e!=null&&"cx"in e&&Ur(e.cx),L_r={angle:0,offset:5,zIndex:Qc.label,position:"middle",textBreakAll:!1};function $_r(e){if(!WL(e))return e;var{cx:t,cy:r,outerRadius:n}=e,s=n*2;return{x:t-n,y:r-n,width:s,upperWidth:s,lowerWidth:s,height:s}}function _b(e){var t=td(e,L_r),{viewBox:r,parentViewBox:n,position:s,value:a,children:i,content:l,className:c="",textBreakAll:u,labelRef:d}=t,f=I_r(),h=zit(),p=s==="center"?h:f??h,m,g,y;r==null?m=p:WL(r)?m=r:m=Zde(r);var x=$_r(m);if(!m||wl(a)&&wl(i)&&!b.isValidElement(l)&&typeof l!="function")return null;var w=uT(uT({},t),{},{viewBox:m});if(b.isValidElement(l)){var{labelRef:O}=w,k=$Te(w,k_r);return b.cloneElement(l,k)}if(typeof l=="function"){var{content:_}=w,E=$Te(w,__r);if(g=b.createElement(l,E),b.isValidElement(g))return g}else g=R_r(t);var T=eu(t);if(WL(m)){if(s==="insideStart"||s==="insideEnd"||s==="end")return M_r(t,s,g,T,m);y=D_r(m,t.offset,t.position)}else{if(!x)return null;var j=O_r({viewBox:x,position:s,offset:t.offset,parentViewBox:WL(n)?void 0:n});y=uT(uT({x:j.x,y:j.y,textAnchor:j.horizontalAnchor,verticalAnchor:j.verticalAnchor},j.width!==void 0?{width:j.width}:{}),j.height!==void 0?{height:j.height}:{})}return b.createElement(Ov,{zIndex:t.zIndex},b.createElement(the,by({ref:d,className:ya("recharts-label",c)},T,y,{textAnchor:Mit(T.textAnchor)?T.textAnchor:y.textAnchor,breakAll:u}),g))}_b.displayName="Label";var F_r=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?b.createElement(_b,by({key:"label-implicit"},n)):eg(e)?b.createElement(_b,by({key:"label-implicit",value:e},n)):b.isValidElement(e)?e.type===_b?b.cloneElement(e,uT({key:"label-implicit"},n)):b.createElement(_b,by({key:"label-implicit",content:e},n)):rhe(e)?b.createElement(_b,by({key:"label-implicit",content:e},n)):e&&typeof e=="object"?b.createElement(_b,by({},e,{key:"label-implicit"},n)):null};function z_r(e){var{label:t,labelRef:r}=e,n=zit();return F_r(t,n,r)||null}var B_r=["valueAccessor"],U_r=["dataKey","clockWise","id","textBreakAll","zIndex"];function $5(){return $5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$5.apply(null,arguments)}function zTe(e,t){if(e==null)return{};var r,n,s=V_r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function V_r(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var q_r=e=>{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(m_r(t))return t},Bit=b.createContext(void 0),H_r=Bit.Provider,Uit=b.createContext(void 0);Uit.Provider;function Q_r(){return b.useContext(Bit)}function W_r(){return b.useContext(Uit)}function GL(e){var{valueAccessor:t=q_r}=e,r=zTe(e,B_r),{dataKey:n,clockWise:s,id:a,textBreakAll:i,zIndex:l}=r,c=zTe(r,U_r),u=Q_r(),d=W_r(),f=u||d;return!f||!f.length?null:b.createElement(Ov,{zIndex:l??Qc.label},b.createElement(Qy,{className:"recharts-label-list"},f.map((h,p)=>{var m,g=wl(n)?t(h,p):Gl(h.payload,n),y=wl(a)?{}:{id:"".concat(a,"-").concat(p)};return b.createElement(_b,$5({key:"label-".concat(p)},eu(h),c,y,{fill:(m=r.fill)!==null&&m!==void 0?m:h.fill,parentViewBox:h.parentViewBox,value:g,textBreakAll:i,viewBox:h.viewBox,index:p,zIndex:0}))})))}GL.displayName="LabelList";function G_r(e){var{label:t}=e;return t?t===!0?b.createElement(GL,{key:"labelList-implicit"}):b.isValidElement(t)||rhe(t)?b.createElement(GL,{key:"labelList-implicit",content:t}):typeof t=="object"?b.createElement(GL,$5({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Bse(){return Bse=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bse.apply(null,arguments)}var Vit=e=>{var{cx:t,cy:r,r:n,className:s}=e,a=ya("recharts-dot",s);return Ur(t)&&Ur(r)&&Ur(n)?b.createElement("circle",Bse({},Jm(e),zde(e),{className:a,cx:t,cy:r,r:n})):null},Z_r={radiusAxis:{},angleAxis:{}},qit=_c({name:"polarAxis",initialState:Z_r,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:QAn,removeRadiusAxis:WAn,addAngleAxis:GAn,removeAngleAxis:ZAn}=qit.actions,Y_r=qit.reducer;function X_r(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var $q={exports:{}},Ks={};var BTe;function K_r(){if(BTe)return Ks;BTe=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function g(y){if(typeof y=="object"&&y!==null){var x=y.$$typeof;switch(x){case e:switch(y=y.type,y){case r:case s:case n:case u:case d:return y;default:switch(y=y&&y.$$typeof,y){case l:case i:case c:case h:case f:case a:return y;default:return x}}case t:return x}}}return Ks.ContextConsumer=i,Ks.ContextProvider=a,Ks.Element=e,Ks.ForwardRef=c,Ks.Fragment=r,Ks.Lazy=h,Ks.Memo=f,Ks.Portal=t,Ks.Profiler=s,Ks.StrictMode=n,Ks.Suspense=u,Ks.SuspenseList=d,Ks.isAsyncMode=function(){return!1},Ks.isConcurrentMode=function(){return!1},Ks.isContextConsumer=function(y){return g(y)===i},Ks.isContextProvider=function(y){return g(y)===a},Ks.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},Ks.isForwardRef=function(y){return g(y)===c},Ks.isFragment=function(y){return g(y)===r},Ks.isLazy=function(y){return g(y)===h},Ks.isMemo=function(y){return g(y)===f},Ks.isPortal=function(y){return g(y)===t},Ks.isProfiler=function(y){return g(y)===s},Ks.isStrictMode=function(y){return g(y)===n},Ks.isSuspense=function(y){return g(y)===u},Ks.isSuspenseList=function(y){return g(y)===d},Ks.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===r||y===s||y===n||y===u||y===d||y===p||typeof y=="object"&&y!==null&&(y.$$typeof===h||y.$$typeof===f||y.$$typeof===a||y.$$typeof===i||y.$$typeof===c||y.$$typeof===m||y.getModuleId!==void 0)},Ks.typeOf=g,Ks}var UTe;function J_r(){return UTe||(UTe=1,$q.exports=K_r()),$q.exports}J_r();var Hit=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,Fq={},VTe;function eEr(){return VTe||(VTe=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const s=r[Symbol.toStringTag];return s==null||!Object.getOwnPropertyDescriptor(r,Symbol.toStringTag)?.writable?!1:r.toString()===`[object ${s}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(Fq)),Fq}var zq,qTe;function tEr(){return qTe||(qTe=1,zq=eEr().isPlainObject),zq}var rEr=tEr();const nEr=$o(rEr);var HTe,QTe,WTe,GTe,ZTe;function YTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function XTe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YTe(Object(r),!0).forEach(function(n){sEr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sEr(e,t,r){return(t=aEr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aEr(e){var t=iEr(e,"string");return typeof t=="symbol"?t:t+""}function iEr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function F5(){return F5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},F5.apply(null,arguments)}function Oj(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var KTe=(e,t,r,n,s)=>{var a=r-n,i;return i=Ui(HTe||(HTe=Oj(["M ",",",""])),e,t),i+=Ui(QTe||(QTe=Oj(["L ",",",""])),e+r,t),i+=Ui(WTe||(WTe=Oj(["L ",",",""])),e+r-a/2,t+s),i+=Ui(GTe||(GTe=Oj(["L ",",",""])),e+r-a/2-n,t+s),i+=Ui(ZTe||(ZTe=Oj(["L ",","," Z"])),e,t),i},oEr={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},lEr=e=>{var t=td(e,oEr),{x:r,y:n,upperWidth:s,lowerWidth:a,height:i,className:l}=t,{animationEasing:c,animationDuration:u,animationBegin:d,isUpdateAnimationActive:f}=t,h=b.useRef(null),[p,m]=b.useState(-1),g=b.useRef(s),y=b.useRef(a),x=b.useRef(i),w=b.useRef(r),O=b.useRef(n),k=Jde(e,"trapezoid-");if(b.useEffect(()=>{if(h.current&&h.current.getTotalLength)try{var D=h.current.getTotalLength();D&&m(D)}catch{}},[]),r!==+r||n!==+n||s!==+s||a!==+a||i!==+i||s===0&&a===0||i===0)return null;var _=ya("recharts-trapezoid",l);if(!f)return b.createElement("g",null,b.createElement("path",F5({},eu(t),{className:_,d:KTe(r,n,s,a,i)})));var E=g.current,T=y.current,j=x.current,A=w.current,I=O.current,P="0px ".concat(p===-1?1:p,"px"),R="".concat(p,"px ").concat(p,"px"),B=ost(["strokeDasharray"],u,c);return b.createElement(Kde,{animationId:k,key:k,canBegin:p>0,duration:u,easing:c,isActive:f,begin:d},D=>{var F=Au(E,s,D),U=Au(T,a,D),z=Au(j,i,D),V=Au(A,r,D),W=Au(I,n,D);h.current&&(g.current=F,y.current=U,x.current=z,w.current=V,O.current=W);var L=D>0?{transition:B,strokeDasharray:R}:{strokeDasharray:P};return b.createElement("path",F5({},eu(t),{className:_,d:KTe(V,W,F,U,z),ref:h,style:XTe(XTe({},L),t.style)}))})},cEr=["option","shapeType","activeClassName","inActiveClassName"];function uEr(e,t){if(e==null)return{};var r,n,s=dEr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function dEr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function JTe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function z5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?JTe(Object(r),!0).forEach(function(n){fEr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JTe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fEr(e,t,r){return(t=hEr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hEr(e){var t=pEr(e,"string");return typeof t=="symbol"?t:t+""}function pEr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mEr(e,t){return z5(z5({},t),e)}function gEr(e,t){return e==="symbols"}function eNe(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return b.createElement(dst,r);case"trapezoid":return b.createElement(lEr,r);case"sector":return b.createElement(pst,r);case"symbols":if(gEr(t))return b.createElement(Xrt,r);break;case"curve":return b.createElement(ist,r);default:return null}}function yEr(e){return b.isValidElement(e)?e.props:e}function vEr(e){var{option:t,shapeType:r,activeClassName:n="recharts-active-shape",inActiveClassName:s="recharts-shape"}=e,a=uEr(e,cEr),i;if(b.isValidElement(t))i=b.cloneElement(t,z5(z5({},a),yEr(t)));else if(typeof t=="function")i=t(a,a.index);else if(nEr(t)&&typeof t!="boolean"){var l=mEr(t,a);i=b.createElement(eNe,{shapeType:r,elementProps:l})}else{var c=a;i=b.createElement(eNe,{shapeType:r,elementProps:c})}return a.isActive?b.createElement(Qy,{className:n},i):b.createElement(Qy,{className:s},i)}function bEr(e){var{tooltipEntrySettings:t}=e,r=Fo(),n=rd(),s=b.useRef(null);return b.useLayoutEffect(()=>{n||(s.current===null?r(C1r(t)):s.current!==t&&r(j1r({prev:s.current,next:t})),s.current=t)},[t,r,n]),b.useLayoutEffect(()=>()=>{s.current&&(r(T1r(s.current)),s.current=null)},[r]),null}function xEr(e){var{legendPayload:t}=e,r=Fo(),n=rd(),s=b.useRef(null);return b.useLayoutEffect(()=>{n||(s.current===null?r(Uvr(t)):s.current!==t&&r(Vvr({prev:s.current,next:t})),s.current=t)},[r,n,t]),b.useLayoutEffect(()=>()=>{s.current&&(r(qvr(s.current)),s.current=null)},[r]),null}var Bq,wEr=()=>{var[e]=b.useState(()=>pA("uid-"));return e},SEr=(Bq=LS.useId)!==null&&Bq!==void 0?Bq:wEr;function OEr(e,t){var r=SEr();return t||(e?"".concat(e,"-").concat(r):r)}var kEr=b.createContext(void 0),_Er=e=>{var{id:t,type:r,children:n}=e,s=OEr("recharts-".concat(r),t);return b.createElement(kEr.Provider,{value:s},n(s))},EEr={cartesianItems:[],polarItems:[]},Qit=_c({name:"graphicalItems",initialState:EEr,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:ai()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,s=oh(e).cartesianItems.indexOf(r);s>-1&&(e.cartesianItems[s]=n)},prepare:ai()},removeCartesianGraphicalItem:{reducer(e,t){var r=oh(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:ai()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:ai()},removePolarGraphicalItem:{reducer(e,t){var r=oh(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:ai()},replacePolarGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,s=oh(e).polarItems.indexOf(r);s>-1&&(e.polarItems[s]=n)},prepare:ai()}}}),{addCartesianGraphicalItem:CEr,replaceCartesianGraphicalItem:jEr,removeCartesianGraphicalItem:TEr,addPolarGraphicalItem:YAn,removePolarGraphicalItem:XAn,replacePolarGraphicalItem:KAn}=Qit.actions,NEr=Qit.reducer,AEr=e=>{var t=Fo(),r=b.useRef(null);return b.useLayoutEffect(()=>{r.current===null?t(CEr(e)):r.current!==e&&t(jEr({prev:r.current,next:e})),r.current=e},[t,e]),b.useLayoutEffect(()=>()=>{r.current&&(t(TEr(r.current)),r.current=null)},[t]),null},IEr=b.memo(AEr),REr=["points"];function tNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Uq(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tNe(Object(r),!0).forEach(function(n){PEr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PEr(e,t,r){return(t=MEr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MEr(e){var t=DEr(e,"string");return typeof t=="symbol"?t:t+""}function DEr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function B5(){return B5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},B5.apply(null,arguments)}function LEr(e,t){if(e==null)return{};var r,n,s=$Er(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function $Er(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function FEr(e){var{option:t,dotProps:r,className:n}=e;if(b.isValidElement(t))return b.cloneElement(t,r);if(typeof t=="function")return t(r);var s=ya(n,typeof t!="boolean"?t.className:""),a=r??{},{points:i}=a,l=LEr(a,REr);return b.createElement(Vit,B5({},l,{className:s}))}function zEr(e,t){return e==null?!1:t?!0:e.length===1}function BEr(e){var{points:t,dot:r,className:n,dotClassName:s,dataKey:a,baseProps:i,needClip:l,clipPathId:c,zIndex:u=Qc.scatter}=e;if(!zEr(t,r))return null;var d=Hit(r),f=Jpr(r),h=t.map((m,g)=>{var y,x,w=Uq(Uq(Uq({r:3},i),f),{},{index:g,cx:(y=m.x)!==null&&y!==void 0?y:void 0,cy:(x=m.y)!==null&&x!==void 0?x:void 0,dataKey:a,value:m.value,payload:m.payload,points:t});return b.createElement(FEr,{key:"dot-".concat(g),option:r,dotProps:w,className:s})}),p={};return l&&c!=null&&(p.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(c,")")),b.createElement(Ov,{zIndex:u},b.createElement(Qy,B5({className:n},p),h))}function rNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function nNe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rNe(Object(r),!0).forEach(function(n){UEr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function UEr(e,t,r){return(t=VEr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VEr(e){var t=qEr(e,"string");return typeof t=="symbol"?t:t+""}function qEr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var HEr={xAxis:{},yAxis:{},zAxis:{}},Wit=_c({name:"cartesianAxis",initialState:HEr,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:ai()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.xAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:ai()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:ai()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:ai()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.yAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:ai()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:ai()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:ai()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.zAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:ai()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:ai()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,s=e.yAxis[r];if(s){var a,i=s.widthHistory||[];if(i.length===3&&i[0]===i[2]&&n===i[1]&&n!==s.width&&Math.abs(n-((a=i[0])!==null&&a!==void 0?a:0))<=1)return;var l=[...i,n].slice(-3);e.yAxis[r]=nNe(nNe({},s),{},{width:n,widthHistory:l})}}}}),{addXAxis:QEr,replaceXAxis:WEr,removeXAxis:GEr,addYAxis:ZEr,replaceYAxis:YEr,removeYAxis:XEr,addZAxis:JAn,replaceZAxis:eIn,removeZAxis:tIn,updateYAxisWidth:KEr}=Wit.actions,JEr=Wit.reducer,eCr=et([Kl],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),tCr=et([eCr,yv,vv],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),nhe=()=>Jr(tCr),rCr=()=>Jr(COr);function sNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Vq(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sNe(Object(r),!0).forEach(function(n){nCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function nCr(e,t,r){return(t=sCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sCr(e){var t=aCr(e,"string");return typeof t=="symbol"?t:t+""}function aCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iCr=e=>{var{point:t,childIndex:r,mainColor:n,activeDot:s,dataKey:a,clipPath:i}=e;if(s===!1||t.x==null||t.y==null)return null;var l={index:r,dataKey:a,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},c=Vq(Vq(Vq({},l),HF(s)),zde(s)),u;return b.isValidElement(s)?u=b.cloneElement(s,c):typeof s=="function"?u=s(c):u=b.createElement(Vit,c),b.createElement(Qy,{className:"recharts-active-dot",clipPath:i},u)};function oCr(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:s,clipPath:a,zIndex:i=Qc.activeDot}=e,l=Jr(EA),c=rCr();if(t==null||c==null)return null;var u=t.find(d=>c.includes(d.payload));return wl(u)?null:b.createElement(Ov,{zIndex:i},b.createElement(iCr,{point:u,childIndex:Number(l),mainColor:r,dataKey:s,activeDot:n,clipPath:a}))}var lCr=e=>{var{chartData:t}=e,r=Fo(),n=rd();return b.useEffect(()=>n?()=>{}:(r(STe(t)),()=>{r(STe(void 0))}),[t,r,n]),null},aNe={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},Git=_c({name:"brush",initialState:aNe,reducers:{setBrushSettings(e,t){return t.payload==null?aNe:t.payload}}}),{setBrushSettings:rIn}=Git.actions,cCr=Git.reducer;function uCr(e){return(e%180+180)%180}var dCr=function(t){var{width:r,height:n}=t,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=uCr(s),i=a*Math.PI/180,l=Math.atan(n/r),c=i>l&&i<Math.PI-l?n/Math.sin(i):r/Math.cos(i);return Math.abs(c)},fCr={dots:[],areas:[],lines:[]},Zit=_c({name:"referenceElements",initialState:fCr,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=oh(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=oh(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=oh(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:nIn,removeDot:sIn,addArea:aIn,removeArea:iIn,addLine:oIn,removeLine:lIn}=Zit.actions,hCr=Zit.reducer,pCr=b.createContext(void 0),mCr=e=>{var{children:t}=e,[r]=b.useState("".concat(pA("recharts"),"-clip")),n=nhe();if(n==null)return null;var{x:s,y:a,width:i,height:l}=n;return b.createElement(pCr.Provider,{value:r},b.createElement("defs",null,b.createElement("clipPath",{id:r},b.createElement("rect",{x:s,y:a,height:l,width:i}))),t)};function Yit(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t){var s=e[n];s!==void 0&&r.push(s)}return r}function gCr(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return dCr(n,r)}function yCr(e,t,r){var n=r==="width",{x:s,y:a,width:i,height:l}=e;return t===1?{start:n?s:a,end:n?s+i:a+l}:{start:n?s+i:a+l,end:n?s:a}}function jA(e,t,r,n,s){if(e*t<e*n||e*t>e*s)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-s)<=0}function vCr(e,t){return Yit(e,t+1)}function bCr(e,t,r,n,s){for(var a=(n||[]).slice(),{start:i,end:l}=t,c=0,u=1,d=i,f=function(){var m=n?.[c];if(m===void 0)return{v:Yit(n,u)};var g=c,y,x=()=>(y===void 0&&(y=r(m,g)),y),w=m.coordinate,O=c===0||jA(e,w,x,d,l);O||(c=0,d=i,u+=1),O&&(d=w+e*(x()/2+s),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function xCr(e,t,r,n,s){var a=(n||[]).slice(),i=a.length;if(i===0)return[];for(var{start:l,end:c}=t,u=1;u<=i;u++){for(var d=(i-1)%u,f=l,h=!0,p=function(){var k=n[g];if(k==null)return 0;var _=g,E,T=()=>(E===void 0&&(E=r(k,_)),E),j=k.coordinate,A=g===d||jA(e,j,T,f,c);if(!A)return h=!1,1;A&&(f=j+e*(T()/2+s))},m,g=d;g<i&&(m=p(),!(m!==0&&m===1));g+=u);if(h){for(var y=[],x=d;x<i;x+=u){var w=n[x];w!=null&&y.push(w)}return y}}return[]}function iNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function nc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iNe(Object(r),!0).forEach(function(n){wCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wCr(e,t,r){return(t=SCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SCr(e){var t=OCr(e,"string");return typeof t=="symbol"?t:t+""}function OCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kCr(e,t,r,n,s){for(var a=(n||[]).slice(),i=a.length,{start:l}=t,{end:c}=t,u=function(h){var p=a[h];if(p==null)return 1;var m=p,g,y=()=>(g===void 0&&(g=r(p,h)),g);if(h===i-1){var x=e*(m.coordinate+e*y()/2-c);a[h]=m=nc(nc({},m),{},{tickCoord:x>0?m.coordinate-x*e:m.coordinate})}else a[h]=m=nc(nc({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var w=jA(e,m.tickCoord,y,l,c);w&&(c=m.tickCoord-e*(y()/2+s),a[h]=nc(nc({},m),{},{isShow:!0}))}},d=i-1;d>=0;d--)u(d);return a}function _Cr(e,t,r,n,s,a){var i=(n||[]).slice(),l=i.length,{start:c,end:u}=t;if(a){var d=n[l-1];if(d!=null){var f=r(d,l-1),h=e*(d.coordinate+e*f/2-u);if(i[l-1]=d=nc(nc({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate}),d.tickCoord!=null){var p=jA(e,d.tickCoord,()=>f,c,u);p&&(u=d.tickCoord-e*(f/2+s),i[l-1]=nc(nc({},d),{},{isShow:!0}))}}}for(var m=a?l-1:l,g=function(w){var O=i[w];if(O==null)return 1;var k=O,_,E=()=>(_===void 0&&(_=r(O,w)),_);if(w===0){var T=e*(k.coordinate-e*E()/2-c);i[w]=k=nc(nc({},k),{},{tickCoord:T<0?k.coordinate-T*e:k.coordinate})}else i[w]=k=nc(nc({},k),{},{tickCoord:k.coordinate});if(k.tickCoord!=null){var j=jA(e,k.tickCoord,E,c,u);j&&(c=k.tickCoord+e*(E()/2+s),i[w]=nc(nc({},k),{},{isShow:!0}))}},y=0;y<m;y++)g(y);return i}function she(e,t,r){var{tick:n,ticks:s,viewBox:a,minTickGap:i,orientation:l,interval:c,tickFormatter:u,unit:d,angle:f}=e;if(!s||!s.length||!n)return[];if(Ur(c)||HR.isSsr){var h;return(h=vCr(s,Ur(c)?c:0))!==null&&h!==void 0?h:[]}var p=[],m=l==="top"||l==="bottom"?"width":"height",g=d&&m==="width"?YT(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},y=(_,E)=>{var T=typeof u=="function"?u(_.value,E):_.value;return m==="width"?gCr(YT(T,{fontSize:t,letterSpacing:r}),g,f):YT(T,{fontSize:t,letterSpacing:r})[m]},x=s[0],w=s[1],O=s.length>=2&&x!=null&&w!=null?ih(w.coordinate-x.coordinate):1,k=yCr(a,O,m);return c==="equidistantPreserveStart"?bCr(O,k,y,s,i):c==="equidistantPreserveEnd"?xCr(O,k,y,s,i):(c==="preserveStart"||c==="preserveStartEnd"?p=_Cr(O,k,y,s,i,c==="preserveStartEnd"):p=kCr(O,k,y,s,i),p.filter(_=>_.isShow))}var ECr=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:s=0,tickMargin:a=0}=e,i=0;if(t){Array.from(t).forEach(d=>{if(d){var f=d.getBoundingClientRect();f.width>i&&(i=f.width)}});var l=r?r.getBoundingClientRect().width:0,c=s+a,u=i+c+l+(r?n:0);return Math.round(u)}return 0},CCr={xAxis:{},yAxis:{}},Xit=_c({name:"renderedTicks",initialState:CCr,reducers:{setRenderedTicks:(e,t)=>{var{axisType:r,axisId:n,ticks:s}=t.payload;e[r][n]=s},removeRenderedTicks:(e,t)=>{var{axisType:r,axisId:n}=t.payload;delete e[r][n]}}}),{setRenderedTicks:jCr,removeRenderedTicks:TCr}=Xit.actions,NCr=Xit.reducer,ACr=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function ICr(e,t){if(e==null)return{};var r,n,s=RCr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function RCr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function mS(){return mS=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mS.apply(null,arguments)}function oNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Bi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oNe(Object(r),!0).forEach(function(n){PCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function PCr(e,t,r){return(t=MCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MCr(e){var t=DCr(e,"string");return typeof t=="symbol"?t:t+""}function DCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var My={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Qc.axis};function LCr(e){var{x:t,y:r,width:n,height:s,orientation:a,mirror:i,axisLine:l,otherSvgProps:c}=e;if(!l)return null;var u=Bi(Bi(Bi({},c),Jm(l)),{},{fill:"none"});if(a==="top"||a==="bottom"){var d=+(a==="top"&&!i||a==="bottom"&&i);u=Bi(Bi({},u),{},{x1:t,y1:r+d*s,x2:t+n,y2:r+d*s})}else{var f=+(a==="left"&&!i||a==="right"&&i);u=Bi(Bi({},u),{},{x1:t+f*n,y1:r,x2:t+f*n,y2:r+s})}return b.createElement("line",mS({},u,{className:ya("recharts-cartesian-axis-line",ZF(l,"className"))}))}function $Cr(e,t,r,n,s,a,i,l,c){var u,d,f,h,p,m,g=l?-1:1,y=e.tickSize||i,x=Ur(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":u=d=e.coordinate,h=r+ +!l*s,f=h-g*y,m=f-g*c,p=x;break;case"left":f=h=e.coordinate,d=t+ +!l*n,u=d-g*y,p=u-g*c,m=x;break;case"right":f=h=e.coordinate,d=t+ +l*n,u=d+g*y,p=u+g*c,m=x;break;default:u=d=e.coordinate,h=r+ +l*s,f=h+g*y,m=f+g*c,p=x;break}return{line:{x1:u,y1:f,x2:d,y2:h},tick:{x:p,y:m}}}function FCr(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function zCr(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function BCr(e){var{option:t,tickProps:r,value:n}=e,s,a=ya(r.className,"recharts-cartesian-axis-tick-value");if(b.isValidElement(t))s=b.cloneElement(t,Bi(Bi({},r),{},{className:a}));else if(typeof t=="function")s=t(Bi(Bi({},r),{},{className:a}));else{var i="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(i=ya(i,X_r(t))),s=b.createElement(the,mS({},r,{className:i}),n)}return s}function UCr(e){var{ticks:t,axisType:r,axisId:n}=e,s=Fo();return b.useEffect(()=>{if(n==null||r==null)return JS;var a=t.map(i=>({value:i.value,coordinate:i.coordinate,offset:i.offset,index:i.index}));return s(jCr({ticks:a,axisId:n,axisType:r})),()=>{s(TCr({axisId:n,axisType:r}))}},[s,t,n,r]),null}var VCr=b.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:s,stroke:a,tickFormatter:i,unit:l,padding:c,tickTextProps:u,orientation:d,mirror:f,x:h,y:p,width:m,height:g,tickSize:y,tickMargin:x,fontSize:w,letterSpacing:O,getTicksConfig:k,events:_,axisType:E,axisId:T}=e,j=she(Bi(Bi({},k),{},{ticks:r}),w,O),A=Jm(k),I=HF(n),P=Mit(A.textAnchor)?A.textAnchor:FCr(d,f),R=zCr(d,f),B={};typeof s=="object"&&(B=s);var D=Bi(Bi({},A),{},{fill:"none"},B),F=j.map(V=>Bi({entry:V},$Cr(V,h,p,m,g,d,y,f,x))),U=F.map(V=>{var{entry:W,line:L}=V;return b.createElement(Qy,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)},s&&b.createElement("line",mS({},D,L,{className:ya("recharts-cartesian-axis-tick-line",ZF(s,"className"))})))}),z=F.map((V,W)=>{var L,Y,{entry:q,tick:M}=V,Q=Bi(Bi(Bi(Bi({verticalAnchor:R},A),{},{textAnchor:P,stroke:"none",fill:a},M),{},{index:W,payload:q,visibleTicksCount:j.length,tickFormatter:i,padding:c},u),{},{angle:(L=(Y=u?.angle)!==null&&Y!==void 0?Y:A.angle)!==null&&L!==void 0?L:0}),G=Bi(Bi({},Q),I);return b.createElement(Qy,mS({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(q.value,"-").concat(q.coordinate,"-").concat(q.tickCoord)},ngr(_,q,W)),n&&b.createElement(BCr,{option:n,tickProps:G,value:"".concat(typeof i=="function"?i(q.value,W):q.value).concat(l||"")}))});return b.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(E,"-ticks")},b.createElement(UCr,{ticks:j,axisId:T,axisType:E}),z.length>0&&b.createElement(Ov,{zIndex:Qc.label},b.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(E,"-tick-labels"),ref:t},z)),U.length>0&&b.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(E,"-tick-lines")},U))}),qCr=b.forwardRef((e,t)=>{var{axisLine:r,width:n,height:s,className:a,hide:i,ticks:l,axisType:c,axisId:u}=e,d=ICr(e,ACr),[f,h]=b.useState(""),[p,m]=b.useState(""),g=b.useRef(null);b.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var x;return ECr({ticks:g.current,label:(x=e.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var y=b.useCallback(x=>{if(x){var w=x.getElementsByClassName("recharts-cartesian-axis-tick-value");g.current=w;var O=w[0];if(O){var k=window.getComputedStyle(O),_=k.fontSize,E=k.letterSpacing;(_!==f||E!==p)&&(h(_),m(E))}}},[f,p]);return i||n!=null&&n<=0||s!=null&&s<=0?null:b.createElement(Ov,{zIndex:e.zIndex},b.createElement(Qy,{className:ya("recharts-cartesian-axis",a)},b.createElement(LCr,{x:e.x,y:e.y,width:n,height:s,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:Jm(e)}),b.createElement(VCr,{ref:y,axisType:c,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:p,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:u}),b.createElement(N_r,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},b.createElement(z_r,{label:e.label,labelRef:e.labelRef}),e.children)))}),ahe=b.forwardRef((e,t)=>{var r=td(e,My);return b.createElement(qCr,mS({},r,{ref:t}))});ahe.displayName="CartesianAxis";var HCr=["x1","y1","x2","y2","key"],QCr=["offset"],WCr=["xAxisId","yAxisId"],GCr=["xAxisId","yAxisId"];function lNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function cc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lNe(Object(r),!0).forEach(function(n){ZCr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ZCr(e,t,r){return(t=YCr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function YCr(e){var t=XCr(e,"string");return typeof t=="symbol"?t:t+""}function XCr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yw(){return yw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yw.apply(null,arguments)}function U5(e,t){if(e==null)return{};var r,n,s=KCr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function KCr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var JCr=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:s,width:a,height:i,ry:l}=e;return b.createElement("rect",{x:n,y:s,ry:l,width:a,height:i,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Kit(e){var{option:t,lineItemProps:r}=e,n;if(b.isValidElement(t))n=b.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var s,{x1:a,y1:i,x2:l,y2:c,key:u}=r,d=U5(r,HCr),f=(s=Jm(d))!==null&&s!==void 0?s:{},{offset:h}=f,p=U5(f,QCr);n=b.createElement("line",yw({},p,{x1:a,y1:i,x2:l,y2:c,fill:"none",key:u}))}return n}function ejr(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:s}=e;if(!n||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,l=U5(e,WCr),c=s.map((u,d)=>{var f=cc(cc({},l),{},{x1:t,y1:u,x2:t+r,y2:u,key:"line-".concat(d),index:d});return b.createElement(Kit,{key:"line-".concat(d),option:n,lineItemProps:f})});return b.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function tjr(e){var{y:t,height:r,vertical:n=!0,verticalPoints:s}=e;if(!n||!s||!s.length)return null;var{xAxisId:a,yAxisId:i}=e,l=U5(e,GCr),c=s.map((u,d)=>{var f=cc(cc({},l),{},{x1:u,y1:t,x2:u,y2:t+r,key:"line-".concat(d),index:d});return b.createElement(Kit,{option:n,lineItemProps:f,key:"line-".concat(d)})});return b.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function rjr(e){var{horizontalFill:t,fillOpacity:r,x:n,y:s,width:a,height:i,horizontalPoints:l,horizontal:c=!0}=e;if(!c||!t||!t.length||l==null)return null;var u=l.map(f=>Math.round(f+s-s)).sort((f,h)=>f-h);s!==u[0]&&u.unshift(0);var d=u.map((f,h)=>{var p=u[h+1],m=p==null,g=m?s+i-f:p-f;if(g<=0)return null;var y=h%t.length;return b.createElement("rect",{key:"react-".concat(h),y:f,x:n,height:g,width:a,stroke:"none",fill:t[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return b.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function njr(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:s,y:a,width:i,height:l,verticalPoints:c}=e;if(!t||!r||!r.length)return null;var u=c.map(f=>Math.round(f+s-s)).sort((f,h)=>f-h);s!==u[0]&&u.unshift(0);var d=u.map((f,h)=>{var p=u[h+1],m=p==null,g=m?s+i-f:p-f;if(g<=0)return null;var y=h%r.length;return b.createElement("rect",{key:"react-".concat(h),x:f,y:a,width:g,height:l,stroke:"none",fill:r[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return b.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var sjr=(e,t)=>{var{xAxis:r,width:n,height:s,offset:a}=e;return $nt(she(cc(cc(cc({},My),r),{},{ticks:Fnt(r),viewBox:{x:0,y:0,width:n,height:s}})),a.left,a.left+a.width,t)},ajr=(e,t)=>{var{yAxis:r,width:n,height:s,offset:a}=e;return $nt(she(cc(cc(cc({},My),r),{},{ticks:Fnt(r),viewBox:{x:0,y:0,width:n,height:s}})),a.top,a.top+a.height,t)},ijr={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Qc.grid};function Jit(e){var t=Wnt(),r=Gnt(),n=Qnt(),s=cc(cc({},td(e,ijr)),{},{x:Ur(e.x)?e.x:n.left,y:Ur(e.y)?e.y:n.top,width:Ur(e.width)?e.width:n.width,height:Ur(e.height)?e.height:n.height}),{xAxisId:a,yAxisId:i,x:l,y:c,width:u,height:d,syncWithTicks:f,horizontalValues:h,verticalValues:p}=s,m=rd(),g=Jr(A=>cTe(A,"xAxis",a,m)),y=Jr(A=>cTe(A,"yAxis",i,m));if(!tg(u)||!tg(d)||!Ur(l)||!Ur(c))return null;var x=s.verticalCoordinatesGenerator||sjr,w=s.horizontalCoordinatesGenerator||ajr,{horizontalPoints:O,verticalPoints:k}=s;if((!O||!O.length)&&typeof w=="function"){var _=h&&h.length,E=w({yAxis:y?cc(cc({},y),{},{ticks:_?h:y.ticks}):void 0,width:t??u,height:r??d,offset:n},_?!0:f);h5(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(O=E)}if((!k||!k.length)&&typeof x=="function"){var T=p&&p.length,j=x({xAxis:g?cc(cc({},g),{},{ticks:T?p:g.ticks}):void 0,width:t??u,height:r??d,offset:n},T?!0:f);h5(Array.isArray(j),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(k=j)}return b.createElement(Ov,{zIndex:s.zIndex},b.createElement("g",{className:"recharts-cartesian-grid"},b.createElement(JCr,{fill:s.fill,fillOpacity:s.fillOpacity,x:s.x,y:s.y,width:s.width,height:s.height,ry:s.ry}),b.createElement(rjr,yw({},s,{horizontalPoints:O})),b.createElement(njr,yw({},s,{verticalPoints:k})),b.createElement(ejr,yw({},s,{offset:n,horizontalPoints:O,xAxis:g,yAxis:y})),b.createElement(tjr,yw({},s,{offset:n,verticalPoints:k,xAxis:g,yAxis:y}))))}Jit.displayName="CartesianGrid";var ojr={},eot=_c({name:"errorBars",initialState:ojr,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:s}=t.payload;e[r]&&(e[r]=e[r].map(a=>a.dataKey===n.dataKey&&a.direction===n.direction?s:a))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(s=>s.dataKey!==n.dataKey||s.direction!==n.direction))}}}),{addErrorBar:cIn,replaceErrorBar:uIn,removeErrorBar:dIn}=eot.actions,ljr=eot.reducer,cjr=["children"];function ujr(e,t){if(e==null)return{};var r,n,s=djr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function djr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var fjr={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},hjr=b.createContext(fjr);function pjr(e){var{children:t}=e,r=ujr(e,cjr);return b.createElement(hjr.Provider,{value:r},t)}function tot(e,t){var r,n,s=Jr(u=>xv(u,e)),a=Jr(u=>wv(u,t)),i=(r=s?.allowDataOverflow)!==null&&r!==void 0?r:Qo.allowDataOverflow,l=(n=a?.allowDataOverflow)!==null&&n!==void 0?n:Wo.allowDataOverflow,c=i||l;return{needClip:c,needClipX:i,needClipY:l}}function mjr(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,s=nhe(),{needClipX:a,needClipY:i,needClip:l}=tot(t,r);if(!l||!s)return null;var{x:c,y:u,width:d,height:f}=s;return b.createElement("clipPath",{id:"clipPath-".concat(n)},b.createElement("rect",{x:a?c:c-d/2,y:i?u:u-f/2,width:a?d:d*2,height:i?f:f*2}))}var rot=(e,t,r,n)=>tit(e,"xAxis",t,n),not=(e,t,r,n)=>eit(e,"xAxis",t,n),sot=(e,t,r,n)=>tit(e,"yAxis",r,n),aot=(e,t,r,n)=>eit(e,"yAxis",r,n),gjr=et([Pi,rot,sot,not,aot],(e,t,r,n,s)=>gv(e,"xAxis")?f5(t,n,!1):f5(r,s,!1)),yjr=(e,t,r,n,s)=>s;function vjr(e){return e.type==="line"}var bjr=et([kat,yjr],(e,t)=>e.filter(vjr).find(r=>r.id===t)),xjr=et([Pi,rot,sot,not,aot,bjr,gjr,efe],(e,t,r,n,s,a,i,l)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:d}=l;if(!(a==null||t==null||r==null||n==null||s==null||n.length===0||s.length===0||i==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:f,data:h}=a,p;if(h!=null&&h.length>0?p=h:p=c?.slice(u,d+1),p!=null)return Bjr({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:s,dataKey:f,bandSize:i,displayedData:p})}});function wjr(e){var t=HF(e),r=3,n=2;if(t!=null){var{r:s,strokeWidth:a}=t,i=Number(s),l=Number(a);return(Number.isNaN(i)||i<0)&&(i=r),(Number.isNaN(l)||l<0)&&(l=n),{r:i,strokeWidth:l}}return{r,strokeWidth:n}}var Sjr=["id"],Ojr=["type","layout","connectNulls","needClip","shape"],kjr=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function TA(){return TA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},TA.apply(null,arguments)}function cNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function bm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cNe(Object(r),!0).forEach(function(n){_jr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _jr(e,t,r){return(t=Ejr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ejr(e){var t=Cjr(e,"string");return typeof t=="symbol"?t:t+""}function Cjr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ihe(e,t){if(e==null)return{};var r,n,s=jjr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function jjr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Tjr=e=>{var{dataKey:t,name:r,stroke:n,legendType:s,hide:a}=e;return[{inactive:a,dataKey:t,type:s,color:n,value:znt(r,t),payload:e}]},Njr=b.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:s,fill:a,name:i,hide:l,unit:c,tooltipType:u,id:d}=e,f={dataDefinedOnItem:r,getPosition:JS,settings:{stroke:n,strokeWidth:s,fill:a,dataKey:t,nameKey:void 0,name:znt(i,t),hide:l,type:u,color:n,unit:c,graphicalItemId:d}};return b.createElement(bEr,{tooltipEntrySettings:f})}),iot=(e,t)=>"".concat(t,"px ").concat(e,"px");function Ajr(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],s=0;s<t;++s)n.push(...r);return n}var Ijr=(e,t,r)=>{var n=r.reduce((h,p)=>h+p,0);if(!n)return iot(t,e);for(var s=Math.floor(e/n),a=e%n,i=[],l=0,c=0;l<r.length;c+=(u=r[l])!==null&&u!==void 0?u:0,++l){var u,d=r[l];if(d!=null&&c+d>a){i=[...r.slice(0,l),a-c];break}}var f=i.length%2===0?[0,t]:[t];return[...Ajr(r,s),...i,...f].map(h=>"".concat(h,"px")).join(", ")};function Rjr(e){var{clipPathId:t,points:r,props:n}=e,{dot:s,dataKey:a,needClip:i}=n,{id:l}=n,c=ihe(n,Sjr),u=Jm(c);return b.createElement(BEr,{points:r,dot:s,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:u,needClip:i,clipPathId:t})}function Pjr(e){var{showLabels:t,children:r,points:n}=e,s=b.useMemo(()=>n?.map(a=>{var i,l,c={x:(i=a.x)!==null&&i!==void 0?i:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return bm(bm({},c),{},{value:a.value,payload:a.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[n]);return b.createElement(H_r,{value:t?s:void 0},r)}function uNe(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:s,props:a}=e,{type:i,layout:l,connectNulls:c,needClip:u,shape:d}=a,f=ihe(a,Ojr),h=bm(bm({},eu(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:u?"url(#clipPath-".concat(t,")"):void 0,points:n,type:i,layout:l,connectNulls:c,strokeDasharray:s??a.strokeDasharray});return b.createElement(b.Fragment,null,n?.length>1&&b.createElement(vEr,TA({shapeType:"curve",option:d},h,{pathRef:r})),b.createElement(Rjr,{points:n,clipPathId:t,props:a}))}function Mjr(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Djr(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:s,longestAnimatedLengthRef:a}=e,{points:i,strokeDasharray:l,isAnimationActive:c,animationBegin:u,animationDuration:d,animationEasing:f,animateNewValues:h,width:p,height:m,onAnimationEnd:g,onAnimationStart:y}=r,x=s.current,w=Jde(i,"recharts-line-"),O=b.useRef(w),[k,_]=b.useState(!1),E=!k,T=b.useCallback(()=>{typeof g=="function"&&g(),_(!1)},[g]),j=b.useCallback(()=>{typeof y=="function"&&y(),_(!0)},[y]),A=Mjr(n.current),I=b.useRef(0);O.current!==w&&(I.current=a.current,O.current=w);var P=I.current;return b.createElement(Pjr,{points:i,showLabels:E},r.children,b.createElement(Kde,{animationId:w,begin:u,duration:d,isActive:c,easing:f,onAnimationEnd:T,onAnimationStart:j,key:w},R=>{var B=Au(P,A+P,R),D=Math.min(B,A),F;if(c)if(l){var U="".concat(l).split(/[,\s]+/gim).map(W=>parseFloat(W));F=Ijr(D,A,U)}else F=iot(A,D);else F=l==null?void 0:String(l);if(R>0&&A>0&&(s.current=i,a.current=Math.max(a.current,D)),x){var z=x.length/i.length,V=R===1?i:i.map((W,L)=>{var Y=Math.floor(L*z);if(x[Y]){var q=x[Y];return bm(bm({},W),{},{x:Au(q.x,W.x,R),y:Au(q.y,W.y,R)})}return h?bm(bm({},W),{},{x:Au(p*2,W.x,R),y:Au(m/2,W.y,R)}):bm(bm({},W),{},{x:W.x,y:W.y})});return s.current=V,b.createElement(uNe,{props:r,points:V,clipPathId:t,pathRef:n,strokeDasharray:F})}return b.createElement(uNe,{props:r,points:i,clipPathId:t,pathRef:n,strokeDasharray:F})}),b.createElement(G_r,{label:r.label}))}function Ljr(e){var{clipPathId:t,props:r}=e,n=b.useRef(null),s=b.useRef(0),a=b.useRef(null);return b.createElement(Djr,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:s,pathRef:a})}var $jr=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Gl(e.payload,t)}};class Fjr extends b.Component{render(){var{hide:t,dot:r,points:n,className:s,xAxisId:a,yAxisId:i,top:l,left:c,width:u,height:d,id:f,needClip:h,zIndex:p}=this.props;if(t)return null;var m=ya("recharts-line",s),g=f,{r:y,strokeWidth:x}=wjr(r),w=Hit(r),O=y*2+x,k=h?"url(#clipPath-".concat(w?"":"dots-").concat(g,")"):void 0;return b.createElement(Ov,{zIndex:p},b.createElement(Qy,{className:m},h&&b.createElement("defs",null,b.createElement(mjr,{clipPathId:g,xAxisId:a,yAxisId:i}),!w&&b.createElement("clipPath",{id:"clipPath-dots-".concat(g)},b.createElement("rect",{x:c-O/2,y:l-O/2,width:u+O,height:d+O}))),b.createElement(pjr,{xAxisId:a,yAxisId:i,data:n,dataPointFormatter:$jr,errorBarOffset:0},b.createElement(Ljr,{props:this.props,clipPathId:g}))),b.createElement(oCr,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:k}))}}var oot={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Qc.line,type:"linear"};function zjr(e){var t=td(e,oot),{activeDot:r,animateNewValues:n,animationBegin:s,animationDuration:a,animationEasing:i,connectNulls:l,dot:c,hide:u,isAnimationActive:d,label:f,legendType:h,xAxisId:p,yAxisId:m,id:g}=t,y=ihe(t,kjr),{needClip:x}=tot(p,m),w=nhe(),O=EE(),k=rd(),_=Jr(I=>xjr(I,p,m,k,g));if(O!=="horizontal"&&O!=="vertical"||_==null||w==null)return null;var{height:E,width:T,x:j,y:A}=w;return b.createElement(Fjr,TA({},y,{id:g,connectNulls:l,dot:c,activeDot:r,animateNewValues:n,animationBegin:s,animationDuration:a,animationEasing:i,isAnimationActive:d,hide:u,label:f,legendType:h,xAxisId:p,yAxisId:m,points:_,layout:O,height:E,width:T,left:j,top:A,needClip:x}))}function Bjr(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:s,yAxisTicks:a,dataKey:i,bandSize:l,displayedData:c}=e;return c.map((u,d)=>{var f=Gl(u,i);if(t==="horizontal"){var h=lCe({axis:r,ticks:s,bandSize:l,entry:u,index:d}),p=wl(f)?null:n.scale.map(f);return{x:h,y:p??null,value:f,payload:u}}var m=wl(f)?null:r.scale.map(f),g=lCe({axis:n,ticks:a,bandSize:l,entry:u,index:d});return m==null||g==null?null:{x:m,y:g,value:f,payload:u}}).filter(Boolean)}function Ujr(e){var t=td(e,oot),r=rd();return b.createElement(_Er,{id:t.id,type:"line"},n=>b.createElement(b.Fragment,null,b.createElement(xEr,{legendPayload:Tjr(t)}),b.createElement(Njr,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),b.createElement(IEr,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),b.createElement(zjr,TA({},t,{id:n}))))}var lot=b.memo(Ujr,pz);lot.displayName="Line";var Vjr=["domain","range"],qjr=["domain","range"];function dNe(e,t){if(e==null)return{};var r,n,s=Hjr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Hjr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function fNe(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function cot(e,t){if(e===t)return!0;var{domain:r,range:n}=e,s=dNe(e,Vjr),{domain:a,range:i}=t,l=dNe(t,qjr);return!fNe(r,a)||!fNe(n,i)?!1:pz(s,l)}var Qjr=["type"],Wjr=["dangerouslySetInnerHTML","ticks","scale"],Gjr=["id","scale"];function Use(){return Use=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Use.apply(null,arguments)}function hNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function pNe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hNe(Object(r),!0).forEach(function(n){Zjr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zjr(e,t,r){return(t=Yjr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yjr(e){var t=Xjr(e,"string");return typeof t=="symbol"?t:t+""}function Xjr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vse(e,t){if(e==null)return{};var r,n,s=Kjr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Kjr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Jjr(e){var t=Fo(),r=b.useRef(null),n=Znt(),{type:s}=e,a=Vse(e,Qjr),i=yz(n,"xAxis",s),l=b.useMemo(()=>{if(i!=null)return pNe(pNe({},a),{},{type:i})},[a,i]);return b.useLayoutEffect(()=>{l!=null&&(r.current===null?t(QEr(l)):r.current!==l&&t(WEr({prev:r.current,next:l})),r.current=l)},[l,t]),b.useLayoutEffect(()=>()=>{r.current&&(t(GEr(r.current)),r.current=null)},[t]),null}var eTr=e=>{var{xAxisId:t,className:r}=e,n=Jr(Unt),s=rd(),a="xAxis",i=Jr(x=>Jat(x,a,t,s)),l=Jr(x=>l1r(x,t)),c=Jr(x=>p1r(x,t)),u=Jr(x=>xat(x,t));if(l==null||c==null||u==null)return null;var{dangerouslySetInnerHTML:d,ticks:f,scale:h}=e,p=Vse(e,Wjr),{id:m,scale:g}=u,y=Vse(u,Gjr);return b.createElement(ahe,Use({},p,y,{x:c.x,y:c.y,width:l.width,height:l.height,className:ya("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:i,axisType:a,axisId:t}))},tTr={allowDataOverflow:Qo.allowDataOverflow,allowDecimals:Qo.allowDecimals,allowDuplicatedCategory:Qo.allowDuplicatedCategory,angle:Qo.angle,axisLine:My.axisLine,height:Qo.height,hide:!1,includeHidden:Qo.includeHidden,interval:Qo.interval,label:!1,minTickGap:Qo.minTickGap,mirror:Qo.mirror,orientation:Qo.orientation,padding:Qo.padding,reversed:Qo.reversed,scale:Qo.scale,tick:Qo.tick,tickCount:Qo.tickCount,tickLine:My.tickLine,tickSize:My.tickSize,type:Qo.type,niceTicks:Qo.niceTicks,xAxisId:0},rTr=e=>{var t=td(e,tTr);return b.createElement(b.Fragment,null,b.createElement(Jjr,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),b.createElement(eTr,t))},uot=b.memo(rTr,cot);uot.displayName="XAxis";var nTr=["type"],sTr=["dangerouslySetInnerHTML","ticks","scale"],aTr=["id","scale"];function qse(){return qse=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qse.apply(null,arguments)}function mNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function gNe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mNe(Object(r),!0).forEach(function(n){iTr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iTr(e,t,r){return(t=oTr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oTr(e){var t=lTr(e,"string");return typeof t=="symbol"?t:t+""}function lTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hse(e,t){if(e==null)return{};var r,n,s=cTr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function cTr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function uTr(e){var t=Fo(),r=b.useRef(null),n=Znt(),{type:s}=e,a=Hse(e,nTr),i=yz(n,"yAxis",s),l=b.useMemo(()=>{if(i!=null)return gNe(gNe({},a),{},{type:i})},[i,a]);return b.useLayoutEffect(()=>{l!=null&&(r.current===null?t(ZEr(l)):r.current!==l&&t(YEr({prev:r.current,next:l})),r.current=l)},[l,t]),b.useLayoutEffect(()=>()=>{r.current&&(t(XEr(r.current)),r.current=null)},[t]),null}function dTr(e){var{yAxisId:t,className:r,width:n,label:s}=e,a=b.useRef(null),i=b.useRef(null),l=Jr(Unt),c=rd(),u=Fo(),d="yAxis",f=Jr(E=>y1r(E,t)),h=Jr(E=>g1r(E,t)),p=Jr(E=>Jat(E,d,t,c)),m=Jr(E=>wat(E,t));if(b.useLayoutEffect(()=>{if(!(n!=="auto"||!f||rhe(s)||b.isValidElement(s)||m==null)){var E=a.current;if(E){var T=E.getCalculatedWidth();Math.round(f.width)!==Math.round(T)&&u(KEr({id:t,width:T}))}}},[p,f,u,s,t,n,m]),f==null||h==null||m==null)return null;var{dangerouslySetInnerHTML:g,ticks:y,scale:x}=e,w=Hse(e,sTr),{id:O,scale:k}=m,_=Hse(m,aTr);return b.createElement(ahe,qse({},w,_,{ref:a,labelRef:i,x:h.x,y:h.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:f.width,height:f.height,className:ya("recharts-".concat(d," ").concat(d),r),viewBox:l,ticks:p,axisType:d,axisId:t}))}var fTr={allowDataOverflow:Wo.allowDataOverflow,allowDecimals:Wo.allowDecimals,allowDuplicatedCategory:Wo.allowDuplicatedCategory,angle:Wo.angle,axisLine:My.axisLine,hide:!1,includeHidden:Wo.includeHidden,interval:Wo.interval,label:!1,minTickGap:Wo.minTickGap,mirror:Wo.mirror,orientation:Wo.orientation,padding:Wo.padding,reversed:Wo.reversed,scale:Wo.scale,tick:Wo.tick,tickCount:Wo.tickCount,tickLine:My.tickLine,tickSize:My.tickSize,type:Wo.type,niceTicks:Wo.niceTicks,width:Wo.width,yAxisId:0},hTr=e=>{var t=td(e,fTr);return b.createElement(b.Fragment,null,b.createElement(uTr,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),b.createElement(dTr,t))},dot=b.memo(hTr,cot);dot.displayName="YAxis";var pTr=(e,t)=>t,ohe=et([pTr,Pi,Rst,kl,yit,Sv,zOr,Kl],WOr);function mTr(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function lhe(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(mTr(e)){var s=e.currentTarget.getBBox();r=s.width>0?t.width/s.width:1,n=s.height>0?t.height/s.height:1}else{var a=e.currentTarget;r=a.offsetWidth>0?t.width/a.offsetWidth:1,n=a.offsetHeight>0?t.height/a.offsetHeight:1}var i=(l,c)=>({relativeX:Math.round((l-t.left)/r),relativeY:Math.round((c-t.top)/n)});return"touches"in e?Array.from(e.touches).map(l=>i(l.clientX,l.clientY)):i(e.clientX,e.clientY)}var fot=rf("mouseClick"),hot=BR();hot.startListening({actionCreator:fot,effect:(e,t)=>{var r=e.payload,n=ohe(t.getState(),lhe(r));n?.activeIndex!=null&&t.dispatch(I1r({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Qse=rf("mouseMove"),pot=BR(),oO=null,I0=null,qq=null;pot.startListening({actionCreator:Qse,effect:(e,t)=>{var r=e.payload,n=t.getState(),{throttleDelay:s,throttledEvents:a}=n.eventSettings,i=a==="all"||a?.includes("mousemove");oO!==null&&(cancelAnimationFrame(oO),oO=null),I0!==null&&(typeof s!="number"||!i)&&(clearTimeout(I0),I0=null),qq=lhe(r);var l=()=>{var c=t.getState(),u=Hfe(c,c.tooltip.settings.shared);if(!qq){oO=null,I0=null;return}if(u==="axis"){var d=ohe(c,qq);d?.activeIndex!=null?t.dispatch(lit({activeIndex:d.activeIndex,activeDataKey:void 0,activeCoordinate:d.activeCoordinate})):t.dispatch(oit())}oO=null,I0=null};if(!i){l();return}s==="raf"?oO=requestAnimationFrame(l):typeof s=="number"&&I0===null&&(I0=setTimeout(l,s))}});function gTr(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var yNe={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},mot=_c({name:"rootProps",initialState:yNe,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:yNe.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),yTr=mot.reducer,{updateOptions:vTr}=mot.actions,bTr=null,xTr={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},got=_c({name:"polarOptions",initialState:bTr,reducers:xTr}),{updatePolarOptions:fIn}=got.actions,wTr=got.reducer,yot=rf("keyDown"),vot=rf("focus"),bot=rf("blur"),Az=BR(),lO=null,R0=null,O2=null;Az.startListening({actionCreator:yot,effect:(e,t)=>{O2=e.payload,lO!==null&&(cancelAnimationFrame(lO),lO=null);var r=t.getState(),{throttleDelay:n,throttledEvents:s}=r.eventSettings,a=s==="all"||s.includes("keydown");R0!==null&&(typeof n!="number"||!a)&&(clearTimeout(R0),R0=null);var i=()=>{try{var l=t.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var{keyboardInteraction:u}=l.tooltip,d=O2;if(d!=="ArrowRight"&&d!=="ArrowLeft"&&d!=="Enter")return;var f=Qfe(u,PE(l),JR(l),tP(l)),h=f==null?-1:Number(f);if(!Number.isFinite(h)||h<0)return;var p=Sv(l);if(d==="Enter"){var m=L5(l,"axis","hover",String(u.index));t.dispatch(D5({active:!u.active,activeIndex:u.index,activeCoordinate:m}));return}var g=S1r(l),y=g==="left-to-right"?1:-1,x=d==="ArrowRight"?1:-1,w=h+x*y;if(p==null||w>=p.length||w<0)return;var O=L5(l,"axis","hover",String(w));t.dispatch(D5({active:!0,activeIndex:w.toString(),activeCoordinate:O}))}finally{lO=null,R0=null}};if(!a){i();return}n==="raf"?lO=requestAnimationFrame(i):typeof n=="number"&&R0===null&&(i(),O2=null,R0=setTimeout(()=>{O2?i():(R0=null,lO=null)},n))}});Az.startListening({actionCreator:vot,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;if(!s.active&&s.index==null){var a="0",i=L5(r,"axis","hover",String(a));t.dispatch(D5({active:!0,activeIndex:a,activeCoordinate:i}))}}}});Az.startListening({actionCreator:bot,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:s}=r.tooltip;s.active&&t.dispatch(D5({active:!1,activeIndex:s.index,activeCoordinate:s.coordinate}))}}});function xot(e){e.persist();var{currentTarget:t}=e;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var s=Reflect.get(r,n);return typeof s=="function"?s.bind(r):s}})}var Vf=rf("externalEvent"),wot=BR(),k2=new Map,kj=new Map,Hq=new Map;wot.startListening({actionCreator:Vf,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){var s=n.type,a=xot(n);Hq.set(s,{handler:r,reactEvent:a});var i=k2.get(s);i!==void 0&&(cancelAnimationFrame(i),k2.delete(s));var l=t.getState(),{throttleDelay:c,throttledEvents:u}=l.eventSettings,d=u,f=d==="all"||d?.includes(s),h=kj.get(s);h!==void 0&&(typeof c!="number"||!f)&&(clearTimeout(h),kj.delete(s));var p=()=>{var y=Hq.get(s);try{if(!y)return;var{handler:x,reactEvent:w}=y,O=t.getState(),k={activeCoordinate:kOr(O),activeDataKey:wOr(O),activeIndex:EA(O),activeLabel:xit(O),activeTooltipIndex:EA(O),isTooltipActive:_Or(O)};x&&x(k,w)}finally{k2.delete(s),kj.delete(s),Hq.delete(s)}};if(!f){p();return}if(c==="raf"){var m=requestAnimationFrame(p);k2.set(s,m)}else if(typeof c=="number"){if(!kj.has(s)){p();var g=setTimeout(p,c);kj.set(s,g)}}else p()}}});var STr=et([IE],e=>e.tooltipItemPayloads),OTr=et([STr,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(a=>a.settings.graphicalItemId===r);if(n!=null){var{getPosition:s}=n;if(s!=null)return s(t)}}}),Sot=rf("touchMove"),Oot=BR(),P0=null,cb=null,vNe=null,_j=null;Oot.startListening({actionCreator:Sot,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){_j=xot(r);var n=t.getState(),{throttleDelay:s,throttledEvents:a}=n.eventSettings,i=a==="all"||a.includes("touchmove");P0!==null&&(cancelAnimationFrame(P0),P0=null),cb!==null&&(typeof s!="number"||!i)&&(clearTimeout(cb),cb=null),vNe=Array.from(r.touches).map(c=>lhe({clientX:c.clientX,clientY:c.clientY,currentTarget:r.currentTarget}));var l=()=>{if(_j!=null){var c=t.getState(),u=Hfe(c,c.tooltip.settings.shared);if(u==="axis"){var d,f=(d=vNe)===null||d===void 0?void 0:d[0];if(f==null){P0=null,cb=null;return}var h=ohe(c,f);h?.activeIndex!=null&&t.dispatch(lit({activeIndex:h.activeIndex,activeDataKey:void 0,activeCoordinate:h.activeCoordinate}))}else if(u==="item"){var p,m=_j.touches[0];if(document.elementFromPoint==null||m==null)return;var g=document.elementFromPoint(m.clientX,m.clientY);if(!g||!g.getAttribute)return;var y=g.getAttribute(Kyr),x=(p=g.getAttribute(Jyr))!==null&&p!==void 0?p:void 0,w=RE(c).find(_=>_.id===x);if(y==null||w==null||x==null)return;var{dataKey:O}=w,k=OTr(c,y,x);t.dispatch(A1r({activeDataKey:O,activeIndex:y,activeCoordinate:k,activeGraphicalItemId:x}))}P0=null,cb=null}};if(!i){l();return}s==="raf"?P0=requestAnimationFrame(l):typeof s=="number"&&cb===null&&(l(),_j=null,cb=setTimeout(()=>{_j?l():(cb=null,P0=null)},s))}}});var kot={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},_ot=_c({name:"eventSettings",initialState:kot,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),{setEventSettings:kTr}=_ot.actions,_Tr=_ot.reducer,ETr=ttt({brush:cCr,cartesianAxis:JEr,chartData:_kr,errorBars:ljr,eventSettings:_Tr,graphicalItems:NEr,layout:Lyr,legend:Hvr,options:xkr,polarAxis:Y_r,polarOptions:wTr,referenceElements:hCr,renderedTicks:NCr,rootProps:yTr,tooltip:R1r,zIndex:okr}),CTr=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return lyr({reducer:ETr,preloadedState:t,middleware:n=>{var s;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((s="es6")!==null&&s!==void 0?s:"")}).concat([hot.middleware,pot.middleware,Az.middleware,wot.middleware,Oot.middleware])},enhancers:n=>{var s=n;return typeof n=="function"&&(s=n()),s.concat(knt({type:"raf"}))},devTools:{serialize:{replacer:gTr},name:"recharts-".concat(r)}})};function jTr(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,s=rd(),a=b.useRef(null);if(s)return r;a.current==null&&(a.current=CTr(t,n));var i=Ude;return b.createElement(utt,{context:i,store:a.current},r)}function TTr(e){var{layout:t,margin:r}=e,n=Fo(),s=rd();return b.useEffect(()=>{s||(n(Pyr(t)),n(Ryr(r)))},[n,s,t,r]),null}var NTr=b.memo(TTr,pz);function ATr(e){var t=Fo();return b.useEffect(()=>{t(vTr(e))},[t,e]),null}var ITr=e=>{var t=Fo();return b.useEffect(()=>{t(kTr(e))},[t,e]),null},RTr=b.memo(ITr,pz);function bNe(e){var{zIndex:t,isPanorama:r}=e,n=b.useRef(null),s=Fo();return b.useLayoutEffect(()=>(n.current&&s(akr({zIndex:t,element:n.current,isPanorama:r})),()=>{s(ikr({zIndex:t,isPanorama:r}))}),[s,t,r]),b.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function xNe(e){var{children:t,isPanorama:r}=e,n=Jr(ZOr);if(!n||n.length===0)return t;var s=n.filter(i=>i<0),a=n.filter(i=>i>0);return b.createElement(b.Fragment,null,s.map(i=>b.createElement(bNe,{key:i,zIndex:i,isPanorama:r})),t,a.map(i=>b.createElement(bNe,{key:i,zIndex:i,isPanorama:r})))}var PTr=["children"];function MTr(e,t){if(e==null)return{};var r,n,s=DTr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function DTr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function V5(){return V5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},V5.apply(null,arguments)}var LTr={width:"100%",height:"100%",display:"block"},$Tr=b.forwardRef((e,t)=>{var r=Wnt(),n=Gnt(),s=ast();if(!tg(r)||!tg(n))return null;var{children:a,otherAttributes:i,title:l,desc:c}=e,u,d;return i!=null&&(typeof i.tabIndex=="number"?u=i.tabIndex:u=s?0:void 0,typeof i.role=="string"?d=i.role:d=s?"application":void 0),b.createElement(Nrt,V5({},i,{title:l,desc:c,role:d,tabIndex:u,width:r,height:n,style:LTr,ref:t}),a)}),FTr=e=>{var{children:t}=e,r=Jr(cz);if(!r)return null;var{width:n,height:s,y:a,x:i}=r;return b.createElement(Nrt,{width:n,height:s,x:i,y:a},t)},wNe=b.forwardRef((e,t)=>{var{children:r}=e,n=MTr(e,PTr),s=rd();return s?b.createElement(FTr,null,b.createElement(xNe,{isPanorama:!0},r)):b.createElement($Tr,V5({ref:t},n),b.createElement(xNe,{isPanorama:!1},r))});function zTr(){var e=Fo(),[t,r]=b.useState(null),n=Jr(Xyr);return b.useEffect(()=>{if(t!=null){var s=t.getBoundingClientRect(),a=s.width/t.offsetWidth;$s(a)&&a!==n&&e(Dyr(a))}},[t,e,n]),r}function SNe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function BTr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?SNe(Object(r),!0).forEach(function(n){UTr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SNe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function UTr(e,t,r){return(t=VTr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VTr(e){var t=qTr(e,"string");return typeof t=="symbol"?t:t+""}function qTr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zb(){return Zb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zb.apply(null,arguments)}var HTr=()=>(Pkr(),null);function q5(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var QTr=b.forwardRef((e,t)=>{var r,n,s=b.useRef(null),[a,i]=b.useState({containerWidth:q5((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:q5((n=e.style)===null||n===void 0?void 0:n.height)}),l=b.useCallback((u,d)=>{i(f=>{var h=Math.round(u),p=Math.round(d);return f.containerWidth===h&&f.containerHeight===p?f:{containerWidth:h,containerHeight:p}})},[]),c=b.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=u.getBoundingClientRect();l(d,f);var h=m=>{var g=m[0];if(g!=null){var{width:y,height:x}=g.contentRect;l(y,x)}},p=new ResizeObserver(h);p.observe(u),s.current=p}},[t,l]);return b.useEffect(()=>()=>{var u=s.current;u?.disconnect()},[l]),b.createElement(b.Fragment,null,b.createElement(VR,{width:a.containerWidth,height:a.containerHeight}),b.createElement("div",Zb({ref:c},e)))}),WTr=b.forwardRef((e,t)=>{var{width:r,height:n}=e,[s,a]=b.useState({containerWidth:q5(r),containerHeight:q5(n)}),i=b.useCallback((c,u)=>{a(d=>{var f=Math.round(c),h=Math.round(u);return d.containerWidth===f&&d.containerHeight===h?d:{containerWidth:f,containerHeight:h}})},[]),l=b.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:u,height:d}=c.getBoundingClientRect();i(u,d)}},[t,i]);return b.createElement(b.Fragment,null,b.createElement(VR,{width:s.containerWidth,height:s.containerHeight}),b.createElement("div",Zb({ref:l},e)))}),GTr=b.forwardRef((e,t)=>{var{width:r,height:n}=e;return b.createElement(b.Fragment,null,b.createElement(VR,{width:r,height:n}),b.createElement("div",Zb({ref:t},e)))}),ZTr=b.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?b.createElement(WTr,Zb({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?b.createElement(GTr,Zb({},e,{width:r,height:n,ref:t})):b.createElement(b.Fragment,null,b.createElement(VR,{width:r,height:n}),b.createElement("div",Zb({ref:t},e)))});function YTr(e){return e?QTr:ZTr}var XTr=b.forwardRef((e,t)=>{var{children:r,className:n,height:s,onClick:a,onContextMenu:i,onDoubleClick:l,onMouseDown:c,onMouseEnter:u,onMouseLeave:d,onMouseMove:f,onMouseUp:h,onTouchEnd:p,onTouchMove:m,onTouchStart:g,style:y,width:x,responsive:w,dispatchTouchEvents:O=!0}=e,k=b.useRef(null),_=Fo(),[E,T]=b.useState(null),[j,A]=b.useState(null),I=zTr(),P=Gde(),R=P?.width>0?P.width:x,B=P?.height>0?P.height:s,D=b.useCallback(oe=>{I(oe),typeof t=="function"&&t(oe),T(oe),A(oe),oe!=null&&(k.current=oe)},[I,t,T,A]),F=b.useCallback(oe=>{_(fot(oe)),_(Vf({handler:a,reactEvent:oe}))},[_,a]),U=b.useCallback(oe=>{_(Qse(oe)),_(Vf({handler:u,reactEvent:oe}))},[_,u]),z=b.useCallback(oe=>{_(oit()),_(Vf({handler:d,reactEvent:oe}))},[_,d]),V=b.useCallback(oe=>{_(Qse(oe)),_(Vf({handler:f,reactEvent:oe}))},[_,f]),W=b.useCallback(()=>{_(vot())},[_]),L=b.useCallback(()=>{_(bot())},[_]),Y=b.useCallback(oe=>{_(yot(oe.key))},[_]),q=b.useCallback(oe=>{_(Vf({handler:i,reactEvent:oe}))},[_,i]),M=b.useCallback(oe=>{_(Vf({handler:l,reactEvent:oe}))},[_,l]),Q=b.useCallback(oe=>{_(Vf({handler:c,reactEvent:oe}))},[_,c]),G=b.useCallback(oe=>{_(Vf({handler:h,reactEvent:oe}))},[_,h]),J=b.useCallback(oe=>{_(Vf({handler:g,reactEvent:oe}))},[_,g]),ie=b.useCallback(oe=>{O&&_(Sot(oe)),_(Vf({handler:m,reactEvent:oe}))},[_,O,m]),te=b.useCallback(oe=>{_(Vf({handler:p,reactEvent:oe}))},[_,p]),se=YTr(w);return b.createElement(Cit.Provider,{value:E},b.createElement(imr.Provider,{value:j},b.createElement(se,{width:R??y?.width,height:B??y?.height,className:ya("recharts-wrapper",n),style:BTr({position:"relative",cursor:"default",width:R,height:B},y),onClick:F,onContextMenu:q,onDoubleClick:M,onFocus:W,onBlur:L,onKeyDown:Y,onMouseDown:Q,onMouseEnter:U,onMouseLeave:z,onMouseMove:V,onMouseUp:G,onTouchEnd:te,onTouchMove:ie,onTouchStart:J,ref:D},b.createElement(HTr,null),r)))}),KTr=["width","height","responsive","children","className","style","compact","title","desc"];function JTr(e,t){if(e==null)return{};var r,n,s=eNr(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function eNr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var tNr=b.forwardRef((e,t)=>{var{width:r,height:n,responsive:s,children:a,className:i,style:l,compact:c,title:u,desc:d}=e,f=JTr(e,KTr),h=Jm(f);return c?b.createElement(b.Fragment,null,b.createElement(VR,{width:r,height:n}),b.createElement(wNe,{otherAttributes:h,title:u,desc:d},a)):b.createElement(XTr,{className:i,style:l,width:r,height:n,responsive:s??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},b.createElement(wNe,{otherAttributes:h,title:u,desc:d,ref:t},b.createElement(mCr,null,a)))});function Wse(){return Wse=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wse.apply(null,arguments)}function ONe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function rNr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ONe(Object(r),!0).forEach(function(n){nNr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ONe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function nNr(e,t,r){return(t=sNr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sNr(e){var t=aNr(e,"string");return typeof t=="symbol"?t:t+""}function aNr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iNr={top:5,right:5,bottom:5,left:5},oNr=rNr({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:iNr,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},kot),lNr=b.forwardRef(function(t,r){var n,s=td(t.categoricalChartProps,oNr),{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:u}=t,d={chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return b.createElement(jTr,{preloadedState:{options:d},reduxStoreName:(n=u.id)!==null&&n!==void 0?n:a},b.createElement(lCr,{chartData:u.data}),b.createElement(NTr,{layout:s.layout,margin:s.margin}),b.createElement(RTr,{throttleDelay:s.throttleDelay,throttledEvents:s.throttledEvents}),b.createElement(ATr,{baseValue:s.baseValue,accessibilityLayer:s.accessibilityLayer,barCategoryGap:s.barCategoryGap,maxBarSize:s.maxBarSize,stackOffset:s.stackOffset,barGap:s.barGap,barSize:s.barSize,syncId:s.syncId,syncMethod:s.syncMethod,className:s.className,reverseStackOrder:s.reverseStackOrder}),b.createElement(tNr,Wse({},s,{ref:r})))}),cNr=["axis"],uNr=b.forwardRef((e,t)=>b.createElement(lNr,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:cNr,tooltipPayloadSearcher:vkr,categoricalChartProps:e,ref:t}));function dNr(e,t){const r=getComputedStyle(e),n=parseFloat(r.fontSize);return t*n}function fNr(e,t){const r=getComputedStyle(e.ownerDocument.body),n=parseFloat(r.fontSize);return t*n}function hNr(e){return e/100*window.innerHeight}function pNr(e){return e/100*window.innerWidth}function mNr(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function dT({groupSize:e,panelElement:t,styleProp:r}){let n;const[s,a]=mNr(r);switch(a){case"%":{n=s/100*e;break}case"px":{n=s;break}case"rem":{n=fNr(t,s);break}case"em":{n=dNr(t,s);break}case"vh":{n=hNr(s);break}case"vw":{n=pNr(s);break}}return n}function Lu(e){return parseFloat(e.toFixed(3))}function O_({group:e}){const{orientation:t,panels:r}=e;return r.reduce((n,s)=>(n+=t==="horizontal"?s.element.offsetWidth:s.element.offsetHeight,n),0)}function Gse(e){const{panels:t}=e,r=O_({group:e});return r===0?t.map(n=>({groupResizeBehavior:n.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:n.panelConstraints.disabled,minSize:0,maxSize:100,panelId:n.id})):t.map(n=>{const{element:s,panelConstraints:a}=n;let i=0;if(a.collapsedSize!==void 0){const d=dT({groupSize:r,panelElement:s,styleProp:a.collapsedSize});i=Lu(d/r*100)}let l;if(a.defaultSize!==void 0){const d=dT({groupSize:r,panelElement:s,styleProp:a.defaultSize});l=Lu(d/r*100)}let c=0;if(a.minSize!==void 0){const d=dT({groupSize:r,panelElement:s,styleProp:a.minSize});c=Lu(d/r*100)}let u=100;if(a.maxSize!==void 0){const d=dT({groupSize:r,panelElement:s,styleProp:a.maxSize});u=Lu(d/r*100)}return{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:i,collapsible:a.collapsible===!0,defaultSize:l,disabled:a.disabled,minSize:c,maxSize:u,panelId:n.id}})}function _a(e,t="Assertion error"){if(!e)throw Error(t)}function Zse(e,t){return Array.from(t).sort(e==="horizontal"?gNr:yNr)}function gNr(e,t){const r=e.element.offsetLeft-t.element.offsetLeft;return r!==0?r:e.element.offsetWidth-t.element.offsetWidth}function yNr(e,t){const r=e.element.offsetTop-t.element.offsetTop;return r!==0?r:e.element.offsetHeight-t.element.offsetHeight}function Eot(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Cot(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function vNr({orientation:e,rects:t,targetRect:r}){const n={x:r.x+r.width/2,y:r.y+r.height/2};let s,a=Number.MAX_VALUE;for(const i of t){const{x:l,y:c}=Cot(n,i),u=e==="horizontal"?l:c;u<a&&(a=u,s=i)}return _a(s,"No rect found"),s}let _2;function bNr(){return _2===void 0&&(typeof matchMedia=="function"?_2=!!matchMedia("(pointer:coarse)").matches:_2=!1),_2}function jot(e){const{element:t,orientation:r,panels:n,separators:s}=e,a=Zse(r,Array.from(t.children).filter(Eot).map(m=>({element:m}))).map(({element:m})=>m),i=[];let l=!1,c=!1,u=-1,d=-1,f=0,h,p=[];{let m=-1;for(const g of a)g.hasAttribute("data-panel")&&(m++,g.ariaDisabled===null&&(f++,u===-1&&(u=m),d=m))}if(f>1){let m=-1;for(const g of a)if(g.hasAttribute("data-panel")){m++;const y=n.find(x=>x.element===g);if(y){if(h){const x=h.element.getBoundingClientRect(),w=g.getBoundingClientRect();let O;if(c){const k=r==="horizontal"?new DOMRect(x.right,x.top,0,x.height):new DOMRect(x.left,x.bottom,x.width,0),_=r==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(p.length){case 0:{O=[k,_];break}case 1:{const E=p[0],T=vNr({orientation:r,rects:[x,w],targetRect:E.element.getBoundingClientRect()});O=[E,T===x?_:k];break}default:{O=p;break}}}else p.length?O=p:O=[r==="horizontal"?new DOMRect(x.right,w.top,w.left-x.right,w.height):new DOMRect(w.left,x.bottom,w.width,w.top-x.bottom)];for(const k of O){let _="width"in k?k:k.element.getBoundingClientRect();const E=bNr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(_.width<E){const j=E-_.width;_=new DOMRect(_.x-j/2,_.y,_.width+j,_.height)}if(_.height<E){const j=E-_.height;_=new DOMRect(_.x,_.y-j/2,_.width,_.height+j)}const T=m<=u||m>d;!l&&!T&&i.push({group:e,groupSize:O_({group:e}),panels:[h,y],separator:"width"in k?void 0:k,rect:_}),l=!1}}c=!1,h=y,p=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(l=!0);const y=s.find(x=>x.element===g);y?p.push(y):(h=void 0,p=[])}else c=!0}return i}let Tot=class{#e={};addListener(t,r){const n=this.#e[t];return n===void 0?this.#e[t]=[r]:n.includes(r)||n.push(r),()=>{this.removeListener(t,r)}}emit(t,r){const n=this.#e[t];if(n!==void 0)if(n.length===1)n[0].call(null,r);else{let s=!1,a=null;const i=Array.from(n);for(let l=0;l<i.length;l++){const c=i[l];try{c.call(null,r)}catch(u){a===null&&(s=!0,a=u)}}if(s)throw a}}removeAllListeners(){this.#e={}}removeListener(t,r){const n=this.#e[t];if(n!==void 0){const s=n.indexOf(r);s>=0&&n.splice(s,1)}}},Lm=new Map;const Not=new Tot;function xNr(e){Lm=new Map(Lm),Lm.delete(e)}function kNe(e,t){for(const[r]of Lm)if(r.id===e)return r}function Yb(e,t){for(const[r,n]of Lm)if(r.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function r1(){return Lm}function che(e,t){return Not.addListener("groupChange",r=>{r.group.id===e&&t(r)})}function Jy(e,t){const r=Lm.get(e);Lm=new Map(Lm),Lm.set(e,t),Not.emit("groupChange",{group:e,prev:r,next:t})}function wNr(e,t,r){let n,s={x:1/0,y:1/0};for(const a of t){const i=Cot(r,a.rect);switch(e){case"horizontal":{i.x<=s.x&&(n=a,s=i);break}case"vertical":{i.y<=s.y&&(n=a,s=i);break}}}return n?{distance:s,hitRegion:n}:void 0}function SNr(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ONr(e,t){if(e===t)throw new Error("Cannot compare node with itself");const r={a:CNe(e),b:CNe(t)};let n;for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();_a(n,"Stacking order can only be calculated for elements with a common ancestor");const s={a:ENe(_Ne(r.a)),b:ENe(_Ne(r.b))};if(s.a===s.b){const a=n.childNodes,i={a:r.a.at(-1),b:r.b.at(-1)};let l=a.length;for(;l--;){const c=a[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(s.a-s.b)}const kNr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function _Nr(e){const t=getComputedStyle(Aot(e)??e).display;return t==="flex"||t==="inline-flex"}function ENr(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||_Nr(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||kNr.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function _Ne(e){let t=e.length;for(;t--;){const r=e[t];if(_a(r,"Missing node"),ENr(r))return r}return null}function ENe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function CNe(e){const t=[];for(;e;)t.push(e),e=Aot(e);return t}function Aot(e){const{parentNode:t}=e;return SNr(t)?t.host:t}function CNr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function jNr({groupElement:e,hitRegion:t,pointerEventTarget:r}){if(!Eot(r)||r.contains(e)||e.contains(r))return!0;if(ONr(r,e)>0){let n=r;for(;n;){if(n.contains(e))return!0;if(CNr(n.getBoundingClientRect(),t))return!1;n=n.parentElement}}return!0}function uhe(e,t){const r=[];return t.forEach((n,s)=>{if(s.disabled)return;const a=jot(s),i=wNr(s.orientation,a,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&jNr({groupElement:s.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&r.push(i.hitRegion)}),r}function TNr(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function Bc(e,t,r=0){return Math.abs(Lu(e)-Lu(t))<=r}function hm(e,t){return Bc(e,t)?0:e>t?1:-1}function QO({overrideDisabledPanels:e,panelConstraints:t,prevSize:r,size:n}){const{collapsedSize:s=0,collapsible:a,disabled:i,maxSize:l=100,minSize:c=0}=t;if(i&&!e)return r;if(hm(n,c)<0)if(a){const u=(s+c)/2;hm(n,u)<0?n=s:n=c}else n=c;return n=Math.min(l,n),n=Lu(n),n}function NA({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:s,trigger:a}){if(Bc(e,0))return t;const i=a==="imperative-api",l=Object.values(t),c=Object.values(s),u=[...l],[d,f]=n;_a(d!=null,"Invalid first pivot index"),_a(f!=null,"Invalid second pivot index");let h=0;switch(a){case"keyboard":{{const g=e<0?f:d,y=r[g];_a(y,`Panel constraints not found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:O=0}=y;if(w){const k=l[g];if(_a(k!=null,`Previous layout not found for panel index ${g}`),Bc(k,x)){const _=O-k;hm(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const g=e<0?d:f,y=r[g];_a(y,`No panel constraints found for index ${g}`);const{collapsedSize:x=0,collapsible:w,minSize:O=0}=y;if(w){const k=l[g];if(_a(k!=null,`Previous layout not found for panel index ${g}`),Bc(k,O)){const _=k-x;hm(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}break}default:{const g=e<0?f:d,y=r[g];_a(y,`Panel constraints not found for index ${g}`);const x=l[g],{collapsible:w,collapsedSize:O,minSize:k}=y;if(w&&hm(x,k)<0)if(e>0){const _=k-O,E=_/2,T=x+e;hm(T,k)<0&&(e=hm(e,E)<=0?0:_)}else{const _=k-O,E=100-_/2,T=x-e;hm(T,k)<0&&(e=hm(100+e,E)>0?0:-_)}break}}{const g=e<0?1:-1;let y=e<0?f:d,x=0;for(;;){const O=l[y];_a(O!=null,`Previous layout not found for panel index ${y}`);const k=QO({overrideDisabledPanels:i,panelConstraints:r[y],prevSize:O,size:100})-O;if(x+=k,y+=g,y<0||y>=r.length)break}const w=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-w:w}{let g=e<0?d:f;for(;g>=0&&g<r.length;){const y=Math.abs(e)-Math.abs(h),x=l[g];_a(x!=null,`Previous layout not found for panel index ${g}`);const w=x-y,O=QO({overrideDisabledPanels:i,panelConstraints:r[g],prevSize:x,size:w});if(!Bc(x,O)&&(h+=x-O,u[g]=O,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(TNr(c,u))return s;{const g=e<0?f:d,y=l[g];_a(y!=null,`Previous layout not found for panel index ${g}`);const x=y+h,w=QO({overrideDisabledPanels:i,panelConstraints:r[g],prevSize:y,size:x});if(u[g]=w,!Bc(w,x)){let O=x-w,k=e<0?f:d;for(;k>=0&&k<r.length;){const _=u[k];_a(_!=null,`Previous layout not found for panel index ${k}`);const E=_+O,T=QO({overrideDisabledPanels:i,panelConstraints:r[k],prevSize:_,size:E});if(Bc(_,T)||(O-=T-_,u[k]=T),Bc(O,0))break;e>0?k--:k++}}}const p=Object.values(u).reduce((g,y)=>y+g,0);if(!Bc(p,100,.1))return s;const m=Object.keys(s);return u.reduce((g,y,x)=>(g[m[x]]=y,g),{})}function gS(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(t[r]===void 0||hm(e[r],t[r])!==0)return!1;return!0}function yS({layout:e,panelConstraints:t}){const r=Object.values(e),n=[...r],s=n.reduce((l,c)=>l+c,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(l=>`${l}%`).join(", ")}`);if(!Bc(s,100)&&n.length>0)for(let l=0;l<t.length;l++){const c=n[l];_a(c!=null,`No layout data found for index ${l}`);const u=100/s*c;n[l]=u}let a=0;for(let l=0;l<t.length;l++){const c=r[l];_a(c!=null,`No layout data found for index ${l}`);const u=n[l];_a(u!=null,`No layout data found for index ${l}`);const d=QO({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:u});u!=d&&(a+=u-d,n[l]=d)}if(!Bc(a,0))for(let l=0;l<t.length;l++){const c=n[l];_a(c!=null,`No layout data found for index ${l}`);const u=c+a,d=QO({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:c,size:u});if(c!==d&&(a-=d-c,n[l]=d,Bc(a,0)))break}const i=Object.keys(e);return n.reduce((l,c,u)=>(l[i[u]]=c,l),{})}function Iot({groupId:e,panelId:t}){const r=()=>{const l=r1();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:h,separatorToPanels:p}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:h,layout:f,separatorToPanels:p};throw Error(`Group ${e} not found`)},n=()=>{const l=r().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},s=()=>{const l=r().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const l=r().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},i=l=>{const c=a();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:h,layout:p,separatorToPanels:m}=r(),g=f.panels.findIndex(O=>O.id===t),y=g===f.panels.length-1,x=NA({delta:y?c-l:l-c,initialLayout:p,panelConstraints:d,pivotIndices:y?[g-1,g]:[g,g+1],prevLayout:p,trigger:"imperative-api"}),w=yS({layout:x,panelConstraints:d});gS(p,w)||Jy(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:h,layout:w,separatorToPanels:m})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=n(),{mutableValues:u}=s(),d=a();l&&d!==c&&(u.expandToSize=d,i(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=n(),{mutableValues:d}=s(),f=a();if(l&&f===c){let h=d.expandToSize??u;h===0&&(h=1),i(h)}},getSize:()=>{const{group:l}=r(),c=a(),{element:u}=s(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=n(),u=a();return l&&Bc(c,u)},resize:l=>{const{group:c}=r(),{element:u}=s(),d=O_({group:c}),f=dT({groupSize:d,panelElement:u,styleProp:l}),h=Lu(f/d*100);i(h)}}}function jNe(e){if(e.defaultPrevented)return;const t=r1();uhe(e,t).forEach(r=>{if(r.separator){const n=r.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(n){const s=n.panelConstraints.defaultSize,a=Iot({groupId:r.group.id,panelId:n.id});a&&s!==void 0&&(a.resize(s),e.preventDefault())}}})}function ZL(e){const t=r1();for(const[r]of t)if(r.separators.some(n=>n.element===e))return r;throw Error("Could not find parent Group for separator element")}function Rot({groupId:e}){const t=()=>{const r=r1();for(const[n,s]of r)if(n.id===e)return{group:n,...s};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:r,layout:n}=t();return r?{}:n},setLayout(r){const{defaultLayoutDeferred:n,derivedPanelConstraints:s,group:a,groupSize:i,layout:l,separatorToPanels:c}=t(),u=yS({layout:r,panelConstraints:s});return n?l:(gS(l,u)||Jy(a,{defaultLayoutDeferred:n,derivedPanelConstraints:s,groupSize:i,layout:u,separatorToPanels:c}),u)}}}function M0(e,t){const r=ZL(e),n=Yb(r.id,!0),s=r.separators.find(d=>d.element===e);_a(s,"Matching separator not found");const a=n.separatorToPanels.get(s);_a(a,"Matching panels not found");const i=a.map(d=>r.panels.indexOf(d)),l=Rot({groupId:r.id}).getLayout(),c=NA({delta:t,initialLayout:l,panelConstraints:n.derivedPanelConstraints,pivotIndices:i,prevLayout:l,trigger:"keyboard"}),u=yS({layout:c,panelConstraints:n.derivedPanelConstraints});gS(l,u)||Jy(r,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,groupSize:n.groupSize,layout:u,separatorToPanels:n.separatorToPanels})}function TNe(e){if(e.defaultPrevented)return;const t=e.currentTarget,r=ZL(t);if(!r.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),r.orientation==="vertical"&&M0(t,5);break}case"ArrowLeft":{e.preventDefault(),r.orientation==="horizontal"&&M0(t,-5);break}case"ArrowRight":{e.preventDefault(),r.orientation==="horizontal"&&M0(t,5);break}case"ArrowUp":{e.preventDefault(),r.orientation==="vertical"&&M0(t,-5);break}case"End":{e.preventDefault(),M0(t,100);break}case"Enter":{e.preventDefault();const n=ZL(t),s=Yb(n.id,!0),{derivedPanelConstraints:a,layout:i,separatorToPanels:l}=s,c=n.separators.find(h=>h.element===t);_a(c,"Matching separator not found");const u=l.get(c);_a(u,"Matching panels not found");const d=u[0],f=a.find(h=>h.panelId===d.id);if(_a(f,"Panel metadata not found"),f.collapsible){const h=i[d.id],p=f.collapsedSize===h?n.mutableState.expandedPanelSizes[d.id]??f.minSize:f.collapsedSize;M0(t,p-h)}break}case"F6":{e.preventDefault();const n=ZL(t).separators.map(i=>i.element),s=Array.from(n).findIndex(i=>i===e.currentTarget);_a(s!==null,"Index not found");const a=e.shiftKey?s>0?s-1:n.length-1:s+1<n.length?s+1:0;n[a].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),M0(t,-100);break}}}let Tk={cursorFlags:0,state:"inactive"};const dhe=new Tot;function vS(){return Tk}function NNr(e){return dhe.addListener("change",e)}function ANr(e){const t=Tk,r={...Tk};r.cursorFlags=e,Tk=r,dhe.emit("change",{prev:t,next:r})}function Nk(e){const t=Tk;Tk=e,dhe.emit("change",{prev:t,next:e})}function NNe(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=r1(),r=uhe(e,t),n=new Map;let s=!1;r.forEach(a=>{a.separator&&(s||(s=!0,a.separator.element.focus({preventScroll:!0})));const i=t.get(a.group);i&&n.set(a.group,i.layout)}),Nk({cursorFlags:0,hitRegions:r,initialLayoutMap:n,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),r.length&&e.preventDefault()}const INr=e=>e,Qq=()=>{},Pot=1,Mot=2,Dot=4,Lot=8,ANe=3,INe=12;let E2;function RNe(){return E2===void 0&&(E2=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(E2=!0)),E2}function RNr({cursorFlags:e,groups:t,state:r}){let n=0,s=0;switch(r){case"active":case"hover":t.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":{n++;break}case"vertical":{s++;break}}})}if(!(n===0&&s===0)){switch(r){case"active":{if(e&&RNe()){const a=(e&Pot)!==0,i=(e&Mot)!==0,l=(e&Dot)!==0,c=(e&Lot)!==0;if(a)return l?"se-resize":c?"ne-resize":"e-resize";if(i)return l?"sw-resize":c?"nw-resize":"w-resize";if(l)return"s-resize";if(c)return"n-resize"}break}}return RNe()?n>0&&s>0?"move":n>0?"ew-resize":"ns-resize":n>0&&s>0?"grab":n>0?"col-resize":"row-resize"}}const PNe=new WeakMap;function fhe(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:r}=PNe.get(e)??{};r===void 0&&(r=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(r));const n=vS();switch(n.state){case"active":case"hover":{const s=RNr({cursorFlags:n.cursorFlags,groups:n.hitRegions.map(i=>i.group),state:n.state}),a=`*, *:hover {cursor: ${s} !important; }`;if(t===a)return;t=a,s?r.cssRules.length===0?r.insertRule(a):r.replaceSync(a):r.cssRules.length===1&&r.deleteRule(0);break}case"inactive":{t=void 0,r.cssRules.length===1&&r.deleteRule(0);break}}PNe.set(e,{prevStyle:t,styleSheet:r})}function $ot({document:e,event:t,hitRegions:r,initialLayoutMap:n,mountedGroups:s,pointerDownAtPoint:a,prevCursorFlags:i}){let l=0;r.forEach(u=>{const{group:d,groupSize:f}=u,{orientation:h,panels:p}=d,{disableCursor:m}=d.mutableState;let g=0;a?h==="horizontal"?g=(t.clientX-a.x)/f*100:g=(t.clientY-a.y)/f*100:h==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const y=n.get(d),x=s.get(d);if(!y||!x)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:O,groupSize:k,layout:_,separatorToPanels:E}=x;if(O&&_&&E){const T=NA({delta:g,initialLayout:y,panelConstraints:O,pivotIndices:u.panels.map(j=>p.indexOf(j)),prevLayout:_,trigger:"mouse-or-touch"});if(gS(T,_)){if(g!==0&&!m)switch(h){case"horizontal":{l|=g<0?Pot:Mot;break}case"vertical":{l|=g<0?Dot:Lot;break}}}else Jy(u.group,{defaultLayoutDeferred:w,derivedPanelConstraints:O,groupSize:k,layout:T,separatorToPanels:E})}});let c=0;t.movementX===0?c|=i&ANe:c|=l&ANe,t.movementY===0?c|=i&INe:c|=l&INe,ANr(c),fhe(e)}function MNe(e){const t=r1(),r=vS();r.state==="active"&&$ot({document:e.currentTarget,event:e,hitRegions:r.hitRegions,initialLayoutMap:r.initialLayoutMap,mountedGroups:t,prevCursorFlags:r.cursorFlags})}function DNe(e){if(e.defaultPrevented)return;const t=vS(),r=r1();switch(t.state){case"active":{if(e.buttons===0){Nk({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(n=>{const s=Yb(n.group.id,!0);Jy(n.group,s)});return}$ot({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:r,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const n=uhe(e,r);n.length===0?t.state!=="inactive"&&Nk({cursorFlags:0,state:"inactive"}):Nk({cursorFlags:0,hitRegions:n,state:"hover"}),fhe(e.currentTarget);break}}}function LNe(e){e.relatedTarget instanceof HTMLIFrameElement&&vS().state==="hover"&&Nk({cursorFlags:0,state:"inactive"})}function $Ne(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=vS();t.state==="active"&&(Nk({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(fhe(e.currentTarget),t.hitRegions.forEach(r=>{const n=Yb(r.group.id,!0);Jy(r.group,n)}),e.preventDefault()))}function FNe(e){let t=0,r=0;const n={};for(const a of e)if(a.defaultSize!==void 0){t++;const i=Lu(a.defaultSize);r+=i,n[a.panelId]=i}else n[a.panelId]=void 0;const s=e.length-t;if(s!==0){const a=Lu((100-r)/s);for(const i of e)i.defaultSize===void 0&&(n[i.panelId]=a)}return n}function PNr(e,t,r){if(!r[0])return;const n=e.panels.find(c=>c.element===t);if(!n||!n.onResize)return;const s=O_({group:e}),a=e.orientation==="horizontal"?n.element.offsetWidth:n.element.offsetHeight,i=n.mutableValues.prevSize,l={asPercentage:Lu(a/s*100),inPixels:a};n.mutableValues.prevSize=l,n.onResize(l,n.id,i)}function MNr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function DNr({group:e,nextGroupSize:t,prevGroupSize:r,prevLayout:n}){if(r<=0||t<=0||r===t)return n;let s=0,a=0,i=!1;const l=new Map,c=[];for(const f of e.panels){const h=n[f.id]??0;if(f.panelConstraints.groupResizeBehavior==="preserve-pixel-size"){i=!0;const p=h/100*r,m=Lu(p/t*100);l.set(f.id,m),s+=m}else c.push(f.id),a+=h}if(!i||c.length===0)return n;const u=100-s,d={...n};if(l.forEach((f,h)=>{d[h]=f}),a>0)for(const f of c){const h=n[f]??0;d[f]=Lu(h/a*u)}else{const f=Lu(u/c.length);for(const h of c)d[h]=f}return d}function LNr(e,t){const r=e.map(s=>s.id),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r)if(!n.includes(s))return!1;return!0}const cO=new Map;function $Nr(e){let t=!0;_a(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const r=e.element.ownerDocument.defaultView.ResizeObserver,n=new Set,s=new Set,a=new r(m=>{for(const g of m){const{borderBoxSize:y,target:x}=g;if(x===e.element){if(t){const w=O_({group:e});if(w===0)return;const O=Yb(e.id);if(!O)return;const k=Gse(e),_=O.defaultLayoutDeferred?FNe(k):O.layout,E=DNr({group:e,nextGroupSize:w,prevGroupSize:O.groupSize,prevLayout:_}),T=yS({layout:E,panelConstraints:k});if(!O.defaultLayoutDeferred&&gS(O.layout,T)&&MNr(O.derivedPanelConstraints,k)&&O.groupSize===w)return;Jy(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:k,groupSize:w,layout:T,separatorToPanels:O.separatorToPanels})}}else PNr(e,x,y)}});a.observe(e.element),e.panels.forEach(m=>{_a(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&a.observe(m.element)});const i=O_({group:e}),l=Gse(e),c=e.panels.map(({id:m})=>m).join(",");let u=e.mutableState.defaultLayout;u&&(LNr(e.panels,u)||(u=void 0));const d=e.mutableState.layouts[c]??u??FNe(l),f=yS({layout:d,panelConstraints:l}),h=e.element.ownerDocument;cO.set(h,(cO.get(h)??0)+1);const p=new Map;return jot(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),Jy(e,{defaultLayoutDeferred:i===0,derivedPanelConstraints:l,groupSize:i,layout:f,separatorToPanels:p}),e.separators.forEach(m=>{_a(!s.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),s.add(m.id),m.element.addEventListener("keydown",TNe)}),cO.get(h)===1&&(h.addEventListener("dblclick",jNe,!0),h.addEventListener("pointerdown",NNe,!0),h.addEventListener("pointerleave",MNe),h.addEventListener("pointermove",DNe),h.addEventListener("pointerout",LNe),h.addEventListener("pointerup",$Ne,!0)),function(){t=!1,cO.set(h,Math.max(0,(cO.get(h)??0)-1)),xNr(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",TNe)}),cO.get(h)||(h.removeEventListener("dblclick",jNe,!0),h.removeEventListener("pointerdown",NNe,!0),h.removeEventListener("pointerleave",MNe),h.removeEventListener("pointermove",DNe),h.removeEventListener("pointerout",LNe),h.removeEventListener("pointerup",$Ne,!0)),a.disconnect()}}function FNr(){const[e,t]=b.useState({}),r=b.useCallback(()=>t({}),[]);return[e,r]}function hhe(e){const t=b.useId();return`${e??t}`}const n1=typeof window<"u"?b.useLayoutEffect:b.useEffect;function XT(e){const t=b.useRef(e);return n1(()=>{t.current=e},[e]),b.useCallback((...r)=>t.current?.(...r),[t])}function phe(...e){return XT(t=>{e.forEach(r=>{if(r)switch(typeof r){case"function":{r(t);break}case"object":{r.current=t;break}}})})}function mhe(e){const t=b.useRef({...e});return n1(()=>{for(const r in e)t.current[r]=e[r]},[e]),t.current}const Fot=b.createContext(null);function zNr(e,t){const r=b.useRef({getLayout:()=>({}),setLayout:INr});b.useImperativeHandle(t,()=>r.current,[]),n1(()=>{Object.assign(r.current,Rot({groupId:e}))})}function Iz({children:e,className:t,defaultLayout:r,disableCursor:n,disabled:s,elementRef:a,groupRef:i,id:l,onLayoutChange:c,onLayoutChanged:u,orientation:d="horizontal",resizeTargetMinimumSize:f={coarse:20,fine:10},style:h,...p}){const m=b.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=XT(P=>{gS(m.current.onLayoutChange,P)||(m.current.onLayoutChange=P,c?.(P))}),y=XT(P=>{gS(m.current.onLayoutChanged,P)||(m.current.onLayoutChanged=P,u?.(P))}),x=hhe(l),w=b.useRef(null),[O,k]=FNr(),_=b.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:f,separators:[]}),E=phe(w,a);zNr(x,i);const T=XT((P,R)=>{const B=vS(),D=kNe(P),F=Yb(P);if(F){let U=!1;return B.state==="active"&&(U=B.hitRegions.some(z=>z.group===D)),{flexGrow:F.layout[R]??1,pointerEvents:U?"none":void 0}}return{flexGrow:r?.[R]??1}}),j=mhe({defaultLayout:r,disableCursor:n}),A=b.useMemo(()=>({get disableCursor(){return!!j.disableCursor},getPanelStyles:T,id:x,orientation:d,registerPanel:P=>{const R=_.current;return R.panels=Zse(d,[...R.panels,P]),k(),()=>{R.panels=R.panels.filter(B=>B!==P),k()}},registerSeparator:P=>{const R=_.current;return R.separators=Zse(d,[...R.separators,P]),k(),()=>{R.separators=R.separators.filter(B=>B!==P),k()}},togglePanelDisabled:(P,R)=>{const B=_.current.panels.find(U=>U.id===P);B&&(B.panelConstraints.disabled=R);const D=kNe(x),F=Yb(x);D&&F&&Jy(D,{...F,derivedPanelConstraints:Gse(D)})},toggleSeparatorDisabled:(P,R)=>{const B=_.current.separators.find(D=>D.id===P);B&&(B.disabled=R)}}),[T,x,k,d,j]),I=b.useRef(null);return n1(()=>{const P=w.current;if(P===null)return;const R=_.current;let B;if(j.defaultLayout!==void 0&&Object.keys(j.defaultLayout).length===R.panels.length){B={};for(const L of R.panels){const Y=j.defaultLayout[L.id];Y!==void 0&&(B[L.id]=Y)}}const D={disabled:!!s,element:P,id:x,mutableState:{defaultLayout:B,disableCursor:!!j.disableCursor,expandedPanelSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:d,panels:R.panels,resizeTargetMinimumSize:R.resizeTargetMinimumSize,separators:R.separators};I.current=D;const F=$Nr(D),{defaultLayoutDeferred:U,derivedPanelConstraints:z,layout:V}=Yb(D.id,!0);!U&&z.length>0&&(g(V),y(V));const W=che(x,L=>{const{defaultLayoutDeferred:Y,derivedPanelConstraints:q,layout:M}=L.next;if(Y||q.length===0)return;const Q=D.panels.map(({id:J})=>J).join(",");D.mutableState.layouts[Q]=M,q.forEach(J=>{if(J.collapsible){const{layout:ie}=L.prev??{};if(ie){const te=Bc(J.collapsedSize,M[J.panelId]),se=Bc(J.collapsedSize,ie[J.panelId]);te&&!se&&(D.mutableState.expandedPanelSizes[J.panelId]=ie[J.panelId])}}});const G=vS().state!=="active";g(M),G&&y(M)});return()=>{I.current=null,F(),W()}},[s,x,y,g,d,O,j]),b.useEffect(()=>{const P=I.current;P&&(P.mutableState.defaultLayout=r,P.mutableState.disableCursor=!!n)}),o.jsx(Fot.Provider,{value:A,children:o.jsx("div",{...p,className:t,"data-group":!0,"data-testid":x,id:x,ref:E,style:{height:"100%",width:"100%",overflow:"hidden",...h,display:"flex",flexDirection:d==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:d==="horizontal"?"pan-y":"pan-x"},children:e})})}Iz.displayName="Group";function Wq(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function ghe({debounceSaveMs:e=100,panelIds:t,storage:r=localStorage,...n}){const s=t!==void 0,a="id"in n?n.id:n.groupId,i=Wq(a,t??[]),l=b.useSyncExternalStore(BNr,()=>r.getItem(i),()=>r.getItem(i)),c=b.useMemo(()=>l?JSON.parse(l):void 0,[l]),u=b.useRef(null),d=b.useCallback(()=>{const p=u.current;p&&(u.current=null,clearTimeout(p))},[]);b.useLayoutEffect(()=>()=>{d()},[d]);const f=b.useCallback(p=>{d();let m;s?m=Wq(a,Object.keys(p)):m=Wq(a,[]);try{r.setItem(m,JSON.stringify(p))}catch(g){console.error(g)}},[d,s,a,r]),h=b.useCallback(p=>{d(),e===0?f(p):u.current=setTimeout(()=>{f(p)},e)},[d,e,f]);return{defaultLayout:c,onLayoutChange:h,onLayoutChanged:f}}function BNr(){return function(){}}function yhe(){const e=b.useContext(Fot);return _a(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function UNr(e,t){const{id:r}=yhe(),n=b.useRef({collapse:Qq,expand:Qq,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Qq});b.useImperativeHandle(t,()=>n.current,[]),n1(()=>{Object.assign(n.current,Iot({groupId:r,panelId:e}))})}function k_({children:e,className:t,collapsedSize:r="0%",collapsible:n=!1,defaultSize:s,disabled:a,elementRef:i,groupResizeBehavior:l="preserve-relative-size",id:c,maxSize:u="100%",minSize:d="0%",onResize:f,panelRef:h,style:p,...m}){const g=!!c,y=hhe(c),x=mhe({disabled:a}),w=b.useRef(null),O=phe(w,i),{getPanelStyles:k,id:_,orientation:E,registerPanel:T,togglePanelDisabled:j}=yhe(),A=f!==null,I=XT((R,B,D)=>{f?.(R,c,D)});n1(()=>{const R=w.current;if(R!==null){const B={element:R,id:y,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:A?I:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:r,collapsible:n,defaultSize:s,disabled:x.disabled,maxSize:u,minSize:d}};return T(B)}},[l,r,n,s,A,y,g,u,d,I,T,x]),b.useEffect(()=>{j(y,!!a)},[a,y,j]),UNr(y,h);const P=b.useSyncExternalStore(R=>che(_,R),()=>JSON.stringify(k(_,y)),()=>JSON.stringify(k(_,y)));return o.jsx("div",{...m,"aria-disabled":a||void 0,"data-panel":!0,"data-testid":y,id:y,ref:O,style:{...VNr,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(P)},children:o.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:E==="horizontal"?"pan-y":"pan-x"},children:e})})}k_.displayName="Panel";const VNr={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function qNr(){return b.useRef(null)}function HNr({layout:e,panelConstraints:t,panelId:r,panelIndex:n}){let s,a;const i=e[r],l=t.find(c=>c.panelId===r);if(l){const c=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,d=[n,n+1];a=yS({layout:NA({delta:u-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[r],s=yS({layout:NA({delta:c-i,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[r]}return{valueControls:r,valueMax:s,valueMin:a,valueNow:i}}function zot({children:e,className:t,disabled:r,elementRef:n,id:s,style:a,...i}){const l=hhe(s),c=mhe({disabled:r}),[u,d]=b.useState({}),[f,h]=b.useState("inactive"),p=b.useRef(null),m=phe(p,n),{disableCursor:g,id:y,orientation:x,registerSeparator:w,toggleSeparatorDisabled:O}=yhe(),k=x==="horizontal"?"vertical":"horizontal";n1(()=>{const E=p.current;if(E!==null){const T={disabled:c.disabled,element:E,id:l},j=w(T),A=NNr(P=>{h(P.next.state!=="inactive"&&P.next.hitRegions.some(R=>R.separator===T)?P.next.state:"inactive")}),I=che(y,P=>{const{derivedPanelConstraints:R,layout:B,separatorToPanels:D}=P.next,F=D.get(T);if(F){const U=F[0],z=F.indexOf(U);d(HNr({layout:B,panelConstraints:R,panelId:U.id,panelIndex:z}))}});return()=>{A(),I(),j()}}},[y,l,w,c]),b.useEffect(()=>{O(l,!!r)},[r,l,O]);let _;return r&&!g&&(_="not-allowed"),o.jsx("div",{...i,"aria-controls":u.valueControls,"aria-disabled":r||void 0,"aria-orientation":k,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":r?"disabled":f,"data-testid":l,id:l,ref:m,role:"separator",style:{flexBasis:"auto",cursor:_,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:r?void 0:0})}zot.displayName="Separator";const pc={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},nP="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",QNr="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",WNr="rounded-md",vhe="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",bhe="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",xhe="disabled:opacity-50 disabled:cursor-not-allowed";function Bot(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Bot(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Uot(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Bot(e))&&(n&&(n+=" "),n+=t);return n}const GNr=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},ZNr=(e,t)=>({classGroupId:e,validator:t}),Vot=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),H5="-",zNe=[],YNr="arbitrary..",XNr=e=>{const t=JNr(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return KNr(i);const l=i.split(H5),c=l[0]===""&&l.length>1?1:0;return qot(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],u=r[i];return c?u?GNr(u,c):c:u||zNe}return r[i]||zNe}}},qot=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const u=qot(e,t+1,a);if(u)return u}const i=r.validators;if(i===null)return;const l=t===0?e.join(H5):e.slice(t).join(H5),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},KNr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?YNr+n:void 0})(),JNr=e=>{const{theme:t,classGroups:r}=e;return eAr(r,t)},eAr=(e,t)=>{const r=Vot();for(const n in e){const s=e[n];whe(s,r,n,t)}return r},whe=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];tAr(i,t,r,n)}},tAr=(e,t,r,n)=>{if(typeof e=="string"){rAr(e,t,r);return}if(typeof e=="function"){nAr(e,t,r,n);return}sAr(e,t,r,n)},rAr=(e,t,r)=>{const n=e===""?t:Hot(t,e);n.classGroupId=r},nAr=(e,t,r,n)=>{if(aAr(e)){whe(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(ZNr(r,e))},sAr=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];whe(c,Hot(t,l),r,n)}},Hot=(e,t)=>{let r=e;const n=t.split(H5),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=Vot(),r.nextPart.set(i,l)),r=l}return r},aAr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,iAr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},Yse="!",BNe=":",oAr=[],UNe=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),lAr=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,u;const d=s.length;for(let g=0;g<d;g++){const y=s[g];if(i===0&&l===0){if(y===BNe){a.push(s.slice(c,g)),c=g+1;continue}if(y==="/"){u=g;continue}}y==="["?i++:y==="]"?i--:y==="("?l++:y===")"&&l--}const f=a.length===0?s:s.slice(c);let h=f,p=!1;f.endsWith(Yse)?(h=f.slice(0,-1),p=!0):f.startsWith(Yse)&&(h=f.slice(1),p=!0);const m=u&&u>c?u-c:void 0;return UNe(a,p,h,m)};if(t){const s=t+BNe,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):UNe(oAr,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},cAr=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],l=i[0]==="[",c=t.has(i);l||c?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},uAr=e=>({cache:iAr(e.cacheSize),parseClassName:lAr(e),sortModifiers:cAr(e),...XNr(e)}),dAr=/\s+/,fAr=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(dAr);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!g,x=n(y?m.substring(0,g):m);if(!x){if(!y){c=d+(c.length>0?" "+c:c);continue}if(x=n(m),!x){c=d+(c.length>0?" "+c:c);continue}y=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),O=p?w+Yse:w,k=O+x;if(i.indexOf(k)>-1)continue;i.push(k);const _=s(x,y);for(let E=0;E<_.length;++E){const T=_[E];i.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},hAr=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Qot(r))&&(s&&(s+=" "),s+=n);return s},Qot=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Qot(e[n]))&&(r&&(r+=" "),r+=t);return r},VNe=(e,...t)=>{let r,n,s,a;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return r=uAr(u),n=r.cache.get,s=r.cache.set,a=l,l(c)},l=c=>{const u=n(c);if(u)return u;const d=fAr(c,r);return s(c,d),d};return a=i,(...c)=>a(hAr(...c))},pAr=[],qo=e=>{const t=r=>r[e]||pAr;return t.isThemeGetter=!0,t},Wot=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Got=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mAr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gAr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yAr=/\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$/,vAr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bAr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xAr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ub=e=>mAr.test(e),zn=e=>!!e&&!Number.isNaN(Number(e)),db=e=>!!e&&Number.isInteger(Number(e)),Gq=e=>e.endsWith("%")&&zn(e.slice(0,-1)),Jg=e=>gAr.test(e),Zot=()=>!0,wAr=e=>yAr.test(e)&&!vAr.test(e),She=()=>!1,SAr=e=>bAr.test(e),OAr=e=>xAr.test(e),kAr=e=>!br(e)&&!_r(e),_Ar=e=>t0(e,Kot,She),br=e=>Wot.test(e),D0=e=>t0(e,Jot,wAr),qNe=e=>t0(e,RAr,zn),EAr=e=>t0(e,tlt,Zot),CAr=e=>t0(e,elt,She),HNe=e=>t0(e,Yot,She),jAr=e=>t0(e,Xot,OAr),C2=e=>t0(e,rlt,SAr),_r=e=>Got.test(e),Ej=e=>s1(e,Jot),TAr=e=>s1(e,elt),QNe=e=>s1(e,Yot),NAr=e=>s1(e,Kot),AAr=e=>s1(e,Xot),j2=e=>s1(e,rlt,!0),IAr=e=>s1(e,tlt,!0),t0=(e,t,r)=>{const n=Wot.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},s1=(e,t,r=!1)=>{const n=Got.exec(e);return n?n[1]?t(n[1]):r:!1},Yot=e=>e==="position"||e==="percentage",Xot=e=>e==="image"||e==="url",Kot=e=>e==="length"||e==="size"||e==="bg-size",Jot=e=>e==="length",RAr=e=>e==="number",elt=e=>e==="family-name",tlt=e=>e==="number"||e==="weight",rlt=e=>e==="shadow",WNe=()=>{const e=qo("color"),t=qo("font"),r=qo("text"),n=qo("font-weight"),s=qo("tracking"),a=qo("leading"),i=qo("breakpoint"),l=qo("container"),c=qo("spacing"),u=qo("radius"),d=qo("shadow"),f=qo("inset-shadow"),h=qo("text-shadow"),p=qo("drop-shadow"),m=qo("blur"),g=qo("perspective"),y=qo("aspect"),x=qo("ease"),w=qo("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...k(),_r,br],E=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[_r,br,c],A=()=>[ub,"full","auto",...j()],I=()=>[db,"none","subgrid",_r,br],P=()=>["auto",{span:["full",db,_r,br]},db,_r,br],R=()=>[db,"auto",_r,br],B=()=>["auto","min","max","fr",_r,br],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...j()],z=()=>[ub,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],V=()=>[ub,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[ub,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],L=()=>[e,_r,br],Y=()=>[...k(),QNe,HNe,{position:[_r,br]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",NAr,_Ar,{size:[_r,br]}],Q=()=>[Gq,Ej,D0],G=()=>["","none","full",u,_r,br],J=()=>["",zn,Ej,D0],ie=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[zn,Gq,QNe,HNe],oe=()=>["","none",m,_r,br],he=()=>["none",zn,_r,br],K=()=>["none",zn,_r,br],re=()=>[zn,_r,br],le=()=>[ub,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jg],breakpoint:[Jg],color:[Zot],container:[Jg],"drop-shadow":[Jg],ease:["in","out","in-out"],font:[kAr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jg],shadow:[Jg],spacing:["px",zn],text:[Jg],"text-shadow":[Jg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ub,br,_r,y]}],container:["container"],columns:[{columns:[zn,br,_r,l]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[db,"auto",_r,br]}],basis:[{basis:[ub,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[zn,ub,"auto","initial","none",br]}],grow:[{grow:["",zn,_r,br]}],shrink:[{shrink:["",zn,_r,br]}],order:[{order:[db,"first","last","none",_r,br]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...D(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...D()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...z()]}],"min-w":[{"min-w":[l,"screen","none",...z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",r,Ej,D0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,IAr,EAr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Gq,br]}],"font-family":[{font:[TAr,CAr,t]}],"font-features":[{"font-features":[br]}],"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:[s,_r,br]}],"line-clamp":[{"line-clamp":[zn,"none",_r,qNe]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",_r,br]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_r,br]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[zn,"from-font","auto",_r,D0]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[zn,"auto",_r,br]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_r,br]}],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",_r,br]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},db,_r,br],radial:["",_r,br],conic:[db,_r,br]},AAr,jAr]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[zn,_r,br]}],"outline-w":[{outline:["",zn,Ej,D0]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",d,j2,C2]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",f,j2,C2]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[zn,D0]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",h,j2,C2]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[zn,_r,br]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"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":[zn]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[_r,br]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"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":k()}],"mask-image-conic-pos":[{"mask-conic":[zn]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_r,br]}],filter:[{filter:["","none",_r,br]}],blur:[{blur:oe()}],brightness:[{brightness:[zn,_r,br]}],contrast:[{contrast:[zn,_r,br]}],"drop-shadow":[{"drop-shadow":["","none",p,j2,C2]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",zn,_r,br]}],"hue-rotate":[{"hue-rotate":[zn,_r,br]}],invert:[{invert:["",zn,_r,br]}],saturate:[{saturate:[zn,_r,br]}],sepia:[{sepia:["",zn,_r,br]}],"backdrop-filter":[{"backdrop-filter":["","none",_r,br]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[zn,_r,br]}],"backdrop-contrast":[{"backdrop-contrast":[zn,_r,br]}],"backdrop-grayscale":[{"backdrop-grayscale":["",zn,_r,br]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[zn,_r,br]}],"backdrop-invert":[{"backdrop-invert":["",zn,_r,br]}],"backdrop-opacity":[{"backdrop-opacity":[zn,_r,br]}],"backdrop-saturate":[{"backdrop-saturate":[zn,_r,br]}],"backdrop-sepia":[{"backdrop-sepia":["",zn,_r,br]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_r,br]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[zn,"initial",_r,br]}],ease:[{ease:["linear","initial",x,_r,br]}],delay:[{delay:[zn,_r,br]}],animate:[{animate:["none",w,_r,br]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,_r,br]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[_r,br,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"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",_r,br]}],"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":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",_r,br]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[zn,Ej,D0,qNe]}],stroke:[{stroke:["none",...L()]}],"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"]}},PAr=(e,{cacheSize:t,prefix:r,experimentalParseClassName:n,extend:s={},override:a={}})=>(fT(e,"cacheSize",t),fT(e,"prefix",r),fT(e,"experimentalParseClassName",n),T2(e.theme,a.theme),T2(e.classGroups,a.classGroups),T2(e.conflictingClassGroups,a.conflictingClassGroups),T2(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),fT(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),N2(e.theme,s.theme),N2(e.classGroups,s.classGroups),N2(e.conflictingClassGroups,s.conflictingClassGroups),N2(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),nlt(e,s,"orderSensitiveModifiers"),e),fT=(e,t,r)=>{r!==void 0&&(e[t]=r)},T2=(e,t)=>{if(t)for(const r in t)fT(e,r,t[r])},N2=(e,t)=>{if(t)for(const r in t)nlt(e,t,r)},nlt=(e,t,r)=>{const n=t[r];n!==void 0&&(e[r]=e[r]?e[r].concat(n):n)},MAr=(e,...t)=>typeof e=="function"?VNe(WNe,e,...t):VNe(()=>PAr(WNe(),e),...t),DAr=Object.keys({...Ib,...l_t}),LAr=Object.keys(p_t),$Ar=Object.keys(c_t),FAr=Object.keys(u_t),zAr=Object.keys(o_t),L0=Object.keys(h_t),BAr=Object.keys(d_t).concat(Object.keys(f_t)),UAr=MAr({extend:{theme:{color:DAr,spacing:LAr,radius:zAr,leading:FAr,shadow:BAr},classGroups:{"font-size":[{text:$Ar}],h:[{h:L0}],w:[{w:L0}],size:[{size:L0}],"min-h":[{"min-h":L0}],"min-w":[{"min-w":L0}],"max-h":[{"max-h":L0}],"max-w":[{"max-w":L0}]}}});function Z(...e){return UAr(Uot(e))}const VAr={sm:`${pc.sm} text-ui-sm px-[.75em]`,md:`${pc.md} text-ui-md px-[.75em]`,default:`${pc.default} text-ui-md px-[.85em] `,lg:`${pc.lg} text-ui-lg px-[1em] `},qAr={default:"bg-surface3 border-2 border-border1 hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral5",primary:"bg-surface4 border-2 border-border2 hover:text-neutral6 hover:bg-surface5 active:bg-surface6 text-neutral6",cta:"bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",ghost:"bg-transparent border-2 border-transparent hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral4",inputLike:vhe,light:"",outline:""},HAr=Z("flex items-center justify-center gap-[.75em] leading-0 transition-colors duration-200 ease-out-custom rounded-lg","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100",xhe,bhe),QAr={light:"default",outline:"default"};function WAr(e){return QAr[e]??e}function ME(e){const t=WAr(e?.variant||"default"),r=e?.size||"default";return Z(HAr,qAr[t],VAr[r],e?.iconOnly&&"[&>svg]:opacity-75")}function slt(e){const t=[];return je.Children.forEach(e,r=>{je.isValidElement(r)&&r.type===je.Fragment?t.push(...slt(r.props.children)):t.push(r)}),t}function GAr(e){const t=slt(e);return t.length>0&&t.every(r=>je.isValidElement(r))}const ve=je.forwardRef(({className:e,as:t,size:r="default",variant:n="default",disabled:s,children:a,...i},l)=>{const c=t||"button",u=GAr(a);return o.jsx(c,{ref:l,disabled:s,className:Z(ME({variant:n,size:r,iconOnly:u}),e),...i,children:a})});ve.displayName="Button";const nd=aCt,Yr=iCt,Xr=oCt,Wr=b.forwardRef(({className:e,sideOffset:t=4,children:r,...n},s)=>o.jsx(lCt,{children:o.jsxs(RBe,{ref:s,sideOffset:t,className:Z("z-50 overflow-hidden rounded-md bg-surface3 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=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",e),...n,children:[r,o.jsx(cCt,{className:"fill-surface3"})]})}));Wr.displayName=RBe.displayName;const xs=je.forwardRef(({tooltipContent:e,...t},r)=>o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(ve,{ref:r,...t})}),e&&o.jsx(Wr,{children:e})]}));xs.displayName="ButtonWithTooltip";const ZAr={sm:"[&>svg]:h-icon-sm [&>svg]:w-icon-sm",default:"[&>svg]:h-icon-default [&>svg]:w-icon-default",lg:"[&>svg]:h-icon-lg [&>svg]:w-icon-lg"},Ce=({children:e,className:t,size:r="default",...n})=>o.jsx("span",{className:Z("block",ZAr[r],t),...n,children:e}),nn={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},r0={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},alt=({children:e})=>o.jsx("nav",{className:"bg-surface2 min-h-full overflow-hidden",children:e}),Q5=({children:e,as:t="a",href:r,className:n,prefetch:s,to:a})=>o.jsx(t,{href:r,prefetch:s,to:a,className:Z("text-ui-sm flex h-full w-full flex-col justify-center font-medium cursor-pointer",nn.colors,n),children:e}),ilt=({children:e})=>o.jsx("ol",{"data-testid":"thread-list",children:e}),W5=({children:e,isActive:t,className:r})=>o.jsx("li",{className:Z("border-b border-border1 group flex h-[54px] items-center justify-between gap-2 px-3 py-2",nn.colors,"hover:bg-surface3",t&&"bg-accent1Dark",r),children:e}),olt=({onClick:e})=>o.jsx(ve,{variant:"ghost",className:Z("shrink-0 opacity-0",nn.all,"group-focus-within:opacity-100 group-hover:opacity-100","hover:bg-surface4 hover:text-accent2"),onClick:e,children:o.jsx(Ce,{children:o.jsx(ff,{"aria-label":"delete thread",className:"text-neutral3 hover:text-accent2 transition-colors"})})}),YAr={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-smd":"text-ui-smd leading-ui-smd","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","header-xs":"text-header-xs leading-header-xs","header-sm":"text-header-sm leading-header-sm","header-md":"text-header-md leading-header-md","header-lg":"text-header-lg leading-header-lg","header-xl":"text-header-xl leading-header-xl"},XAr={mono:"font-mono"},me=({as:e="p",className:t,variant:r="ui-md",font:n,...s})=>o.jsx(e,{className:Z(YAr[r],n&&XAr[n],t),...s}),pa=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",fill:"currentColor"}),o.jsx("path",{d:"M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",fill:"currentColor"})]}),KAr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M11.0313 7.97578C11.0313 9.34436 9.92183 10.4538 8.55324 10.4538C7.18466 10.4538 6.0752 9.34436 6.0752 7.97578C6.0752 6.60719 7.18466 5.49773 8.55324 5.49773C9.92183 5.49773 11.0313 6.60719 11.0313 7.97578ZM11.0313 7.97578H14.573",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"}),o.jsx("path",{d:"M12.967 4.46154C11.9273 3.14431 10.3165 2.29883 8.50814 2.29883C5.37277 2.29883 2.83105 4.84055 2.83105 7.97591C2.83105 11.1113 5.37277 13.653 8.50814 13.653C10.3165 13.653 11.9273 12.8075 12.967 11.4903",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"})]}),Ohe=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.97865 4.57004C8.22604 4.75795 8.27426 5.11082 8.08635 5.35821L6.05486 8.03279C5.94873 8.17251 5.78348 8.25471 5.60803 8.25505C5.43257 8.2554 5.267 8.17385 5.16032 8.03454L3.80937 6.27034C3.6205 6.02369 3.66733 5.67063 3.91398 5.48176C4.16063 5.29288 4.51369 5.33972 4.70257 5.58637L5.6051 6.76498L7.19048 4.67774C7.37839 4.43036 7.73126 4.38213 7.97865 4.57004Z",fill:"currentColor"})]}),khe=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.89741 4.10293C8.11707 4.32261 8.11706 4.67877 7.89738 4.89843L6.79517 6.00058L7.8962 7.10155C8.11588 7.32122 8.11589 7.67737 7.89623 7.89705C7.67656 8.11673 7.32041 8.11674 7.10073 7.89707L5.99965 6.79605L4.89856 7.89707C4.67889 8.11673 4.32273 8.11672 4.10307 7.89704C3.88341 7.67737 3.88342 7.32121 4.10309 7.10155L5.20413 6.00058L4.10191 4.89843C3.88224 4.67877 3.88223 4.32262 4.10189 4.10294C4.32155 3.88326 4.67771 3.88325 4.89738 4.10292L5.99965 5.20511L7.10191 4.10291C7.32159 3.88325 7.67774 3.88326 7.89741 4.10293Z",fill:"currentColor"})]}),kv=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.1747 3.18598L7.02554 1.95209C7.11557 1.89207 7.31087 1.87106 7.41016 1.90924L12.4139 3.83377C12.4683 3.85467 12.546 3.96798 12.546 4.03118V13.0167C12.546 13.265 12.7473 13.4663 12.9956 13.4663C13.2439 13.4663 13.4452 13.265 13.4452 13.0167V4.03118C13.4452 3.59605 13.1384 3.14906 12.7367 2.99456L7.73293 1.07004C7.36225 0.927472 6.86056 0.981451 6.52679 1.20396L4.20445 2.75219L3.90419 2.95236L3.90647 2.95824C3.69329 3.05449 3.55469 3.27599 3.55469 3.57581V11.7119C3.55469 12.2084 3.93067 12.7499 4.39251 12.9206L9.89804 14.955C10.3608 15.126 10.7359 14.8596 10.7359 14.3659V5.83295C10.7359 5.33662 10.3498 4.81289 9.88389 4.66643L5.1747 3.18598Z",fill:"currentColor"})}),llt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:o.jsx("path",{d:"M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",fill:"currentColor"})}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_22095",children:o.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),clt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[o.jsx("path",{d:"M13.5037 7.54867C13.5037 7.1144 13.4648 6.69683 13.3924 6.29596H7.62436V8.66776H10.9204C10.7756 9.43052 10.3413 10.0764 9.68994 10.5106V12.0529H11.6776C12.8356 10.9839 13.5037 9.41382 13.5037 7.54867Z",fill:"#4285F4"}),o.jsx("path",{d:"M7.62415 13.5339C9.27773 13.5339 10.6643 12.9882 11.6776 12.0529L9.68994 10.5106C9.14431 10.8781 8.44816 11.1009 7.62415 11.1009C6.03182 11.1009 4.67889 10.0263 4.19451 8.57877H2.15677V10.16C3.1645 12.1587 5.23008 13.5339 7.62415 13.5339Z",fill:"#34A853"}),o.jsx("path",{d:"M4.19472 8.57315C4.07223 8.20569 3.99985 7.81595 3.99985 7.40952C3.99985 7.00308 4.07223 6.61335 4.19472 6.24589V4.66469H2.15698C1.73941 5.4887 1.5 6.41849 1.5 7.40952C1.5 8.40055 1.73941 9.33034 2.15698 10.1543L3.74374 8.91834L4.19472 8.57315Z",fill:"#FBBC05"}),o.jsx("path",{d:"M7.62415 3.72376C8.5261 3.72376 9.32783 4.03555 9.96811 4.63685L11.7219 2.88306C10.6585 1.89202 9.27773 1.28516 7.62415 1.28516C5.23008 1.28516 3.16471 2.66036 2.15698 4.66469L4.19472 6.24589C4.6791 4.79832 6.03182 3.72376 7.62415 3.72376Z",fill:"#EA4335"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_20513",children:o.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),JAr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M4.31445 3.16083C3.78402 3.16083 3.27531 3.37154 2.90024 3.74661C2.52517 4.12169 2.31445 4.63039 2.31445 5.16083V5.66083C2.31445 6.19126 2.52517 6.69997 2.90024 7.07504C3.27531 7.45011 3.78402 7.66083 4.31445 7.66083C4.84489 7.66083 5.35359 7.45011 5.72867 7.07504C6.10374 6.69997 6.31445 6.19126 6.31445 5.66083V5.16083C6.31445 4.63039 6.10374 4.12169 5.72867 3.74661C5.35359 3.37154 4.84489 3.16083 4.31445 3.16083Z",fill:"currentColor"}),o.jsx("path",{d:"M6.76666 9.50235C6.57678 9.28532 6.30244 9.16083 6.01407 9.16083H4.50201C4.10791 9.16078 3.71766 9.23838 3.35356 9.38921C3.11733 9.48706 2.8951 9.6145 2.69205 9.76806C2.48056 9.928 2.38001 10.1888 2.38001 10.454V13.0642C2.38001 13.6165 2.82773 14.0642 3.38001 14.0642H8.55436C9.4135 14.0642 9.87269 13.0523 9.30695 12.4057L6.76666 9.50235Z",fill:"currentColor"}),o.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),Rz=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M3.8674 9.19968L4.14554 10.8649C4.23965 11.4283 4.75254 11.8237 5.32137 11.7713L5.58252 11.7472C6.56555 11.6567 7.43309 12.3868 7.51181 13.3708L7.59308 14.3867C7.60422 14.5259 7.71868 14.6342 7.85825 14.6376L9.91053 14.6876C10.1066 14.6924 10.2434 14.4948 10.17 14.3129L8.90452 11.1782C8.80956 10.9429 8.65085 10.7389 8.44626 10.5889L7.90134 10.1895C7.70604 10.0464 7.55223 9.85411 7.45759 9.63124C7.15011 8.90712 6.6579 7.71234 6.37054 6.88944C6.19204 6.3783 5.79931 6.29158 5.45492 6.21553C4.98179 6.11106 4.5999 6.02673 4.99001 4.88985C5.66408 2.92541 8.06015 2.07904 10.6601 3.33088C12.6488 4.2884 13.1187 6.35416 13.0328 7.58237C13.0297 7.62768 13.0214 7.67186 13.0094 7.71566C12.8829 8.17534 12.368 8.40491 11.9415 8.19169L10.3022 7.37201C10.2069 7.32439 10.0927 7.33657 10.0096 7.40322L8.64809 8.49559C8.55405 8.57104 8.52072 8.69931 8.56615 8.811L10.8995 14.5478C10.9404 14.6483 11.0369 14.715 11.1454 14.7177L12.0572 14.7399C12.2581 14.7448 12.3951 14.5382 12.3124 14.3551L11.8681 13.3706C11.4211 12.3803 11.6047 11.2192 12.3354 10.4151L13.4616 9.17575C13.7473 8.86125 13.9224 8.46187 13.9599 8.03858L13.9763 7.85359C14.2866 4.35298 11.377 1.41272 7.87336 1.68639C6.03919 1.82965 4.45399 3.02228 3.80807 4.74492L3.70275 5.02579C3.5828 5.34571 3.62741 5.70411 3.82213 5.98485L3.88946 6.08192C4.12183 6.41695 4.0958 6.86726 3.82637 7.17328L3.06705 8.03572C2.96261 8.15435 2.98058 8.33664 3.10617 8.43259L3.66059 8.85617C3.77064 8.94026 3.84458 9.06307 3.8674 9.19968Z",fill:"currentColor"})}),_he=e=>o.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.40864 11.9983C7.58064 11.9733 6.84164 11.6153 6.31564 11.0563C6.31464 11.0563 6.31464 11.0553 6.31464 11.0553C5.78864 10.4963 5.47564 9.73633 5.50064 8.90833C5.52564 8.08033 5.88464 7.34133 6.44364 6.81533C7.00264 6.28833 7.76264 5.97633 8.59064 6.00133C9.41864 6.02633 10.1576 6.38433 10.6836 6.94333H10.6846C11.2106 7.50333 11.5236 8.26233 11.4986 9.09033C11.4726 9.91833 11.1146 10.6583 10.5556 11.1843C9.99664 11.7103 9.23664 12.0233 8.40864 11.9983ZM16.1266 8.15033L14.3606 7.74033C14.2316 7.14133 14.0146 6.57633 13.7216 6.05733L14.7726 4.57933C14.9116 4.38533 14.8926 4.12033 14.7296 3.94633L13.9206 3.08733C13.7576 2.91333 13.4946 2.87933 13.2916 3.00533L11.7526 3.96533C11.2526 3.64133 10.7016 3.39033 10.1116 3.22633L9.80964 1.43833C9.76964 1.20333 9.56964 1.02833 9.33164 1.02133L8.15264 0.985326C7.91364 0.978326 7.70364 1.14033 7.64964 1.37233L7.24064 3.13933C6.64164 3.26733 6.07664 3.48433 5.55664 3.77733L4.07864 2.72633C3.88464 2.58833 3.61964 2.60633 3.44664 2.76933L2.58664 3.57833C2.41364 3.74133 2.37964 4.00533 2.50564 4.20733L3.46564 5.74633C3.14164 6.24633 2.89064 6.79833 2.72564 7.38833L0.937635 7.68933C0.702635 7.72933 0.528635 7.92933 0.520635 8.16733L0.485635 9.34733C0.477635 9.58533 0.639635 9.79533 0.872635 9.84933L2.63864 10.2583C2.76764 10.8573 2.98464 11.4233 3.27764 11.9423L2.22564 13.4203C2.08764 13.6143 2.10564 13.8793 2.26964 14.0523L3.07864 14.9123C3.24164 15.0853 3.50464 15.1203 3.70664 14.9933L5.24564 14.0333C5.74663 14.3583 6.29764 14.6093 6.88764 14.7733L7.18964 16.5613C7.22864 16.7963 7.42864 16.9713 7.66764 16.9783L8.84663 17.0143C9.08564 17.0213 9.29564 16.8593 9.34964 16.6273L9.75864 14.8603C10.3576 14.7323 10.9226 14.5153 11.4416 14.2213L12.9206 15.2733C13.1146 15.4113 13.3786 15.3933 13.5526 15.2293L14.4116 14.4213C14.5856 14.2573 14.6196 13.9943 14.4936 13.7923L13.5336 12.2533C13.8576 11.7523 14.1086 11.2013 14.2726 10.6113L16.0616 10.3103C16.2966 10.2703 16.4706 10.0703 16.4776 9.83233L16.5136 8.65233C16.5206 8.41433 16.3586 8.20433 16.1266 8.15033Z",fill:"currentColor"})}),eIr=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),Ai=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",fill:"currentColor"})}),DE=e=>o.jsx(a_t,{...e}),Ii=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",fill:"currentColor"})}),ml=e=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",fill:"currentColor"}),o.jsx("path",{d:"M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",fill:"currentColor"})]}),Pz=e=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});function np(e){return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),o.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),o.jsx("path",{d:"M15 2v2"}),o.jsx("path",{d:"M15 20v2"}),o.jsx("path",{d:"M2 15h2"}),o.jsx("path",{d:"M2 9h2"}),o.jsx("path",{d:"M20 15h2"}),o.jsx("path",{d:"M20 9h2"}),o.jsx("path",{d:"M9 2v2"}),o.jsx("path",{d:"M9 20v2"})]})}const ult=e=>o.jsxs("svg",{className:"h-3 w-3",width:"16",height:"16",viewBox:"0 0 181 108",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_1480_1723)",children:[o.jsx("path",{d:"M51.2203 39.3158C51.2203 41.5066 51.4572 43.2829 51.8717 44.5856C52.3453 45.8882 52.9374 47.3093 53.7664 48.8487C54.0624 49.3224 54.1809 49.7961 54.1809 50.2106C54.1809 50.8027 53.8256 51.3948 53.0559 51.9869L49.3256 54.4737C48.7927 54.829 48.2598 55.0066 47.7861 55.0066C47.194 55.0066 46.6019 54.7106 46.0098 54.1777C45.1809 53.2895 44.4703 52.3422 43.8782 51.3948C43.2861 50.3882 42.694 49.2632 42.0427 47.9014C37.4243 53.3487 31.6217 56.0724 24.6348 56.0724C19.6611 56.0724 15.694 54.6514 12.7927 51.8093C9.8914 48.9672 8.41113 45.1777 8.41113 40.4408C8.41113 35.4079 10.1874 31.3224 13.7993 28.2435C17.4111 25.1645 22.2072 23.6251 28.3059 23.6251C30.319 23.6251 32.3914 23.8027 34.5822 24.0987C36.773 24.3948 39.023 24.8685 41.3914 25.4014V21.079C41.3914 16.579 40.444 13.4408 38.6085 11.6053C36.7138 9.76979 33.5164 8.88163 28.9572 8.88163C26.8848 8.88163 24.7532 9.11847 22.5624 9.65137C20.3717 10.1843 18.2401 10.8356 16.1677 11.6645C15.2203 12.079 14.5098 12.3158 14.0953 12.4343C13.6809 12.5527 13.3848 12.6119 13.148 12.6119C12.319 12.6119 11.9046 12.0198 11.9046 10.7764V7.87505C11.9046 6.92768 12.023 6.21716 12.319 5.80268C12.6151 5.38821 13.148 4.97374 13.9769 4.55926C16.0493 3.49347 18.5361 2.60531 21.4374 1.89479C24.3388 1.12505 27.4177 0.769788 30.6743 0.769788C37.7203 0.769788 42.8717 2.36847 46.1875 5.56584C49.444 8.76321 51.1019 13.6185 51.1019 20.1316V39.3158H51.2203ZM27.1809 48.3158C29.1348 48.3158 31.148 47.9606 33.2796 47.2501C35.4111 46.5395 37.3059 45.2369 38.9046 43.4606C39.8519 42.3356 40.5625 41.0922 40.9177 39.6711C41.273 38.2501 41.5098 36.5329 41.5098 34.5198V32.0329C39.7927 31.6185 37.9572 31.2632 36.0624 31.0264C34.1677 30.7895 32.3322 30.6711 30.4967 30.6711C26.5296 30.6711 23.6282 31.4408 21.6743 33.0395C19.7203 34.6382 18.773 36.8882 18.773 39.8487C18.773 42.6316 19.4835 44.704 20.9638 46.1251C22.3848 47.6053 24.4572 48.3158 27.1809 48.3158ZM74.7269 54.7106C73.6611 54.7106 72.9506 54.5329 72.4769 54.1185C72.0032 53.7632 71.5888 52.9343 71.2335 51.8093L57.319 6.03953C56.9638 4.85531 56.7861 4.08558 56.7861 3.6711C56.7861 2.72374 57.2598 2.19084 58.2072 2.19084H64.0098C65.1348 2.19084 65.9046 2.36847 66.319 2.78295C66.7927 3.13821 67.148 3.96716 67.5032 5.09216L77.4506 44.2895L86.6874 5.09216C86.9835 3.90795 87.3388 3.13821 87.8124 2.78295C88.2861 2.42768 89.1151 2.19084 90.1809 2.19084H94.9177C96.0427 2.19084 96.8124 2.36847 97.2861 2.78295C97.7598 3.13821 98.1743 3.96716 98.4111 5.09216L107.766 44.7632L118.01 5.09216C118.365 3.90795 118.78 3.13821 119.194 2.78295C119.668 2.42768 120.437 2.19084 121.503 2.19084H127.01C127.957 2.19084 128.49 2.66453 128.49 3.6711C128.49 3.96716 128.431 4.26321 128.372 4.61847C128.312 4.97374 128.194 5.44742 127.957 6.09874L113.687 51.8685C113.332 53.0527 112.918 53.8224 112.444 54.1777C111.97 54.5329 111.201 54.7698 110.194 54.7698H105.102C103.977 54.7698 103.207 54.5922 102.733 54.1777C102.26 53.7632 101.845 52.9935 101.608 51.8093L92.4309 13.6185L83.3125 51.7501C83.0164 52.9343 82.6611 53.704 82.1874 54.1185C81.7138 54.5329 80.8848 54.7106 79.819 54.7106H74.7269ZM150.812 56.3093C147.734 56.3093 144.655 55.954 141.694 55.2435C138.733 54.5329 136.424 53.7632 134.885 52.8751C133.937 52.3422 133.286 51.7501 133.049 51.2172C132.812 50.6843 132.694 50.0922 132.694 49.5593V46.5395C132.694 45.2961 133.168 44.704 134.056 44.704C134.411 44.704 134.766 44.7632 135.122 44.8816C135.477 45.0001 136.01 45.2369 136.602 45.4737C138.615 46.3619 140.806 47.0724 143.115 47.5461C145.484 48.0198 147.793 48.2566 150.161 48.2566C153.891 48.2566 156.793 47.6053 158.806 46.3027C160.819 45 161.885 43.1053 161.885 40.6777C161.885 39.0198 161.352 37.6579 160.286 36.5329C159.22 35.4079 157.207 34.4014 154.306 33.454L145.72 30.7895C141.398 29.4277 138.201 27.4145 136.247 24.7501C134.293 22.1448 133.286 19.2435 133.286 16.1645C133.286 13.6777 133.819 11.4869 134.885 9.59216C135.951 7.69742 137.372 6.03953 139.148 4.73689C140.924 3.37505 142.937 2.36847 145.306 1.65795C147.674 0.94742 150.161 0.651367 152.766 0.651367C154.069 0.651367 155.431 0.710578 156.734 0.888209C158.095 1.06584 159.339 1.30268 160.582 1.53953C161.766 1.83558 162.891 2.13163 163.957 2.48689C165.023 2.84216 165.852 3.19742 166.444 3.55268C167.273 4.02637 167.865 4.50005 168.22 5.03295C168.576 5.50663 168.753 6.15795 168.753 6.98689V9.76979C168.753 11.0132 168.28 11.6645 167.391 11.6645C166.918 11.6645 166.148 11.4277 165.141 10.954C161.766 9.41453 157.977 8.64479 153.773 8.64479C150.398 8.64479 147.734 9.17768 145.898 10.3027C144.062 11.4277 143.115 13.1448 143.115 15.5724C143.115 17.2303 143.707 18.6514 144.891 19.7764C146.076 20.9014 148.266 22.0264 151.405 23.0329L159.812 25.6974C164.076 27.0593 167.155 28.954 168.99 31.3816C170.826 33.8093 171.714 36.5922 171.714 39.6711C171.714 42.2172 171.181 44.5264 170.174 46.5395C169.108 48.5527 167.687 50.329 165.852 51.7501C164.016 53.2303 161.826 54.2961 159.28 55.0658C156.615 55.8948 153.832 56.3093 150.812 56.3093Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M162.004 85.0856C142.524 99.4738 114.221 107.112 89.8855 107.112C55.7803 107.112 25.05 94.5001 1.83948 73.5396C0.00394917 71.8817 1.66184 69.6317 3.85263 70.9343C28.9579 85.5001 59.925 94.3225 91.9579 94.3225C113.57 94.3225 137.313 89.8225 159.162 80.5856C162.418 79.1054 165.201 82.7172 162.004 85.0856Z",fill:"#FF9900"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M170.115 75.8487C167.628 72.6513 153.654 74.3092 147.319 75.079C145.424 75.3158 145.128 73.6579 146.845 72.4145C157.976 64.5987 176.272 66.8487 178.404 69.454C180.536 72.1184 177.812 90.4145 167.391 99.1776C165.792 100.539 164.253 99.8289 164.963 98.0526C167.332 92.1908 172.601 78.9868 170.115 75.8487Z",fill:"#FF9900"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_1480_1723",children:o.jsx("rect",{width:"180",height:"107.763",fill:"white",transform:"translate(0.0625)"})})})]}),tIr=e=>o.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:o.jsx("path",{d:"m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"})}),rIr=e=>o.jsx("svg",{className:"h-3 w-3",fill:"white",height:"78",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"78",style:{color:"currentcolor"},...e,children:o.jsx("g",{transform:"translate(0,2)",children:o.jsx("path",{d:"M11.375 0h-2.411L13.352 11.13h2.411L11.375 0ZM4.4 0 0 11.13h2.46l0.9-2.336h4.604l0.9 2.336h2.46L6.924 0H4.4Zm-0.244 6.723 1.506-3.909 1.506 3.909H4.156Z",fill:"currentColor"})})}),dlt=e=>o.jsx("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...e,children:o.jsx("path",{d:"M7.402 13.8777C9.45763 13.4674 11.1555 13.128 11.175 13.1233L11.2104 13.1148L9.2697 10.507C8.2023 9.07276 7.32898 7.8937 7.32898 7.88691C7.32898 7.87404 9.33293 1.63997 9.3442 1.61779C9.34797 1.61037 10.7117 4.27017 12.65 8.06532C14.4647 11.6184 15.9608 14.5479 15.9747 14.5754L16 14.6253L9.83224 14.6244L3.66449 14.6235L7.402 13.8777ZM0 13.0824C0 13.0787 0.914457 11.2855 2.03212 9.09735L4.06425 5.11896L6.43245 2.87384C7.73497 1.63902 8.80417 0.627201 8.80845 0.625356C8.81274 0.623511 8.79561 0.672228 8.77038 0.733617C8.74515 0.795006 7.58796 3.59893 6.19884 6.96455L3.67317 13.0839L1.83659 13.0865C0.826464 13.0879 0 13.0861 0 13.0824Z",fill:"#0089D6",style:{fill:"#0089D6",fillOpacity:1}})}),nIr=e=>o.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"18",fill:"none",...e,children:[o.jsx("mask",{id:"mask0_174_2406",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"17",height:"18",children:o.jsx("path",{d:"M17 0.5H0V17.5H17V0.5Z",fill:"white"})}),o.jsxs("g",{mask:"url(#mask0_174_2406)",children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.50773 10.6219C5.9653 10.6219 6.8755 10.5968 8.13362 10.0788C9.59973 9.47518 12.5166 8.37942 14.6208 7.2539C16.0924 6.46668 16.7375 5.42553 16.7375 4.02344C16.7375 2.07751 15.16 0.5 13.2141 0.5H5.06095C2.26586 0.5 0 2.76586 0 5.56095C0 8.35604 2.12151 10.6219 5.50773 10.6219Z",fill:"#39594D"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.88672 14.107C6.88672 12.7369 7.71155 11.5016 8.97699 10.9764L11.5446 9.9108C14.1417 8.83294 17.0003 10.7415 17.0003 13.5535C17.0003 15.732 15.2339 17.4979 13.0553 17.4973L10.2754 17.4966C8.40372 17.4961 6.88672 15.9787 6.88672 14.107Z",fill:"#D18EE2"}),o.jsx("path",{d:"M2.91749 11.2891C1.30623 11.2891 0 12.5952 0 14.2065V14.5844C0 16.1956 1.30618 17.5018 2.91744 17.5018C4.5287 17.5018 5.83493 16.1956 5.83493 14.5844V14.2065C5.83493 12.5952 4.52875 11.2891 2.91749 11.2891Z",fill:"#FF7759"})]})]}),sIr=e=>o.jsxs("svg",{className:"h-3 w-3","data-testid":"geist-icon",height:"78",strokeLinejoin:"round",viewBox:"0 0 160 59",width:"104",style:{color:"currentcolor"},...e,children:[o.jsx("mask",{id:"mask0_4345_1846",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"160",height:"59",style:{maskType:"luminance"},children:o.jsx("path",{d:"M0.273438 0.219727H159.216V58.1817H0.273438V0.219727Z",fill:"white"})}),o.jsx("g",{mask:"url(#mask0_4345_1846)",children:o.jsx("path",{d:"M95.4635 0.314595C84.4822 0.314595 75.5599 9.19525 75.5599 20.1677C75.5599 31.1402 84.4632 40.0208 95.4635 40.0208C106.464 40.0208 115.367 31.1402 115.367 20.1677C115.348 9.21427 106.445 0.333611 95.4635 0.314595ZM95.4635 32.5664C88.6002 32.5664 83.0333 27.0136 83.0333 20.1677C83.0333 13.3218 88.6002 7.76902 95.4635 7.76902C102.327 7.76902 107.894 13.3218 107.894 20.1677C107.894 27.0136 102.327 32.5664 95.4635 32.5664ZM67.9912 0.39066C67.3049 0.314595 66.6376 0.276562 65.9513 0.276562C65.6081 0.276562 65.284 0.276562 64.9599 0.295578C64.6358 0.314595 64.2926 0.333611 63.9685 0.352628C62.634 0.44771 61.2995 0.675906 60.0031 1.03722C57.3531 1.74082 54.8556 2.99591 52.7013 4.68836C50.4898 6.43787 48.7358 8.68181 47.5347 11.23C46.9437 12.5041 46.5052 13.8543 46.2193 15.2234C46.0858 15.908 45.9905 16.5926 45.9142 17.2772C45.8952 17.6195 45.857 17.9618 45.857 18.3041L45.838 18.8175V19.293L45.8761 32.5854L45.9142 39.2221H53.3685L53.4067 32.5854L53.4448 19.293V18.5893C53.4448 18.3802 53.4829 18.171 53.4829 17.9618C53.5211 17.5434 53.5973 17.1441 53.6736 16.7257C53.8452 15.9271 54.093 15.1474 54.4362 14.4057C55.1225 12.9225 56.152 11.6293 57.4293 10.6025C58.7639 9.53755 60.3081 8.75787 61.9477 8.3205C62.7865 8.0923 63.6635 7.94017 64.5405 7.8641C64.7693 7.84509 64.979 7.82607 65.2078 7.82607C65.4365 7.82607 65.6653 7.80705 65.875 7.80705C66.2944 7.80705 66.7329 7.82607 67.1524 7.8641C68.8491 8.03525 70.4887 8.54869 71.9948 9.38541L75.7124 2.93886C73.3484 1.56968 70.7175 0.694923 67.9912 0.39066ZM20.3484 0.219513C9.36711 0.124431 0.36855 8.92902 0.273226 19.8825C0.177902 30.8359 9.00488 39.8116 19.9862 39.9067H26.8876V32.4713H20.3484C13.4851 32.5474 7.84193 27.0707 7.76567 20.2057C7.68941 13.3408 13.1801 7.73099 20.0624 7.65492H20.3484C27.2117 7.65492 32.7786 13.2077 32.8167 20.0536V38.3284C32.8167 45.1172 27.2689 50.651 20.4819 50.7271C17.2218 50.708 14.1142 49.3959 11.8265 47.0949L6.54553 52.3625C10.206 56.0326 15.1628 58.1244 20.3484 58.1625H20.6153C31.4632 58.0103 40.1757 49.2248 40.2329 38.4044V19.5592C39.966 8.81492 31.1391 0.238529 20.3484 0.219513ZM139.389 0.314595C128.407 0.314595 119.485 9.19525 119.504 20.1677C119.504 31.1212 128.407 40.0018 139.389 40.0018H146.195V32.5664H139.389C132.525 32.5664 126.958 27.0136 126.958 20.1677C126.958 13.3218 132.525 7.76902 139.389 7.76902C145.833 7.76902 151.209 12.6943 151.781 19.1028H151.762V57.2116H159.216V20.1677C159.216 9.21427 150.351 0.314595 139.389 0.314595Z",fill:"currentColor"})})]}),aIr=e=>o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:o.jsx("path",{d:"M4.49805 11.6934C6.98237 11.6934 8.99609 13.7081 8.99609 16.1924C8.9959 18.6765 6.98225 20.6904 4.49805 20.6904C2.01394 20.6903 0.000196352 18.6765 0 16.1924C0 13.7081 2.01382 11.6935 4.49805 11.6934ZM10.3867 0C12.8709 0 14.8846 2.01388 14.8848 4.49805C14.8848 4.8377 14.847 5.16846 14.7755 5.48643C14.4618 6.88139 14.1953 8.4633 14.9928 9.65L16.2575 11.5319C16.3363 11.6491 16.4727 11.7115 16.6137 11.703C16.7369 11.6957 16.8525 11.6343 16.9214 11.5318L18.1876 9.64717C18.9772 8.47198 18.7236 6.90783 18.4205 5.52484C18.3523 5.21392 18.3164 4.89094 18.3164 4.55957C18.3167 2.07546 20.3313 0.0615234 22.8154 0.0615234C25.2994 0.0617476 27.3132 2.0756 27.3135 4.55957C27.3135 4.93883 27.2665 5.30712 27.178 5.65896C26.8547 6.94441 26.5817 8.37932 27.2446 9.52714L28.459 11.6301C28.4819 11.6697 28.5245 11.6934 28.5703 11.6934C31.0545 11.6935 33.0684 13.7081 33.0684 16.1924C33.0682 18.6765 31.0544 20.6903 28.5703 20.6904C26.0861 20.6904 24.0725 18.6765 24.0723 16.1924C24.0723 15.8049 24.1212 15.4288 24.2133 15.0701C24.5458 13.7746 24.8298 12.3251 24.1609 11.1668L23.0044 9.16384C22.9656 9.09659 22.8931 9.05859 22.8154 9.05859C22.7983 9.05859 22.7824 9.06614 22.7728 9.08033L21.4896 10.9895C20.686 12.1851 20.9622 13.781 21.284 15.1851C21.3582 15.5089 21.3975 15.8461 21.3975 16.1924C21.3973 18.6764 19.3834 20.6902 16.8994 20.6904C14.4152 20.6904 12.4006 18.6765 12.4004 16.1924C12.4004 15.932 12.4226 15.6768 12.4651 15.4286C12.6859 14.14 12.8459 12.7122 12.1167 11.6271L11.2419 10.3253C10.6829 9.49347 9.71913 9.05932 8.78286 8.70188C7.0906 8.05584 5.88867 6.41734 5.88867 4.49805C5.88886 2.0139 7.90254 3.29835e-05 10.3867 0Z",fill:e.fill||"currentColor"})}),iIr=e=>o.jsxs("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",width:"176",height:"162",viewBox:"0 0 176 162",fill:"none",...e,children:[o.jsx("rect",{x:"15",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"1",width:"32",height:"32",fill:"#FFCD00",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"47",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"111",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"33",width:"32",height:"32",fill:"#FFA400",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"47",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"79",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"111",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"65",width:"32",height:"32",fill:"#FF7100",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"79",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"97",width:"32",height:"32",fill:"#FF4902",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"15",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{x:"143",y:"129",width:"32",height:"32",fill:"#FF0006",stroke:"#636363","stroke-opacity":"0.2",strokeWidth:"0.5"}),o.jsx("rect",{y:"1",width:"16",height:"160",fill:"black"}),o.jsx("rect",{x:"63",y:"97",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"95",y:"33",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"127",y:"1",width:"16",height:"32",fill:"black"}),o.jsx("rect",{x:"127",y:"97",width:"16",height:"64",fill:"black"})]}),oIr=e=>o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"128",height:"113",viewBox:"0 0 128 113",children:[o.jsxs("g",{clipPath:"url(#clip0_236_138)",...e,children:[o.jsx("path",{d:"M34.593 94.0509H33.3844L27.3514 88.0179V86.8094L36.5743 77.5866H42.9639L43.8158 78.4385V84.8281L34.593 94.0509Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M27.3514 25.816V24.6074L33.3844 18.5744H34.593L43.8158 27.7972V34.1868L42.9639 35.0388H36.5743L27.3514 25.816Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M80.4594 74.6047H71.6824L70.9493 73.8717V53.3259C70.9493 49.6705 69.5129 46.8372 65.1046 46.7382C62.836 46.6787 60.2405 46.7382 57.4668 46.8471L57.0507 47.2731V73.8618L56.3176 74.5948H47.5406L46.8075 73.8618V38.7636L47.5406 38.0305H67.2939C74.9713 38.0305 81.1925 44.2517 81.1925 51.9291V73.8717L80.4594 74.6047Z",fill:e.fill||"#014847"}),o.jsx("path",{d:"M35.8412 61.4491H0.73307L0 60.716V51.9192L0.73307 51.1861H35.8412L36.5743 51.9192V60.716L35.8412 61.4491Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M127.277 61.4491H92.1687L91.4356 60.716V51.9192L92.1687 51.1861H127.277L128.01 51.9192V60.716L127.277 61.4491Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M58.9428 27.0642V0.73307L59.6759 0H68.4727L69.2058 0.73307V27.0642L68.4727 27.7972H59.6759L58.9428 27.0642Z",fill:e.fill||"#05BDBA"}),o.jsx("path",{d:"M58.9428 111.902V85.5711L59.6759 84.838H68.4727L69.2058 85.5711V111.902L68.4727 112.635H59.6759L58.9428 111.902Z",fill:e.fill||"#05BDBA"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_236_138",children:o.jsx("rect",{width:"128",height:"112.635",fill:"white"})})})]}),GNe=e=>o.jsx("svg",{className:"h-3 w-3",viewBox:"0 0 320 320",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...e,children:o.jsx("path",{d:"m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"})}),lIr=e=>o.jsx("svg",{className:"h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1000 1000",width:"78",height:"78",style:{color:"currentcolor"},...e,children:o.jsxs("g",{children:[o.jsx("polygon",{fill:"currentColor",points:"226.83 411.15 501.31 803.15 623.31 803.15 348.82 411.15 226.83 411.15"}),o.jsx("polygon",{fill:"currentColor",points:"348.72 628.87 226.69 803.15 348.77 803.15 409.76 716.05 348.72 628.87"}),o.jsx("polygon",{fill:"currentColor",points:"651.23 196.85 440.28 498.12 501.32 585.29 773.31 196.85 651.23 196.85"}),o.jsx("polygon",{fill:"currentColor",points:"673.31 383.25 673.31 803.15 773.31 803.15 773.31 240.44 673.31 383.25"})]})}),cIr={warning:"bg-accent6Darker border-accent6/30 text-accent6",destructive:"bg-accent2Darker border-accent2/30 text-accent2",info:"bg-accent5Darker border-accent5/30 text-accent5"},uIr={warning:KI,destructive:a6,info:XI},Ll=({children:e,variant:t="destructive",className:r})=>{const n=uIr[t];return o.jsx("div",{className:Z(cIr[t],"p-3 rounded-md border shadow-sm",nn.all,"animate-in fade-in-0 slide-in-from-top-2 duration-200",r),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(Ce,{className:"mt-0.5 shrink-0",children:o.jsx(n,{})}),o.jsx("div",{className:"text-neutral4",children:e})]})})},$l=({children:e,as:t="h5"})=>o.jsx(me,{as:t,variant:"ui-md",className:"font-semibold",children:e}),Iu=({children:e,as:t="p"})=>o.jsx(me,{as:t,variant:"ui-sm",children:e}),dIr={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},flt=({src:e,name:t,size:r="sm",interactive:n=!1})=>o.jsx("div",{className:Z(dIr[r],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",nn.all,n&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?o.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):o.jsx(me,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),fIr={default:"text-neutral3 bg-surface4",success:"text-accent1 bg-accent1Dark",error:"text-accent2 bg-accent2Dark",info:"text-accent5 bg-accent5Dark",warning:"text-accent6 bg-accent6Dark"},hIr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},vt=({icon:e,variant:t="default",className:r,children:n,...s})=>o.jsxs("div",{className:Z("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",nn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":fIr[t],r),...s,children:[e&&o.jsx("span",{className:hIr[t],children:o.jsx(Ce,{children:e})}),n]}),ja=({children:e,label:t})=>o.jsx("nav",{"aria-label":t,children:o.jsx("ol",{className:"gap-0.5 flex items-center",children:e})}),dr=({className:e,as:t,isCurrent:r,action:n,...s})=>{const a=t||"span";return o.jsxs(o.Fragment,{children:[o.jsxs("li",{className:"flex h-full shrink-0 items-center gap-1",children:[o.jsx(a,{"aria-current":r?"page":void 0,className:Z("text-ui-md leading-ui-md flex items-center gap-2",nn.colors,r?"text-white":"text-neutral3 hover:text-neutral5",e),...s}),n]}),!r&&o.jsx("li",{role:"separator",className:"flex h-full items-center",children:o.jsx(Ce,{className:Z("text-neutral2",nn.colors),children:o.jsx(eIr,{})})})]})};function pIr(e,t=5){if(!e?.properties)return[];const r=[];function n(s,a,i){if(i>t)return;const l=Array.isArray(s.type)?s.type.join(" | "):s.type;if(r.push({path:a,label:a,description:s.description??s.title,type:l}),s.properties)for(const[c,u]of Object.entries(s.properties))n(u,`${a}.${c}`,i+1);if(s.items?.properties)for(const[c,u]of Object.entries(s.items.properties))n(u,`${a}[].${c}`,i+1)}for(const[s,a]of Object.entries(e.properties))n(a,s,1);return r}function mIr(e){const t=pIr(e);return ZUe({override:[gIr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function gIr(e){return t=>{const n=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!n)return null;const s=n[1]??"",a=t.pos-s.length,i=s?e.filter(c=>c.path.toLowerCase().startsWith(s.toLowerCase())):e;if(i.length===0)return null;const l=i.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,h)=>{const g=u.state.sliceDoc(h,h+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:h,insert:g},selection:{anchor:f+g.length}})}}));return{from:a,options:l,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const yIr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,vIr=er.mark({class:"cm-variable-highlight"}),ZNe=new cUe({regexp:yIr,decoration:()=>vIr}),bIr=wi.fromClass(class{decorations;constructor(e){this.decorations=ZNe.createDeco(e)}update(e){this.decorations=ZNe.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),xIr=bIr,wIr={duration:5e3,cancel:{label:o.jsx(Ce,{children:o.jsx(ff,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-lg gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card :data-content:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"bg-transparent! hover:bg-surface2! border-none! rounded-md! p-1.5! m-0! text-neutral3! hover:text-neutral6! shrink-0 transition-all",actionButton:"bg-white! flex items-center justify-center font-medium text-black! order-last hover:opacity-80"}};function Zd(e){const{classNames:t,...r}=wIr,{classNames:n,...s}=e||{};return{...r,classNames:{...t,title:Z(t?.title,n?.title),toast:Z(t?.toast,n?.toast),cancelButton:Z(t?.cancelButton,n?.cancelButton),actionButton:Z(t?.actionButton,n?.actionButton),description:Z(t?.description,n?.description)},...s}}const Ue=(e,t={})=>{if(Array.isArray(e))return e.forEach(r=>gc(r,Zd(t)));if(je.isValidElement(e))return gc(e,Zd(t));if(typeof e=="string")return gc(e,Zd(t));throw new Error("Invalid message type")};Ue.success=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent1 shrink-0",children:o.jsx(ikt,{})}),classNames:{...t.classNames,toast:Z("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return gc.success(e,Zd(r));case"object":return e.forEach(n=>gc.success(n,Zd(r)))}};Ue.error=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent2 shrink-0",children:o.jsx(U8e,{})}),classNames:{...t.classNames,toast:Z("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return gc.error(e,Zd(r));case"object":return e.forEach(n=>gc.error(n,Zd(r)))}};Ue.warning=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent6 shrink-0",children:o.jsx(a6,{})}),classNames:{...t.classNames,toast:Z("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return gc.warning(e,Zd(r));case"object":return e.forEach(n=>gc.warning(n,Zd(r)))}};Ue.info=(e,t={})=>{const r={...t,icon:o.jsx(Ce,{className:"text-accent3 shrink-0",children:o.jsx(XI,{})}),classNames:{...t.classNames,toast:Z("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:Z("text-xs text-neutral5",t.classNames?.title),description:Z("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return gc.info(e,Zd(r));case"object":return e.forEach(n=>gc.info(n,Zd(r)))}};Ue.custom=(e,t={})=>gc(e,Zd(t));Ue.dismiss=e=>{e&&gc.dismiss(e)};Ue.promise=({myPromise:e,loadingMessage:t,successMessage:r,errorMessage:n,onSuccess:s,onError:a,options:i={}})=>gc.promise(e,{loading:t??"Loading...",success:l=>(s?.(l),r),error:l=>(a?.(l),n||l?.message||"Error..."),...Zd(i)});function sf({text:e,copyMessage:t="Copied to clipboard!"}){const[r,n]=b.useState(!1),s=b.useRef(null),a=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{Ue.success(t),n(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{n(!1)},2e3)}).catch(()=>{Ue.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:r,handleCopy:a}}function Ya({content:e,copyMessage:t,tooltip:r="Copy to clipboard",size:n="sm",className:s}){const[a,i]=b.useState(!1),{handleCopy:l}=sf({text:e,copyMessage:t}),c=()=>{l(),i(!0),setTimeout(()=>i(!1),2e3)};return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(ve,{onClick:c,type:"button",size:n,className:s,"aria-label":a?"Copied!":r,children:a?o.jsx(ov,{}):o.jsx(q8e,{})})}),o.jsx(Wr,{children:a?"Copied!":r})]})}const Hn=Ule()(DLt(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),Xse=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function SIr(e){return Xse?.addEventListener("change",e),()=>Xse?.removeEventListener("change",e)}function OIr(){return Xse?.matches??!0}function sP(){const e=Hn(r=>r.theme),t=b.useSyncExternalStore(SIr,OIr,()=>!0);return e==="system"?t:e==="dark"}function kIr(){const e=cE({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"var(--neutral2)",background:"transparent",foreground:"var(--neutral6)",caret:"var(--neutral6)"},styles:[{tag:[ne.className,ne.propertyName],color:"var(--neutral6)"},{tag:ne.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.heading1,ne.heading2,ne.heading3,ne.heading4,ne.heading5,ne.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:ne.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:ne.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:ne.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ne.url,color:"var(--accent3)"},{tag:ne.monospace,color:"var(--neutral6)"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:ne.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=pt.theme({".cm-editor":{backgroundColor:"transparent"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{color:"var(--neutral3)"},".cm-cursor":{borderLeftColor:"var(--neutral6)"},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:"color-mix(in srgb, var(--accent3) 22%, transparent)"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}});return[e,t]}function _Ir(){const e=pt.theme({"&":{backgroundColor:"transparent",color:"var(--neutral6)",fontSize:"0.8rem"},"&.cm-editor .cm-scroller":{fontFamily:"var(--geist-mono)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--neutral2)",borderRight:"none"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-activeLine":{backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--neutral3)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--neutral6)"},"&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{background:"color-mix(in srgb, var(--accent3) 22%, transparent) !important"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}}),t=Ap.define([{tag:[ne.comment,ne.bracket],color:"var(--neutral2)"},{tag:[ne.string,ne.meta,ne.regexp],color:"var(--accent1)"},{tag:[ne.atom,ne.bool,ne.special(ne.variableName)],color:"var(--accent6)"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"var(--accent2)"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"var(--accent5)"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"var(--accent3)"},{tag:[ne.variableName,ne.number],color:"var(--accent5)"},{tag:[ne.name,ne.quote],color:"var(--accent1)"},{tag:ne.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.heading1,ne.heading2,ne.heading3,ne.heading4,ne.heading5,ne.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[ne.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[ne.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:ne.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ne.url,color:"var(--accent3)"},{tag:ne.monospace,color:"var(--neutral6)"},{tag:ne.strikethrough,textDecoration:"line-through"},{tag:[ne.deleted],color:"var(--accent2)"},{tag:ne.invalid,color:"var(--error)"},{tag:[ne.standard(ne.tagName)],color:"var(--accent1)"}]);return[e,Fx(t)]}const _v=()=>{const e=sP();return b.useMemo(()=>e?kIr():_Ir(),[e])},ds=b.forwardRef(({data:e,value:t,onChange:r,showCopyButton:n=!0,className:s,language:a="json",highlightVariables:i=!1,placeholder:l,schema:c,autoFocus:u,lineNumbers:d=!0,editable:f,...h},p)=>{const m=_v(),g=e?JSON.stringify(e,null,2):t??"",y=b.useMemo(()=>{const x=[];return a==="json"?x.push(Vd):a==="markdown"&&(x.push(Ile({base:Hw,codeLanguages:yqe})),x.push(pt.lineWrapping)),i&&a==="markdown"&&x.push(xIr),c&&a==="markdown"&&x.push(mIr(c)),f===!1&&x.push(Dn.readOnly.of(!0)),x},[a,i,c,f]);return o.jsxs("div",{className:Z("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...h,children:[n&&o.jsx(Ya,{content:g,className:"absolute top-2 right-2 z-20"}),o.jsx(bc,{ref:p,value:g,theme:m,extensions:y,onChange:r,editable:f,"aria-label":"Code editor",placeholder:l,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function EIr(e,t){const{codeToTokens:r,bundledLanguages:n}=await Je(async()=>{const{codeToTokens:a,bundledLanguages:i}=await import("./index-3yHTJowu.js");return{codeToTokens:a,bundledLanguages:i}},__vite__mapDeps([23,1]),import.meta.url);if(!(t in n))return null;const{tokens:s}=await r(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}function li({iconSlot:e,titleSlot:t,descriptionSlot:r,actionSlot:n,className:s,as:a="h3"}){return o.jsxs("div",{className:Z("flex flex-col items-center justify-center text-center py-10 px-6","transition-opacity duration-normal ease-out-custom",s),children:[e&&o.jsx("div",{className:"mb-4",children:e}),o.jsx(a,{className:"font-medium text-neutral5 text-ui-md",children:t}),r&&o.jsx("p",{className:"mt-1.5 text-neutral3 text-ui-sm max-w-md",children:r}),n&&o.jsx("div",{className:"mt-5",children:n})]})}const yf=({children:e,className:t,onClick:r})=>o.jsx("div",{tabIndex:r?0:void 0,onKeyDown:n=>{r&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),r?.())},className:Z("flex gap-3 group/entity bg-surface3 rounded-xl border border-border1 py-3 px-4",r&&"cursor-pointer hover:bg-surface4 transition-all",t),onClick:r,children:e}),hlt=({children:e,className:t,style:r})=>o.jsx(Ce,{size:"lg",className:Z("text-neutral3 mt-1 shrink-0",t),style:r,children:e}),vf=({children:e,className:t})=>o.jsx(me,{as:"p",variant:"ui-lg",className:Z("text-neutral6 font-medium",t),children:e}),bf=({children:e,className:t})=>o.jsx(me,{as:"div",variant:"ui-sm",className:Z("text-neutral3",t),children:e}),xf=({children:e,className:t})=>o.jsx("div",{className:Z("flex-1 w-full",t),children:e});function Zs({resource:e,title:t,description:r,actionSlot:n,className:s}){const a="Permission Denied",i=e?`You don't have permission to access ${e}. Contact your administrator for access.`:"You don't have permission to access this resource. Contact your administrator for access.";return o.jsx(li,{className:s,iconSlot:o.jsx(Ce,{size:"lg",className:"text-neutral3",children:o.jsx(qkt,{})}),titleSlot:t??a,descriptionSlot:r??i,actionSlot:n})}function na({title:e,description:t,className:r}){const[n,s]=b.useState(!1),a=Ze(),i=b.useCallback(async()=>{try{s(!0);const{baseUrl:l="",apiPrefix:c}=a.options||{},u=(c||"/api").trim(),d=(u.startsWith("/")?u:`/${u}`).replace(/\/$/,""),f=new URLSearchParams({redirect_uri:window.location.href}),h=`${l}${d}/auth/sso/login?${f}`,p=await fetch(h,{credentials:"include",headers:{"Content-Type":"application/json"}});if(p.ok){const m=await p.json();window.location.href=m.url}}finally{s(!1)}},[a]);return o.jsx(li,{className:r,iconSlot:o.jsx(Ce,{size:"lg",className:"text-neutral3",children:o.jsx($kt,{})}),titleSlot:e??"Session Expired",descriptionSlot:t??"Your session has expired. Please log in again to continue.",actionSlot:o.jsx(ve,{variant:"default",onClick:i,disabled:n,children:n?"Redirecting...":"Log in"})})}const mn=({children:e,border:t=!0,className:r})=>o.jsx("header",{className:Z("h-header-default z-50 flex w-full items-center gap-4 bg-transparent px-3",{"border-b border-border1":t},r),children:e}),Vu=({children:e})=>o.jsx(me,{as:"h1",variant:"ui-md",className:"text-neutral6 flex items-center gap-2",children:e}),Ec=({children:e})=>o.jsx("div",{className:"ml-auto flex items-center gap-3",children:e}),CIr=({children:e})=>o.jsx("div",{className:"gap-2 flex items-center",children:e}),Xb=e=>o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 34 21",fill:"none",...e,children:o.jsx("path",{d:"M4.49805 11.6934C6.98237 11.6934 8.99609 13.7081 8.99609 16.1924C8.9959 18.6765 6.98225 20.6904 4.49805 20.6904C2.01394 20.6903 0.000196352 18.6765 0 16.1924C0 13.7081 2.01382 11.6935 4.49805 11.6934ZM10.3867 0C12.8709 0 14.8846 2.01388 14.8848 4.49805C14.8848 4.8377 14.847 5.16846 14.7755 5.48643C14.4618 6.88139 14.1953 8.4633 14.9928 9.65L16.2575 11.5319C16.3363 11.6491 16.4727 11.7115 16.6137 11.703C16.7369 11.6957 16.8525 11.6343 16.9214 11.5318L18.1876 9.64717C18.9772 8.47198 18.7236 6.90783 18.4205 5.52484C18.3523 5.21392 18.3164 4.89094 18.3164 4.55957C18.3167 2.07546 20.3313 0.0615234 22.8154 0.0615234C25.2994 0.0617476 27.3132 2.0756 27.3135 4.55957C27.3135 4.93883 27.2665 5.30712 27.178 5.65896C26.8547 6.94441 26.5817 8.37932 27.2446 9.52714L28.459 11.6301C28.4819 11.6697 28.5245 11.6934 28.5703 11.6934C31.0545 11.6935 33.0684 13.7081 33.0684 16.1924C33.0682 18.6765 31.0544 20.6903 28.5703 20.6904C26.0861 20.6904 24.0725 18.6765 24.0723 16.1924C24.0723 15.8049 24.1212 15.4288 24.2133 15.0701C24.5458 13.7746 24.8298 12.3251 24.1609 11.1668L23.0044 9.16384C22.9656 9.09659 22.8931 9.05859 22.8154 9.05859C22.7983 9.05859 22.7824 9.06614 22.7728 9.08033L21.4896 10.9895C20.686 12.1851 20.9622 13.781 21.284 15.1851C21.3582 15.5089 21.3975 15.8461 21.3975 16.1924C21.3973 18.6764 19.3834 20.6902 16.8994 20.6904C14.4152 20.6904 12.4006 18.6765 12.4004 16.1924C12.4004 15.932 12.4226 15.6768 12.4651 15.4286C12.6859 14.14 12.8459 12.7122 12.1167 11.6271L11.2419 10.3253C10.6829 9.49347 9.71913 9.05932 8.78286 8.70188C7.0906 8.05584 5.88867 6.41734 5.88867 4.49805C5.88886 2.0139 7.90254 3.29835e-05 10.3867 0Z",fill:"currentColor"})}),jIr={default:"[&>tbody>tr]:h-table-row",small:"[&>tbody>tr]:h-table-row-small"},TIr=({className:e,children:t,size:r="default",style:n})=>o.jsx("table",{className:Z("w-full",jIr[r],e),style:n,children:t}),NIr=({className:e,children:t})=>o.jsx("thead",{children:o.jsx("tr",{className:Z("h-table-header border-b border-border1 bg-surface2/80",e),children:t})}),AIr=({className:e,children:t,...r})=>o.jsx("th",{className:Z("text-neutral2 text-ui-xs h-full whitespace-nowrap text-left font-medium uppercase tracking-wide first:pl-3 last:pr-3",e),...r,children:t}),IIr=({className:e,children:t,...r})=>o.jsx("tbody",{className:Z("",e),...r,children:t}),RIr=b.forwardRef(({className:e,children:t,selected:r=!1,style:n,onClick:s,isActive:a=!1,...i},l)=>{const c=b.useRef(null);b.useEffect(()=>{l&&(typeof l=="function"?l(c.current):l.current=c.current)},[l]),b.useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.scrollIntoView({block:"nearest"}))},[a]);const u=d=>{d.key==="Enter"&&s&&s()};return o.jsx("tr",{className:Z("border-b border-border1","transition-colors duration-normal ease-out-custom","hover:bg-surface3","focus:bg-surface3 focus:outline-hidden focus:ring-1 focus:ring-inset focus:ring-accent1/50",r&&"bg-surface4",s&&"cursor-pointer",e),style:n,onClick:s,ref:c,tabIndex:s?0:void 0,onKeyDown:u,"data-active":a||void 0,...i,children:t})}),PIr=({className:e,children:t,...r})=>o.jsx("td",{className:Z("text-neutral5 first:pl-3 last:pr-3",e),...r,children:o.jsx("div",{className:Z("flex h-full w-full shrink-0 items-center"),children:t})}),YNe=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,XNe=Uot,LE=(e,t)=>r=>{var n;if(t?.variants==null)return XNe(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const d=r?.[u],f=a?.[u];if(d===null)return null;const h=YNe(d)||YNe(f);return s[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...a,...l}[g]):{...a,...l}[g]===y})?[...u,f,h]:u},[]);return XNe(e,i,c,r?.class,r?.className)},MIr=LE(Z("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70","min-h-[80px] resize-y"),{variants:{variant:{default:Z(vhe,bhe,xhe),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:"px-2 py-1.5 text-ui-sm",md:"px-3 py-2 text-ui-sm",default:"px-3 py-2 text-ui-md",lg:"px-4 py-3 text-ui-sm"}},defaultVariants:{variant:"default",size:"default"}}),vc=b.forwardRef(({className:e,size:t,testId:r,variant:n,error:s,...a},i)=>o.jsx("textarea",{className:Z(MIr({variant:n,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:i,"aria-invalid":s,...a}));vc.displayName="Textarea";const DIr=kQt,LIr=_Qt,plt=EQt;function $t({open:e,onOpenChange:t,children:r}){return o.jsx(DIr,{open:e,onOpenChange:t,children:r})}const Ehe=b.forwardRef(({className:e,...t},r)=>o.jsx(WGe,{className:Z("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:duration-200","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:duration-150",e),...t,ref:r}));Ehe.displayName=WGe.displayName;const mlt=b.forwardRef(({className:e,...t},r)=>o.jsxs(plt,{children:[o.jsx(Ehe,{}),o.jsx(GGe,{ref:r,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border1 bg-surface3 p-6 shadow-dialog rounded-md","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] data-[state=open]:duration-200","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=closed]:duration-150",e),...t})]}));mlt.displayName=GGe.displayName;const glt=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col space-y-2 text-center sm:text-left",e),...t});glt.displayName="AlertDialogHeader";const ylt=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ylt.displayName="AlertDialogFooter";const vlt=b.forwardRef(({className:e,...t},r)=>o.jsx(XGe,{ref:r,className:Z("text-lg font-semibold",e),...t}));vlt.displayName=XGe.displayName;const blt=b.forwardRef(({className:e,...t},r)=>o.jsx(KGe,{ref:r,className:Z("text-sm text-neutral3",e),...t}));blt.displayName=KGe.displayName;const xlt=b.forwardRef(({className:e,...t},r)=>o.jsx(ZGe,{ref:r,className:Z(ME({variant:"primary",size:"default"}),e),...t}));xlt.displayName=ZGe.displayName;const wlt=b.forwardRef(({className:e,...t},r)=>o.jsx(YGe,{ref:r,className:Z(ME({variant:"default",size:"default"}),"mt-2 sm:mt-0",e),...t}));wlt.displayName=YGe.displayName;$t.Trigger=LIr;$t.Portal=plt;$t.Overlay=Ehe;$t.Content=mlt;$t.Header=glt;$t.Footer=ylt;$t.Title=vlt;$t.Description=blt;$t.Action=xlt;$t.Cancel=wlt;const bi=b.forwardRef(({className:e,...t},r)=>o.jsx(Ice,{ref:r,className:Z("peer h-4 w-4 shrink-0 rounded-sm border border-neutral3","shadow-sm",nn.all,"hover:border-neutral5 hover:shadow-md",nP,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:bg-accent1 data-[state=checked]:border-accent1 data-[state=checked]:text-surface1","data-[state=checked]:shadow-glow-accent1",e),...t,children:o.jsx(rZe,{className:Z("flex items-center justify-center text-current","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:o.jsx(ov,{className:"h-3.5 w-3.5 stroke-3"})})}));bi.displayName=Ice.displayName;const _p=PQt,bh=je.forwardRef(({className:e,children:t,...r},n)=>o.jsx(Pce,{ref:n,className:Z("-outline-offset-2",nn.colors,r0.visible,"hover:text-neutral5","[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom","[&[data-state=open]>svg]:rotate-90",e),...r,children:t}));bh.displayName=Pce.displayName;const xh=je.forwardRef(({className:e,children:t,...r},n)=>o.jsx(Dce,{ref:n,className:Z("overflow-hidden","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-1","duration-normal ease-out-custom",e),...r,children:t}));xh.displayName=Dce.displayName;const yn={root:"flex flex-col gap-1.5",trigger:"w-full min-w-32 justify-between",triggerError:"border-accent2",chevron:"ml-2 h-4 w-4 shrink-0 opacity-50",placeholder:"text-neutral3",popup:Z("min-w-(--anchor-width) w-max max-w-[500px] rounded-md bg-surface3 text-neutral5","shadow-elevated","origin-(--transform-origin)","transition-[transform,scale,opacity] duration-150 ease-out","data-starting-style:scale-95 data-starting-style:opacity-0","data-ending-style:scale-95 data-ending-style:opacity-0"),positioner:"z-50 pointer-events-auto",searchContainer:Z("flex items-center border-b border-border1 px-3 py-2",nn.colors),searchIcon:Z("mr-2 h-4 w-4 shrink-0 text-neutral3",nn.colors),searchInput:Z("flex h-8 w-full rounded-md bg-transparent py-1 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-hidden",nn.colors),empty:"not-empty:block hidden py-6 text-center text-sm text-neutral3",list:"max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",item:Z("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm",nn.colors,"data-highlighted:bg-surface5 data-highlighted:text-neutral5"),itemSelected:"data-selected:bg-accent1Dark data-selected:text-accent1",checkContainer:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center",checkIcon:Z("h-4 w-4 text-accent1",nn.opacity),checkbox:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center rounded border",checkboxSelected:"bg-accent1 border-accent1",checkboxUnselected:"border-border1",checkboxIcon:"h-3 w-3 text-white",optionContent:"flex items-center gap-2 w-full min-w-0",optionText:"flex flex-col gap-0.5 min-w-0",optionLabel:"truncate",optionDescription:"text-xs text-neutral3 truncate",optionEnd:"ml-auto",error:"text-xs text-accent2"};function Zl({options:e,value:t,onValueChange:r,placeholder:n="Select option...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:l=!1,variant:c="inputLike",size:u="default",open:d,onOpenChange:f,container:h,error:p}){const m=e.find(y=>y.value===t)??null,g=y=>{y&&r?.(y.value)};return o.jsxs("div",{className:yn.root,children:[o.jsxs(aYe,{items:e,value:m,onValueChange:g,disabled:l,open:d,onOpenChange:f,children:[o.jsxs(hYe,{className:Z(ME({variant:c,size:u}),yn.trigger,p&&yn.triggerError,i),children:[o.jsxs("span",{className:"truncate flex items-center gap-2",children:[m?.start,o.jsx(dZt,{placeholder:n})]}),o.jsx(B8e,{className:yn.chevron})]}),o.jsx(yYe,{container:h,children:o.jsx(xYe,{align:"start",sideOffset:4,className:yn.positioner,children:o.jsxs(wYe,{className:yn.popup,children:[o.jsxs("div",{className:yn.searchContainer,children:[o.jsx(ix,{className:yn.searchIcon}),o.jsx(fYe,{className:yn.searchInput,placeholder:s})]}),o.jsx(EYe,{className:yn.empty,children:a}),o.jsx(mYe,{className:yn.list,children:y=>o.jsxs(_Ye,{value:y,className:Z(yn.item,yn.itemSelected),children:[o.jsx("span",{className:yn.checkContainer,children:o.jsx(KZt,{children:o.jsx(ov,{className:yn.checkIcon})})}),o.jsxs("span",{className:yn.optionContent,children:[y.start,o.jsxs("span",{className:yn.optionText,children:[o.jsx("span",{className:yn.optionLabel,children:y.label}),y.description&&o.jsx("span",{className:yn.optionDescription,children:y.description})]}),y.end?o.jsx("div",{className:yn.optionEnd,children:y.end}):null]})]},y.value)})]})})})]}),p&&o.jsx("span",{className:yn.error,children:p})]})}function $Ir({options:e,value:t=[],onValueChange:r,placeholder:n="Select options...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:l=!1,variant:c="default",size:u="md",open:d,onOpenChange:f,container:h,error:p}){const m=e.filter(x=>t.includes(x.value)),g=x=>{x&&r?.(x.map(w=>w.value))},y=m.length===0?n:`${m.length} selected`;return o.jsxs("div",{className:yn.root,children:[o.jsxs(aYe,{multiple:!0,items:e,value:m,onValueChange:g,disabled:l,open:d,onOpenChange:f,children:[o.jsxs(hYe,{className:Z(ME({variant:c,size:u}),yn.trigger,p&&yn.triggerError,i),children:[o.jsx("span",{className:Z("truncate",m.length===0&&yn.placeholder),children:y}),o.jsx(B8e,{className:yn.chevron})]}),o.jsx(yYe,{container:h,children:o.jsx(xYe,{align:"start",sideOffset:4,className:yn.positioner,children:o.jsxs(wYe,{className:yn.popup,children:[o.jsxs("div",{className:yn.searchContainer,children:[o.jsx(ix,{className:yn.searchIcon}),o.jsx(fYe,{className:yn.searchInput,placeholder:s})]}),o.jsx(EYe,{className:yn.empty,children:a}),o.jsx(mYe,{className:yn.list,children:x=>{const w=t.includes(x.value);return o.jsxs(_Ye,{value:x,className:yn.item,children:[o.jsx("span",{className:Z(yn.checkbox,w?yn.checkboxSelected:yn.checkboxUnselected),children:w&&o.jsx(ov,{className:yn.checkboxIcon})}),o.jsxs("span",{className:yn.optionContent,children:[x.start,o.jsxs("span",{className:yn.optionText,children:[o.jsx("span",{className:yn.optionLabel,children:x.label}),x.description&&o.jsx("span",{className:yn.optionDescription,children:x.description})]}),x.end?o.jsx("div",{className:yn.optionEnd,children:x.end}):null]})]},x.value)}})]})})})]}),p&&o.jsx("span",{className:yn.error,children:p})]})}const kn=rF,Slt=RGe,FIr=nF,zIr=xR,Olt=b.forwardRef(({className:e,...t},r)=>o.jsx(vR,{ref:r,className:Z("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Olt.displayName=vR.displayName;const wn=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(FIr,{children:[o.jsx(Olt,{}),o.jsxs(bR,{ref:n,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","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","data-[state=closed]:slide-out-to-bottom-4","data-[state=open]:slide-in-from-bottom-4",e),...r,children:[t,o.jsxs(xR,{className:Z("absolute right-4 top-4 rounded-md p-1","text-neutral3 hover:text-neutral6 hover:bg-surface4","transition-all duration-normal ease-out-custom","focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[o.jsx(ff,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wn.displayName=bR.displayName;const _n=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});_n.displayName="DialogHeader";const af=({className:e,...t})=>o.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});af.displayName="DialogFooter";const Vn=({className:e,...t})=>o.jsx("div",{className:Z("overflow-y-auto px-6 max-h-[50vh]",e),...t});Vn.displayName="DialogBody";const Sn=b.forwardRef(({className:e,...t},r)=>o.jsx(sF,{ref:r,className:Z("text-ui-md font-medium",e),...t}));Sn.displayName=sF.displayName;const ea=b.forwardRef(({className:e,...t},r)=>o.jsx(aF,{ref:r,className:Z("sr-only",e),...t}));ea.displayName=aF.displayName;const klt=b.forwardRef(({className:e,...t},r)=>o.jsx(ed,{ref:r,className:Z("flex h-full w-full flex-col overflow-hidden rounded-md bg-surface3 text-neutral5",e),...t}));klt.displayName=ed.displayName;const BIr=({children:e,title:t="Command Palette",description:r="Search for commands and actions",...n})=>{const s=b.useCallback((i,l)=>{const c=i.toLowerCase();return l.toLowerCase().split(/\s+/).filter(Boolean).every(h=>c.includes(h))?1:0},[]),a=b.useCallback(i=>{i.stopPropagation()},[]);return o.jsx(kn,{...n,children:o.jsxs(wn,{className:"overflow-hidden p-0",children:[o.jsx(Sn,{className:"sr-only",children:t}),o.jsx(ea,{className:"sr-only",children:r}),o.jsx(klt,{filter:s,onKeyDown:a,className:Z("**:[[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-neutral3","[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 **:[[cmdk-group]]:px-2","[&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5","**:[[cmdk-input]]:h-12","**:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3","[&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"),children:e})]})})},_lt=b.forwardRef(({className:e,...t},r)=>o.jsxs("div",{className:Z("flex items-center border-b border-border1 px-3",nn.colors),"cmdk-input-wrapper":"",children:[o.jsx(ix,{className:Z("mr-2 h-4 w-4 shrink-0 text-neutral3",nn.colors)}),o.jsx(ed.Input,{ref:r,className:Z("flex h-10 w-full rounded-md bg-transparent py-3 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-hidden",nn.colors,e),...t})]}));_lt.displayName=ed.Input.displayName;const Elt=b.forwardRef(({className:e,...t},r)=>o.jsx(ed.List,{ref:r,className:Z("max-h-dropdown-max-height overflow-y-auto overflow-x-hidden",e),...t}));Elt.displayName=ed.List.displayName;const Clt=b.forwardRef((e,t)=>o.jsx(ed.Empty,{ref:t,className:"py-6 text-center text-sm text-neutral3",...e}));Clt.displayName=ed.Empty.displayName;const vb=b.forwardRef(({className:e,...t},r)=>o.jsx(ed.Group,{ref:r,className:Z("overflow-hidden p-1 text-neutral5","**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-neutral3",e),...t}));vb.displayName=ed.Group.displayName;const tw=b.forwardRef(({className:e,...t},r)=>o.jsx(ed.Separator,{ref:r,className:Z("-mx-1 h-px bg-border1",e),...t}));tw.displayName=ed.Separator.displayName;const Ho=b.forwardRef(({className:e,...t},r)=>o.jsx(ed.Item,{ref:r,className:Z("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden",nn.colors,"data-[selected=true]:bg-surface5 data-[selected=true]:text-neutral5","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Ho.displayName=ed.Item.displayName;const jlt=({className:e,...t})=>o.jsx("span",{className:Z("ml-auto text-xs tracking-widest text-neutral3",e),...t});jlt.displayName="CommandShortcut";function Tlt({children:e,className:t}){return o.jsx("div",{className:Z("border border-border1 rounded-lg p-6 bg-surface2",t),children:e})}const UIr=ZXt,VIr=YXt,qIr=TR,HIr=JXt,QIr=XXt,Nlt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsx(TXe,{ref:n,className:Z("cursor-pointer focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-white/30 focus-visible:rounded-sm",e),...r,children:t}));Nlt.displayName=TXe.displayName;const Alt=b.forwardRef(({className:e,inset:t,children:r,...n},s)=>o.jsxs(DXe,{ref:s,className:Z("hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-[state=open]:bg-surface4 flex cursor-default select-none items-center rounded-md px-2 py-1.5 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 focus-visible:outline-hidden focus-visible:ring-0",t&&"pl-8",e),...n,children:[r,o.jsx($8e,{className:"ml-auto -rotate-90"})]}));Alt.displayName=DXe.displayName;const Ilt=b.forwardRef(({className:e,...t},r)=>o.jsx(NR,{ref:r,className:Z("bg-surface3 backdrop-blur-xl data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 z-50 min-w-32 overflow-auto overflow-x-hidden rounded-lg",e),...t}));Ilt.displayName=NR.displayName;const Rlt=b.forwardRef(({className:e,container:t,sideOffset:r=8,...n},s)=>o.jsx(TR,{container:t,children:o.jsx(NXe,{ref:s,sideOffset:r,className:Z("bg-surface3 data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 backdrop-blur-xl text-neutral4 z-50 min-w-32 overflow-auto rounded-lg p-2 shadow-md",e),...n})}));Rlt.displayName=NXe.displayName;const Plt=b.forwardRef(({className:e,...t},r)=>o.jsx(IXe,{ref:r,className:Z("relative flex cursor-pointer select-none items-center gap-3 rounded-md px-2 py-1.5 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-disabled:pointer-events-none data-disabled:opacity-50 [&>span]:truncate [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-hidden focus-visible:ring-0","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-50 [&>svg]:mx-[-.25em] [&:hover>svg]:opacity-100",e),...t}));Plt.displayName=IXe.displayName;const Mlt=b.forwardRef(({className:e,children:t,checked:r,...n},s)=>o.jsxs(RXe,{ref:s,className:Z("hover:bg-surface4 focus:bg-surface4 active:bg-surface5 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 relative flex w-full cursor-pointer select-none items-center gap-4 rounded-md px-2 py-1.5 text-sm transition-colors text-neutral4 data-disabled:pointer-events-none data-disabled:opacity-50 focus-visible:outline-hidden focus-visible:ring-0",e),checked:r,...n,children:[o.jsx("div",{className:"border dark:border-white/20 border-black/20 flex h-4 w-4 items-center justify-center rounded-sm",children:r&&o.jsx(ov,{})}),t]}));Mlt.displayName=RXe.displayName;const Dlt=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(PXe,{ref:n,className:Z("relative flex cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm transition-colors text-neutral4 dark:hover:text-white dark:focus:text-white hover:text-neutral6 focus:text-neutral6 hover:bg-surface4 focus:bg-surface4 active:bg-surface5 data-disabled:pointer-events-none data-disabled:opacity-50 focus-visible:outline-hidden focus-visible:ring-0",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(KXt,{children:o.jsx(V8e,{className:"h-2 w-2 fill-current"})})}),t]}));Dlt.displayName=PXe.displayName;const Llt=b.forwardRef(({className:e,inset:t,...r},n)=>o.jsx(AXe,{ref:n,className:Z("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Llt.displayName=AXe.displayName;const $lt=b.forwardRef(({className:e,...t},r)=>o.jsx(MXe,{ref:r,className:Z("dark:bg-white/10 bg-black/10 -mx-1 my-1 h-px",e),...t}));$lt.displayName=MXe.displayName;const Flt=({className:e,...t})=>o.jsx("span",{className:Z("ml-auto text-xs tracking-widest opacity-60",e),...t});Flt.displayName="DropdownMenuShortcut";function dt({open:e,onOpenChange:t,children:r,modal:n}){return o.jsx(UIr,{modal:n,open:e,onOpenChange:t,children:r})}dt.Trigger=Nlt;dt.Content=Rlt;dt.Group=VIr;dt.Portal=qIr;dt.Item=Plt;dt.CheckboxItem=Mlt;dt.RadioItem=Dlt;dt.Label=Llt;dt.Separator=$lt;dt.Shortcut=Flt;dt.Sub=HIr;dt.SubContent=Ilt;dt.SubTrigger=Alt;dt.RadioGroup=QIr;const A2=({label:e,children:t})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{as:"p",variant:"ui-md",className:"text-neutral3",children:e}),t]});function In({className:e,...t}){return o.jsx("div",{className:Z("rounded-md bg-surface4 relative overflow-hidden","before:absolute before:inset-0","before:-translate-x-full","before:animate-[shimmer_2s_infinite]","before:bg-linear-to-r before:from-transparent before:via-surface5/20 before:to-transparent",e),...t})}const zlt=({icon:e,title:t,isLoading:r,children:n})=>o.jsxs("div",{className:"p-5 w-full overflow-x-hidden",children:[o.jsxs("div",{className:"text-neutral6 flex items-center gap-2",children:[o.jsx(Ce,{size:"lg",className:"bg-surface4 rounded-md p-1",children:e}),r?o.jsx(In,{className:"h-3 w-1/3"}):o.jsx("div",{className:"flex min-w-0 items-center gap-4",children:o.jsx(me,{variant:"header-md",as:"h2",className:"truncate font-medium",children:t})})]}),n&&o.jsx("div",{className:"pt-2",children:n})]});function WIr({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-2 text-neutral4",t),children:e})}function GIr({children:e}){return o.jsxs("p",{className:Z("text-ui-sm text-neutral4 flex items-center gap-2","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-70 [&>svg]:text-red-400"),children:[o.jsx(KI,{})," ",e]})}function ZIr({children:e}){return o.jsx("p",{className:"text-neutral3 text-ui-sm",children:e})}function YIr({children:e,name:t,required:r,size:n="default",className:s}){return o.jsxs("label",{htmlFor:`input-${t}`,className:Z("text-ui-smd text-neutral3 flex justify-between items-center ","in-[.horizontal-field-block]:grid in-[.horizontal-field-block]:content-start",{"text-ui-md":n==="bigger"},s),children:[e,r&&o.jsx("i",{className:"text-neutral2 text-xs",children:"(required)"})]})}function XIr({children:e,className:t,layout:r="vertical",labelColumnWidth:n}){return o.jsx("div",{className:Z("grid gap-2 text-neutral4",{"horizontal-field-block grid-cols-[auto_1fr] items-baseline":r==="horizontal"},t),style:r==="horizontal"&&n?{gridTemplateColumns:`${n} 1fr`}:void 0,children:e})}const lo=Object.assign({},{Layout:XIr,Column:WIr,Label:YIr,HelpText:ZIr,ErrorMsg:GIr});function KIr({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-6 content-start",t),children:e})}function JIr({children:e,className:t,columns:r=1,gap:n}){return o.jsx("div",{className:Z("grid",{"grid-cols-1":r===1,"grid-cols-2":r===2},n??"gap-6",t),children:e})}Object.assign(JIr,{Column:KIr});const eRr=LE(Z("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70"),{variants:{variant:{default:Z(vhe,bhe,xhe),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${pc.sm} text-ui-sm px-[.75em]`,md:`${pc.md} text-ui-md px-[.75em]`,default:`${pc.default} text-ui-md px-[.85em]`,lg:`${pc.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),cr=b.forwardRef(({className:e,size:t,testId:r,variant:n,type:s,error:a,...i},l)=>o.jsx("input",{type:s,className:Z(eRr({variant:n,size:t}),a&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:l,"aria-invalid":a,...i}));cr.displayName="Input";function Ex({name:e,value:t,label:r,labelIsHidden:n=!1,labelColumnWidth:s,helpText:a,errorMsg:i,required:l=!1,disabled:c=!1,labelSize:u,layout:d="vertical",placeholder:f,size:h="default",testId:p,className:m,...g}){return o.jsxs(lo.Layout,{layout:d,labelColumnWidth:s,className:m,children:[d==="horizontal"?o.jsx(lo.Column,{children:o.jsx(lo.Label,{name:e,required:l,size:u||"bigger",children:n?o.jsx(Wu,{children:r}):r})}):null,o.jsxs(lo.Column,{children:[!n&&d==="vertical"?o.jsx(lo.Label,{name:e,required:l,size:u||"default",children:r}):null,o.jsx(cr,{name:e,disabled:c,required:l,value:t,placeholder:f,"data-testid":p,size:h,...g}),a&&o.jsx(lo.HelpText,{children:a}),i&&o.jsx(lo.ErrorMsg,{children:i})]})]})}function Cx({name:e,helpText:t,errorMsg:r,required:n=!1,disabled:s=!1,value:a,label:i,labelIsHidden:l=!1,layout:c="vertical",placeholder:u="Search...",onChange:d,onReset:f,className:h,size:p,isMinimized:m,onMinimizedChange:g}){const y=b.useRef(null);return b.useEffect(()=>{m===!1&&y.current?.focus()},[m]),m?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(ve,{size:p||"sm","aria-label":i||"Search",disabled:s,onClick:()=>g?.(!1),children:o.jsx(ix,{})})}),o.jsx(Wr,{children:i||"Search"})]}):o.jsxs(lo.Layout,{layout:c,className:h,children:[c==="horizontal"?o.jsx(lo.Column,{children:o.jsx(lo.Label,{name:e,required:n,children:l?o.jsx(Wu,{children:i}):i})}):null,o.jsxs(lo.Column,{children:[c==="vertical"&&i&&!l?o.jsx(lo.Label,{name:e,required:n,children:i}):null,o.jsxs("div",{className:"relative group",children:[o.jsx(cr,{ref:y,name:e,disabled:s,value:a,placeholder:u,onChange:d,size:p,className:Z(p==="sm"&&"pl-8 pr-8",p==="md"&&"pl-9 pr-9",(!p||p==="default")&&"pl-10 pr-10",p==="lg"&&"pl-11 pr-11")}),o.jsx(ix,{"aria-hidden":"true",className:Z("text-neutral4 opacity-50 group-has-focus:opacity-100 absolute left-3 top-1/2 -translate-y-1/2",p==="sm"&&"w-3.5 h-3.5",p==="md"&&"w-4 h-4",(!p||p==="default")&&"w-[1.125rem] h-[1.125rem]",p==="lg"&&"w-5 h-5")}),f&&(a||m===!1)&&o.jsx(ve,{variant:"ghost",size:p||"default","aria-label":"Clear search",onClick:()=>{a&&f(),m===!1&&g?.(!0)},className:"absolute top-1/2 right-0 -translate-y-1/2",children:o.jsx(ff,{})})]}),t&&o.jsx(lo.HelpText,{children:t}),r&&o.jsx(lo.ErrorMsg,{children:r})]})]})}const ci=jKt,ui=TKt,Xa=b.forwardRef(({className:e,children:t,variant:r="inputLike",size:n="default",...s},a)=>o.jsxs(oKe,{ref:a,className:Z(ME({variant:r,size:n}),"justify-between [&>svg]:opacity-100",e),...s,children:[t,o.jsx(NKt,{asChild:!0,children:o.jsx($8e,{className:Z("h-4 w-4 text-neutral3",nn.colors)})})]}));Xa.displayName=oKe.displayName;const Ka=b.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>o.jsx(AKt,{children:o.jsx(lKe,{ref:s,className:Z("relative z-50 min-w-32 max-h-dropdown-max-height overflow-y-auto overflow-x-hidden rounded-md border border-border1 bg-surface3 text-neutral5 shadow-md 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 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",r==="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",e),position:r,...n,children:o.jsx(IKt,{className:Z("p-1",r==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"),children:t})})}));Ka.displayName=lKe.displayName;const rs=b.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(cKe,{ref:n,className:Z("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-neutral5 text-sm",nn.colors,"hover:bg-surface5 hover:text-neutral5","focus:bg-surface5 focus:text-neutral5","data-[state=checked]:bg-accent1Dark data-[state=checked]:text-accent1","data-disabled:pointer-events-none data-disabled:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(PKt,{children:o.jsx(ov,{className:"h-4 w-4 text-accent1"})})}),o.jsx(RKt,{children:t})]}));rs.displayName=cKe.displayName;function Po({name:e,helpText:t,errorMsg:r,required:n=!1,disabled:s=!1,size:a="default",value:i,label:l,labelIsHidden:c=!1,layout:u="vertical",labelColumnWidth:d,options:f,placeholder:h="Select an option",onValueChange:p,className:m}){return o.jsxs(lo.Layout,{layout:u,labelColumnWidth:d,className:m,children:[u==="horizontal"?o.jsx(lo.Column,{children:o.jsx(lo.Label,{name:e,required:n,children:c?o.jsx(Wu,{children:l}):l})}):null,o.jsxs(lo.Column,{children:[u==="vertical"&&l&&!c?o.jsx(lo.Label,{name:e,required:n,children:l}):null,o.jsxs(ci,{"aria-label":c?l:void 0,name:e,value:i,onValueChange:p,disabled:s,children:[o.jsx(Xa,{size:a,children:o.jsx(ui,{placeholder:h})}),o.jsx(Ka,{children:f.map(g=>o.jsx(rs,{value:g.value,children:g.label},g.value))})]}),t&&o.jsx(lo.HelpText,{children:t}),r&&o.jsx(lo.ErrorMsg,{children:r})]})]})}const tRr={sm:`${pc.sm} w-form-sm`,md:`${pc.md} w-form-md`,lg:`${pc.lg} w-form-lg`,default:`${pc.default}`},rRr={sm:"sm",md:"default",lg:"lg",default:"default"},nRr={default:"bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",light:"bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",outline:"bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"bg-transparent border-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-accent1 hover:bg-accent1/90 text-surface1 font-medium hover:shadow-glow-accent1 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none"},sRr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",Rn=je.forwardRef(({className:e,children:t,tooltip:r,size:n="md",variant:s="default",disabled:a,...i},l)=>o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("button",{ref:l,disabled:a,"aria-label":typeof r=="string"?r:void 0,className:Z(sRr,nP,nRr[s],tRr[n],a&&"active:scale-100",e),...i,children:o.jsx(Ce,{size:rRr[n],children:t})})}),o.jsx(Wr,{children:r})]}));Rn.displayName="IconButton";const aRr=LE("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=b.forwardRef(({className:e,...t},r)=>o.jsx(dKe,{ref:r,className:Z(aRr(),e),...t}));xt.displayName=dKe.displayName;function __({children:e}){const t=e.replace(/\\n/g,`
288
288
  `);return o.jsx(LKe,{remarkPlugins:[oJe],components:oRr,className:"space-y-3",children:t})}const Blt=je.memo(({children:e,language:t,...r})=>{const[n,s]=b.useState([]);return b.useEffect(()=>{EIr(e,t).then(a=>{a&&s(a)})},[e,t]),n.length?o.jsx("pre",{...r,children:o.jsx("code",{children:n.map((a,i)=>o.jsxs(o.Fragment,{children:[o.jsx("span",{children:a.map((l,c)=>{const u=typeof l.htmlStyle=="string"?void 0:l.htmlStyle;return o.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",style:u,children:l.content},c)})},i),i!==n.length-1&&`
289
289
  `]}))})}):o.jsx("pre",{...r,children:e})});Blt.displayName="HighlightedCode";const iRr=({children:e,className:t,language:r,...n})=>{const s=typeof e=="string"?e:Kse(e),a=Z("overflow-x-scroll rounded-md border bg-surface1/50 p-4 font-mono text-sm [scrollbar-width:none]",t);return o.jsxs("div",{className:"group/code relative mb-4",children:[o.jsx(b.Suspense,{fallback:o.jsx("pre",{className:a,...n,children:e}),children:o.jsx(Blt,{language:r,className:a,children:s})}),o.jsx("div",{className:"invisible absolute right-2 top-2 flex space-x-1 rounded-lg p-1 opacity-0 transition-all duration-200 group-hover/code:visible group-hover/code:opacity-100",children:o.jsx(Ya,{content:s,copyMessage:"Copied code to clipboard"})})]})};function Kse(e){if(typeof e=="string")return e;if(e?.props?.children){let t=e.props.children;return Array.isArray(t)?t.map(r=>Kse(r)).join(""):Kse(t)}return""}const oRr={h1:({children:e,...t})=>o.jsx("h1",{className:"text-2xl font-semibold",...t,children:e}),h2:({children:e,...t})=>o.jsx("h2",{className:"font-semibold text-xl",...t,children:e}),h3:({children:e,...t})=>o.jsx("h3",{className:"font-semibold text-lg",...t,children:e}),h4:({children:e,...t})=>o.jsx("h4",{className:"font-semibold text-base",...t,children:e}),h5:({children:e,...t})=>o.jsx("h5",{className:"font-medium",...t,children:e}),strong:({children:e,...t})=>o.jsx("strong",{className:"font-semibold",...t,children:e}),a:({children:e,...t})=>o.jsx("a",{className:"underline underline-offset-2",...t,children:e}),blockquote:({children:e,...t})=>o.jsx("blockquote",{className:"border-l-2 border-neutral6 pl-4",...t,children:e}),code:({children:e,className:t,...r})=>{const n=/language-(\w+)/.exec(t||"");return n?o.jsx(iRr,{className:t,language:n[1],...r,children:e}):o.jsx("code",{className:Z("font-mono [:not(pre)>&]:rounded-md [:not(pre)>&]:bg-surface1/50 [:not(pre)>&]:px-1 [:not(pre)>&]:py-0.5"),...r,children:e})},pre:({children:e})=>e,ol:({children:e,...t})=>o.jsx("ol",{className:"list-decimal space-y-2 pl-6",...t,children:e}),ul:({children:e,...t})=>o.jsx("ul",{className:"list-disc space-y-2 pl-6",...t,children:e}),li:({children:e,...t})=>o.jsx("li",{className:"my-1.5",...t,children:e}),table:({children:e,...t})=>o.jsx("table",{className:"w-full border-collapse overflow-y-auto rounded-md border border-neutral6/20",...t,children:e}),th:({children:e,...t})=>o.jsx("th",{className:"border border-neutral6/20 px-4 py-2 text-left font-bold [[align=center]]:text-center [[align=right]]:text-right",...t,children:e}),td:({children:e,...t})=>o.jsx("td",{className:"border border-neutral6/20 px-4 py-2 text-left [[align=center]]:text-center [[align=right]]:text-right",...t,children:e}),tr:({children:e,...t})=>o.jsx("tr",{className:"m-0 border-t p-0 even:bg-surface4",...t,children:e}),p:({children:e,...t})=>o.jsx("p",{className:"whitespace-pre-wrap leading-relaxed",...t,children:e}),hr:({...e})=>o.jsx("hr",{className:"border-neutral6/20",...e})};function lRr({children:e,className:t}){return o.jsx("div",{className:Z("overflow-x-auto ",t),children:e})}function Ult({children:e,className:t}){return o.jsx("p",{className:Z("text-ui-md text-neutral2 leading-tight mt-0.5",t),children:e})}function cRr({message:e="Failed to load data",className:t}){return o.jsx("div",{className:Z("flex flex-col gap-3 items-center justify-center",t),children:o.jsx("p",{className:"text-ui-sm text-accent2",children:e})})}const uRr={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function It({color:e,className:t,size:r="md"}){return o.jsx("svg",{className:Z("animate-spin",uRr[r],t),style:{animationDuration:"800ms",animationTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)"},xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}function dRr({className:e}){return o.jsx("div",{className:Z("flex items-center justify-center",e),children:o.jsx(It,{size:"md",color:Ib.neutral1})})}function fRr({message:e="No data yet",className:t}){return o.jsx("div",{className:Z("flex items-center justify-center h-full",t),children:o.jsx("p",{className:"text-neutral1 text-sm",children:e})})}function KNe({children:e,className:t}){return o.jsx(Tlt,{className:Z("flex-1 grid grid-rows-[4rem_1fr] min-h-72 gap-2 min-w-80 md:min-w-[22rem] lg:min-w-[24rem] xl:min-w-[26rem] 2xl:min-w-[30rem]",t),children:e})}function hRr({value:e,label:t,className:r}){return o.jsxs("div",{className:Z("grid justify-end content-start text-right gap-1",r),children:[o.jsx("span",{className:"text-ui-lg font-semibold text-neutral4 leading-none",children:e}),t&&o.jsx("span",{className:"text-ui-md text-neutral2",children:t})]})}function Vlt({children:e,className:t,as:r="h2"}){return o.jsx(r,{className:Z("text-ui-md font-normal text-neutral4",t),children:e})}function pRr(e){if("children"in e)return o.jsx("div",{className:e.className,children:e.children});const{title:t,description:r,titleAs:n}=e;return o.jsxs("div",{className:e.className,children:[o.jsx(Vlt,{as:n,children:t}),r&&o.jsx(Ult,{children:r})]})}function mRr({children:e,className:t}){return o.jsx("div",{className:Z("grid grid-cols-[1fr_auto] gap-4",t),children:e})}function gRr({changePct:e,prevValue:t,lowerIsBetter:r,className:n}){const s=r?e<0:e>=0;return o.jsxs("div",{className:Z("flex items-center gap-1 text-sm text-neutral1 flex-wrap",n),children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{className:Z("[&>svg]:w-4 [&>svg]:h-4",s?"text-green-600":"text-red-600"),children:e>=0?o.jsx(t_t,{}):o.jsx(Jkt,{})}),o.jsx("span",{className:Z(s?"text-green-600":"text-red-600"),children:`${e>=0?"+":"-"}${Math.abs(e).toFixed(1)}%`})]}),t&&o.jsxs("div",{children:["vs previous ",o.jsx("b",{className:"text-neutral2 font-semibold",children:t})]})]})}function yRr({message:e="Failed to load data",className:t}){return o.jsx("span",{className:Z("text-ui-sm text-accent2",t),children:e})}function vRr({children:e,className:t}){return o.jsx("span",{className:Z("text-ui-md text-neutral3 leading-relaxed",t),children:e})}function bRr({className:e}){return o.jsx("span",{className:Z("text-sm",e),children:o.jsx(It,{size:"md",color:Ib.neutral1})})}function xRr({message:e="No previous value to compare",className:t}){return o.jsx("span",{className:Z("text-sm text-neutral1",t),children:e})}function wRr({message:e="No data yet",className:t}){return o.jsx("span",{className:Z("text-sm text-neutral1",t),children:e})}function SRr({children:e,className:t}){return o.jsx(Tlt,{className:Z("flex-1 min-w-60",t),children:o.jsx("div",{className:"grid gap-1",children:e})})}function ORr({children:e,className:t}){return o.jsx("strong",{className:Z("text-header-lg text-neutral4 font-semibold",t),children:e})}const fr=Object.assign(SRr,{Label:vRr,Value:ORr,Change:gRr,NoChange:xRr,NoData:wRr,Error:yRr,Loading:bRr}),qt=Object.assign(KNe,{Root:KNe,Kpi:fr,TopBar:mRr,TitleAndDescription:pRr,Title:Vlt,Description:Ult,Summary:hRr,Loading:dRr,Error:cRr,Content:lRr,NoData:fRr});function Jse({children:e,className:t}){return o.jsx("div",{className:Z("flex flex-wrap gap-8",t),children:e})}const wg=Ssr,$p=Osr,Nh=b.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>o.jsx(ksr,{children:o.jsx(vJe,{ref:s,align:t,sideOffset:r,className:Z("z-50 w-72 rounded-md border border-border1 bg-surface3 text-neutral5 shadow-md focus-visible:outline-hidden 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 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",e&&/\bp-\S+/.test(e)?!1:"p-4",e),...n})}));Nh.displayName=vJe.displayName;function qlt({children:e,...t}){const[r,n]=b.useState(!1),s=b.useRef(void 0),a=b.useCallback(()=>{clearTimeout(s.current),n(!0)},[]),i=b.useCallback(()=>{s.current=setTimeout(()=>n(!1),150)},[]);return b.useEffect(()=>()=>clearTimeout(s.current),[]),o.jsx(wg,{open:r,onOpenChange:n,...t,children:o.jsx("span",{onMouseEnter:a,onMouseLeave:i,onFocusCapture:a,onBlurCapture:i,style:{display:"contents"},children:e})})}const aP=b.forwardRef(({className:e,...t},r)=>o.jsx(AJe,{className:Z("grid gap-2",e),...t,ref:r}));aP.displayName=AJe.displayName;const zd=b.forwardRef(({className:e,...t},r)=>o.jsx(IJe,{ref:r,className:Z("aspect-square h-4 w-4 rounded-full border border-neutral3 text-neutral6","shadow-sm",nn.all,"hover:border-neutral5 hover:shadow-md",nP,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:border-accent1 data-[state=checked]:shadow-glow-accent1",e),...t,children:o.jsx(Psr,{className:Z("flex items-center justify-center","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:o.jsx(V8e,{className:"h-2 w-2 fill-accent1 text-accent1"})})}));zd.displayName=IJe.displayName;const Hlt=(e,{enabled:t=!0})=>{const r=b.useRef(t);je.useEffect(()=>{if(!t||!e?.current)return;const n=e.current,s=new MutationObserver(()=>{r.current&&n.scrollTo({top:n.scrollHeight,behavior:"smooth"})});s.observe(n,{childList:!0,subtree:!0,characterData:!0});const a=i=>{const l=i.target,c=l.scrollTop+l.clientHeight,u=l.scrollHeight;c>=u-1?r.current=!0:r.current=!1};return n.addEventListener("scroll",a),()=>{n.removeEventListener("scroll",a),s.disconnect()}},[t,e])},Rs=b.forwardRef(({className:e,children:t,viewPortClassName:r,maxHeight:n,autoScroll:s=!1,orientation:a="vertical",...i},l)=>{const c=b.useRef(null);return Hlt(c,{enabled:s}),o.jsxs(HJe,{ref:l,className:Z("relative overflow-hidden",e),...i,children:[o.jsx(Qsr,{ref:c,className:Z("h-full w-full rounded-[inherit] [&>div]:block!",r),style:n?{maxHeight:n}:void 0,children:t}),(a==="vertical"||a==="both")&&o.jsx(eae,{orientation:"vertical"}),(a==="horizontal"||a==="both")&&o.jsx(eae,{orientation:"horizontal"}),a==="both"&&o.jsx(Wsr,{})]})});Rs.displayName=HJe.displayName;const eae=b.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx(Eue,{ref:n,orientation:t,className:Z("flex touch-none select-none transition-all duration-normal ease-out-custom","opacity-0 hover:opacity-100 data-[state=visible]:opacity-100",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",e),...r,children:o.jsx(zJe,{className:"relative flex-1 rounded-full bg-neutral2 hover:bg-neutral3 transition-colors duration-normal"})}));eae.displayName=Eue.displayName;const JNe={sm:pc.sm,md:pc.md,lg:pc.lg,default:pc.default},jm=({onSearch:e,label:t,placeholder:r,debounceMs:n=300,size:s="md"})=>{const a=b.useId(),i=b.useRef(null),l=YS(u=>{e(u)},n);b.useEffect(()=>()=>{l.cancel()},[l]),b.useEffect(()=>{const u=i.current;if(!u)return;const d=f=>{f.key.toLowerCase()==="f"&&f.shiftKey&&(f.ctrlKey||f.metaKey)&&(f.preventDefault(),u.focus())};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}},[]);const c=u=>{l(u.target.value)};return o.jsxs("div",{className:Z("border border-border1 flex w-full items-center gap-2 overflow-hidden pl-2 pr-1",WNr,QNr,nn.all,"hover:border-neutral2",JNe[s]),children:[o.jsx(ix,{className:Z("text-neutral3 h-4 w-4",nn.colors)}),o.jsxs("div",{className:"flex-1",children:[o.jsx("label",{htmlFor:a,className:"sr-only",children:t}),o.jsx("input",{id:a,type:"text",placeholder:r,className:Z("bg-transparent text-ui-md placeholder:text-neutral3 block w-full px-2 outline-hidden",JNe[s]),name:a,ref:i,onChange:c})]})]})},kRr=({children:e})=>o.jsx("div",{className:"px-3 py-2.5 border-b border-border1",children:e}),G5=b.forwardRef(({className:e,...t},r)=>o.jsxs(oet,{ref:r,className:Z("relative flex w-full touch-none select-none items-center group",e),...t,children:[o.jsx(dar,{className:Z("relative h-1.5 w-full grow overflow-hidden rounded-full bg-neutral2",nn.colors),children:o.jsx(far,{className:Z("absolute h-full bg-accent1",nn.all)})}),o.jsx(har,{className:Z("block h-4 w-4 rounded-full border-2 border-accent1 bg-white shadow-md","transition-all duration-normal ease-out-custom",nP,"hover:scale-110 hover:shadow-lg","active:scale-95","disabled:pointer-events-none disabled:opacity-50")})]}));G5.displayName=oet.displayName;const Yl=b.forwardRef(({className:e,...t},r)=>o.jsx(pet,{className:Z("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent",nn.all,nP,"hover:brightness-110","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:brightness-100","data-[state=checked]:bg-accent1 data-[state=checked]:shadow-glow-accent1","data-[state=unchecked]:bg-neutral2",e),...t,ref:r,children:o.jsx(bar,{className:Z("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-md","transition-all duration-normal ease-out-custom","data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0","data-[state=checked]:shadow-lg")})}));Yl.displayName=pet.displayName;function _Rr({children:e,untilChar:t,charCount:r,copy:n,withTooltip:s=!0,className:a,as:i="span",...l}){const c=e;let u=c,d=!1;if(t!==void 0){const h=c.indexOf(t);h!==-1&&(u=c.slice(0,h),d=!0)}else r!==void 0&&c.length>r&&(u=c.slice(0,r),d=!0);if(!d)return o.jsx(me,{as:i,className:a,...l,children:c});const f=o.jsxs(me,{as:"span",className:"cursor-default",variant:l.variant,font:l.font,children:[u,"..."]});return o.jsxs(me,{as:i,className:Z("group inline-flex items-center gap-1",a),...l,children:[s?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:f}),o.jsx(Wr,{children:c})]}):f,n&&o.jsx(Ya,{content:c,className:"opacity-0 group-hover:opacity-100 transition-opacity"})]})}function ws({children:e,className:t,spacing:r="default"}){return o.jsx("div",{className:Z("flex gap-2 items-center ",{"gap-[2px] [&>*:not(:last-child)]:rounded-r-none [&>*:not(:first-child)]:rounded-l-none":r==="close"},t),children:e})}function Ir({children:e,className:t,style:r}){const n=Qlt("MainContentLayout");return o.jsx("main",{className:Z("grid grid-rows-[auto_1fr] h-full items-start content-start",t),style:{...r,...n?{border:"3px dotted red"}:{}},children:e})}function of({children:e,className:t,isCentered:r=!1,isDivided:n=!1,hasLeftServiceColumn:s=!1,style:a}){const i=Qlt("MainContentContent"),l=Che({isCentered:r,isDivided:n,hasLeftServiceColumn:s,className:t});return o.jsx("div",{className:l,style:{...a,...i?{border:"3px dotted orange"}:{}},children:e})}const Che=({isCentered:e,isDivided:t,hasLeftServiceColumn:r,className:n})=>Z("grid overflow-y-auto h-full ","overflow-x-auto min-w-min",{"items-start content-start":!e&&!t&&!r,"grid place-items-center":e,"grid-cols-[1fr_1fr]":t&&!r,"grid-cols-[12rem_1fr_1fr]":t&&r,"grid-cols-[auto_1fr]":!t&&r},n);function Qlt(e){try{const t=localStorage.getItem("add-dev-style-to-components");return t?t.split(",").map(n=>n.trim()).filter(Boolean).includes(e):!1}catch(t){return console.error("Error reading or parsing localStorage:",t),!1}}function ERr({children:e,className:t}){return o.jsx("div",{className:Z("grid content-start",t),children:e})}function CRr({children:e,isLoading:t}){return o.jsx("p",{className:Z("text-neutral3 text-sm max-w-[35rem] flex flex-wrap gap-x-4 gap-y-1 mt-1 first-of-type:mt-3 ml-1",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":t}),children:t?o.jsx(o.Fragment,{children:" "}):o.jsx(o.Fragment,{children:e})})}function jRr({children:e,title:t,description:r,icon:n,className:s,withMargins:a=!0}){const i=t==="loading",l=r==="loading";return e?o.jsx("header",{className:Z("grid grid-cols-[1fr_auto] gap-16 w-full ",{"mt-[6vh] mb-[4vh]":a},s),children:e}):o.jsxs("header",{className:Z("grid gap-2 pt-8 pb-8 ",s),children:[o.jsx("h1",{className:Z("text-neutral6 text-xl font-normal flex items-center gap-2","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:text-neutral3",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":i}),children:i?o.jsx(o.Fragment,{children:" "}):o.jsxs(o.Fragment,{children:[n&&n," ",t]})}),r&&o.jsx("p",{className:Z("text-neutral4 text-sm m-0",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":l}),children:l?o.jsx(o.Fragment,{children:" "}):r})]})}function TRr({children:e,isLoading:t,size:r="default"}){return o.jsx("h1",{className:Z("text-neutral5 text-xl font-normal gap-2 flex items-center","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:opacity-50",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":t,"text-md":r==="smaller"}),children:t?o.jsx(o.Fragment,{children:" "}):o.jsx(o.Fragment,{children:e})})}const Ar=Object.assign(jRr,{Title:TRr,Description:CRr,Column:ERr});function bS({children:e,className:t}){return o.jsx("div",{className:Z("grid gap-12",t),children:e})}const Wlt=({className:e,children:t})=>o.jsx("div",{className:Z("flex items-center text-ui-sm border border-border1 rounded-lg overflow-hidden","[&>button]:border-0 [&>button:not(:first-child)]:border-l [&>button:not(:first-child)]:border-border1","[&>button]:rounded-none [&>button:first-child]:rounded-l-lg [&>button:last-child]:rounded-r-lg",e),children:t});function Z5({className:e,classNames:t,showOutsideDays:r=!0,...n}){return o.jsx(ncr,{showOutsideDays:r,className:Z("p-3",e),classNames:{months:"flex flex-col space-y-4 sm:space-y-0 ",month:"space-y-4 text-ui-sm ",caption:"flex justify-between pt-1 items-center pl-2",caption_label:"text-text font-medium ",nav:"flex items-center",nav_button_previous:Z("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_next:Z("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),dropdown_month:"w-full border-collapse space-y-1",weeknumber:"flex",day:Z("relative p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-surface5 [&:has([aria-selected].day-outside)]:bg-surface5/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md","h-8 w-8 p-0 hover:bg-lightGray-7/50 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start rounded-l-md",day_range_end:"day-range-end rounded-r-md",day_selected:Z("bg-accent1! text-white! hover:bg-accent1/80! focus:bg-accent1/80! focus:text-white!",n.mode!=="range"&&"rounded-md"),day_today:"bg-neutral6/10 text-neutral5",day_outside:"day-outside text-neutral3 opacity-50 aria-selected:bg-surface5/50 aria-selected:text-neutral3 aria-selected:opacity-30",day_disabled:"text-neutral3 opacity-50",day_range_middle:"aria-selected:bg-surface5 aria-selected:text-neutral5",day_hidden:"invisible",head_cell:"text-ui-xs text-neutral3",...t},...n})}const Zq=["12","1","2","3","4","5","6","7","8","9","10","11"],I2=["00","15","30","45","59"],R2=["AM","PM"];function tae({defaultValue:e,onValueChange:t,className:r}){const[n,s]=b.useState("12"),[a,i]=b.useState("00"),[l,c]=b.useState("AM");b.useEffect(()=>{if(e){const h=/^(\d{1,2}):(\d{2})(?::\d{2})?\s*(AM|PM|am|pm)?$/,p=e.match(h);if(p){let m=parseInt(p[1],10);const g=parseInt(p[2],10),y=p[3]?.toUpperCase();m>=1&&m<=12&&g>=0&&g<=59&&(s(m.toString()),i(g===0?"00":g.toString()),c(y||"AM"))}}},[e]);const u=h=>{s(h),t(`${Zq[+h]}:${a} ${l}`.trim())},d=h=>{i(I2[+h]),t(`${n}:${I2[+h]} ${l}`.trim())},f=h=>{c(R2[+h]),t(`${n}:${a} ${R2[+h]}`.trim())};return o.jsxs("div",{className:Z("flex gap-2 items-center",r),children:[o.jsxs(ci,{name:"hour",value:Zq.indexOf(n).toString(),onValueChange:u,children:[o.jsx(Xa,{size:"sm",children:o.jsx(ui,{placeholder:"Select..."})}),o.jsx(Ka,{children:Zq.map((h,p)=>o.jsx(rs,{value:`${p}`,children:h},h))})]}),":",o.jsxs(ci,{name:"minute",value:I2.indexOf(a).toString(),onValueChange:d,children:[o.jsx(Xa,{size:"sm",children:o.jsx(ui,{placeholder:"Select..."})}),o.jsx(Ka,{children:I2.map((h,p)=>o.jsx(rs,{value:`${p}`,children:h},h))})]}),o.jsxs(ci,{name:"period",value:R2.indexOf(l).toString(),onValueChange:f,children:[o.jsx(Xa,{size:"sm",children:o.jsx(ui,{placeholder:"Select..."})}),o.jsx(Ka,{children:R2.map((h,p)=>o.jsx(rs,{value:`${p}`,children:h},h))})]})]})}const eAe=({value:e,minValue:t,maxValue:r,defaultTimeStrValue:n,onValueChange:s,children:a,className:i,placeholder:l,...c})=>{const[u,d]=b.useState(!1);return o.jsxs(wg,{open:u,onOpenChange:d,children:[o.jsx($p,{asChild:!0,children:a||o.jsx(ARr,{value:e,placeholder:l,className:i,"data-testid":"datepicker-button"})}),o.jsx(Nh,{className:"backdrop-blur-4xl w-auto p-0! bg-surface4 max-w-[16.5rem]",align:"start","data-testid":"datepicker-calendar",children:o.jsx(NRr,{value:e,minValue:t,maxValue:r,onValueChange:s,setOpenPopover:d,defaultTimeStrValue:n,...c})})]})};function P2({date:e,timeStr:t=""}){if(!Oy(e))return null;if(t){const r=or(e,"yyyy-MM-dd"),n=new Date(`${r} ${t}`);if(Oy(n))return n}return e}const NRr=({value:e,minValue:t,maxValue:r,onValueChange:n,setOpenPopover:s,placeholder:a,className:i,defaultTimeStrValue:l,...c})=>{const[u,d]=b.useState(null),[f,h]=b.useState(e?or(P2({date:e,timeStr:l})||"","PP p"):""),[p,m]=b.useState(l||""),[g,y]=b.useState(e?new Date(e):void 0),x=YS(B=>{Oy(B)&&(y(B),n?.(B),s?.(!1))},500),w=B=>{h(B.currentTarget.value);const D=new Date(B.currentTarget.value);x(D)},O=B=>{Oy(B)?r&&B>r?(d(`The selected date should be before ${or(r,"PP p")}`),h("")):t&&B<t?(d(`The selected date should be after ${or(t,"PP p")}`),h("")):(h(or(B,"PP p")),d("")):(h(""),d(""))},k=new Date(f),_=Oy(k),E=_&&k.getTime()!==e?.getTime(),T=B=>{if(y(B),B){const D=P2({date:B,timeStr:p});O(D||"")}else O("")},j=B=>{if(y(B),B){const D=P2({date:B,timeStr:p});O(D||"")}else O("")},A=B=>{if(m(B),_){const D=P2({date:k,timeStr:B});O(D||"")}},I=()=>{s?.(!1)},P=()=>{Oy(k)&&n(k),s?.(!1)},R=()=>{n(void 0),y(void 0),h(""),m(""),s?.(!1)};return o.jsxs("div",{"aria-label":"Choose date",className:Z("relative flex flex-col",i),onKeyDown:B=>{B.stopPropagation(),B.key==="Escape"&&s?.(!1)},children:[o.jsx(Ex,{name:"date-range",type:"text",value:f,onChange:w,placeholder:a,className:"m-4 mb-0 w-auto!"}),u&&o.jsxs("div",{className:Z("text-ui-md m-4 mb-0 text-neutral3","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mt-0.5 [&>svg]:text-red-500 [&>svg]:float-left [&>svg]:mr-2"),children:[o.jsx(a6,{})," ",u]}),o.jsx(Z5,{mode:"single",month:g,selected:g,onMonthChange:j,onSelect:T,...c}),o.jsx(tae,{onValueChange:A,className:"m-4 mt-0 w-auto",defaultValue:e?or(new Date(e),"hh:mm a"):l}),o.jsxs("div",{className:"grid grid-cols-[1fr_2fr] gap-2 m-4 mt-0",children:[E&&o.jsx(ve,{tabIndex:0,size:"md",onClick:R,type:"button",children:"Clear"}),o.jsx(ve,{tabIndex:0,type:"button",size:"md",variant:E?"primary":"default",onClick:()=>{_?P():I()},children:E?"Apply":"Cancel"})]})]})},ARr=b.forwardRef(({value:e,placeholder:t,className:r,...n},s)=>o.jsxs(ve,{ref:s,className:Z("justify-start",r),variant:"inputLike",...n,children:[o.jsx(ate,{className:"h-4 w-4"}),e?o.jsx("span",{className:"text-white",children:or(e,"PP p")}):o.jsx("span",{className:"text-gray",children:t??"Pick a date"})]}));function Glt({children:e}){return o.jsx("ul",{className:"grid bg-surface3 overflow-y-auto",children:e})}function Zlt(e){return!e||e.length===0?"":e?.map(t=>t.size).join(" ")}function Ylt({entry:e,isSelected:t,onClick:r,children:n,columns:s}){const a=()=>{r?.(e?.id)};return o.jsx("li",{className:Z("border-t text-neutral5 border-border1 last:border-b-0 text-ui-md","[&:last-child>button]:rounded-b-lg",nn.colors,{"bg-accent1Dark":t}),children:o.jsx("button",{onClick:a,className:Z("grid w-full px-6 gap-6 text-left items-center min-h-12",nn.colors,r0.visible,{"hover:bg-surface4":e&&!t}),style:{gridTemplateColumns:Zlt(s)},disabled:!e,children:n})})}function IRr({children:e,isLoading:t}){return o.jsx("div",{className:"text-neutral4 text-ui-md truncate ",children:t?o.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-4 select-none"}):e})}function RRr({status:e}){return o.jsxs("div",{className:Z("flex justify-center items-center w-full relative"),children:[e?o.jsx("div",{className:Z("w-[0.6rem] h-[0.6rem] rounded-full",{"bg-green-600":e==="success","bg-red-700":e==="failed"})}):o.jsx("div",{className:"text-neutral2 text-ui-sm leading-none",children:"-"}),o.jsxs(Wu,{children:["Status: ",e||"not provided"]})]})}function Xlt({columns:e}){return o.jsx("div",{className:Z("sticky top-0 bg-surface4 z-10 rounded-t-lg px-6"),children:o.jsx("div",{className:Z("grid gap-6 text-left uppercase py-3 text-neutral3 text-ui-sm"),style:{gridTemplateColumns:Zlt(e)},children:e?.map(t=>o.jsx("span",{children:t.label||t.name},t.name))})})}function PRr({children:e,message:t,className:r,type:n}){return!e&&!t?null:o.jsx("div",{className:Z("grid border-t border-border1",r),children:t?o.jsxs("p",{className:Z("text-neutral3 text-ui-md text-center grid p-8 justify-center justify-items-center gap-2","[&>svg]:w-[1.5em] [&>svg]:h-[1.5em] [&>svg]:opacity-75",{"[&>svg]:text-red-500":n==="error"}),children:[n==="error"?o.jsx(KI,{}):o.jsx(XI,{})," ",t]}):e})}function MRr({isLoading:e,hasMore:t,setEndOfListElement:r,loadingText:n="Loading more data...",noMoreDataText:s="No more data to load"}){return r?o.jsxs("div",{ref:r,className:"text-ui-md text-neutral3 opacity-50 flex mt-8 justify-center",children:[e&&n,!t&&!e&&s]}):null}function DRr({currentPage:e,hasMore:t,onNextPage:r,onPrevPage:n}){const s=typeof e=="number"&&e>0||t;return o.jsxs("div",{className:Z("flex pt-6 items-center justify-center text-neutral3 text-ui-md gap-8"),children:[o.jsxs("span",{children:["Page ",o.jsx("b",{children:e?e+1:"1"})]}),s&&o.jsxs("div",{className:Z("flex gap-4","[&>button]:flex [&>button]:items-center [&>button]:gap-2 [&>button]:text-neutral4 [&>button:hover]:text-neutral5 [&>button]:transition-colors [&>button]:border [&>button]:border-border1 [&>button]:p-1 [&>button]:px-2 [&>button]:rounded-md","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[typeof e=="number"&&e>0&&o.jsxs("button",{onClick:n,children:[o.jsx(ZI,{}),"Previous"]}),t&&o.jsxs("button",{onClick:r,children:["Next",o.jsx(YI,{})]})]})]})}function LRr({children:e}){return o.jsx("div",{className:"grid",children:e})}function Klt({children:e}){return o.jsx("div",{className:Z("rounded-lg border border-border1 overflow-clip"),children:e})}const oo=Object.assign(LRr,{Header:Xlt,Trim:Klt,Entries:Glt,Entry:Ylt,Message:PRr,NextPageLoading:MRr,Pagination:DRr,EntryText:IRr,EntryStatus:RRr}),tAe=["75%","50%","65%","90%","60%","80%"];function $Rr({columns:e,numberOfRows:t=3}){const r=(n,s)=>{const a=(n+s+(e?.length||0)+(t||0))%tAe.length;return tAe[a]};return o.jsx(Glt,{children:Array.from({length:t}).map((n,s)=>o.jsx(Ylt,{columns:e,children:(e||[]).map((a,i)=>{const l=`${a.name}-${i}`;return o.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-4 select-none",style:{width:`${r(s,i)}`}},l)})},s))})}function FRr({columns:e,numberOfRows:t}){return o.jsx(oo,{children:o.jsxs(Klt,{children:[o.jsx(Xlt,{columns:e}),o.jsx($Rr,{columns:e,numberOfRows:t})]})})}function jhe({entries:e,id:t,update:r}){const n=e.findIndex(a=>a.id===t);if(n<e.length-1)return()=>{const a=e[n+1];r(a.id)}}function The({entries:e,id:t,update:r}){const n=e.findIndex(a=>a.id===t);if(n>0)return()=>{const a=e[n-1];r(a.id)}}function Jlt({name:e,value:t,label:r,labelIsHidden:n=!1,className:s,required:a,disabled:i,helpMsg:l,options:c,onValueChange:u,placeholder:d="Select an option",size:f="default"}){const h=({children:p})=>n?o.jsx(Wu,{children:p}):p;return o.jsxs("div",{className:Z("flex gap-2 items-center",{"grid-rows-[auto_1fr]":r,"grid-rows-[auto_1fr_auto]":l},s),children:[o.jsx(h,{children:o.jsxs("label",{className:Z("text-ui-sm text-neutral3 flex justify-between items-center shrink-0"),children:[r,a&&o.jsx("i",{className:"text-neutral2",children:"(required)"})]})}),o.jsxs(ci,{name:e,value:t,onValueChange:u,disabled:i,children:[o.jsx(Xa,{id:`select-${e}`,size:f,className:"grid grid-cols-[1fr_auto] [&>span]:truncate w-full",children:o.jsx(ui,{placeholder:d})}),o.jsx(Ka,{children:c.map(p=>o.jsx(rs,{value:p.value,disabled:p.disabled,children:o.jsxs("span",{className:"whitespace-nowrap truncate flex items-center gap-2",children:[p.icon,p.label]})},p.value))})]}),l&&o.jsx("p",{className:"text-neutral3 text-ui-sm",children:l})]})}const ect=b.createContext(null);function zRr({children:e,value:t}){return o.jsx(ect.Provider,{value:t,children:e})}function Mz(){const e=b.useContext(ect);if(!e)throw new Error("useJSONSchemaForm must be used within a JSONSchemaForm.Root");return e}let BRr=0;function Dz(e={}){return{id:`field-${Date.now()}-${BRr++}`,name:"",type:"string",nullable:!1,optional:!1,...e}}function URr(e){return e==="text"?"string":e}function tct(e){const t=URr(e.type),n={type:e.nullable?[t,"null"]:t};if(e.description&&(n.description=e.description),e.type==="object"&&e.properties&&e.properties.length>0){const{properties:s,required:a}=rct(e.properties);n.properties=s,a.length>0&&(n.required=a)}return e.type==="array"&&e.items&&(n.items=tct(e.items)),n}function rct(e){const t={},r=[];for(const n of e)n.name.trim()&&(t[n.name]=tct(n),n.optional||r.push(n.name));return{properties:t,required:r}}function VRr(e){const{properties:t,required:r}=rct(e),n={type:"object",properties:t};return r.length>0&&(n.required=r),n}function nct(e){if(Array.isArray(e)){const t=e.includes("null");return{type:e.find(n=>n!=="null")||"string",nullable:t}}return{type:e||"string",nullable:!1}}function sct(e){return["string","number","boolean","object","array"].includes(e)?e:"string"}function act(e){const{type:t,nullable:r}=nct(e.type);return Dz({name:"",type:sct(t),description:e.description,nullable:r,optional:!1,properties:e.properties?Lz({properties:e.properties,required:e.required}):void 0,items:e.items?act(e.items):void 0})}function Lz(e){if(!e?.properties)return[];const t=new Set(e.required||[]);return Object.entries(e.properties).map(([r,n])=>{const{type:s,nullable:a}=nct(n.type);return Dz({name:r,type:sct(s),description:n.description,nullable:a,optional:!t.has(r),properties:n.properties?Lz({properties:n.properties,required:n.required}):void 0,items:n.items?act(n.items):void 0})})}function rae(e,t,r,n){if(t.length===0)return e.map(i=>i.id===r?{...i,...n}:i);const[s,...a]=t;return e.map(i=>i.id!==s?i:i.type==="object"?{...i,properties:rae(i.properties||[],a,r,n)}:i.type==="array"&&i.items?{...i,items:{...i.items,properties:rae(i.items.properties||[],a,r,n)}}:i)}function nae(e,t,r){if(t.length===0)return[...e,r];const[n,...s]=t;return e.map(a=>a.id!==n?a:a.type==="object"?{...a,properties:nae(a.properties||[],s,r)}:a.type==="array"&&a.items?{...a,items:{...a.items,properties:nae(a.items.properties||[],s,r)}}:a)}function sae(e,t,r){if(t.length===0)return e.filter(a=>a.id!==r);const[n,...s]=t;return e.map(a=>a.id!==n?a:a.type==="object"?{...a,properties:sae(a.properties||[],s,r)}:a.type==="array"&&a.items?{...a,items:{...a.items,properties:sae(a.items.properties||[],s,r)}}:a)}function qRr({onChange:e,onFieldsChange:t,defaultValue:r,maxDepth:n=5,className:s,children:a}){const[i,l]=b.useState(()=>r||[]),c=b.useRef("");b.useEffect(()=>{const p=VRr(i),m=JSON.stringify(p);m!==c.current&&(c.current=m,e?.(p))},[i,e]),b.useEffect(()=>{t?.(i)},[i,t]);const u=b.useCallback(p=>{const m=Dz();l(g=>nae(g,p,m))},[]),d=b.useCallback((p,m)=>{l(g=>sae(g,p,m))},[]),f=b.useCallback((p,m,g)=>{l(y=>rae(y,p,m,g))},[]),h=b.useMemo(()=>({fields:i,addField:u,removeField:d,updateField:f,maxDepth:n}),[i,u,d,f,n]);return o.jsx(zRr,{value:h,children:o.jsx("div",{className:Z(s),children:a})})}const ict=b.createContext(null);function HRr({children:e,value:t}){return o.jsx(ict.Provider,{value:t,children:e})}function $E(){const e=b.useContext(ict);if(!e)throw new Error("useJSONSchemaFormField must be used within a JSONSchemaForm.Field");return e}function QRr({field:e,parentPath:t=[],depth:r=0,className:n,children:s}){const{updateField:a,removeField:i}=Mz(),l=b.useCallback(d=>{a(t,e.id,d)},[a,t,e.id]),c=b.useCallback(()=>{i(t,e.id)},[i,t,e.id]),u=b.useMemo(()=>({field:e,parentPath:t,depth:r,update:l,remove:c}),[e,t,r,l,c]);return o.jsx(HRr,{value:u,children:o.jsx("div",{className:Z(n),children:s})})}const oct=b.createContext(null);function WRr({children:e,value:t}){return o.jsx(oct.Provider,{value:t,children:e})}function lct(){return b.useContext(oct)}function GRr({className:e,children:t}){const{fields:r}=Mz(),n=lct(),s=n?n.fields:r,a=n?n.parentPath:[],i=n?n.depth:0;return s.length===0?null:o.jsx("div",{className:e,children:s.map((l,c)=>t(l,c,{parentPath:a,depth:i}))})}function ZRr(e){const{field:t,update:r}=$E(),n=b.useCallback(s=>{r({name:s.target.value})},[r]);return o.jsx(Ex,{...e,size:"md",labelIsHidden:!0,name:`field-name-${t.id}`,value:t.name,onChange:n})}const YRr=[{value:"string",label:"String",icon:o.jsx(Ce,{size:"sm",children:o.jsx(Soe,{})})},{value:"number",label:"Number",icon:o.jsx(Ce,{size:"sm",children:o.jsx(boe,{})})},{value:"boolean",label:"Boolean",icon:o.jsx(Ce,{size:"sm",children:o.jsx(woe,{})})},{value:"text",label:"Text",icon:o.jsx(Ce,{size:"sm",children:o.jsx(fN,{})})},{value:"object",label:"Object",icon:o.jsx(Ce,{size:"sm",children:o.jsx(L8e,{})})},{value:"array",label:"Array",icon:o.jsx(Ce,{size:"sm",children:o.jsx(xoe,{})})}];function XRr({className:e,...t}){const{field:r,update:n}=$E(),s=b.useCallback(a=>{n({type:a})},[n]);return o.jsx(Po,{className:Z("w-28 shrink-0",e),name:`field-type-${r.id}`,label:"Select type",labelIsHidden:!0,value:r.type,onValueChange:s,options:YRr,size:"md",...t})}function KRr({label:e="Optional",labelClassName:t,className:r,...n}){const{field:s,update:a}=$E(),i=b.useCallback(l=>{a({optional:l===!0})},[a]);return o.jsxs("label",{className:Z("flex items-center gap-2 text-ui-sm text-neutral3 cursor-pointer",t),children:[o.jsx(bi,{...n,className:r,checked:s.optional,onCheckedChange:i}),e]})}function JRr({label:e="Nullable",labelClassName:t,className:r,...n}){const{field:s,update:a}=$E(),i=b.useCallback(l=>{a({nullable:l===!0})},[a]);return o.jsxs("label",{className:Z("flex items-center gap-2 text-ui-sm text-neutral3 cursor-pointer",t),children:[o.jsx(bi,{...n,className:r,checked:s.nullable,onCheckedChange:i}),e]})}function ePr({children:e,tooltip:t="Remove field",...r}){const{remove:n}=$E();return o.jsx(xs,{tooltipContent:t,onClick:n,size:"md",...r,children:e||o.jsx(Xkt,{})})}function tPr({className:e,children:t}){const{maxDepth:r,updateField:n}=Mz(),{field:s,parentPath:a,depth:i}=$E(),l=s.type==="object"||s.type==="array",c=i>=r;if(b.useEffect(()=>{s.type==="object"&&!s.properties&&n(a,s.id,{properties:[]}),s.type==="array"&&!s.items&&n(a,s.id,{items:Dz({name:"items",type:"object",properties:[]})})},[s.type,s.properties,s.items,s.id,a,n]),!l||c)return null;const u=[...a,s.id],d=i+1,f=s.type==="object"?s.properties||[]:s.type==="array"&&s.items?s.items.properties||[]:[];return o.jsx(WRr,{value:{parentPath:u,depth:d,fields:f},children:o.jsx("div",{className:Z("pl-4 border-l border-border1 mt-2",e),children:t})})}function rPr({children:e,...t}){const{addField:r}=Mz(),n=lct(),s=n?n.parentPath:[],a=b.useCallback(()=>{r(s)},[r,s]);return o.jsx(ve,{type:"button",...t,onClick:a,children:e||"Add field"})}const pi={Root:qRr,Field:QRr,FieldList:GRr,FieldName:ZRr,FieldType:XRr,FieldOptional:KRr,FieldNullable:JRr,FieldRemove:ePr,NestedFields:tPr,AddField:rPr};function n0({data:e,className:t,labelsAreHidden:r,isLoading:n,LinkComponent:s}){const a=({children:i})=>r?o.jsx(Wu,{children:i}):i;return!e||e.length===0?null:o.jsx("dl",{className:Z("grid grid-cols-[auto_1fr] gap-x-4 items-start content-start",t),children:e.map(({label:i,value:l,icon:c,separator:u},d)=>{const f=Array.isArray(l);return o.jsxs(je.Fragment,{children:[o.jsxs("dt",{className:Z("text-neutral3 text-ui-md flex items-center gap-8 justify-between min-h-9"),children:[o.jsxs("span",{className:Z("flex items-center gap-2","[&>svg]:w-[1.4em] [&>svg]:h-[1.4em] [&>svg]:text-neutral3 [&>svg]:opacity-50",{"[&>svg]:opacity-20":n}),children:[c," ",o.jsx(a,{children:i})]}),!r&&o.jsx("span",{className:Z("text-neutral3","[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:text-neutral3"),children:u})]}),o.jsx("dd",{className:Z("flex flex-wrap gap-2 py-1 min-h-9 text-ui-md items-center text-neutral5 text-wrap","[&>a]:text-neutral5 [&>a]:max-w-full [&>a]:w-auto truncate [&>a]:bg-surface4 [&>a]:transition-colors [&>a]:flex [&>a]:items-center [&>a]:gap-2 [&>a]:pt-0.5 [&>a]:pb-0.5 [&>a]:px-2 [&>a]:rounded-md [&>a]:text-ui-md [&>a]:min-h-7 [&>a]:leading-none","[&>a:hover]:text-neutral6 [&>a:hover]:bg-surface6","[&>a>svg]:w-[1em] [&>a>svg]:h-[1em] [&>a>svg]:text-neutral3 [&>a>svg]:ml-[-0.5em]"),children:n?o.jsx("span",{className:Z("bg-surface4 rounded-e-lg w-full"),style:{width:`${Math.floor(Math.random()*61)+50}%`},children:" "}):f?l?.map(h=>h.path&&s?o.jsx(rAe,{description:h.description,children:o.jsxs(s,{href:h.path,children:[h?.name," ",o.jsx(hN,{})]})},h.id):h.path?o.jsx(rAe,{description:h.description,children:o.jsxs("a",{href:h.path,children:[h?.name," ",o.jsx(hN,{})]})},h.id):o.jsx("span",{children:h?.name},h.id)):o.jsx(o.Fragment,{children:l||o.jsx("span",{className:"text-neutral3 text-ui-sm",children:"n/a"})})})]},i+d)})})}function rAe({description:e,children:t}){return e?o.jsxs(Xue,{openDelay:250,children:[o.jsx(Kue,{asChild:!0,children:t}),o.jsx(Jue,{children:o.jsxs(ede,{className:"z-50 w-auto max-w-60 rounded-md bg-surface5 p-2 px-4 text-ui-sm text-neutral5 text-center",sideOffset:5,side:"top",children:[e,o.jsx(tde,{className:"fill-surface5"})]})})]}):t}function nPr({children:e,className:t}){return o.jsx("div",{className:Z("mt-auto",t),children:e})}function sPr({children:e,className:t}){return o.jsx("nav",{className:Z("",t),children:e})}function cct({className:e}){return o.jsx("div",{className:Z("min-h-5 relative",'[&:after]:content-[""] [&:after]:block [&:after]:absolute [&:after]:h-0 [&:after]:border-border1 [&:after]:border-t [&:after]:top-1/2 [&:after]:left-3 [&:after]:right-3',e)})}function aPr({children:e,className:t,state:r="default",href:n,isActive:s,LinkComponent:a}){const i=r==="default",l=i?e:o.jsx(Wu,{children:e});return o.jsxs("div",{className:Z("grid grid-cols-[auto_1fr] items-center min-h-11",t),children:[o.jsx("header",{className:Z("text-ui-xs uppercase tracking-widest",{"pl-3":i,"text-black dark:text-white font-semibold":s,"text-neutral3/75":!s}),children:n&&i&&a?o.jsx(a,{href:n,className:Z("transition-colors duration-normal",{"hover:text-neutral5":!s,"text-black dark:text-white":s}),children:l}):l}),o.jsx(cct,{})]})}function iPr({link:e,state:t="default",children:r,isActive:n,className:s,LinkComponent:a}){const i=t==="collapsed",l=e?.variant==="featured",u=e?.url?.startsWith("http")?{target:"_blank",rel:"noreferrer"}:{};return o.jsx("li",{className:Z("flex relative","[&>a]:flex [&>a]:items-center [&>a]:min-h-8 [&>a]:gap-2.5 [&>a]:text-ui-md [&>a]:text-neutral3 [&>a]:py-1.5 [&>a]:px-3 [&>a]:w-full [&>a]:rounded-lg [&>a]:justify-center","[&>a]:transition-all [&>a]:duration-normal [&>a]:ease-out-custom","[&_svg]:w-4 [&_svg]:h-4 [&_svg]:text-neutral3/60 [&_svg]:transition-colors [&_svg]:duration-normal","[&>a:hover]:bg-surface4 [&>a:hover]:text-neutral5 [&>a:hover_svg]:text-neutral3",{"[&>a]:text-neutral5 [&>a]:bg-surface3":n,"[&_svg]:text-neutral5":n,"before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-0.5 before:h-5 before:bg-black dark:before:bg-white before:rounded-r-full before:transition-all before:duration-normal":n&&!i,"[&>a]:justify-start":!i,"[&_svg]:text-neutral3":i,"[&>a]:rounded-md [&>a]:my-2 [&>a]:bg-accent1Dark [&>a:hover]:bg-accent1Darker [&>a]:text-accent1 [&>a:hover]:text-accent1 [&>a]:border [&>a]:border-accent1/30":l,"dark:[&>a]:bg-accent1 dark:[&>a:hover]:bg-accent1/90 dark:[&>a]:text-black dark:[&>a:hover]:text-black dark:[&>a]:border-transparent":l,"[&_svg]:text-accent1 [&>a:hover_svg]:text-accent1 dark:[&_svg]:text-black/75 dark:[&>a:hover_svg]:text-black":l,"[&>a]:pl-7 [&>a]:text-ui-sm":e?.indent&&!i},s),children:e?o.jsx(o.Fragment,{children:i||e.tooltipMsg?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsxs(a,{href:e.url,...u,children:[e.icon&&e.icon,i?o.jsx(Wu,{children:e.name}):e.name," ",r]})}),o.jsx(Wr,{side:"right",align:"center",className:"ml-4",children:e.tooltipMsg?o.jsxs(o.Fragment,{children:[i&&`${e.name} | `," ",e.tooltipMsg]}):e.name})]}):o.jsxs(a,{href:e.url,...u,children:[e.icon&&e.icon,i?o.jsx(Wu,{children:e.name}):e.name," ",r,e.isExperimental&&o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(a6,{className:"ml-auto stroke-accent5"})}),o.jsx(Wr,{side:"right",align:"center",className:"ml-4",children:"Experimental Feature"})]})]})}):r})}function oPr({children:e,className:t}){return o.jsx("ul",{className:Z("grid gap-1 items-start content-center",t),children:e})}function lPr({children:e,className:t}){return o.jsx("section",{className:Z("grid items-start content-center relative",t),children:e})}const uct="sidebar:state",Nhe=je.createContext(null);function Ahe(){const e=je.useContext(Nhe);if(!e)throw new Error("useMainSidebar must be used within a MainSidebarProvider.");return e}function cPr(){return je.useContext(Nhe)}const uPr=e=>{window.localStorage.setItem(uct,e.toString())};function dPr({children:e}){const[t,r]=je.useState(()=>"default");je.useLayoutEffect(()=>{const a=window.localStorage.getItem(uct);(a==="collapsed"||a==="default")&&r(a)},[]);const n=je.useCallback(()=>{uPr(t==="default"?"collapsed":"default"),r(t==="default"?"collapsed":"default")},[t]),s=je.useMemo(()=>({state:t,toggleSidebar:n}),[t,n]);return o.jsx(Nhe.Provider,{value:s,children:e})}function fPr({children:e,className:t}){const{state:r,toggleSidebar:n}=Ahe(),s=r==="collapsed";return o.jsxs("div",{className:Z("flex flex-col h-full px-4 relative overflow-y-auto","transition-all duration-slow ease-out-custom",{"lg:min-w-52 xl:min-w-56 2xl:min-w-60 3xl:min-w-64 4xl:min-w-72":!s},t),children:[e,o.jsx("button",{onClick:n,className:Z("w-[.75rem] h-full right-0 top-0 absolute opacity-10",{"cursor-w-resize":!s,"cursor-e-resize":s}),"aria-label":"Toggle sidebar"})]})}function hPr({className:e}){const{state:t,toggleSidebar:r}=Ahe(),n=t==="collapsed";return b.useEffect(()=>{const s=a=>{a.ctrlKey&&a.key==="b"&&(a.preventDefault(),r())};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[r]),o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("button",{onClick:r,className:Z("inline-flex w-auto items-center text-neutral3 h-8 px-3 rounded-md","hover:bg-surface4 hover:text-neutral5","transition-all duration-normal ease-out-custom","focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","[&_svg]:w-4 [&_svg]:h-4 [&_svg]:text-neutral3 [&_svg]:transition-transform [&_svg]:duration-normal",e),"aria-label":"Toggle sidebar",children:o.jsx(zkt,{className:Z({"rotate-180":n})})})}),o.jsxs(Wr,{children:["Toggle Sidebar",o.jsxs("div",{className:"flex items-center gap-1 [&>svg]:w-[1em] [&>svg]:h-[1em]",children:[o.jsx(Akt,{})," Ctrl+B"]})]})]})}const Bh=Object.assign(fPr,{Bottom:nPr,Nav:sPr,NavSection:lPr,NavLink:iPr,NavHeader:aPr,NavList:oPr,NavSeparator:cct,Trigger:hPr});function Yq({children:e,className:t,isVisible:r,autoDismiss:n=!0,dismissTime:s=5e3,dismissible:a=!0,type:i="info"}){const[l,c]=b.useState(r),[u,d]=b.useState(!1);b.useEffect(()=>{if(a&&n&&r){const m=setTimeout(()=>{f()},s);return()=>clearTimeout(m)}},[n,r,s,a]),b.useEffect(()=>{r&&(d(!1),c(!0))},[r]);const f=()=>{d(!0),setTimeout(()=>{c(!1),d(!1)},200)};if(!l)return null;const h={info:"bg-surface4 border-border1",error:"bg-accent2Darker border-accent2/30",success:"bg-accent1Darker border-accent1/30",warning:"bg-accent6Darker border-accent6/30"},p={info:"text-accent5",error:"text-accent2",success:"text-accent1",warning:"text-accent6"};return o.jsxs("div",{className:Z("grid grid-cols-[auto_1fr_auto] gap-3 rounded-lg border p-4 text-ui-md text-neutral4 items-start","shadow-card",nn.all,u?"animate-out fade-out-0 slide-out-to-right-2 duration-200":"animate-in fade-in-0 slide-in-from-right-2 duration-300",h[i],t),children:[o.jsx("div",{className:Z("shrink-0 mt-0.5",p[i]),children:i==="error"||i==="warning"?o.jsx(KI,{className:"h-4 w-4"}):o.jsx(XI,{className:"h-4 w-4"})}),o.jsx("div",{className:"flex gap-2 items-start min-w-0",children:e}),a&&o.jsxs(ve,{variant:"ghost",className:Z("h-6 w-6 p-0 shrink-0",nn.colors,"hover:bg-surface5"),onClick:f,children:[o.jsx(ff,{className:"h-4 w-4"}),o.jsx(Wu,{children:"Dismiss"})]})]})}function dct({children:e,isLoading:t}){return o.jsx("p",{className:Z("text-neutral2 text-sm max-w-[35rem] flex flex-wrap gap-x-4 gap-y-1 mt-1",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":t}),children:t?o.jsx(o.Fragment,{children:" "}):o.jsx(o.Fragment,{children:e})})}function fct({children:e,isLoading:t,size:r="default"}){return o.jsx("h1",{className:Z("text-neutral5 text-xl font-normal gap-2 flex items-center","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:opacity-50",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":t,"text-md":r==="smaller"}),children:t?o.jsx(o.Fragment,{children:" "}):o.jsx(o.Fragment,{children:e})})}function pPr({children:e,className:t,title:r,description:n,icon:s,isLoading:a}){const i=e===void 0&&r!==void 0;return o.jsx("header",{className:Z("w-full grid",t),children:i?o.jsxs(o.Fragment,{children:[o.jsxs(fct,{isLoading:a,children:[s," ",r]}),n!==void 0&&o.jsx(dct,{isLoading:a,children:n})]}):e})}const Cn=Object.assign(pPr,{Title:fct,Description:dct});function mPr({children:e,className:t}){return o.jsx("header",{className:Z("grid items-center grid-cols-[1fr_auto]",t),children:e})}function gPr({headingLevel:e="h2",children:t,className:r}){const n=e;return o.jsx(n,{className:Z("flex items-center gap-2 text-ui-lg font-bold text-neutral4","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",r),children:t})}function hct({children:e,className:t}){return o.jsx("section",{className:Z("grid gap-4",t),children:e})}function a1({children:e,className:t}){return o.jsx("section",{className:Z("grid gap-2",t),children:e})}const fl=Object.assign(hct,{Header:mPr,Heading:gPr});function yPr(){return cE({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8125rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#939393",background:"transparent"},styles:[{tag:[ne.className,ne.propertyName]}]})}function vPr(){const e=pt.theme({"&":{backgroundColor:"transparent",color:"var(--neutral6)",fontSize:"0.8125rem"},"&.cm-editor .cm-scroller":{fontFamily:"var(--geist-mono)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--neutral2)",borderRight:"none"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-activeLine":{backgroundColor:"transparent"},".cm-activeLineGutter":{backgroundColor:"transparent"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--neutral6)"}}),t=Ap.define([{tag:[ne.comment,ne.bracket],color:"var(--neutral2)"},{tag:[ne.string,ne.meta,ne.regexp],color:"var(--accent1)"},{tag:[ne.atom,ne.bool,ne.special(ne.variableName)],color:"var(--accent6)"},{tag:[ne.keyword,ne.operator,ne.tagName],color:"var(--accent2)"},{tag:[ne.function(ne.propertyName),ne.propertyName],color:"var(--accent5)"},{tag:[ne.definition(ne.variableName),ne.function(ne.variableName),ne.className,ne.attributeName],color:"var(--accent3)"},{tag:[ne.variableName,ne.number],color:"var(--accent5)"},{tag:[ne.name,ne.quote],color:"var(--accent1)"}]);return[e,Fx(t)]}const bPr=()=>{const e=sP();return b.useMemo(()=>e?yPr():vPr(),[e])};function xPr({codeStr:e="",title:t,icon:r,simplified:n=!1}){const s=bPr(),[a,i]=b.useState(!1),l=b.useMemo(()=>{try{const u=JSON.parse(e);return aae(u||"")}catch{return!1}},[e]),c=a?e?.replace(/\\n/g,`
290
290
  `):e;return o.jsxs(fl,{children:[o.jsxs(fl.Header,{children:[o.jsxs(fl.Heading,{children:[r,t]}),o.jsxs(ws,{children:[o.jsx(Ya,{content:e||"No content"}),l&&o.jsx(ve,{onClick:()=>i(!a),children:a?o.jsx(fN,{}):o.jsx(g$,{})})]})]}),e&&o.jsx("div",{className:"dark:bg-black/20 bg-surface3 p-4 overflow-hidden rounded-xl border dark:border-white/10 border-border1 text-neutral4 text-ui-md break-all max-h-[30vh] overflow-y-auto",children:n?o.jsx("div",{className:"text-neutral4 font-mono break-all px-2",children:o.jsx("pre",{className:"text-wrap",children:e})}):o.jsx(bc,{extensions:[Gk(),pt.lineWrapping],theme:s,value:c})})]})}function aae(e){if(typeof e=="string"){const t=e.indexOf(`
@@ -427,7 +427,7 @@ Error message: ${ome(r)}`,cause:r}),this[MMe]=!0,this.value=t}static isInstance(
427
427
  ]))`;continue}else if(s[u]==="$"){a+=`($|(?=[\r
428
428
  ]))`;continue}}if(n.s&&s[u]==="."){a+=l?`${s[u]}\r
429
429
  `:`[${s[u]}\r
430
- ]`;continue}a+=s[u],s[u]==="\\"?i=!0:l&&s[u]==="]"?l=!1:!l&&s[u]==="["&&(l=!0)}return a}function Umt(e,t){var r,n,s,a,i,l;const c={type:"object",additionalProperties:(r=ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Pe.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...d}=Bmt(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===Pe.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Pe.ZodBranded&&e.keyType._def.type._def.typeName===Pe.ZodString&&((l=e.keyType._def.type._def.checks)!=null&&l.length)){const{type:u,...d}=Fmt(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function lZr(e,t){if(t.mapStrategy==="record")return Umt(e,t);const r=ma(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||cf(),n=ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||cf();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function cZr(e){const t=e.values,n=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function uZr(){return{not:cf()}}function dZr(){return{type:"null"}}var Iie={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fZr(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in Iie&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,a)=>{const i=Iie[a._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){const s=n.filter((a,i,l)=>l.indexOf(a)===i);return{type:s.length>1?s:s[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return hZr(e,t)}var hZr=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,s)=>ma(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function pZr(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Iie[e.innerType._def.typeName],"null"]};const r=ma(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function mZr(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function gZr(e,t){const r={type:"object",properties:{}},n=[],s=e.shape();for(const i in s){let l=s[i];if(l===void 0||l._def===void 0)continue;const c=vZr(l),u=ma(l._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(r.properties[i]=u,c||n.push(i))}n.length&&(r.required=n);const a=yZr(e,t);return a!==void 0&&(r.additionalProperties=a),r}function yZr(e,t){if(e.catchall._def.typeName!=="ZodNever")return ma(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function vZr(e){try{return e.isOptional()}catch{return!0}}var bZr=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return ma(e.innerType._def,t);const n=ma(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:cf()},n]}:cf()},xZr=(e,t)=>{if(t.pipeStrategy==="input")return ma(e.in._def,t);if(t.pipeStrategy==="output")return ma(e.out._def,t);const r=ma(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=ma(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function wZr(e,t){return ma(e.type._def,t)}function SZr(e,t){const n={type:"array",uniqueItems:!0,items:ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function OZr(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>ma(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ma(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>ma(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function kZr(){return{not:cf()}}function _Zr(){return cf()}var EZr=(e,t)=>ma(e.innerType._def,t),CZr=(e,t,r)=>{switch(t){case Pe.ZodString:return Bmt(e,r);case Pe.ZodNumber:return mZr(e);case Pe.ZodObject:return gZr(e,r);case Pe.ZodBigInt:return YGr(e);case Pe.ZodBoolean:return XGr();case Pe.ZodDate:return zmt(e,r);case Pe.ZodUndefined:return kZr();case Pe.ZodNull:return dZr();case Pe.ZodArray:return ZGr(e,r);case Pe.ZodUnion:case Pe.ZodDiscriminatedUnion:return fZr(e,r);case Pe.ZodIntersection:return sZr(e,r);case Pe.ZodTuple:return OZr(e,r);case Pe.ZodRecord:return Umt(e,r);case Pe.ZodLiteral:return aZr(e);case Pe.ZodEnum:return rZr(e);case Pe.ZodNativeEnum:return cZr(e);case Pe.ZodNullable:return pZr(e,r);case Pe.ZodOptional:return bZr(e,r);case Pe.ZodMap:return lZr(e,r);case Pe.ZodSet:return SZr(e,r);case Pe.ZodLazy:return()=>e.getter()._def;case Pe.ZodPromise:return wZr(e,r);case Pe.ZodNaN:case Pe.ZodNever:return uZr();case Pe.ZodEffects:return tZr(e,r);case Pe.ZodAny:return cf();case Pe.ZodUnknown:return _Zr();case Pe.ZodDefault:return eZr(e,r);case Pe.ZodBranded:return Fmt(e,r);case Pe.ZodReadonly:return EZr(e,r);case Pe.ZodCatch:return KGr(e,r);case Pe.ZodPipeline:return xZr(e,r);case Pe.ZodFunction:case Pe.ZodVoid:case Pe.ZodSymbol:return;default:return(n=>{})()}};function ma(e,t,r=!1){var n;const s=t.seen.get(e);if(t.override){const c=(n=t.override)==null?void 0:n.call(t,e,t,s,r);if(c!==WGr)return c}if(s&&!r){const c=jZr(s,t);if(c!==void 0)return c}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const i=CZr(e,e.typeName,t),l=typeof i=="function"?ma(i(),t):i;if(l&&TZr(e,t,l),t.postProcess){const c=t.postProcess(l,e,t);return a.jsonSchema=l,c}return a.jsonSchema=l,l}var jZr=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:QGr(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),cf()):t.$refStrategy==="seen"?cf():void 0}},TZr=(e,t,r)=>(e.description&&(r.description=e.description),r),NZr=e=>{const t=GGr(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},AZr=(e,t)=>{var r;const n=NZr(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var h;return{...u,[d]:(h=ma(f._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0))!=null?h:cf()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(r=ma(e._def,a===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,a]},!1))!=null?r:cf(),l=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;l!==void 0&&(i.title=l);const c=a===void 0?s?{...i,[n.definitionPath]:s}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,a].join("/"),[n.definitionPath]:{...s,[a]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},IZr=AZr;function RZr(e,t){var r;const n=(r=void 0)!=null?r:!1;return cme(()=>IZr(e,{$refStrategy:n?"root":"none"}),{validate:async s=>{const a=await e.safeParseAsync(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function PZr(e,t){var r;const n=(r=void 0)!=null?r:!1;return cme(()=>o$(U6(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async s=>{const a=await rce(e,s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function MZr(e){return"_zod"in e}function Up(e,t){return MZr(e)?PZr(e):RZr(e)}var Rie=Symbol.for("vercel.ai.schema");function b9(e){let t;return()=>(t==null&&(t=e()),t)}function cme(e,{validate:t}={}){return{[Rie]:!0,_type:void 0,[z4]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function DZr(e){return typeof e=="object"&&e!==null&&Rie in e&&e[Rie]===!0&&"jsonSchema"in e&&"validate"in e}function LZr(e){return e==null?cme({properties:{},additionalProperties:!1}):DZr(e)?e:typeof e=="function"?e():Up(e)}function $Zr(e){return e?.replace(/\/$/,"")}var FZr={},Vmt=v9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)r(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let y of s(p))!a.call(h,y)&&y!==m&&r(h,y,{get:()=>p[y],enumerable:!(g=n(p,y))||g.enumerable});return h},c=h=>l(r({},"__esModule",{value:!0}),h),u={};i(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>f}),t.exports=c(u);var d=Symbol.for("@vercel/request-context");function f(){return globalThis[d]?.get?.()??{}}}}),zZr=v9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(m,g)=>{for(var y in g)r(m,y,{get:g[y],enumerable:!0})},l=(m,g,y,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of s(g))!a.call(m,w)&&w!==y&&r(m,w,{get:()=>g[w],enumerable:!(x=n(g,w))||x.enumerable});return m},c=m=>l(r({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>h,getVercelOidcTokenSync:()=>p}),t.exports=c(u);var d=Vmt(),f=gGr();async function h(){let m="",g;try{m=p()}catch(y){g=y}try{const[{getTokenPayload:y,isExpired:x},{refreshToken:w}]=await Promise.all([await Je(()=>import("./token-util-RMHT2CPJ-VVUHOXBL-DFna4FDk.js"),__vite__mapDeps([24,25,1]),import.meta.url),await Je(()=>import("./token-APYSY3BW-RPVF55TR-P4FYXpNU.js"),__vite__mapDeps([26,25,1]),import.meta.url)]);(!m||x(y(m)))&&(await w(),m=p())}catch(y){let x=g instanceof Error?g.message:"";throw y instanceof Error&&(x=`${x}
430
+ ]`;continue}a+=s[u],s[u]==="\\"?i=!0:l&&s[u]==="]"?l=!1:!l&&s[u]==="["&&(l=!0)}return a}function Umt(e,t){var r,n,s,a,i,l;const c={type:"object",additionalProperties:(r=ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Pe.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...d}=Bmt(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===Pe.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Pe.ZodBranded&&e.keyType._def.type._def.typeName===Pe.ZodString&&((l=e.keyType._def.type._def.checks)!=null&&l.length)){const{type:u,...d}=Fmt(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function lZr(e,t){if(t.mapStrategy==="record")return Umt(e,t);const r=ma(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||cf(),n=ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||cf();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function cZr(e){const t=e.values,n=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function uZr(){return{not:cf()}}function dZr(){return{type:"null"}}var Iie={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fZr(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in Iie&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,a)=>{const i=Iie[a._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){const s=n.filter((a,i,l)=>l.indexOf(a)===i);return{type:s.length>1?s:s[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return hZr(e,t)}var hZr=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,s)=>ma(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function pZr(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Iie[e.innerType._def.typeName],"null"]};const r=ma(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function mZr(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function gZr(e,t){const r={type:"object",properties:{}},n=[],s=e.shape();for(const i in s){let l=s[i];if(l===void 0||l._def===void 0)continue;const c=vZr(l),u=ma(l._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(r.properties[i]=u,c||n.push(i))}n.length&&(r.required=n);const a=yZr(e,t);return a!==void 0&&(r.additionalProperties=a),r}function yZr(e,t){if(e.catchall._def.typeName!=="ZodNever")return ma(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function vZr(e){try{return e.isOptional()}catch{return!0}}var bZr=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return ma(e.innerType._def,t);const n=ma(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:cf()},n]}:cf()},xZr=(e,t)=>{if(t.pipeStrategy==="input")return ma(e.in._def,t);if(t.pipeStrategy==="output")return ma(e.out._def,t);const r=ma(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=ma(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function wZr(e,t){return ma(e.type._def,t)}function SZr(e,t){const n={type:"array",uniqueItems:!0,items:ma(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function OZr(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>ma(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ma(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>ma(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function kZr(){return{not:cf()}}function _Zr(){return cf()}var EZr=(e,t)=>ma(e.innerType._def,t),CZr=(e,t,r)=>{switch(t){case Pe.ZodString:return Bmt(e,r);case Pe.ZodNumber:return mZr(e);case Pe.ZodObject:return gZr(e,r);case Pe.ZodBigInt:return YGr(e);case Pe.ZodBoolean:return XGr();case Pe.ZodDate:return zmt(e,r);case Pe.ZodUndefined:return kZr();case Pe.ZodNull:return dZr();case Pe.ZodArray:return ZGr(e,r);case Pe.ZodUnion:case Pe.ZodDiscriminatedUnion:return fZr(e,r);case Pe.ZodIntersection:return sZr(e,r);case Pe.ZodTuple:return OZr(e,r);case Pe.ZodRecord:return Umt(e,r);case Pe.ZodLiteral:return aZr(e);case Pe.ZodEnum:return rZr(e);case Pe.ZodNativeEnum:return cZr(e);case Pe.ZodNullable:return pZr(e,r);case Pe.ZodOptional:return bZr(e,r);case Pe.ZodMap:return lZr(e,r);case Pe.ZodSet:return SZr(e,r);case Pe.ZodLazy:return()=>e.getter()._def;case Pe.ZodPromise:return wZr(e,r);case Pe.ZodNaN:case Pe.ZodNever:return uZr();case Pe.ZodEffects:return tZr(e,r);case Pe.ZodAny:return cf();case Pe.ZodUnknown:return _Zr();case Pe.ZodDefault:return eZr(e,r);case Pe.ZodBranded:return Fmt(e,r);case Pe.ZodReadonly:return EZr(e,r);case Pe.ZodCatch:return KGr(e,r);case Pe.ZodPipeline:return xZr(e,r);case Pe.ZodFunction:case Pe.ZodVoid:case Pe.ZodSymbol:return;default:return(n=>{})()}};function ma(e,t,r=!1){var n;const s=t.seen.get(e);if(t.override){const c=(n=t.override)==null?void 0:n.call(t,e,t,s,r);if(c!==WGr)return c}if(s&&!r){const c=jZr(s,t);if(c!==void 0)return c}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const i=CZr(e,e.typeName,t),l=typeof i=="function"?ma(i(),t):i;if(l&&TZr(e,t,l),t.postProcess){const c=t.postProcess(l,e,t);return a.jsonSchema=l,c}return a.jsonSchema=l,l}var jZr=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:QGr(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),cf()):t.$refStrategy==="seen"?cf():void 0}},TZr=(e,t,r)=>(e.description&&(r.description=e.description),r),NZr=e=>{const t=GGr(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},AZr=(e,t)=>{var r;const n=NZr(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var h;return{...u,[d]:(h=ma(f._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0))!=null?h:cf()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(r=ma(e._def,a===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,a]},!1))!=null?r:cf(),l=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;l!==void 0&&(i.title=l);const c=a===void 0?s?{...i,[n.definitionPath]:s}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,a].join("/"),[n.definitionPath]:{...s,[a]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},IZr=AZr;function RZr(e,t){var r;const n=(r=void 0)!=null?r:!1;return cme(()=>IZr(e,{$refStrategy:n?"root":"none"}),{validate:async s=>{const a=await e.safeParseAsync(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function PZr(e,t){var r;const n=(r=void 0)!=null?r:!1;return cme(()=>o$(U6(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async s=>{const a=await rce(e,s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function MZr(e){return"_zod"in e}function Up(e,t){return MZr(e)?PZr(e):RZr(e)}var Rie=Symbol.for("vercel.ai.schema");function b9(e){let t;return()=>(t==null&&(t=e()),t)}function cme(e,{validate:t}={}){return{[Rie]:!0,_type:void 0,[z4]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function DZr(e){return typeof e=="object"&&e!==null&&Rie in e&&e[Rie]===!0&&"jsonSchema"in e&&"validate"in e}function LZr(e){return e==null?cme({properties:{},additionalProperties:!1}):DZr(e)?e:typeof e=="function"?e():Up(e)}function $Zr(e){return e?.replace(/\/$/,"")}var FZr={},Vmt=v9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)r(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let y of s(p))!a.call(h,y)&&y!==m&&r(h,y,{get:()=>p[y],enumerable:!(g=n(p,y))||g.enumerable});return h},c=h=>l(r({},"__esModule",{value:!0}),h),u={};i(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>f}),t.exports=c(u);var d=Symbol.for("@vercel/request-context");function f(){return globalThis[d]?.get?.()??{}}}}),zZr=v9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(m,g)=>{for(var y in g)r(m,y,{get:g[y],enumerable:!0})},l=(m,g,y,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of s(g))!a.call(m,w)&&w!==y&&r(m,w,{get:()=>g[w],enumerable:!(x=n(g,w))||x.enumerable});return m},c=m=>l(r({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>h,getVercelOidcTokenSync:()=>p}),t.exports=c(u);var d=Vmt(),f=gGr();async function h(){let m="",g;try{m=p()}catch(y){g=y}try{const[{getTokenPayload:y,isExpired:x},{refreshToken:w}]=await Promise.all([await Je(()=>import("./token-util-RMHT2CPJ-VVUHOXBL-HeVRkPvw.js"),__vite__mapDeps([24,25,1]),import.meta.url),await Je(()=>import("./token-APYSY3BW-RPVF55TR-BZ-AyJYU.js"),__vite__mapDeps([26,25,1]),import.meta.url)]);(!m||x(y(m)))&&(await w(),m=p())}catch(y){let x=g instanceof Error?g.message:"";throw y instanceof Error&&(x=`${x}
431
431
  ${y.message}`),x?new f.VercelOidcTokenError(x):y}return m}function p(){const m=(0,d.getContext)().headers?.["x-vercel-oidc-token"]??FZr.VERCEL_OIDC_TOKEN;if(!m)throw new Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return m}}}),qmt=v9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/index.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)r(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let y of s(p))!a.call(h,y)&&y!==m&&r(h,y,{get:()=>p[y],enumerable:!(g=n(p,y))||g.enumerable});return h},c=h=>l(r({},"__esModule",{value:!0}),h),u={};i(u,{getContext:()=>f.getContext,getVercelOidcToken:()=>d.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync}),t.exports=c(u);var d=zZr(),f=Vmt()}}),BZr=wmt(qmt()),UZr=wmt(qmt()),VZr="vercel.ai.gateway.error",UQ=Symbol.for(VZr),UMe,VMe,nu=class Hmt extends(VMe=Error,UMe=UQ,VMe){constructor({message:t,statusCode:r=500,cause:n}){super(t),this[UMe]=!0,this.statusCode=r,this.cause=n}static isInstance(t){return Hmt.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&UQ in t&&t[UQ]===!0}},Qmt="GatewayAuthenticationError",qZr=`vercel.ai.gateway.error.${Qmt}`,qMe=Symbol.for(qZr),HMe,QMe,Wmt=class Gmt extends(QMe=nu,HMe=qMe,QMe){constructor({message:t="Authentication failed",statusCode:r=401,cause:n}={}){super({message:t,statusCode:r,cause:n}),this[HMe]=!0,this.name=Qmt,this.type="authentication_error"}static isInstance(t){return nu.hasMarker(t)&&qMe in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:n="Authentication failed",statusCode:s=401,cause:a}){let i;return t?i=`AI Gateway authentication failed: Invalid API key.
432
432
 
433
433
  Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
@@ -455,7 +455,7 @@ Error message: ${Agt(r)}`,cause:r}),this[RDe]=!0,this.value=t,this.context=n}sta
455
455
  ]))`;continue}else if(s[u]==="$"){a+=`($|(?=[\r
456
456
  ]))`;continue}}if(n.s&&s[u]==="."){a+=l?`${s[u]}\r
457
457
  `:`[${s[u]}\r
458
- ]`;continue}a+=s[u],s[u]==="\\"?i=!0:l&&s[u]==="]"?l=!1:!l&&s[u]==="["&&(l=!0)}return a}function Qgt(e,t){var r,n,s,a,i,l;const c={type:"object",additionalProperties:(r=ga(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Pe.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...d}=Hgt(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===Pe.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Pe.ZodBranded&&e.keyType._def.type._def.typeName===Pe.ZodString&&((l=e.keyType._def.type._def.checks)!=null&&l.length)){const{type:u,...d}=Vgt(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function yKr(e,t){if(t.mapStrategy==="record")return Qgt(e,t);const r=ga(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||uf(),n=ga(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||uf();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function vKr(e){const t=e.values,n=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function bKr(){return{not:uf()}}function xKr(){return{type:"null"}}var Die={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function wKr(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in Die&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,a)=>{const i=Die[a._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){const s=n.filter((a,i,l)=>l.indexOf(a)===i);return{type:s.length>1?s:s[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return SKr(e,t)}var SKr=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,s)=>ga(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function OKr(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Die[e.innerType._def.typeName],"null"]};const r=ga(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function kKr(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function _Kr(e,t){const r={type:"object",properties:{}},n=[],s=e.shape();for(const i in s){let l=s[i];if(l===void 0||l._def===void 0)continue;const c=CKr(l),u=ga(l._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(r.properties[i]=u,c||n.push(i))}n.length&&(r.required=n);const a=EKr(e,t);return a!==void 0&&(r.additionalProperties=a),r}function EKr(e,t){if(e.catchall._def.typeName!=="ZodNever")return ga(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function CKr(e){try{return e.isOptional()}catch{return!0}}var jKr=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return ga(e.innerType._def,t);const n=ga(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:uf()},n]}:uf()},TKr=(e,t)=>{if(t.pipeStrategy==="input")return ga(e.in._def,t);if(t.pipeStrategy==="output")return ga(e.out._def,t);const r=ga(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=ga(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function NKr(e,t){return ga(e.type._def,t)}function AKr(e,t){const n={type:"array",uniqueItems:!0,items:ga(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function IKr(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>ga(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ga(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>ga(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function RKr(){return{not:uf()}}function PKr(){return uf()}var MKr=(e,t)=>ga(e.innerType._def,t),DKr=(e,t,r)=>{switch(t){case Pe.ZodString:return Hgt(e,r);case Pe.ZodNumber:return kKr(e);case Pe.ZodObject:return _Kr(e,r);case Pe.ZodBigInt:return aKr(e);case Pe.ZodBoolean:return iKr();case Pe.ZodDate:return qgt(e,r);case Pe.ZodUndefined:return RKr();case Pe.ZodNull:return xKr();case Pe.ZodArray:return sKr(e,r);case Pe.ZodUnion:case Pe.ZodDiscriminatedUnion:return wKr(e,r);case Pe.ZodIntersection:return hKr(e,r);case Pe.ZodTuple:return IKr(e,r);case Pe.ZodRecord:return Qgt(e,r);case Pe.ZodLiteral:return pKr(e);case Pe.ZodEnum:return dKr(e);case Pe.ZodNativeEnum:return vKr(e);case Pe.ZodNullable:return OKr(e,r);case Pe.ZodOptional:return jKr(e,r);case Pe.ZodMap:return yKr(e,r);case Pe.ZodSet:return AKr(e,r);case Pe.ZodLazy:return()=>e.getter()._def;case Pe.ZodPromise:return NKr(e,r);case Pe.ZodNaN:case Pe.ZodNever:return bKr();case Pe.ZodEffects:return uKr(e,r);case Pe.ZodAny:return uf();case Pe.ZodUnknown:return PKr();case Pe.ZodDefault:return cKr(e,r);case Pe.ZodBranded:return Vgt(e,r);case Pe.ZodReadonly:return MKr(e,r);case Pe.ZodCatch:return oKr(e,r);case Pe.ZodPipeline:return TKr(e,r);case Pe.ZodFunction:case Pe.ZodVoid:case Pe.ZodSymbol:return;default:return(n=>{})()}},LKr=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function ga(e,t,r=!1){var n;const s=t.seen.get(e);if(t.override){const c=(n=t.override)==null?void 0:n.call(t,e,t,s,r);if(c!==rKr)return c}if(s&&!r){const c=$Kr(s,t);if(c!==void 0)return c}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const i=DKr(e,e.typeName,t),l=typeof i=="function"?ga(i(),t):i;if(l&&FKr(e,t,l),t.postProcess){const c=t.postProcess(l,e,t);return a.jsonSchema=l,c}return a.jsonSchema=l,l}var $Kr=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:LKr(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),uf()):t.$refStrategy==="seen"?uf():void 0}},FKr=(e,t,r)=>(e.description&&(r.description=e.description),r),zKr=e=>{const t=nKr(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},BKr=(e,t)=>{var r;const n=zKr(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var h;return{...u,[d]:(h=ga(f._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0))!=null?h:uf()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(r=ga(e._def,a===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,a]},!1))!=null?r:uf(),l=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;l!==void 0&&(i.title=l);const c=a===void 0?s?{...i,[n.definitionPath]:s}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,a].join("/"),[n.definitionPath]:{...s,[a]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},Lie=Symbol.for("vercel.ai.schema");function Eg(e){let t;return()=>(t==null&&(t=e()),t)}function w9(e,{validate:t}={}){return{[Lie]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function UKr(e){return typeof e=="object"&&e!==null&&Lie in e&&e[Lie]===!0&&"jsonSchema"in e&&"validate"in e}function vme(e){return e==null?w9({properties:{},additionalProperties:!1}):UKr(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Vp(e):VKr(e):e()}function VKr(e){return w9(()=>yme(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const r=await e["~standard"].validate(t);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new AS({value:t,cause:r.issues})}}})}function qKr(e,t){var r;const n=(r=void 0)!=null?r:!1;return w9(()=>BKr(e,{$refStrategy:n?"root":"none"}),{validate:async s=>{const a=await e.safeParseAsync(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function HKr(e,t){var r;const n=(r=void 0)!=null?r:!1;return w9(()=>yme(U6(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async s=>{const a=await rce(e,s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function QKr(e){return"_zod"in e}function Vp(e,t){return QKr(e)?HKr(e):qKr(e)}async function WKr({value:e,schema:t,context:r}){const n=await Px({value:e,schema:t,context:r});if(!n.success)throw AS.wrap({value:e,cause:n.error,context:r});return n.value}async function Px({value:e,schema:t,context:r}){const n=vme(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};const s=await n.validate(e);return s.success?{success:!0,value:s.value,rawValue:e}:{success:!1,error:AS.wrap({value:e,cause:s.error,context:r}),rawValue:e}}catch(s){return{success:!1,error:AS.wrap({value:e,cause:s,context:r}),rawValue:e}}}async function GKr({text:e,schema:t}){try{const r=Ugt(e);return t==null?r:WKr({value:r,schema:t})}catch(r){throw V4.isInstance(r)||AS.isInstance(r)?r:new V4({text:e,cause:r})}}async function Mx({text:e,schema:t}){try{const r=Ugt(e);return t==null?{success:!0,value:r,rawValue:r}:await Px({value:r,schema:t})}catch(r){return{success:!1,error:V4.isInstance(r)?r:new V4({text:e,cause:r}),rawValue:void 0}}}function Wgt({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new QXr).pipeThrough(new TransformStream({async transform({data:r},n){r!=="[DONE]"&&n.enqueue(await Mx({text:r,schema:t}))}}))}var ZKr=()=>globalThis.fetch,NI=async({url:e,headers:t,body:r,failedResponseHandler:n,successfulResponseHandler:s,abortSignal:a,fetch:i})=>YKr({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:n,successfulResponseHandler:s,abortSignal:a,fetch:i}),YKr=async({url:e,headers:t={},body:r,successfulResponseHandler:n,failedResponseHandler:s,abortSignal:a,fetch:i=ZKr()})=>{try{const l=await i(e,{method:"POST",headers:gme(t,`ai-sdk/provider-utils/${Bgt}`,zgt()),body:r.content,signal:a}),c=IP(l);if(!l.ok){let u;try{u=await s({response:l,url:e,requestBodyValues:r.values})}catch(d){throw TI(d)||Ko.isInstance(d)?d:new Ko({message:"Failed to process error response",cause:d,statusCode:l.status,url:e,responseHeaders:c,requestBodyValues:r.values})}throw u.value}try{return await n({response:l,url:e,requestBodyValues:r.values})}catch(u){throw u instanceof Error&&(TI(u)||Ko.isInstance(u))?u:new Ko({message:"Failed to process successful response",cause:u,statusCode:l.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(l){throw Fgt({error:l,url:e,requestBodyValues:r.values})}};function Ggt({id:e,inputSchema:t,outputSchema:r,supportsDeferredResults:n}){return({execute:s,needsApproval:a,toModelOutput:i,onInputStart:l,onInputDelta:c,onInputAvailable:u,...d})=>({type:"provider",id:e,args:d,inputSchema:t,outputSchema:r,execute:s,needsApproval:a,toModelOutput:i,onInputStart:l,onInputDelta:c,onInputAvailable:u,supportsDeferredResults:n})}async function Bu(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var IS=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:n,url:s,requestBodyValues:a})=>{const i=await n.text(),l=IP(n);if(i.trim()==="")return{responseHeaders:l,value:new Ko({message:n.statusText,url:s,requestBodyValues:a,statusCode:n.status,responseHeaders:l,responseBody:i,isRetryable:r?.(n)})};try{const c=await GKr({text:i,schema:e});return{responseHeaders:l,value:new Ko({message:t(c),url:s,requestBodyValues:a,statusCode:n.status,responseHeaders:l,responseBody:i,data:c,isRetryable:r?.(n,c)})}}catch{return{responseHeaders:l,value:new Ko({message:n.statusText,url:s,requestBodyValues:a,statusCode:n.status,responseHeaders:l,responseBody:i,isRetryable:r?.(n)})}}},XKr=e=>async({response:t})=>{const r=IP(t);if(t.body==null)throw new FXr({});return{responseHeaders:r,value:Wgt({stream:t.body,schema:e})}},AI=e=>async({response:t,url:r,requestBodyValues:n})=>{const s=await t.text(),a=await Mx({text:s,schema:e}),i=IP(t);if(!a.success)throw new Ko({message:"Invalid JSON response",cause:a.error,statusCode:t.status,responseHeaders:i,responseBody:s,url:r,requestBodyValues:n});return{responseHeaders:i,value:a.value,rawValue:a.rawValue}};function KKr(e){return e?.replace(/\/$/,"")}var Zgt=x9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)r(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let y of s(p))!a.call(h,y)&&y!==m&&r(h,y,{get:()=>p[y],enumerable:!(g=n(p,y))||g.enumerable});return h},c=h=>l(r({},"__esModule",{value:!0}),h),u={};i(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>f}),t.exports=c(u);var d=Symbol.for("@vercel/request-context");function f(){return globalThis[d]?.get?.()??{}}}}),JKr=x9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(m,g)=>{for(var y in g)r(m,y,{get:g[y],enumerable:!0})},l=(m,g,y,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of s(g))!a.call(m,w)&&w!==y&&r(m,w,{get:()=>g[w],enumerable:!(x=n(g,w))||x.enumerable});return m},c=m=>l(r({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>h,getVercelOidcTokenSync:()=>p}),t.exports=c(u);var d=Zgt(),f=PXr();async function h(){let m="",g;try{m=p()}catch(y){g=y}try{const[{getTokenPayload:y,isExpired:x},{refreshToken:w}]=await Promise.all([await Je(()=>import("./token-util-RMHT2CPJ-CEAUOCJP-C7XmH4Cj.js"),__vite__mapDeps([27,28,1]),import.meta.url),await Je(()=>import("./token-APYSY3BW-ZWRZO2RI-BVP_WEmK.js"),__vite__mapDeps([29,28,1]),import.meta.url)]);(!m||x(y(m)))&&(await w(),m=p())}catch(y){let x=g instanceof Error?g.message:"";throw y instanceof Error&&(x=`${x}
458
+ ]`;continue}a+=s[u],s[u]==="\\"?i=!0:l&&s[u]==="]"?l=!1:!l&&s[u]==="["&&(l=!0)}return a}function Qgt(e,t){var r,n,s,a,i,l;const c={type:"object",additionalProperties:(r=ga(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Pe.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...d}=Hgt(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===Pe.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Pe.ZodBranded&&e.keyType._def.type._def.typeName===Pe.ZodString&&((l=e.keyType._def.type._def.checks)!=null&&l.length)){const{type:u,...d}=Vgt(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function yKr(e,t){if(t.mapStrategy==="record")return Qgt(e,t);const r=ga(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||uf(),n=ga(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||uf();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function vKr(e){const t=e.values,n=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function bKr(){return{not:uf()}}function xKr(){return{type:"null"}}var Die={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function wKr(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in Die&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,a)=>{const i=Die[a._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){const s=n.filter((a,i,l)=>l.indexOf(a)===i);return{type:s.length>1?s:s[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return SKr(e,t)}var SKr=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,s)=>ga(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function OKr(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Die[e.innerType._def.typeName],"null"]};const r=ga(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function kKr(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function _Kr(e,t){const r={type:"object",properties:{}},n=[],s=e.shape();for(const i in s){let l=s[i];if(l===void 0||l._def===void 0)continue;const c=CKr(l),u=ga(l._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(r.properties[i]=u,c||n.push(i))}n.length&&(r.required=n);const a=EKr(e,t);return a!==void 0&&(r.additionalProperties=a),r}function EKr(e,t){if(e.catchall._def.typeName!=="ZodNever")return ga(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function CKr(e){try{return e.isOptional()}catch{return!0}}var jKr=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return ga(e.innerType._def,t);const n=ga(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:uf()},n]}:uf()},TKr=(e,t)=>{if(t.pipeStrategy==="input")return ga(e.in._def,t);if(t.pipeStrategy==="output")return ga(e.out._def,t);const r=ga(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=ga(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function NKr(e,t){return ga(e.type._def,t)}function AKr(e,t){const n={type:"array",uniqueItems:!0,items:ga(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function IKr(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>ga(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ga(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>ga(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function RKr(){return{not:uf()}}function PKr(){return uf()}var MKr=(e,t)=>ga(e.innerType._def,t),DKr=(e,t,r)=>{switch(t){case Pe.ZodString:return Hgt(e,r);case Pe.ZodNumber:return kKr(e);case Pe.ZodObject:return _Kr(e,r);case Pe.ZodBigInt:return aKr(e);case Pe.ZodBoolean:return iKr();case Pe.ZodDate:return qgt(e,r);case Pe.ZodUndefined:return RKr();case Pe.ZodNull:return xKr();case Pe.ZodArray:return sKr(e,r);case Pe.ZodUnion:case Pe.ZodDiscriminatedUnion:return wKr(e,r);case Pe.ZodIntersection:return hKr(e,r);case Pe.ZodTuple:return IKr(e,r);case Pe.ZodRecord:return Qgt(e,r);case Pe.ZodLiteral:return pKr(e);case Pe.ZodEnum:return dKr(e);case Pe.ZodNativeEnum:return vKr(e);case Pe.ZodNullable:return OKr(e,r);case Pe.ZodOptional:return jKr(e,r);case Pe.ZodMap:return yKr(e,r);case Pe.ZodSet:return AKr(e,r);case Pe.ZodLazy:return()=>e.getter()._def;case Pe.ZodPromise:return NKr(e,r);case Pe.ZodNaN:case Pe.ZodNever:return bKr();case Pe.ZodEffects:return uKr(e,r);case Pe.ZodAny:return uf();case Pe.ZodUnknown:return PKr();case Pe.ZodDefault:return cKr(e,r);case Pe.ZodBranded:return Vgt(e,r);case Pe.ZodReadonly:return MKr(e,r);case Pe.ZodCatch:return oKr(e,r);case Pe.ZodPipeline:return TKr(e,r);case Pe.ZodFunction:case Pe.ZodVoid:case Pe.ZodSymbol:return;default:return(n=>{})()}},LKr=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function ga(e,t,r=!1){var n;const s=t.seen.get(e);if(t.override){const c=(n=t.override)==null?void 0:n.call(t,e,t,s,r);if(c!==rKr)return c}if(s&&!r){const c=$Kr(s,t);if(c!==void 0)return c}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const i=DKr(e,e.typeName,t),l=typeof i=="function"?ga(i(),t):i;if(l&&FKr(e,t,l),t.postProcess){const c=t.postProcess(l,e,t);return a.jsonSchema=l,c}return a.jsonSchema=l,l}var $Kr=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:LKr(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),uf()):t.$refStrategy==="seen"?uf():void 0}},FKr=(e,t,r)=>(e.description&&(r.description=e.description),r),zKr=e=>{const t=nKr(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},BKr=(e,t)=>{var r;const n=zKr(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var h;return{...u,[d]:(h=ga(f._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0))!=null?h:uf()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(r=ga(e._def,a===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,a]},!1))!=null?r:uf(),l=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;l!==void 0&&(i.title=l);const c=a===void 0?s?{...i,[n.definitionPath]:s}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,a].join("/"),[n.definitionPath]:{...s,[a]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},Lie=Symbol.for("vercel.ai.schema");function Eg(e){let t;return()=>(t==null&&(t=e()),t)}function w9(e,{validate:t}={}){return{[Lie]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function UKr(e){return typeof e=="object"&&e!==null&&Lie in e&&e[Lie]===!0&&"jsonSchema"in e&&"validate"in e}function vme(e){return e==null?w9({properties:{},additionalProperties:!1}):UKr(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Vp(e):VKr(e):e()}function VKr(e){return w9(()=>yme(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const r=await e["~standard"].validate(t);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new AS({value:t,cause:r.issues})}}})}function qKr(e,t){var r;const n=(r=void 0)!=null?r:!1;return w9(()=>BKr(e,{$refStrategy:n?"root":"none"}),{validate:async s=>{const a=await e.safeParseAsync(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function HKr(e,t){var r;const n=(r=void 0)!=null?r:!1;return w9(()=>yme(U6(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async s=>{const a=await rce(e,s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function QKr(e){return"_zod"in e}function Vp(e,t){return QKr(e)?HKr(e):qKr(e)}async function WKr({value:e,schema:t,context:r}){const n=await Px({value:e,schema:t,context:r});if(!n.success)throw AS.wrap({value:e,cause:n.error,context:r});return n.value}async function Px({value:e,schema:t,context:r}){const n=vme(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};const s=await n.validate(e);return s.success?{success:!0,value:s.value,rawValue:e}:{success:!1,error:AS.wrap({value:e,cause:s.error,context:r}),rawValue:e}}catch(s){return{success:!1,error:AS.wrap({value:e,cause:s,context:r}),rawValue:e}}}async function GKr({text:e,schema:t}){try{const r=Ugt(e);return t==null?r:WKr({value:r,schema:t})}catch(r){throw V4.isInstance(r)||AS.isInstance(r)?r:new V4({text:e,cause:r})}}async function Mx({text:e,schema:t}){try{const r=Ugt(e);return t==null?{success:!0,value:r,rawValue:r}:await Px({value:r,schema:t})}catch(r){return{success:!1,error:V4.isInstance(r)?r:new V4({text:e,cause:r}),rawValue:void 0}}}function Wgt({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new QXr).pipeThrough(new TransformStream({async transform({data:r},n){r!=="[DONE]"&&n.enqueue(await Mx({text:r,schema:t}))}}))}var ZKr=()=>globalThis.fetch,NI=async({url:e,headers:t,body:r,failedResponseHandler:n,successfulResponseHandler:s,abortSignal:a,fetch:i})=>YKr({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:n,successfulResponseHandler:s,abortSignal:a,fetch:i}),YKr=async({url:e,headers:t={},body:r,successfulResponseHandler:n,failedResponseHandler:s,abortSignal:a,fetch:i=ZKr()})=>{try{const l=await i(e,{method:"POST",headers:gme(t,`ai-sdk/provider-utils/${Bgt}`,zgt()),body:r.content,signal:a}),c=IP(l);if(!l.ok){let u;try{u=await s({response:l,url:e,requestBodyValues:r.values})}catch(d){throw TI(d)||Ko.isInstance(d)?d:new Ko({message:"Failed to process error response",cause:d,statusCode:l.status,url:e,responseHeaders:c,requestBodyValues:r.values})}throw u.value}try{return await n({response:l,url:e,requestBodyValues:r.values})}catch(u){throw u instanceof Error&&(TI(u)||Ko.isInstance(u))?u:new Ko({message:"Failed to process successful response",cause:u,statusCode:l.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(l){throw Fgt({error:l,url:e,requestBodyValues:r.values})}};function Ggt({id:e,inputSchema:t,outputSchema:r,supportsDeferredResults:n}){return({execute:s,needsApproval:a,toModelOutput:i,onInputStart:l,onInputDelta:c,onInputAvailable:u,...d})=>({type:"provider",id:e,args:d,inputSchema:t,outputSchema:r,execute:s,needsApproval:a,toModelOutput:i,onInputStart:l,onInputDelta:c,onInputAvailable:u,supportsDeferredResults:n})}async function Bu(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var IS=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:n,url:s,requestBodyValues:a})=>{const i=await n.text(),l=IP(n);if(i.trim()==="")return{responseHeaders:l,value:new Ko({message:n.statusText,url:s,requestBodyValues:a,statusCode:n.status,responseHeaders:l,responseBody:i,isRetryable:r?.(n)})};try{const c=await GKr({text:i,schema:e});return{responseHeaders:l,value:new Ko({message:t(c),url:s,requestBodyValues:a,statusCode:n.status,responseHeaders:l,responseBody:i,data:c,isRetryable:r?.(n,c)})}}catch{return{responseHeaders:l,value:new Ko({message:n.statusText,url:s,requestBodyValues:a,statusCode:n.status,responseHeaders:l,responseBody:i,isRetryable:r?.(n)})}}},XKr=e=>async({response:t})=>{const r=IP(t);if(t.body==null)throw new FXr({});return{responseHeaders:r,value:Wgt({stream:t.body,schema:e})}},AI=e=>async({response:t,url:r,requestBodyValues:n})=>{const s=await t.text(),a=await Mx({text:s,schema:e}),i=IP(t);if(!a.success)throw new Ko({message:"Invalid JSON response",cause:a.error,statusCode:t.status,responseHeaders:i,responseBody:s,url:r,requestBodyValues:n});return{responseHeaders:i,value:a.value,rawValue:a.rawValue}};function KKr(e){return e?.replace(/\/$/,"")}var Zgt=x9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)r(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let y of s(p))!a.call(h,y)&&y!==m&&r(h,y,{get:()=>p[y],enumerable:!(g=n(p,y))||g.enumerable});return h},c=h=>l(r({},"__esModule",{value:!0}),h),u={};i(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>f}),t.exports=c(u);var d=Symbol.for("@vercel/request-context");function f(){return globalThis[d]?.get?.()??{}}}}),JKr=x9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(m,g)=>{for(var y in g)r(m,y,{get:g[y],enumerable:!0})},l=(m,g,y,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of s(g))!a.call(m,w)&&w!==y&&r(m,w,{get:()=>g[w],enumerable:!(x=n(g,w))||x.enumerable});return m},c=m=>l(r({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>h,getVercelOidcTokenSync:()=>p}),t.exports=c(u);var d=Zgt(),f=PXr();async function h(){let m="",g;try{m=p()}catch(y){g=y}try{const[{getTokenPayload:y,isExpired:x},{refreshToken:w}]=await Promise.all([await Je(()=>import("./token-util-RMHT2CPJ-CEAUOCJP-b-YZjZXy.js"),__vite__mapDeps([27,28,1]),import.meta.url),await Je(()=>import("./token-APYSY3BW-ZWRZO2RI-Mk32lfnc.js"),__vite__mapDeps([29,28,1]),import.meta.url)]);(!m||x(y(m)))&&(await w(),m=p())}catch(y){let x=g instanceof Error?g.message:"";throw y instanceof Error&&(x=`${x}
459
459
  ${y.message}`),x?new f.VercelOidcTokenError(x):y}return m}function p(){const m=(0,d.getContext)().headers?.["x-vercel-oidc-token"]??kgt.VERCEL_OIDC_TOKEN;if(!m)throw new Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return m}}}),Ygt=x9({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/index.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)r(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let y of s(p))!a.call(h,y)&&y!==m&&r(h,y,{get:()=>p[y],enumerable:!(g=n(p,y))||g.enumerable});return h},c=h=>l(r({},"__esModule",{value:!0}),h),u={};i(u,{getContext:()=>f.getContext,getVercelOidcToken:()=>d.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync}),t.exports=c(u);var d=JKr(),f=Zgt()}}),eJr=Ogt(Ygt()),tJr=Ogt(Ygt()),rJr="vercel.ai.gateway.error",KQ=Symbol.for(rJr),zDe,BDe,su=class Xgt extends(BDe=Error,zDe=KQ,BDe){constructor({message:t,statusCode:r=500,cause:n,generationId:s}){super(s?`${t} [${s}]`:t),this[zDe]=!0,this.statusCode=r,this.cause=n,this.generationId=s}static isInstance(t){return Xgt.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&KQ in t&&t[KQ]===!0}},Kgt="GatewayAuthenticationError",nJr=`vercel.ai.gateway.error.${Kgt}`,UDe=Symbol.for(nJr),VDe,qDe,Jgt=class eyt extends(qDe=su,VDe=UDe,qDe){constructor({message:t="Authentication failed",statusCode:r=401,cause:n,generationId:s}={}){super({message:t,statusCode:r,cause:n,generationId:s}),this[VDe]=!0,this.name=Kgt,this.type="authentication_error"}static isInstance(t){return su.hasMarker(t)&&UDe in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:n="Authentication failed",statusCode:s=401,cause:a,generationId:i}){let l;return t?l=`AI Gateway authentication failed: Invalid API key.
460
460
 
461
461
  Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
@@ -546,7 +546,7 @@ Token usage: ${r} input + ${n} output = ${s} total`:`The model stopped generatin
546
546
  "groundTruth": "Expected result (optional)",
547
547
  "metadata": { "key": "value" } // optional
548
548
  }
549
- ]`})]})]})}function G_n({errors:e,maxErrors:t=5}){if(e.length===0)return null;const r=e.slice(0,t),n=e.length-t;return o.jsxs("div",{className:"bg-accent2/10 border border-accent2/30 rounded-md p-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-accent2 mb-2",children:[o.jsx(Ce,{children:o.jsx(gh,{className:"w-4 h-4"})}),o.jsxs("span",{className:"font-medium text-sm",children:[e.length," validation error",e.length!==1?"s":""]})]}),o.jsx("ul",{className:"text-sm text-accent2/80 space-y-1",children:r.map((s,a)=>o.jsxs("li",{className:"flex gap-2",children:[o.jsx("span",{className:"shrink-0",children:"•"}),o.jsx("span",{children:s.message})]},a))}),n>0&&o.jsxs("div",{className:"text-xs text-accent2/60 mt-2",children:["+",n," more error",n!==1?"s":""]})]})}function Z_n({datasetId:e,open:t,onOpenChange:r,onSuccess:n}){const[s,a]=b.useState("upload"),[i,l]=b.useState(null),[c,u]=b.useState({current:0,total:0}),[d,f]=b.useState(null),[h,p]=b.useState(!1),{parseFile:m,isParsing:g,error:y}=e_n(),{batchInsertItems:x}=ei(),w=b.useCallback(async I=>{try{const P=await m(I);l(P),a("preview")}catch{}},[m]),O=b.useCallback(async()=>{if(!i||i.items.length===0)return;a("importing"),p(!0);const{items:I}=i;u({current:0,total:I.length});try{await x.mutateAsync({datasetId:e,items:I.map(P=>({input:P.input,groundTruth:P.groundTruth,metadata:P.metadata}))}),f({success:I.length,errors:0})}catch{f({success:0,errors:I.length})}u({current:I.length,total:I.length}),p(!1),a("complete")},[i,x,e]),k=b.useCallback(()=>{r(!1),n?.(),d&&d.success>0&&Ue.success(`Imported ${d.success} item${d.success!==1?"s":""}`),setTimeout(()=>{a("upload"),l(null),u({current:0,total:0}),f(null)},150)},[r,n,d]),_=b.useCallback(()=>{h||(r(!1),setTimeout(()=>{a("upload"),l(null),u({current:0,total:0}),f(null)},150))},[h,r]),E=i&&i.items.length>0&&i.errors.length===0,T=()=>{switch(s){case"upload":return o.jsx(W_n,{onFileSelect:w,isParsing:g,error:y?.message});case"preview":return i?o.jsx("div",{className:"flex flex-col gap-4",children:i.errors.length>0?o.jsxs(o.Fragment,{children:[o.jsx(G_n,{errors:i.errors}),o.jsx("div",{className:"text-sm text-neutral4",children:"Please fix the errors in your JSON file and try again."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"text-sm text-neutral4",children:["Found ",i.items.length," valid item",i.items.length!==1?"s":""," to import."]}),o.jsx(Q_n,{items:i.items,maxRows:5})]})}):null;case"importing":return o.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[o.jsx(It,{size:"lg"}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Importing items..."}),o.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[c.current," of ",c.total]})]})]});case"complete":return o.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[o.jsx("div",{className:"text-4xl",children:d&&d.errors===0?"✓":"⚠"}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Import Complete"}),o.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[d?.success??0," item",d?.success!==1?"s":""," imported",d&&d.errors>0&&o.jsxs("span",{className:"text-accent2",children:[" ","(",d.errors," error",d.errors!==1?"s":"",")"]})]})]})]})}},j=()=>{switch(s){case"upload":return o.jsx(ve,{onClick:_,children:"Cancel"});case"preview":return o.jsxs(o.Fragment,{children:[o.jsx(ve,{onClick:()=>a("upload"),children:"Back"}),o.jsxs(ve,{variant:"primary",onClick:O,disabled:!E,children:["Import ",i?.items.length??0," Item",i?.items.length!==1?"s":""]})]});case"importing":return null;case"complete":return o.jsx(ve,{variant:"primary",onClick:k,children:"Done"})}},A={upload:"Import JSON",preview:"Preview Data",importing:"Importing",complete:"Import Complete"};return o.jsx(kn,{open:t,onOpenChange:_,children:o.jsxs(wn,{className:"max-w-2xl max-h-[90vh]",children:[o.jsxs(_n,{children:[o.jsx(Sn,{children:A[s]}),o.jsx(ea,{children:"Import dataset items from a JSON file."})]}),o.jsx(Vn,{className:"min-h-[200px] max-h-[50vh] overflow-y-auto",children:T()}),o.jsx(af,{className:"px-6 pt-4 flex justify-end gap-2",children:j()})]})})}function Y_n({dataset:e,isLoading:t=!1,onEditClick:r,onDuplicateClick:n,onDeleteClick:s,experimentTriggerSlot:a,disableExperimentTrigger:i=!1,onExperimentClick:l,className:c}){return o.jsxs(Ar,{className:c,children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{isLoading:t,children:[o.jsx(Ca,{})," ",e?.name]}),o.jsx(Ar.Description,{isLoading:t,children:e?.description}),o.jsxs(Ar.Description,{isLoading:t,children:[o.jsxs(us,{children:[o.jsx(s_,{})," Created at ",e?.createdAt?or(new Date(e.createdAt),"MMM d, yyyy"):""]}),o.jsxs(us,{children:[o.jsx(qx,{})," Latest version v",e?.version??""]})]})]}),o.jsx(Ar.Column,{children:o.jsxs(ws,{children:[a?i?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{className:"cursor-not-allowed",children:o.jsx("div",{className:"pointer-events-none opacity-50",inert:!0,"aria-disabled":"true",children:a})})}),o.jsx(Wr,{children:"Add items to the dataset before running an experiment"})]}):a:l?i?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{className:"cursor-not-allowed",children:o.jsxs(ve,{disabled:!0,tabIndex:-1,children:[o.jsx(Sx,{}),"Run Experiment"]})})}),o.jsx(Wr,{children:"Add items to the dataset before running an experiment"})]}):o.jsxs(ve,{onClick:l,children:[o.jsx(Sx,{}),"Run Experiment"]}):null,o.jsxs(dt,{children:[o.jsx(dt.Trigger,{asChild:!0,children:o.jsx(ve,{size:"default","aria-label":"Dataset actions menu",children:o.jsx(xWe,{})})}),o.jsxs(dt.Content,{align:"end",className:"w-48",children:[o.jsxs(dt.Item,{onSelect:r,children:[o.jsx(dv,{})," Edit Dataset"]}),o.jsxs(dt.Item,{onSelect:n,children:[o.jsx(Jc,{})," Duplicate Dataset"]}),o.jsxs(dt.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[o.jsx(Ku,{})," Delete Dataset"]})]})]})]})})]})}const Zwt=e=>{const t=Ze(),{data:r}=WI(e),n=r?.experiments;return kt({queryKey:["dataset-review-items",e,n?.map(s=>s.id)],queryFn:async()=>!n||n.length===0?[]:(await Promise.all(n.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(l=>l.status==="needs-review").map(l=>({id:l.id,input:l.input,output:l.output,error:l.error,itemId:l.itemId,experimentId:l.experimentId,datasetId:a.datasetId??void 0,traceId:l.traceId??void 0,scores:l.scores?Object.fromEntries(l.scores.map(c=>[c.scorerId,c.score??0])):{},tags:l.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!n&&n.length>0,refetchOnWindowFocus:!1})},X_n=e=>{const t=Ze(),{data:r}=WI(e),n=r?.experiments;return kt({queryKey:["dataset-completed-items",e,n?.map(s=>s.id)],queryFn:async()=>!n||n.length===0?[]:(await Promise.all(n.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(l=>l.status==="complete").map(l=>({id:l.id,input:l.input,output:l.output,error:l.error,itemId:l.itemId,experimentId:l.experimentId,datasetId:a.datasetId??void 0,traceId:l.traceId??void 0,scores:l.scores?Object.fromEntries(l.scores.map(c=>[c.scorerId,c.score??0])):{},tags:l.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!n&&n.length>0,refetchOnWindowFocus:!1})};function K_n(e,t){if(typeof e=="string")return e.length>t?e.slice(0,t)+"...":e;try{const r=JSON.stringify(e);return r.length>t?r.slice(0,t)+"...":r}catch{return String(e)}}const J_n=Z("bg-surface5 backdrop-blur-xl z-50 min-w-32 overflow-auto rounded-lg p-2 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95");function a8e({className:e,children:t,...r}){return o.jsx(TR,{children:o.jsx(NR,{className:Z(J_n,e),...r,children:t})})}function eEn({datasetId:e}){const t=Ze(),{data:r}=jg(e),{data:n,isLoading:s}=Zwt(e),{data:a,isLoading:i}=X_n(e),{updateExperimentResult:l}=ei(),[c,u]=b.useState(null),[d,f]=b.useState(null),[h,p]=b.useState(new Set),[m,g]=b.useState(!1),[y,x]=b.useState(!1),[w,O]=b.useState(!1),[k,_]=b.useState(""),[E,T]=b.useState(""),[j,A]=b.useState(""),[I,P]=b.useState([]),[R,B]=b.useState(!1),[D,F]=b.useState(null),U=D??n??[];b.useEffect(()=>{n&&D===null&&F(n)},[n]);const z=b.useMemo(()=>{const ge=new Set;if(r?.tags)for(const Ee of r.tags)ge.add(Ee);for(const Ee of U)for(const Fe of Ee.tags)ge.add(Fe);return[...ge].sort()},[r,U]),V=b.useCallback(ge=>{!r||!e||(r.tags??[]).includes(ge)},[r,e]),W=b.useMemo(()=>d?d==="__untagged__"?U.filter(ge=>ge.tags.length===0):U.filter(ge=>ge.tags.includes(d)):U,[U,d]),L=b.useMemo(()=>{const ge=new Map;for(const Ee of U)for(const Fe of Ee.tags)ge.set(Fe,(ge.get(Fe)??0)+1);return[...ge.entries()].sort((Ee,Fe)=>Fe[1]-Ee[1])},[U]),Y=b.useMemo(()=>U.filter(ge=>ge.tags.length===0).length,[U]),q=b.useMemo(()=>{let ge=0;return d&&ge++,m&&ge++,ge},[d,m]),M=b.useCallback((ge,Ee)=>{F(He=>(He??[]).map(Xe=>Xe.id===ge?{...Xe,tags:Ee}:Xe));const Fe=U.find(He=>He.id===ge);Fe?.experimentId&&Fe?.datasetId&&l.mutate({datasetId:Fe.datasetId,experimentId:Fe.experimentId,resultId:Fe.id,tags:Ee})},[U,l]),Q=b.useCallback((ge,Ee)=>{const Fe=U.find(He=>He.id===ge);Fe?.traceId&&Ee!==void 0&&t.createFeedback({feedback:{traceId:Fe.traceId,source:"studio",feedbackSource:"studio",feedbackType:"rating",value:Ee==="positive"?1:-1,experimentId:Fe.experimentId??void 0,sourceId:Fe.id}}).catch(()=>{}),F(He=>(He??[]).map(Xe=>Xe.id===ge?{...Xe,rating:Ee}:Xe))},[U,t]),G=b.useCallback((ge,Ee)=>{const Fe=U.find(He=>He.id===ge);Fe?.traceId&&t.createFeedback({feedback:{traceId:Fe.traceId,source:"studio",feedbackSource:"studio",feedbackType:"comment",value:Ee,comment:Ee,experimentId:Fe.experimentId??void 0,sourceId:Fe.id}}).catch(()=>{}),F(He=>(He??[]).map(Xe=>Xe.id===ge?{...Xe,comment:Ee}:Xe))},[U,t]),J=b.useCallback(ge=>{const Ee=U.find(Fe=>Fe.id===ge);F(Fe=>(Fe??[]).filter(He=>He.id!==ge)),p(Fe=>{const He=new Set(Fe);return He.delete(ge),He}),c===ge&&u(null),Ee?.experimentId&&Ee?.datasetId&&l.mutate({datasetId:Ee.datasetId,experimentId:Ee.experimentId,resultId:Ee.id,status:null})},[U,l,c]),ie=b.useCallback(ge=>{const Ee=U.find(Fe=>Fe.id===ge);F(Fe=>(Fe??[]).filter(He=>He.id!==ge)),p(Fe=>{const He=new Set(Fe);return He.delete(ge),He}),c===ge&&u(null),Ee?.experimentId&&Ee?.datasetId&&l.mutate({datasetId:Ee.datasetId,experimentId:Ee.experimentId,resultId:Ee.id,status:"complete"})},[U,l,c]),te=b.useMemo(()=>{const ge=m?a??[]:W;return!m||!d?ge:d==="__untagged__"?ge.filter(Ee=>Ee.tags.length===0):ge.filter(Ee=>Ee.tags.includes(d))},[m,a,W,d]),se=m?i:!1,oe=b.useMemo(()=>new Set(te.map(ge=>ge.id)),[te]),he=b.useMemo(()=>[...h].filter(ge=>oe.has(ge)).length,[h,oe]),K=te.length>0&&he===te.length,re=he>0&&!K,le=b.useCallback(ge=>{p(Ee=>{const Fe=new Set(Ee);return Fe.has(ge)?Fe.delete(ge):Fe.add(ge),Fe})},[]),pe=b.useCallback(()=>{p(K?new Set:new Set(te.map(ge=>ge.id)))},[K,te]),ce=b.useCallback(ge=>{for(const Ee of h){const Fe=U.find(He=>He.id===Ee);Fe&&!Fe.tags.includes(ge)&&M(Ee,[...Fe.tags,ge])}},[U,h,M]),ue=b.useCallback(ge=>{for(const Ee of h){const Fe=U.find(He=>He.id===Ee);Fe&&Fe.tags.includes(ge)&&M(Ee,Fe.tags.filter(He=>He!==ge))}},[U,h,M]),we=b.useCallback(()=>{for(const ge of h)ie(ge);p(new Set)},[h,ie]),ke=b.useCallback(()=>{for(const ge of h)J(ge);p(new Set)},[h,J]),Re=b.useCallback(()=>{_(""),O(!0)},[]),X=b.useCallback(async()=>{if(!(!E||!j)){x(!0),O(!1);try{const ge=U.filter(Fe=>h.has(Fe.id));if(ge.length===0){x(!1);return}const Ee=await t.clusterFailures({modelId:`${E}/${j}`,items:ge.map(Fe=>({id:Fe.id,input:Fe.input,output:Fe.output??void 0,error:typeof Fe.error=="string"?Fe.error:Fe.error?String(Fe.error):void 0,scores:Fe.scores,existingTags:Fe.tags.length>0?Fe.tags:void 0})),availableTags:z.length>0?z:void 0,prompt:k||void 0});Ee.proposedTags&&Ee.proposedTags.length>0&&(P(Ee.proposedTags.map(Fe=>({...Fe,accepted:!0}))),B(!0))}catch(ge){console.error("Analysis failed:",ge)}finally{x(!1)}}},[E,j,U,h,t,z,k]),ae=b.useCallback(()=>{for(const ge of I){if(!ge.accepted)continue;const Ee=U.find(Fe=>Fe.id===ge.itemId);if(Ee){const Fe=[...new Set([...Ee.tags,...ge.tags])];M(Ee.id,Fe)}}B(!1)},[I,U,M]),be=b.useCallback(ge=>{u(Ee=>Ee===ge?null:ge)},[]),Ae=b.useMemo(()=>c?te.find(ge=>ge.id===c)??null:null,[c,te]),De=b.useCallback(()=>{if(!c||te.length===0)return;const ge=te.findIndex(Ee=>Ee.id===c);ge<te.length-1&&u(te[ge+1].id)},[c,te]),ye=b.useCallback(()=>{if(!c||te.length===0)return;const ge=te.findIndex(Ee=>Ee.id===c);ge>0&&u(te[ge-1].id)},[c,te]),_e=Ae?"2rem 1fr 10rem 8rem":"2rem 1fr 10rem 8rem 6rem 6rem";return s?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(It,{className:"w-6 h-6"})}):o.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o.jsx(kn,{open:w,onOpenChange:O,children:o.jsxs(wn,{children:[o.jsxs(_n,{children:[o.jsx(Sn,{children:"Analyze Items"}),o.jsx(ea,{children:"Use an LLM to automatically suggest tags for the selected items."})]}),o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs mb-1 block",children:"Provider"}),o.jsx(Tg,{value:E,onValueChange:T})]}),o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs mb-1 block",children:"Model"}),o.jsx(Ng,{llmId:E,value:j,onValueChange:A})]})]}),o.jsxs(me,{variant:"ui-xs",className:"text-neutral3",children:[h.size," item",h.size!==1?"s":""," will be analyzed"]}),o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs",children:"Instructions (optional)"}),o.jsx(vc,{value:k,onChange:ge=>_(ge.target.value),placeholder:"E.g., Focus on safety issues and factual errors...",rows:3,className:"text-xs mt-1"})]})]}),o.jsxs(af,{children:[o.jsx(ve,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),o.jsxs(ve,{onClick:X,disabled:!E||!j||y,children:[y?o.jsx(It,{className:"w-4 h-4 mr-1"}):null,"Analyze"]})]})]})}),o.jsx(kn,{open:R,onOpenChange:B,children:o.jsxs(wn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(_n,{children:[o.jsx(Sn,{children:"Review Proposed Tags"}),o.jsxs(ea,{children:[I.filter(ge=>ge.accepted).length," of ",I.length," proposals selected"]})]}),o.jsx("div",{className:"space-y-3 py-2",children:I.map((ge,Ee)=>{const Fe=U.find(He=>He.id===ge.itemId);return o.jsx("div",{className:Z("p-3 border rounded-lg",!ge.accepted&&"opacity-50"),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(bi,{checked:ge.accepted,onCheckedChange:He=>P(Xe=>Xe.map((St,ze)=>ze===Ee?{...St,accepted:!!He}:St))}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate block",children:Fe?typeof Fe.input=="string"?Fe.input.slice(0,100):JSON.stringify(Fe.input).slice(0,100):ge.itemId}),o.jsx("div",{className:"flex gap-1 flex-wrap mt-1.5",children:ge.tags.map((He,Xe)=>o.jsx(Rwt,{tag:He,onRename:St=>P(ze=>ze.map((Be,Te)=>Te===Ee?{...Be,tags:Be.tags.map(($e,Ie)=>Ie===Xe?St:$e)}:Be)),onRemove:()=>P(St=>St.map((ze,Be)=>Be===Ee?{...ze,tags:ze.tags.filter((Te,$e)=>$e!==Xe)}:ze))},`${He}-${Xe}`))}),ge.reason&&o.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-1 block italic",children:ge.reason})]})]})},ge.itemId)})}),o.jsxs(af,{children:[o.jsx(ve,{variant:"outline",onClick:()=>B(!1),children:"Cancel"}),o.jsxs(ve,{onClick:ae,disabled:I.filter(ge=>ge.accepted).length===0,children:["Accept ",I.filter(ge=>ge.accepted).length," proposals"]})]})]})}),o.jsxs(Xd,{className:Ae?"grid-cols-[1fr_1fr]":"",children:[o.jsxs(gr,{children:[o.jsxs(gr.Toolbar,{children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(dt,{children:[o.jsx(dt.Trigger,{asChild:!0,children:o.jsxs(ve,{variant:"outline",size:"md",children:[o.jsx(wWe,{}),"Filter",q>0&&o.jsx("span",{className:Z("ml-0.5 inline-flex items-center justify-center rounded-full bg-accent1/50 text-neutral5 text-ui-sm w-5 h-5"),children:q})]})}),o.jsxs(dt.Content,{align:"start",className:Z("min-w-48"),children:[o.jsxs(dt.Sub,{children:[o.jsxs(dt.SubTrigger,{children:["Status",m&&o.jsx("span",{className:Z("ml-auto text-ui-sm text-accent1"),children:"1"})]}),o.jsxs(a8e,{children:[o.jsx(dt.CheckboxItem,{checked:!m,onCheckedChange:()=>{g(!1),u(null)},onSelect:ge=>ge.preventDefault(),children:"Review Queue"}),o.jsx(dt.CheckboxItem,{checked:m,onCheckedChange:()=>{g(!0),u(null)},onSelect:ge=>ge.preventDefault(),children:"Completed"})]})]}),o.jsxs(dt.Sub,{children:[o.jsxs(dt.SubTrigger,{children:["Tags",d&&o.jsx("span",{className:Z("ml-auto text-ui-sm text-accent1"),children:"1"})]}),o.jsxs(a8e,{children:[o.jsx(dt.CheckboxItem,{checked:!d,onCheckedChange:()=>f(null),onSelect:ge=>ge.preventDefault(),children:"All"}),Y>0&&o.jsx(dt.CheckboxItem,{checked:d==="__untagged__",onCheckedChange:()=>f(d==="__untagged__"?null:"__untagged__"),onSelect:ge=>ge.preventDefault(),children:"Untagged"}),L.length>0&&o.jsx(dt.Separator,{}),L.map(([ge])=>o.jsx(dt.CheckboxItem,{checked:d===ge,onCheckedChange:()=>f(d===ge?null:ge),onSelect:Ee=>Ee.preventDefault(),children:ge},ge))]})]}),q>0&&o.jsxs(o.Fragment,{children:[o.jsx(dt.Separator,{}),o.jsxs(dt.Item,{onSelect:()=>{f(null),g(!1),u(null)},children:[o.jsx(vn,{}),"Clear all filters"]})]})]})]}),q>0&&o.jsxs(ve,{variant:"outline",size:"md",onClick:()=>{f(null),g(!1),u(null)},children:[o.jsx(vn,{}),"Reset"]})]}),!m&&h.size>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Iwt,{selectedCount:h.size,vocabulary:z,onApplyTag:ce,onRemoveTag:ue,onNewTag:ge=>ce(ge)}),o.jsxs(dt,{children:[o.jsx(dt.Trigger,{asChild:!0,children:o.jsxs(ve,{disabled:y,children:[y?o.jsx(It,{className:"w-4 h-4"}):o.jsx(Ce,{size:"sm",children:o.jsx(Un,{})}),"Actions"]})}),o.jsxs(dt.Content,{align:"end",children:[o.jsxs(dt.Item,{onSelect:we,children:[o.jsx(Ce,{size:"sm",children:o.jsx(xx,{})}),"Complete"]}),o.jsxs(dt.Item,{onSelect:ke,children:[o.jsx(Ce,{size:"sm",children:o.jsx(Ku,{})}),"Remove"]}),o.jsx(dt.Separator,{}),o.jsxs(dt.Item,{onSelect:Re,children:[o.jsx(Ce,{size:"sm",children:o.jsx(a_,{})}),"Analyze"]})]})]})]})]}),se?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(It,{className:"w-6 h-6"})}):te.length===0?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center px-8",children:[o.jsx(me,{variant:"ui-sm",className:"text-neutral3 block",children:m?"No completed reviews yet":"No items to review"}),o.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-2 block",children:m?"Items marked as complete will appear here for auditing.":"When experiment results are flagged for review, they will appear here."})]})}):o.jsxs(xe,{columns:_e,children:[o.jsxs(xe.Top,{children:[!m&&o.jsx(xe.TopCell,{children:o.jsx(bi,{checked:K?!0:re?"indeterminate":!1,onCheckedChange:()=>pe(),"aria-label":"Select all"})}),m&&o.jsx(xe.TopCell,{children:" "}),o.jsx(xe.TopCell,{children:"Input"}),o.jsx(xe.TopCell,{children:"Comment"}),o.jsx(xe.TopCell,{children:"Tags"}),!Ae&&o.jsx(xe.TopCell,{children:"Rating"}),!Ae&&o.jsx(xe.TopCell,{children:"Scores"})]}),o.jsx(xe.Rows,{children:te.map(ge=>{const Ee=ge.scores?Object.entries(ge.scores):[];return o.jsxs(xe.Row,{onClick:()=>be(ge.id),selected:c===ge.id,children:[o.jsx(xe.Cell,{children:m?ge.error?o.jsx("div",{className:"w-2 h-2 rounded-full bg-red-700",title:"Error"}):o.jsx("div",{className:"w-2 h-2 rounded-full bg-green-600",title:"Success"}):o.jsx(bi,{checked:h.has(ge.id),onCheckedChange:()=>le(ge.id),onClick:Fe=>Fe.stopPropagation(),"aria-label":`Select item ${ge.id}`})}),o.jsx(xe.NameCell,{children:K_n(ge.input,80)}),o.jsx(xe.Cell,{children:ge.comment?o.jsx(me,{variant:"ui-xs",className:"text-neutral3 truncate",children:ge.comment}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),o.jsx(xe.Cell,{children:ge.tags.length>0?o.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate",children:ge.tags.join(", ")}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),!Ae&&o.jsxs(xe.Cell,{children:[ge.rating==="positive"&&o.jsx(Ce,{size:"sm",className:"text-positive1",children:o.jsx(bce,{})}),ge.rating==="negative"&&o.jsx(Ce,{size:"sm",className:"text-negative1",children:o.jsx(vce,{})}),!ge.rating&&o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})]}),!Ae&&o.jsx(xe.Cell,{children:Ee.length>0?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ce,{size:"sm",className:"text-neutral3",children:o.jsx(Hs,{})}),o.jsx(me,{variant:"ui-xs",className:"text-neutral4 font-mono",children:Ee[0][1].toFixed(2)}),Ee.length>1&&o.jsxs(vt,{variant:"default",children:["+",Ee.length-1]})]}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})})]},ge.id)})})]})]}),Ae&&o.jsx(Awt,{item:Ae,isCompleted:m,tagVocabulary:z,onRate:ge=>Q(Ae.id,ge),onSetTags:ge=>{M(Ae.id,ge);for(const Ee of ge)z.includes(Ee)||V(Ee)},onComment:ge=>G(Ae.id,ge),onRemove:()=>J(Ae.id),onComplete:m?void 0:()=>ie(Ae.id),onPrevious:ye,onNext:De,onClose:()=>u(null)})]})]})}function tEn({datasetId:e,onExperimentClick:t,onEditClick:r,onDeleteClick:n,onAddItemClick:s,experimentTriggerSlot:a,onNavigateToDataset:i,activeDatasetVersion:l,onVersionSelect:c,initialTab:u,onTabChange:d}){const{navigate:f}=lr(),[h,p]=b.useState(u??"items"),m=zt=>{p(zt),d?.(zt)},[g,y]=b.useState(!1),[x,w]=b.useState(!1),[O,k]=b.useState(!1),[_,E]=b.useState([]),[T,j]=b.useState(!1),[A,I]=b.useState([]),[P,R]=b.useState(!1),[B,D]=b.useState([]),[F,U]=b.useState(!1),[z,V]=b.useState(0),[W,L]=b.useState(null),[Y,q]=b.useState(""),[M]=Zsr(Y,300),[Q,G]=b.useState(null),ie=l!==void 0?l:Q,{data:te,isLoading:se}=jg(e),{data:oe=[],total:he,isLoading:K,setEndOfListElement:re,isFetchingNextPage:le,hasNextPage:pe}=J_(e,M||void 0,ie),{data:ce=[],total:ue,isLoading:we}=J_(e,void 0,ie),[ke,Re]=b.useState({}),{data:X,isLoading:ae}=WI(e,void 0,ke),{data:be}=WI(e),{deleteItems:Ae}=ei(),De=X?.experiments??[],ye=be?.experiments??[],_e=v_n({hasSearchQuery:!!M,filteredItemsLength:oe.length,unfilteredItemsTotal:ue,itemsTotal:he}),{data:ge}=Zwt(e),Ee=ge?.length??0,Fe=zt=>{L(zt)},He=()=>{L(null)},Xe=zt=>{const $r=zt.isCurrent?null:zt;c?c($r):G(zt.isCurrent?null:zt.version)},St=zt=>{E(zt),k(!0)},ze=zt=>{I(zt),j(!0)},Be=zt=>{j(zt),zt||(I([]),V($r=>$r+1))},Te=zt=>{f(`/datasets/${e}/items?items=${zt.join(",")}`)},$e=zt=>{f(`/datasets/${e}/versions?ids=${zt.join(",")}`)},Ie=zt=>{D(zt),R(!0)},lt=async()=>{await Ae.mutateAsync({datasetId:e,itemIds:B}),Ue.success(`Deleted ${B.length} items`),R(!1),D([]),V(zt=>zt+1)},st=zt=>{k(!1),E([]),V($r=>$r+1),i?.(zt)},mt=zt=>{k(zt),zt||(E([]),V($r=>$r+1))};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsx("div",{className:Z("h-full w-full",nn.allSlow),children:o.jsxs("div",{className:Z("grid grid-rows-[auto_1fr] mx-auto h-full w-full m-auto",W?"max-w-[120rem]":"max-w-[90rem]"),children:[o.jsx(Y_n,{dataset:te,isLoading:se,onEditClick:r,onDuplicateClick:()=>U(!0),onDeleteClick:n,experimentTriggerSlot:a,disableExperimentTrigger:!we&&ce.length===0,onExperimentClick:t}),o.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:o.jsxs(wf,{defaultTab:"items",value:h,onValueChange:m,className:"grid grid-rows-[auto_1fr] h-full",children:[o.jsxs(Sf,{children:[o.jsxs(vs,{value:"items",children:["Items ",o.jsx($a,{color:"gray",children:_e})]}),o.jsxs(vs,{value:"experiments",children:["Experiments",o.jsx($a,{color:"gray",children:De.length})]}),o.jsxs(vs,{value:"review",children:["Review",Ee>0&&o.jsx($a,{color:"orange",children:Ee})]})]}),o.jsx(Ns,{value:"items",className:"grid overflow-auto mt-5",children:o.jsx(H_n,{datasetId:e,items:oe,isLoading:K,featuredItemId:W,onItemSelect:Fe,onItemClose:He,onAddClick:s??(()=>{}),onImportClick:()=>y(!0),onImportJsonClick:()=>w(!0),onBulkDeleteClick:Ie,onCreateDatasetClick:St,onAddToDatasetClick:ze,onCompareItemsClick:Te,datasetName:te?.name,clearSelectionTrigger:z,setEndOfListElement:re,isFetchingNextPage:le,hasNextPage:pe,searchQuery:Y,onSearchChange:q,activeDatasetVersion:ie,currentDatasetVersion:te?.version,onVersionSelect:Xe,onCompareVersionsClick:$e})}),o.jsx(Ns,{value:"experiments",className:"grid overflow-auto mt-5",children:o.jsx(P_n,{experiments:De,allExperiments:ye,isLoading:ae,datasetId:e,filters:ke,onFiltersChange:Re})}),o.jsx(Ns,{value:"review",className:"overflow-auto mt-0",children:o.jsx(eEn,{datasetId:e})})]})})]})})}),o.jsx(E_n,{datasetId:e,open:g,onOpenChange:y}),o.jsx(Z_n,{datasetId:e,open:x,onOpenChange:w}),o.jsx(f_n,{open:O,onOpenChange:mt,items:_,onSuccess:st}),o.jsx(h_n,{open:T,onOpenChange:Be,items:A,currentDatasetId:e}),o.jsx(p_n,{open:F,onOpenChange:U,sourceDatasetId:e,sourceDatasetName:te?.name||"",sourceDatasetDescription:te?.description,onSuccess:i}),o.jsx($t,{open:P,onOpenChange:R,children:o.jsxs($t.Content,{children:[o.jsxs($t.Header,{children:[o.jsx($t.Title,{children:"Delete Items"}),o.jsxs($t.Description,{children:["Are you sure you want to delete ",B.length," item",B.length!==1?"s":"","? This action cannot be undone."]})]}),o.jsxs($t.Footer,{children:[o.jsx($t.Cancel,{children:"Cancel"}),o.jsx($t.Action,{onClick:lt,children:Ae.isPending?"Deleting...":"Delete"})]})]})})]})}function rEn(e){if(!(e instanceof Error))return null;const t=e.message.match(/- ({.*})$/);if(!t)return null;try{const r=JSON.parse(t[1]);if(r.field&&Array.isArray(r.errors))return{field:r.field,errors:r.errors}}catch{}return null}function i8e({field:e,errors:t}){return t.length?o.jsx("div",{className:"mt-2 space-y-1",children:t.map((r,n)=>o.jsxs("p",{className:"text-xs text-destructive",children:[o.jsxs("code",{className:"bg-destructive/10 px-1 rounded",children:[e,r.path!=="/"?r.path:""]}),": ",r.message]},n))}):null}function nEn({datasetId:e,open:t,onOpenChange:r,onSuccess:n}){const[s,a]=b.useState("{}"),[i,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState(null),{addItem:h}=ei(),p=async x=>{x.preventDefault();let w;try{w=JSON.parse(s)}catch{Ue.error("Input must be valid JSON");return}let O;if(i.trim())try{O=JSON.parse(i)}catch{Ue.error("Ground Truth must be valid JSON");return}let k;if(c.trim())try{k=JSON.parse(c)}catch{Ue.error("Expected Trajectory must be valid JSON");return}try{await h.mutateAsync({datasetId:e,input:w,groundTruth:O,expectedTrajectory:k}),Ue.success("Item added successfully"),f(null),a("{}"),l(""),u(""),r(!1),n?.()}catch(_){const E=rEn(_);E?f(E):Ue.error(`Failed to add item: ${_ instanceof Error?_.message:"Unknown error"}`)}},m=x=>{a(x),d?.field==="input"&&f(null)},g=x=>{l(x),d?.field==="groundTruth"&&f(null)},y=()=>{a("{}"),l(""),u(""),f(null),r(!1)};return o.jsx(kn,{open:t,onOpenChange:r,children:o.jsxs(wn,{className:"max-w-lg",children:[o.jsx(_n,{children:o.jsx(Sn,{children:"Add Item"})}),o.jsx(Vn,{children:o.jsxs("form",{onSubmit:p,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-input",children:"Input (JSON) *"}),o.jsx(ds,{value:s,onChange:m,showCopyButton:!1,className:"min-h-[120px]"}),d?.field==="input"&&o.jsx(i8e,{field:"input",errors:d.errors})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-ground-truth",children:"Ground Truth (JSON, optional)"}),o.jsx(ds,{value:i,onChange:g,showCopyButton:!1,className:"min-h-[80px]"}),d?.field==="groundTruth"&&o.jsx(i8e,{field:"groundTruth",errors:d.errors})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-trajectory",children:"Expected Trajectory (JSON, optional)"}),o.jsx(ds,{value:c,onChange:u,showCopyButton:!1,className:"min-h-[80px]"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[o.jsx(ve,{type:"button",onClick:y,children:"Cancel"}),o.jsx(ve,{type:"submit",variant:"primary",disabled:h.isPending,children:h.isPending?"Adding...":"Add Item"})]})]})})]})})}function sEn({selectedScorers:e,setSelectedScorers:t,disabled:r=!1,container:n}){const{data:s,isLoading:a}=_f(),i=b.useMemo(()=>s?Object.entries(s).map(([l,c])=>({value:l,label:c.scorer?.config?.name||l,description:c.scorer?.config?.description||""})):[],[s]);return o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:"Scorers (Optional)"}),o.jsx($Ir,{options:i,value:e,onValueChange:t,placeholder:"Select scorers...",searchPlaceholder:"Search scorers...",emptyText:"No scorers available",disabled:r||a,container:n})]})}const aEn=[{value:"agent",label:"Agent"},{value:"workflow",label:"Workflow"},{value:"scorer",label:"Scorer"}];function iEn({targetType:e,setTargetType:t,targetId:r,setTargetId:n,container:s}){const{data:a,isLoading:i}=Bp(),{data:l,isLoading:c}=Cv(),{data:u,isLoading:d}=_f(),f=e==="agent"?Object.entries(a??{}).map(([g,y])=>({value:g,label:y.name??g})):e==="workflow"?Object.entries(l??{}).map(([g,y])=>({value:g,label:y.name??g})):e==="scorer"?Object.entries(u??{}).map(([g,y])=>({value:g,label:y.scorer?.config?.name??g})):[],h=e==="agent"&&i||e==="workflow"&&c||e==="scorer"&&d,p=g=>{t(g),n("")},m=e==="agent"?"Agent":e==="workflow"?"Workflow":"Scorer";return o.jsxs("div",{className:"grid gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:"Target Type"}),o.jsx(Zl,{options:aEn,value:e,onValueChange:p,placeholder:"Select target type",searchPlaceholder:"Search types...",emptyText:"No types available",container:s})]}),e&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:m}),o.jsx(Zl,{options:f,value:r,onValueChange:n,placeholder:`Select ${e}`,searchPlaceholder:"Search...",emptyText:"No targets available",disabled:h,container:s})]})]})}function oEn({datasetId:e,version:t,open:r,onOpenChange:n,onSuccess:s}){const a=b.useRef(null),[i,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState([]),{triggerExperiment:h}=ei(),p=i&&c,m=h.isPending,g=async()=>{if(p)try{const x=await h.mutateAsync({datasetId:e,targetType:i,targetId:c,scorerIds:d.length>0?d:void 0,version:t});gc.success("Experiment triggered successfully"),n(!1),s?.(x.experimentId),l(""),u(""),f([])}catch(x){const w=x instanceof Error?x.message:"Failed to trigger experiment";gc.error(w)}},y=()=>{m||(n(!1),l(""),u(""),f([]))};return o.jsx(kn,{open:r,onOpenChange:y,children:o.jsxs(wn,{ref:a,children:[o.jsxs(_n,{children:[o.jsx(Sn,{children:"Run Experiment"}),o.jsx(ea,{children:t?`Execute items from ${or(new Date(t),"MMM d, yyyy")} version against a target.`:"Execute all items in this dataset against a target."})]}),o.jsxs(Vn,{className:"grid gap-6",children:[o.jsx(iEn,{targetType:i,setTargetType:l,targetId:c,setTargetId:u,container:a}),i&&i!=="scorer"&&o.jsx(sEn,{selectedScorers:d,setSelectedScorers:f,disabled:m,container:a})]}),o.jsxs(af,{className:"px-6 pt-4",children:[o.jsx(ve,{onClick:y,disabled:m,children:"Cancel"}),o.jsx(ve,{variant:"primary",onClick:g,disabled:!p||m,children:m?o.jsxs(o.Fragment,{children:[o.jsx(It,{className:"w-4 h-4"}),"Running..."]}):"Run"})]})]})})}const oye=e=>{const t=Ze();return kt({queryKey:["experiment-trace",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return t.getTrace(e)},enabled:!!e})},o8e=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"score",label:"Score",size:"1fr"}];function lEn({result:e,scores:t,onPrevious:r,onNext:n,onClose:s,onShowTrace:a,onScoreClick:i,featuredScoreId:l}){const c=!!e?.error,u=Gee(e?.input),d=Gee(e?.output);return o.jsxs(o.Fragment,{children:[o.jsxs(gr.Toolbar,{children:[o.jsx(FE,{onPrevious:r,onNext:n,previousAriaLabel:"View previous result details",nextAriaLabel:"View next result details"}),o.jsxs(ws,{children:[o.jsxs(ve,{onClick:a,disabled:!e.traceId,children:[o.jsx(yce,{}),"Show Trace"]}),o.jsx(ve,{onClick:s,"aria-label":"Close result details panel",children:o.jsx(vn,{})})]})]}),o.jsxs(gr.Content,{children:[o.jsx(Ar,{withMargins:!1,children:o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(Sx,{})," ",e.id]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:[o.jsx(wx,{})," ",e.itemId]})})]})}),c&&o.jsxs(hl,{variant:"destructive",children:[o.jsx(dUt,{}),o.jsxs(hl.Message,{children:[o.jsx("strong",{children:"Error: "}),Gee(e?.error&&typeof e.error=="object"?e.error.message:e?.error)]})]}),t&&t.length>0&&o.jsxs(At,{className:"grid-rows-[auto_auto] overflow-visible",children:[o.jsxs(At.Header,{columns:o8e,children:[o.jsx(At.HeaderCol,{children:"Scorer"}),o.jsx(At.HeaderCol,{children:"Score"})]}),o.jsx(At.Items,{children:t.map(f=>o.jsx(At.Row,{children:o.jsxs(At.RowButton,{item:{id:f.id},columns:o8e,isFeatured:l===f.id,onClick:i,children:[o.jsx(At.TextCell,{children:f.scorerId}),o.jsx(At.TextCell,{className:"font-mono",children:f.score.toFixed(3)})]})},f.id))})]}),(e.status||Array.isArray(e.tags)&&e.tags.length>0)&&o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[o.jsx(yE,{className:"w-4 h-4"})," Review Status"]}),o.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[e.status&&o.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${e.status==="needs-review"?"bg-warning/10 text-warning":e.status==="complete"?"bg-accent1/10 text-accent1":"bg-neutral3/10 text-neutral4"}`,children:e.status}),Array.isArray(e.tags)&&e.tags.length>0&&e.tags.map(f=>o.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-surface4 text-neutral4",children:f},f))]})]}),o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(wx,{}),codeStr:u}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(yc,{}),codeStr:d}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[o.jsx(s_,{className:"w-4 h-4"})," Created"]}),o.jsx("p",{className:"text-sm text-neutral4",children:or(new Date(e.createdAt),"MMM d, yyyy 'at' h:mm a")})]})]})]})}function Gee(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function cEn({span:e}){return e?o.jsxs(o.Fragment,{children:[o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(wp,{}),codeStr:JSON.stringify(e.input||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(yc,{}),codeStr:JSON.stringify(e.output||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Metadata",icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.metadata||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Attributes",icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.attributes||null,null,2)})]}):null}function uEn({traceId:e,spanId:t,onNext:r,onPrevious:n,onClose:s}){const{data:a}=oye(e),i=a?.spans?.find(l=>l.spanId===t);return o.jsxs(o.Fragment,{children:[o.jsxs(gr.Toolbar,{children:[o.jsx(FE,{onPrevious:n,onNext:r,previousAriaLabel:"View previous span details",nextAriaLabel:"View next span details"}),o.jsx(ve,{onClick:s,"aria-label":"Close span details",children:o.jsx(vn,{})})]}),o.jsxs(gr.Content,{children:[o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(yl,{})," Span ",Yd(t)]})})}),o.jsx(cEn,{span:i})]})]})}const dEn=e=>{if(!e||e.length===0)return[];const t=e.reduce((l,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!l||u>l)?u:l},null),r=new Map,n=[];e.forEach(l=>{const c=new Date(l.startedAt),u=l.endedAt?new Date(l.endedAt):void 0,d={id:l.spanId,name:l.name,type:l.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:l.parentSpanId};r.set(l.spanId,d)}),e.forEach(l=>{const c=r.get(l.spanId);if(l?.parentSpanId==null){if(t&&c.endTime&&t>new Date(c.endTime)){c.endTime=t.toISOString();const u=new Date(t).getTime(),d=new Date(c.startTime).getTime();c.latency=u-d}n.push(c)}else{const u=r.get(l.parentSpanId);u?u.spans.push(c):n.push(c)}});const s=l=>l.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(n),i=l=>{l.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function Ywt(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(r=>{t.push(r.id),t.push(...Ywt(r))}),t}const l8e=["agent","workflow","model","mcp","tool","workspace","other"];function Xwt(e){const t=e?.toLowerCase().split("_")[0],r={agent:{icon:o.jsx(pa,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"bg-oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:o.jsx(Ii,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"bg-oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:o.jsx(ip,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"bg-oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},mcp:{icon:o.jsx(ml,{}),color:"oklch(0.75 0.15 160)",label:"MCP",bgColor:"bg-oklch(0.75 0.15 160 / 0.1)",typePrefix:"mcp"},tool:{icon:o.jsx(Ai,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"bg-oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"},workspace:{icon:o.jsx(Pz,{}),color:"oklch(0.75 0.15 40)",label:"Workspace",bgColor:"bg-oklch(0.75 0.15 40 / 0.1)",typePrefix:"workspace"}};return t in r?r[t]:{typePrefix:"other"}}function fEn({isSelected:e,isFaded:t,isExpanded:r,toggleChildren:n,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:l}){return o.jsx("div",{className:Z("flex items-center justify-end h-full px-3",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:l&&l>0?o.jsxs("div",{className:"flex gap-1",children:[o.jsxs(c8e,{onClick:()=>n?.(),children:[i?a:l," ",r?i?o.jsx(dce,{}):o.jsx(uv,{}):o.jsx(Un,{})]}),a>(l??0)&&!i&&o.jsxs(c8e,{onClick:()=>s?.(),children:[a," ",o.jsx(uce,{})]})]}):null})}function c8e({onClick:e,children:t,className:r}){return o.jsx("button",{onClick:e,className:Z("h-full",r),children:o.jsx("div",{className:Z("flex items-center gap-[0.1rem] text-ui-sm text-neutral5 border border-border1 pl-2 pr-1 rounded-lg transition-all","hover:text-yellow-500","[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-4 [&>svg]:h-4 [&>svg]:transition-all"),children:t})})}function hEn({isLastChild:e,hasChildren:t=!1,expanded:r=!1}){return o.jsx("div",{className:Z("w-12 h-[2.8rem] relative opacity-100",'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-0 after:border-l after:border-neutral3 after:border-dashed ','before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-0 before:border-b before:border-neutral3 before:border-dashed',"[&_svg]:transition-all","[&:hover_svg]:text-yellow-500 [&:hover_svg]:scale-[1.3] [&:hover_svg]:opacity-100",{"after:bottom-[50%]":e}),children:t&&o.jsx("span",{className:Z("flex absolute left-[50%] top-[50%] translate-y-[-50%] translate-x-[-50%] items-center justify-center bg-surface2 p-1","[&>svg]:shrink-0 [&>svg]:opacity-60 [&>svg]:w-[0.8rem] [&>svg]:h-[0.8rem]"),children:r?o.jsx(fWe,{}):o.jsx(dWe,{})})})}function pEn({span:e,spanUI:t,isFaded:r,depth:n=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:l,isRootSpan:c,isExpanded:u,toggleChildren:d}){return o.jsxs("div",{className:"flex overflow-x-auto",style:{paddingLeft:`${n*1.5}rem`},children:[!c&&o.jsx("button",{onClick:()=>d?.(),disabled:!l,className:Z({"cursor-default":!l,"cursor-pointer":l}),children:o.jsx(hEn,{isLastChild:i,hasChildren:!!l,expanded:u})}),o.jsx("button",{className:"truncate",onClick:()=>s?.(e.id),children:e.name})]})}function Kwt({span:e,depth:t=0,onSpanClick:r,selectedSpanId:n,isLastChild:s,overallLatency:a,overallStartTime:i,overallEndTime:l,fadedTypes:c,searchPhrase:u,featuredSpanIds:d,expandedSpanIds:f,setExpandedSpanIds:h}){const p=e.spans&&e.spans.length>0,m=e.spans?e.spans.length:0,g=Ywt(e),y=g.length,x=t===0,w=Xwt(e?.type),O=f?f.includes(e.id):!1,k=d&&d.length>0?!d.includes(e.id):!1,E=(c&&c.length>0?c.includes(w?.typePrefix||""):!1)||k;b.useEffect(()=>{x&&h?.([e.id])},[x,e.id,h]),b.useEffect(()=>{if(!d||!e.spans||e.spans.length===0)return;const I=e.spans.some(P=>d.includes(P.id));!O&&I&&T()},[d,e.spans,e.id,O,h,f]);const T=()=>{if(!(!h||!f))if(O){const I=[e.id,...g];h(f.filter(P=>!I.includes(P)))}else h([...f,e.id])},j=()=>{!h||!f||h([...f,e.id,...g])},A=g.every(I=>f?.includes(I));return o.jsxs(o.Fragment,{children:[o.jsx(pEn,{span:e,spanUI:w,isFaded:E,depth:t,onSpanClick:r,selectedSpanId:n,isLastChild:s,hasChildren:p,isRootSpan:x,isExpanded:O,toggleChildren:T}),o.jsx(fEn,{isSelected:n===e.id,isFaded:E,isExpanded:O,toggleChildren:T,expandAllDescendants:j,totalDescendants:y,allDescendantsExpanded:A,numOfChildren:m}),p&&O&&e.spans?.map((I,P,R)=>{const B=P===R.length-1;return o.jsx(Kwt,{span:I,depth:t+1,onSpanClick:r,selectedSpanId:n,isLastChild:B,overallLatency:a,overallStartTime:i,fadedTypes:c,searchPhrase:u,expandedSpanIds:f,setExpandedSpanIds:h,featuredSpanIds:d},I.id)})]})}function mEn({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:r,isLoading:n,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:l}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"",d=e?.[0]?.endTime||"";return o.jsx(o.Fragment,{children:n?o.jsxs("div",{className:Z("flex items-center text-ui-md gap-4 bg-surface3/50 rounded-md p-6 justify-center text-neutral3","[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"),children:[o.jsx(It,{})," Loading Trace Timeline ..."]}):o.jsx("div",{className:"grid grid-cols-[1fr_auto]",children:e?.map(f=>o.jsx(Kwt,{span:f,onSpanClick:t,selectedSpanId:r,overallLatency:c,overallStartTime:u,overallEndTime:d,fadedTypes:s,featuredSpanIds:l,expandedSpanIds:a,setExpandedSpanIds:i},f.id))})})}function gEn({spans:e=[],fadedTypes:t,onLegendClick:r,onLegendReset:n,onSearchPhraseChange:s,traceId:a}){const[i,l]=b.useState("");b.useEffect(()=>{l("")},[a]);const c=l8e.filter(h=>e.some(p=>p?.spanType?.startsWith(h)))||[],u=e.some(h=>!l8e.some(m=>h?.spanType?.startsWith(m))),d=h=>{r?.(h)};b.useEffect(()=>{f(i)},[i,s]);const f=QJe(h=>{s?.(h)},1e3);return o.jsxs("div",{className:"flex gap-3 items-center justify-between",children:[o.jsx("div",{className:"flex",children:o.jsx(Cx,{name:"search-spans",label:"Find span by name",labelIsHidden:!0,placeholder:"Look for span name",value:i,onChange:h=>{l(h.target.value)},onReset:()=>l("")})}),o.jsxs(Wlt,{children:[c.map(h=>{const p=Xwt(h),m=t?.includes(h);return o.jsx(b.Fragment,{children:o.jsxs(ve,{onClick:()=>d(h),className:m?"opacity-40":"",style:{color:m?void 0:p?.color,backgroundColor:p?.bgColor},children:[p?.icon&&o.jsx(Ce,{children:p.icon}),p?.label]})},h)}),u&&o.jsxs(ve,{onClick:()=>d("other"),className:t?.includes("other")?"opacity-40":"",children:[o.jsx(Ce,{children:o.jsx(H6,{})}),"Other"]}),o.jsx(ve,{onClick:n,disabled:t?.length===0,children:o.jsx(Ce,{children:o.jsx(vn,{})})})]})]})}function yEn({traceId:e,selectedSpanId:t,onSpanSelect:r,onClose:n}){const{data:s,isLoading:a}=oye(e),i=s?.spans??[],[l,c]=b.useState(""),[u,d]=b.useState([]),[f,h]=b.useState([]),[p,m]=b.useState([]),g=b.useMemo(()=>dEn(i),[i]);b.useEffect(()=>{if(l.trim()===""){h([]);return}const O=l.toLowerCase(),k=i.filter(_=>_.name.toLowerCase().includes(O)).map(_=>_.spanId);h(k)},[l,i]),b.useEffect(()=>{c(""),d([]),h([]),m([])},[e]);const y=O=>{r?.(t===O?void 0:O)},x=O=>{d(k=>k.includes(O)?k.filter(_=>_!==O):[...k,O])},w=()=>{d([])};return o.jsxs(o.Fragment,{children:[o.jsx(gr.Toolbar,{children:o.jsx(ve,{onClick:n,"aria-label":"Close trace panel",children:o.jsx(vn,{})})}),o.jsxs(gr.Content,{children:[o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(Wi,{})," Trace ",Yd(e)]})})}),o.jsx(gEn,{spans:i,fadedTypes:u,onLegendClick:x,onLegendReset:w,searchPhrase:l,onSearchPhraseChange:c,traceId:e}),o.jsx(mEn,{hierarchicalSpans:g,onSpanClick:y,selectedSpanId:t,isLoading:a,fadedTypes:u,expandedSpanIds:p,setExpandedSpanIds:m,featuredSpanIds:f})]})]})}function vEn({results:e,isLoading:t,featuredResultId:r,onResultClick:n,columns:s,scoresByItemId:a,scorerIds:i,setEndOfListElement:l,isFetchingNextPage:c,hasNextPage:u}){const d=s.map(f=>f.size).join(" ");return t?o.jsxs(xe,{columns:d,children:[o.jsx(xe.Top,{children:s.map(f=>o.jsx(xe.TopCell,{children:f.label},f.name))}),o.jsx("div",{className:"flex items-center justify-center py-20 col-span-full",children:o.jsx(It,{})})]}):e.length===0?o.jsxs(xe,{columns:d,children:[o.jsx(xe.Top,{children:s.map(f=>o.jsx(xe.TopCell,{children:f.label},f.name))}),o.jsx(xe.NoMatch,{message:"No results yet"})]}):o.jsxs(xe,{columns:d,children:[o.jsx(xe.Top,{children:s.map(f=>o.jsx(xe.TopCell,{children:f.label},f.name))}),o.jsxs(xe.Rows,{children:[e.map(f=>{const h=!!f.error,p=f.id===r;return o.jsxs(xe.Row,{onClick:()=>n(f.id),selected:p,children:[o.jsx(xe.TextCell,{children:o.jsx("span",{className:"truncate block font-mono",children:f.itemId})}),o.jsx(xe.Cell,{children:o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("div",{className:"flex items-center justify-center w-10 relative bg-transparent h-full",children:o.jsx("div",{className:Z("w-2 h-2 rounded-full",h?"bg-red-700":"bg-green-600")})})}),o.jsx(Wr,{children:h?"Error":"Success"})]})}),s.some(m=>m.name==="input")&&o.jsx(xe.TextCell,{children:o.jsx("span",{className:"truncate block font-mono",children:xEn(bEn(f.input),200)})}),i?.map(m=>{const y=a?.[f.itemId]?.find(x=>x.scorerId===m);return o.jsx(xe.TextCell,{children:o.jsx("span",{className:"font-mono",children:y!=null?y.score.toFixed(3):"-"})},m)})]},f.id)}),o.jsxs("div",{ref:l,className:"h-1 col-span-full",children:[c&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(It,{})}),!u&&e.length>0&&o.jsx(me,{variant:"ui-xs",className:"text-icon3 text-center py-4 block",children:"All results loaded"})]})]})]})}function bEn(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function xEn(e,t){return e.length<=t?e:e.slice(0,t-1)+"..."}function wEn(e){const t=e.scorer;return t?.hasJudge===!1?!0:t?.hasJudge===!0?!1:!e.preprocessPrompt&&!e.analyzePrompt&&!e.generateScorePrompt&&!e.generateReasonPrompt}function SEn({score:e,onNext:t,onPrevious:r,onClose:n}){const s=wEn(e),a=s?"N/A — code-based scorer":"N/A — step not configured";return o.jsxs(o.Fragment,{children:[o.jsxs(gr.Toolbar,{children:[o.jsx(FE,{onPrevious:r,onNext:t,previousAriaLabel:"View previous score details",nextAriaLabel:"View next score details"}),o.jsx(ve,{onClick:n,"aria-label":"Close score details",children:o.jsx(vn,{})})]}),o.jsxs(gr.Content,{children:[o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(Hs,{})," ",e.scorerId]})})}),o.jsxs(bS,{children:[o.jsx(Xt.CodeSection,{title:`Score: ${e.score}`,icon:o.jsx(Hs,{}),codeStr:e.reason||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(wx,{}),codeStr:JSON.stringify(e.input??null,null,2)}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(yc,{}),codeStr:JSON.stringify(e.output??null,null,2)}),!s&&o.jsxs(o.Fragment,{children:[o.jsx(Xt.CodeSection,{title:"Preprocess Prompt",icon:o.jsx(ac,{}),codeStr:e.preprocessPrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Analyze Prompt",icon:o.jsx(ac,{}),codeStr:e.analyzePrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Generate Score Prompt",icon:o.jsx(ac,{}),codeStr:e.generateScorePrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Generate Reason Prompt",icon:o.jsx(ac,{}),codeStr:e.generateReasonPrompt||a,simplified:!0})]})]})]})]})}const u8e=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"avg",label:"Avg Score",size:"1fr"},{name:"count",label:"Items Scored",size:"1fr"}];function OEn({scoresByItemId:e,experimentStatus:t}){const r=b.useMemo(()=>{if(!e)return[];const n={};for(const s of Object.values(e))for(const a of s)n[a.scorerId]||(n[a.scorerId]={sum:0,count:0}),n[a.scorerId].sum+=a.score,n[a.scorerId].count++;return Object.entries(n).map(([s,{sum:a,count:i}])=>({scorerId:s,avg:a/i,count:i})).sort((s,a)=>s.scorerId.localeCompare(a.scorerId))},[e]);if(r.length===0){const n=t==="running"||t==="pending",s=e!==void 0;let a,i;return n?(a="Experiment in progress",i="Summary metrics will appear here once the experiment completes."):s?(a="No scorers configured",i="Add scorers when triggering an experiment to evaluate results and see summary metrics here."):(a="Loading scores",i="Fetching scorer results…"),o.jsx("div",{className:"flex h-full items-center justify-center py-12",children:o.jsx(li,{iconSlot:o.jsx(Hs,{className:"w-8 h-8 text-neutral3"}),titleSlot:a,descriptionSlot:i})})}return o.jsxs(At,{children:[o.jsxs(At.Header,{columns:u8e,children:[o.jsx(At.HeaderCol,{children:"Scorer"}),o.jsx(At.HeaderCol,{children:"Avg Score"}),o.jsx(At.HeaderCol,{children:"Items Scored"})]}),o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:r.map(({scorerId:n,avg:s,count:a})=>o.jsxs(At.Row,{columns:u8e,children:[o.jsx(At.TextCell,{children:n}),o.jsx(At.TextCell,{className:"font-mono",children:s.toFixed(3)}),o.jsx(At.TextCell,{className:"font-mono",children:a})]},n))})})]})}function Jwt({experimentId:e,experimentStatus:t,results:r,isLoading:n,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i}){const[l,c]=b.useState(null),[u,d]=b.useState(null),[f,h]=b.useState(void 0),[p,m]=b.useState(null),g=r.find(z=>z.id===l)??null,{data:y}=L0t(e,t),x=b.useMemo(()=>{if(!y)return[];const z=new Set;for(const V of Object.values(y))for(const W of V)z.add(W.scorerId);return[...z].sort()},[y]),{data:w}=oye(u),O=w?.spans??[],k=()=>{if(!f)return;const z=O.findIndex(V=>V.spanId===f);if(z>=0&&z<O.length-1)return()=>h(O[z+1].spanId)},_=()=>{if(!f)return;const z=O.findIndex(V=>V.spanId===f);if(z>0)return()=>h(O[z-1].spanId)},E=z=>{c(z),d(null),h(void 0),m(null)},T=z=>{E(z===l?null:z)},j=()=>{E(null)},A=()=>{if(!g)return;const z=r.findIndex(V=>V.id===g.id);if(z>=0&&z<r.length-1)return()=>E(r[z+1].id)},I=()=>{if(!g)return;const z=r.findIndex(V=>V.id===g.id);if(z>0)return()=>E(r[z-1].id)},P=g?y?.[g.itemId]:void 0,R=P?.find(z=>z.id===p)??null,B=z=>{m(z===p?null:z),d(null),h(void 0)},D=()=>{if(!p||!P)return;const z=P.findIndex(V=>V.id===p);if(z>=0&&z<P.length-1)return()=>m(P[z+1].id)},F=()=>{if(!p||!P)return;const z=P.findIndex(V=>V.id===p);if(z>0)return()=>m(P[z-1].id)},U=b.useMemo(()=>[{name:"itemId",label:"Item ID",size:"5rem"},{name:"status",label:"Status",size:"3rem"},{name:"input",label:"Input",size:"1fr"},...l?[]:x.map(z=>({name:z,label:z,size:"1fr"}))],[l,x]);return o.jsxs(wf,{defaultTab:"summary",className:"grid grid-rows-[auto_1fr] h-full overflow-hidden",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"summary",children:"Summary"}),o.jsx(vs,{value:"results",children:"Results"})]}),o.jsx(Ns,{value:"summary",className:"overflow-y-auto mt-5",children:o.jsx(OEn,{scoresByItemId:y,experimentStatus:t})}),o.jsx(Ns,{value:"results",className:"grid overflow-hidden mt-5",children:o.jsxs(Xd,{className:g?"grid-cols-[1fr_2fr]":void 0,children:[o.jsx(gr,{children:o.jsx(vEn,{results:r,isLoading:n,featuredResultId:l,onResultClick:T,columns:U,scoresByItemId:y,scorerIds:l?void 0:x,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i})}),g&&o.jsxs(DPr,{numOfColumns:1+(!u&&p?1:0)+(u?1:0)+(f?1:0),minColumnWidth:"35rem",children:[g&&o.jsx(gr,{withLeftSeparator:!0,children:o.jsx(lEn,{result:g,scores:P,onPrevious:I(),onNext:A(),onClose:j,onScoreClick:B,featuredScoreId:p,onShowTrace:()=>{d(g.traceId??null),h(void 0),m(null)}})}),g&&!u&&R&&o.jsx(gr,{withLeftSeparator:!0,children:o.jsx(SEn,{score:R,onNext:D(),onPrevious:F(),onClose:()=>m(null)})}),g&&u&&o.jsx(gr,{withLeftSeparator:!0,children:o.jsx(yEn,{traceId:u,selectedSpanId:f,onSpanSelect:h,onClose:()=>{d(null),h(void 0)}})}),g&&u&&f&&o.jsx(gr,{withLeftSeparator:!0,children:o.jsx(uEn,{traceId:u,spanId:f,onNext:k(),onPrevious:_(),onClose:()=>h(void 0)})})]})]})})]})}const kEn={pending:o.jsx(hE,{}),running:o.jsx(KN,{}),completed:o.jsx(ra,{}),failed:o.jsx(vn,{})};function _En({experiment:e,className:t}){const r=e.status,n=e.totalItems-e.succeededCount-e.failedCount;return o.jsxs("div",{className:Z("grid justify-items-end gap-3",t),children:[o.jsxs("div",{className:"flex p-1 px-3 text-ui-lg capitalize text-neutral4 gap-2 items-center bg-surface5 rounded-lg ",children:[o.jsx("span",{className:Z("w-5 h-5 flex items-center justify-center rounded-full text-black","[&>svg]:w-4 [&>svg]:h-4",{"bg-green-700":r==="completed","bg-red-700":r==="failed","bg-cyan-600":r==="running","bg-yellow-600":r==="pending"}),children:kEn[r]}),e.status]}),o.jsxs("div",{className:Z("flex items-center gap-3 text-neutral3 text-ui-md ","[&>span]:flex [&>span]:gap-1 [&>span]:items-center ","[&_b]:text-neutral4 [&_b]:font-semibold"),children:[o.jsxs("span",{children:["Total: ",o.jsx("b",{children:e.totalItems})]}),o.jsxs("span",{children:["Succeeded: ",o.jsx("b",{children:e.succeededCount})]}),o.jsxs("span",{children:["Failed: ",o.jsx("b",{children:e.failedCount})]}),(r==="pending"||r==="running")&&o.jsxs("span",{children:["Pending: ",o.jsx("b",{children:n})]})]})]})}function eSt({experimentId:e,experiment:t}){const{Link:r,paths:n}=lr(),{data:s}=Bp(),{data:a}=Cv(),{data:i}=_f(),l=()=>{switch(t.targetType){case"agent":return n.agentLink(t.targetId);case"workflow":return n.workflowLink(t.targetId);case"scorer":return n.scorerLink(t.targetId);default:return"#"}},c=()=>{const u=t.targetId;if(!u)return u;switch(t.targetType){case"agent":return s?.[u]?.name??u;case"workflow":return a?.[u]?.name??u;case"scorer":return i?.[u]?.scorer?.config?.name??u;default:return u}};return o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(pWe,{}),e," ",e&&o.jsx(Ya,{content:e})]}),o.jsxs(Ar.Description,{children:[o.jsxs(us,{children:[o.jsx(s_,{})," Created at ",or(new Date(t.createdAt),"MMM d, yyyy 'at' h:mm a")]}),t.completedAt&&o.jsxs(us,{children:[o.jsx(s_,{})," Completed at ",or(new Date(t.completedAt),"MMM d, yyyy 'at' h:mm a")]})]}),o.jsxs(Ar.Description,{children:[o.jsxs(us,{children:[o.jsx($Bt,{})," Target",o.jsx(r,{href:l(),children:c()})]}),t.agentVersion&&o.jsxs(us,{children:[o.jsx(W6,{})," Version",t.targetType==="agent"&&t.targetId?o.jsx(r,{href:`${n.agentLink(t.targetId)}/editor?version=${encodeURIComponent(t.agentVersion)}`,className:"font-mono text-xs underline hover:text-accent1",children:t.agentVersion}):o.jsx("span",{className:"font-mono text-xs",children:t.agentVersion}),o.jsx(Ya,{content:t.agentVersion})]})]})]}),o.jsx(Ar.Column,{children:o.jsx(_En,{experiment:t})})]})}function lye({delta:e}){const t=e>0?o.jsx($a,{size:"small",color:"green",intensity:"muted",children:o.jsx(q6,{})}):e<0?o.jsx($a,{size:"small",color:"red",intensity:"muted",children:o.jsx(lce,{})}):null;return o.jsxs("span",{className:Z("font-mono text-sm text-neutral4 min-w-20"),children:[o.jsx("span",{className:"w-3 inline-block",children:e>0?"+ ":e<0?"- ":""}),Math.abs(e).toFixed(2)," ",t]})}function fL(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function EEn({item:e,baselineId:t,contenderId:r,baselineVersion:n,contenderVersion:s,onPrevious:a,onNext:i,onClose:l}){const c=e.results[t],u=e.results[r],d=!!(c&&u),f=new Set;if(c)for(const p of Object.keys(c.scores))f.add(p);if(u)for(const p of Object.keys(u.scores))f.add(p);const h=[...f].sort();return o.jsxs(gr,{withLeftSeparator:!0,children:[o.jsxs(gr.Toolbar,{children:[o.jsx(FE,{onPrevious:a,onNext:i,previousAriaLabel:"Previous comparison item",nextAriaLabel:"Next comparison item"}),o.jsx(ws,{children:o.jsx(ve,{onClick:l,"aria-label":"Close comparison detail panel",children:o.jsx(vn,{})})})]}),o.jsxs(gr.Content,{className:"pb-6",children:[o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(wx,{})," ",e.itemId]})})}),d?o.jsx(o.Fragment,{children:o.jsxs(bS,{children:[h.length>0&&o.jsxs("div",{className:"grid gap-3",children:[o.jsx("h4",{className:"text-sm font-medium text-neutral5",children:"Scores"}),o.jsx("div",{className:"grid gap-2",children:h.map(p=>{const m=c?.scores[p]??null,g=u?.scores[p]??null,y=m!=null&&g!=null?g-m:null;return o.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2 rounded-lg bg-surface2",children:[o.jsx("span",{className:"text-sm text-neutral5 font-medium",children:p}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"text-sm text-neutral3",children:[m!=null?m.toFixed(3):"-"," →"," ",g!=null?g.toFixed(3):"-"]}),y!=null&&o.jsx(lye,{delta:y})]})]},p)})})]}),o.jsx(Xt.CodeSection,{title:o.jsxs(o.Fragment,{children:[o.jsx($a,{color:"purple",children:"Baseline "})," Experiment Output"]}),icon:o.jsx(yc,{}),codeStr:fL(c?.output)}),o.jsx(Xt.CodeSection,{title:o.jsxs(o.Fragment,{children:[o.jsx($a,{color:"cyan",children:"Contender "})," Experiment Output"]}),icon:o.jsx(yc,{}),codeStr:fL(u?.output)}),o.jsx(Xt.CodeSection,{title:"Item Input",icon:o.jsx(wp,{}),codeStr:fL(e.input)}),o.jsx(Xt.CodeSection,{title:"Item Ground Truth",icon:o.jsx(NWe,{}),codeStr:fL(e.groundTruth)})]})}):o.jsxs(hl,{variant:"warning",children:[o.jsx(gh,{}),o.jsx(hl.Message,{children:(()=>{const p=c?"Contender":"Baseline",m=c?s:n;return o.jsxs(o.Fragment,{children:["The ",p," experiment was run against dataset",m!=null?` v. ${m}`:"",", which does not contain this item. Comparison is not available."]})})()})]})]})]})}function CEn({items:e,baselineId:t,contenderId:r,scorerIds:n,featuredItemId:s,columns:a,onItemClick:i}){return o.jsx(gr,{children:o.jsxs(At,{children:[o.jsxs(At.Header,{columns:a,children:[o.jsx(At.HeaderCol,{children:"Item ID"}),!s&&n.map(l=>o.jsx(At.HeaderCol,{className:"flex justify-center",children:l},l))]}),o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:e.map(l=>{const c=l.results[t],u=l.results[r],d=!!(c&&u);return o.jsx(At.Row,{children:o.jsxs(At.RowButton,{item:{id:l.itemId},columns:a,isFeatured:s===l.itemId,onClick:i,children:[o.jsx(At.IdCell,{id:l.itemId,className:d?"":"text-neutral1"}),!s&&o.jsx(o.Fragment,{children:n.map(f=>{const h=c?.scores[f]??null,p=u?.scores[f]??null,m=h!=null&&p!=null?p-h:null;return o.jsx(At.Cell,{className:"flex items-center gap-5 justify-center font-mono",children:m!=null?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex items-center text-neutral2 min-w-24",children:[h?.toFixed(2)," → ",p?.toFixed(2)]}),o.jsx(lye,{delta:m})]}):o.jsx("span",{className:"text-neutral1",children:"-"})},f)})})]})},l.itemId)})})})]})})}const jEn={baseline:{label:"Baseline",color:"purple",customStyle:"items-end justify-items-end [&>div]:justify-end border-r-0 rounded-r-none"},contender:{label:"Contender",color:"cyan",customStyle:"items-start justify-items-start [&>div]:justify-start border-l-0 rounded-l-none"}};function d8e({datasetId:e,experiment:t,type:r}){const{Link:n}=lr(),{label:s,color:a,customStyle:i}=jEn[r];if(!t)return null;const l=t.createdAt?new Date(t.createdAt):null;return o.jsxs("div",{className:`grid border-2 border-border1 rounded-lg p-5 gap-3 ${i}`,children:[o.jsxs("div",{className:"flex items-center gap-3 w-full overflow-clip",children:[r==="contender"&&o.jsxs($a,{size:"small",color:a,children:[s,o.jsx(qd,{})]}),o.jsx(ve,{as:n,href:`/datasets/${e}/experiments/${t.id}`,children:o.jsx("span",{className:"truncate min-w-0",children:t.id})}),r==="baseline"&&o.jsxs($a,{size:"small",color:a,children:[o.jsx(xp,{})," ",s]})]}),o.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-ui-sm text-neutral3",children:[o.jsxs(us,{children:[o.jsx(NWe,{})," ",t.targetType," / ",t.targetId]}),o.jsxs(us,{children:[o.jsx(SWe,{})," v",t.datasetVersion??"—"]}),l&&o.jsxs(us,{children:[o.jsx(cce,{})," ",or(l,"MMM d, yyyy HH:mm")]})]})]})}function TEn({datasetId:e,experimentIdA:t,experimentIdB:r,onSwap:n}){const[s,a]=b.useState(null),{data:i,isLoading:l,error:c}=qkn(e,t,r),{data:u}=r6(e,t),{data:d}=r6(e,r),f=u&&d&&u.datasetVersion!==d.datasetVersion,h=b.useMemo(()=>{if(!i)return[];const T=new Set;for(const j of i.items)for(const A of Object.values(j.results))if(A)for(const I of Object.keys(A.scores))T.add(I);return[...T].sort()},[i]),p=b.useMemo(()=>{if(!i||h.length===0)return[];const T=i.baselineId,j=t===T?r:t;return h.map(A=>{let I=0,P=0,R=0,B=0;for(const z of i.items){const V=z.results[T]?.scores[A],W=z.results[j]?.scores[A];V!=null&&(I+=V,R++),W!=null&&(P+=W,B++)}const D=R>0?I/R:null,F=B>0?P/B:null,U=D!=null&&F!=null?F-D:null;return{scorerId:A,avgA:D,avgB:F,delta:U}})},[i,h,t,r]),m=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"baselineAvg",label:"Baseline Avg",size:"1fr"},{name:"comparisonAvg",label:"Comparison Avg",size:"1fr"},{name:"delta",label:"Delta",size:"1fr"}],g=b.useMemo(()=>[{name:"itemId",label:"Item ID",size:"8rem"},...s?[]:h.map(T=>({name:T,label:T,size:"1fr"}))],[h,s]),y=i?.items.find(T=>T.itemId===s)??null,x=T=>{a(T===s?null:T)},w=()=>{a(null)},O=()=>{if(!i||!s)return;const T=i.items.findIndex(j=>j.itemId===s);if(T>=0&&T<i.items.length-1)return()=>a(i.items[T+1].itemId)},k=()=>{if(!i||!s)return;const T=i.items.findIndex(j=>j.itemId===s);if(T>0)return()=>a(i.items[T-1].itemId)};if(l)return o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx(It,{})});if(c)return o.jsxs(hl,{variant:"warning",children:[o.jsx(gh,{}),o.jsxs(hl.Column,{children:[o.jsx(hl.Title,{children:"Error loading comparison"}),o.jsx(hl.Message,{children:c instanceof Error?c.message:"Unknown error"})]})]});if(!i||i.items.length===0)return o.jsx("div",{className:"text-neutral4 text-sm text-center py-8",children:"No comparison data"});const _=i.baselineId,E=t===_?r:t;return o.jsxs("div",{className:"grid gap-10",children:[u&&d&&o.jsxs("div",{className:Z("relative grid xl:grid-cols-[1fr_auto_1fr] gap-4 xl:gap-0"),children:[o.jsx(d8e,{datasetId:e,experiment:u,type:"baseline"}),o.jsx("div",{className:"relative flex items-center justify-center px-[2vw] before:absolute before:inset-y-0 before:left-1/2 before:-translate-x-1/2 before:w-[2px] before:bg-border1",children:o.jsx("div",{className:"relative z-1 bg-surface2 rounded-lg p-2",children:o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(ve,{onClick:n,children:"VS"})}),o.jsx(Wr,{children:"Switch the order"})]})})}),o.jsx(d8e,{datasetId:e,experiment:d,type:"contender"})]}),f&&o.jsxs(hl,{variant:"warning",children:[o.jsx(gh,{}),o.jsxs(hl.Message,{children:[o.jsx("strong",{children:"Version mismatch!"})," These experiments used different dataset versions (v",u.datasetVersion," vs v",d.datasetVersion,"). Results may not be directly comparable."]})]}),p.length>0&&o.jsxs(At,{children:[o.jsxs(At.Header,{columns:m,children:[o.jsx(At.HeaderCol,{children:"Scorer"}),o.jsx(At.HeaderCol,{className:"flex justify-center",children:o.jsxs(aAe,{children:[o.jsx($a,{color:"purple",size:"small",intensity:"muted",children:"Baseline"}),o.jsx($a,{color:"purple",size:"small",children:"Avg"})]})}),o.jsx(At.HeaderCol,{className:"flex justify-center",children:o.jsxs(aAe,{children:[o.jsx($a,{color:"cyan",size:"small",intensity:"muted",children:"Contender"}),o.jsx($a,{color:"cyan",size:"small",children:"Avg"})]})}),o.jsx(At.HeaderCol,{className:"flex justify-center",children:"Delta"})]}),o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:p.map(({scorerId:T,avgA:j,avgB:A,delta:I})=>o.jsxs(At.Row,{columns:m,children:[o.jsx(At.TextCell,{children:T}),o.jsx(At.TextCell,{className:"text-center font-mono",children:j!=null?j.toFixed(3):"-"}),o.jsx(At.TextCell,{className:"text-center font-mono",children:A!=null?A.toFixed(3):"-"}),o.jsx(At.TextCell,{className:"flex justify-center",children:I!=null?o.jsx(lye,{delta:I}):"-"})]},T))})})]}),o.jsxs(Xd,{className:Z({"grid-cols-[1fr_2fr]":!!y}),children:[o.jsx(CEn,{items:i.items,baselineId:_,contenderId:E,scorerIds:h,featuredItemId:s,columns:g,onItemClick:x}),!!y&&o.jsx(EEn,{item:y,baselineId:_,contenderId:E,baselineVersion:u?.datasetVersion,contenderVersion:d?.datasetVersion,onPrevious:k(),onNext:O(),onClose:w})]})]})}function NEn({datasetId:e,itemId:t,onVersionSelect:r,onCompareVersionsClick:n,activeVersion:s}){const{data:a,isLoading:i}=iye(e,t),[l,c]=b.useState(!1),[u,d]=b.useState(new Set),f=x=>{r?.(x)},h=x=>s==null?x.isLatest:x.datasetVersion===s,p=x=>{d(w=>{const O=new Set(w);if(O.has(x))O.delete(x);else if(O.size>=2){const[k]=Array.from(O);return new Set([k,x])}else O.add(x);return O})},m=()=>{c(!1),d(new Set)},g=()=>{c(!0)},y=()=>{u.size===2&&n?.([...u])};return o.jsxs(gr,{className:"min-w-56",children:[l?o.jsx(gr.Toolbar,{className:"grid justify-stretch gap-3 w-full",children:o.jsxs(ws,{children:[o.jsx(ve,{onClick:m,children:"Cancel"}),o.jsx(xs,{variant:"primary",disabled:u.size!==2,onClick:y,tooltipContent:u.size!==2?"Check 2 versions to compare":void 0,className:"grow",children:"Compare"})]})}):o.jsx(o.Fragment,{children:(a||[]).length>1&&o.jsx(gr.Toolbar,{children:o.jsxs(ve,{onClick:g,className:"w-full",children:[o.jsx(qm,{})," Compare Ver."]})})}),i?o.jsx(AEn,{}):o.jsxs(At,{children:[o.jsx(At.Header,{children:o.jsx(At.HeaderCol,{children:"Item Version History"})}),o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:a?.map(x=>{const w=String(x.datasetVersion),O=typeof x.updatedAt=="string"?new Date(x.updatedAt):x.updatedAt;return o.jsxs(At.Row,{isSelected:l&&u.has(w),children:[l&&o.jsx(At.LabelCell,{children:o.jsx(bi,{checked:u.has(w),disabled:x.isDeleted,onCheckedChange:()=>{},onClick:k=>{k.stopPropagation(),x.isDeleted||p(w)},"aria-label":`Select version ${x.datasetVersion}`})}),o.jsx(At.RowButton,{item:x,columns:[{name:"version",label:"Item Version History",size:"1fr"}],isFeatured:h(x),onClick:()=>f(x),className:"py-2",children:o.jsx(At.VersionCell,{version:x.datasetVersion,date:O,isLatest:x.isLatest,isDeleted:x.isDeleted})})]},String(x.datasetVersion))})})})]})]})}function AEn(){return o.jsxs(At,{children:[o.jsx(At.Header,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:o.jsx(At.HeaderCol,{children:"Item Version History"})}),o.jsx(At.Items,{children:Array.from({length:3}).map((e,t)=>o.jsx(At.Row,{children:o.jsx(At.RowButton,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:o.jsx(At.TextCell,{isLoading:!0,children:"Loading..."})})},t))})]})}function IEn(e,t){if(t){const r=typeof t=="string"?new Date(t):t;return`v${e} ${or(r,"MMM dd 'at' H:mm:ss a")}`}return`v${e}`}function REn({datasetId:e,versionA:t,versionB:r,onVersionChange:n}){const{data:s}=tye(e),a=(s??[]).map(i=>({value:String(i.version),label:`${IEn(i.version,i.createdAt)}${i.isCurrent?" (current)":""}`}));return o.jsxs(gr.Toolbar,{className:"grid grid-cols-[1fr_1fr_1fr_10rem] gap-4 w-full",children:[o.jsx("div",{}),o.jsx(Po,{label:"Version A",labelIsHidden:!0,name:"version-a",placeholder:"Select version",options:a,value:t??"",onValueChange:i=>n?.(i,r??"")}),o.jsx(Po,{label:"Version B",labelIsHidden:!0,name:"version-b",options:a,value:r??"",onValueChange:i=>n?.(t??"",i)}),o.jsx("div",{})]})}const PEn=[{name:"id",label:"ID",size:"1fr"},{name:"versionA",label:"Version A",size:"1fr"},{name:"versionB",label:"Version B",size:"1fr"},{name:"compare",label:"Compare",size:"10rem"}],MEn={added:{color:"blue",borderColor:"border-blue-900",icon:o.jsx(is,{}),tooltip:"Added in this version"},changed:{color:"orange",borderColor:"border-yellow-900",icon:o.jsx(TWe,{}),tooltip:"Changed in this version"},same:{color:"green",borderColor:"border-green-900",icon:o.jsx(ZBt,{}),tooltip:"Same in both versions"}};function Zee({red:e=!1,tooltip:t}){return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(A8t,{className:Z("text-neutral3/40 w-5 h-5 ",{"text-red-900":e})})}),t&&o.jsx(Wr,{children:t})]})}function W0({variant:e,version:t}){if(!e)return o.jsxs("span",{className:"text-ui-md text-neutral4",children:["v. ",t]});const{color:r,icon:n,tooltip:s}=MEn[e];return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsxs("div",{className:"grid grid-cols-[1fr_auto]",children:[t!==void 0&&o.jsxs("span",{className:"pr-3 text-ui-md text-neutral4 min-w-16 flex justify-end",children:["v. ",t]}),o.jsx($a,{color:r,size:"small",children:n})]})}),o.jsx(Wr,{children:s})]})}function DEn(e,t){return e&&t&&e.datasetVersion===t.datasetVersion?"same":e&&t&&e.datasetVersion!==t.datasetVersion?"changed":e?"added":"removed"}function LEn({datasetId:e,versionA:t,versionB:r,allItems:n,itemsAMap:s,itemsBMap:a}){const{Link:i}=lr(),l=t>r;return o.jsx(At,{children:o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:n.map(({id:c})=>{const u=s.get(c),d=a.get(c),f=DEn(u,d);return o.jsxs(At.Row,{columns:PEn,children:[o.jsx(At.IdCell,{id:c,isShortened:!1}),f!=="same"?o.jsxs(o.Fragment,{children:[u?.datasetVersion?o.jsx(At.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!d&&l?o.jsx(W0,{variant:"added",version:u.datasetVersion}):f==="changed"&&l?o.jsx(W0,{variant:"changed",version:u.datasetVersion}):o.jsx(W0,{version:u.datasetVersion})}):o.jsx(At.Cell,{className:"justify-center flex items-center",children:o.jsx(Zee,{red:l,tooltip:l?"Deleted in this version":"Not present in this version"})}),d?.datasetVersion?o.jsx(At.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!u&&!l?o.jsx(W0,{variant:"added",version:d.datasetVersion}):f==="changed"&&!l?o.jsx(W0,{variant:"changed",version:d.datasetVersion}):o.jsx(W0,{version:d.datasetVersion})}):o.jsx(At.Cell,{className:"justify-center flex items-center",children:o.jsx(Zee,{red:!l,tooltip:l?"Not present in this version":"Deleted in this version"})})]}):o.jsx(At.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"col-span-2 gap-2",children:o.jsx(W0,{variant:"same",version:d?.datasetVersion})}),f==="changed"?o.jsx(At.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}/versions?ids=${u?.datasetVersion},${d?.datasetVersion}`,children:"Compare"}):o.jsx(At.Cell,{children:o.jsx(Zee,{tooltip:o.jsxs(o.Fragment,{children:["Comparing is available",o.jsx("br",{})," only for changed items"]})})})]},c)})})})})}const f8e={needsReview:"#facc15",complete:"#22c55e"},$En=[{label:"Needs Review",color:f8e.needsReview},{label:"Reviewed",color:f8e.complete}];function FEn({reviewSummary:e,experiments:t,datasets:r,isLoading:n,isError:s}){const{data:a,maxVal:i,totalInPipeline:l}=b.useMemo(()=>{if(!e?.counts||!t)return{data:[],maxVal:0,totalInPipeline:0};const u=new Map;for(const m of t)u.set(m.id,m);const d=new Map;if(r)for(const m of r)d.set(m.id,m.name);let f=0,h=0;const p=[];for(const m of e.counts){const g=m.needsReview+m.complete;if(g===0)continue;h+=g,g>f&&(f=g);const y=u.get(m.experimentId),x=y?.datasetId?d.get(y.datasetId):void 0,w=x?`${x} · ${m.experimentId.slice(0,8)}`:m.experimentId.slice(0,8);p.push({name:w,values:[m.needsReview,m.complete]})}return{data:p,maxVal:f,totalInPipeline:h}},[e,t,r]),c=a.length>0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Review Pipeline",description:"Items in review across experiments."}),c&&o.jsx(qt.Summary,{value:String(l),label:"Items in pipeline"})]}),n?o.jsx(qt.Loading,{}):s?o.jsx(qt.Error,{message:"Failed to load review data"}):o.jsx(qt.Content,{children:c?o.jsx(E_,{data:a,segments:$En,maxVal:i,fmt:u=>String(u)}):o.jsx(qt.NoData,{message:"No items have been sent to review yet"})})]})}function cye(){const e=Ze();return kt({queryKey:["experiment-review-summary"],queryFn:()=>e.getExperimentReviewSummary()})}function tSt(e){const t=new Map;if(!e?.counts)return t;for(const r of e.counts)t.set(r.experimentId,{needsReview:r.needsReview,complete:r.complete,total:r.total});return t}function zEn(e,t){const r=new Map,n=tSt(e);if(!n.size||!t)return r;for(const s of t){const a=n.get(s.id);if(!a||!s.datasetId||a.needsReview+a.complete===0)continue;const l=r.get(s.datasetId)??{needsReview:0,complete:0};l.needsReview+=a.needsReview,l.complete+=a.complete,r.set(s.datasetId,l)}return r}function BEn(e){return e?.counts?e.counts.reduce((t,r)=>({needsReview:t.needsReview+r.needsReview,complete:t.complete+r.complete,inPipeline:t.inPipeline+r.needsReview+r.complete}),{needsReview:0,complete:0,inPipeline:0}):{needsReview:0,complete:0,inPipeline:0}}const UEn=10;function VEn(){const[e,t]=b.useState(!1),[r,n]=b.useState(""),[s,a]=b.useState("all"),[i,l]=b.useState("all"),[c,u]=b.useState("all"),[d,f]=b.useState(0),{data:h,isLoading:p,error:m}=Rh({page:d,perPage:UEn}),{data:g,isLoading:y,error:x}=t8(),{data:w}=cye(),O=b.useMemo(()=>h?.datasets??[],[h?.datasets]),k=h?.pagination?.hasMore??!1,_=b.useMemo(()=>g?.experiments??[],[g?.experiments]),E=b.useMemo(()=>l_n(O),[O]),T=b.useMemo(()=>zEn(w,_),[w,_]),j=p||y,A=m||x,I=()=>t(!0),P=b.useCallback(()=>f(W=>W+1),[]),R=b.useCallback(()=>f(W=>Math.max(0,W-1)),[]),B=b.useCallback(W=>{n(W),f(0)},[]),D=b.useCallback(W=>{a(W),f(0)},[]),F=b.useCallback(W=>{l(W),f(0)},[]),U=b.useCallback(W=>{u(W),f(0)},[]);if(A&&As(A))return o.jsx(Vr,{title:"Datasets",icon:o.jsx(Ca,{}),children:o.jsx(na,{})});if(A&&Os(A))return o.jsx(Vr,{title:"Datasets",icon:o.jsx(Ca,{}),children:o.jsx(Zs,{resource:"datasets"})});if(A)return o.jsx(Vr,{title:"Datasets",icon:o.jsx(Ca,{}),children:o.jsx(sd,{title:"Failed to load datasets",message:A.message})});if(O.length===0&&!j&&d===0)return o.jsxs(o.Fragment,{children:[o.jsx(Vr,{title:"Datasets",icon:o.jsx(Ca,{}),children:o.jsx(c_n,{onCreateClick:I})}),o.jsx(poe,{open:e,onOpenChange:t})]});const z=s!=="all"||i!=="all"||c!=="all"||r!=="",V=()=>{n(""),a("all"),l("all"),u("all"),f(0)};return o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:j,children:[o.jsx(Ca,{})," Datasets"]})})}),o.jsxs(Ft.Column,{className:"flex justify-end gap-2",children:[o.jsx(xs,{onClick:I,tooltipContent:"Create a dataset",children:o.jsx(is,{})}),o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Datasets documentation",children:o.jsx(Io,{})})]})]}),o.jsx(d_n,{search:r,onSearchChange:B,targetFilter:s,onTargetFilterChange:D,experimentFilter:i,onExperimentFilterChange:F,tagFilter:c,onTagFilterChange:U,tagOptions:E,onReset:V,hasActiveFilters:z})]}),o.jsx(a_n,{datasets:O,experiments:_,reviewByDataset:T,isLoading:j,search:r,targetFilter:s,experimentFilter:i,tagFilter:c,currentPage:d,hasMore:k,onNextPage:P,onPrevPage:R}),o.jsx(poe,{open:e,onOpenChange:t})]})}const qEn=new Set(["items","experiments","review"]);function HEn(){const{datasetId:e}=ba(),t=ad(),[r,n]=vo(),s=r.get("tab"),a=s&&qEn.has(s)?s:"items",i=E=>{n(E==="items"?{}:{tab:E},{replace:!0})},[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,y]=b.useState(null),{data:x,error:w}=jg(e??"");if(!e)return o.jsx(Ir,{children:o.jsx(of,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&As(w))return o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})});if(w&&Os(w))return o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})});const O=E=>{t(`/datasets/${e}/experiments/${E}`)},k=()=>{t("/datasets")},_=E=>{y(E?.version??null)};return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:o.jsx(y_n,{value:e,variant:"ghost"})})]})}),o.jsxs(of,{className:"content-stretch",children:[o.jsx(tEn,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>h(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:_,initialTab:a,onTabChange:i,experimentTriggerSlot:o.jsxs(ve,{variant:"primary",onClick:()=>c(!0),children:[o.jsx(Sx,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),o.jsx(oEn,{datasetId:e,version:g??void 0,open:l,onOpenChange:c,onSuccess:O}),o.jsx(nEn,{datasetId:e,open:u,onOpenChange:d}),x&&o.jsx(m_n,{open:f,onOpenChange:h,dataset:{id:x.id,name:x.name,description:x?.description||"",inputSchema:x.inputSchema,groundTruthSchema:x.groundTruthSchema}}),x&&o.jsx(g_n,{open:p,onOpenChange:m,datasetId:x.id,datasetName:x.name,onSuccess:k})]})]})}function QEn(){const{datasetId:e,experimentId:t}=ba(),{data:r}=jg(e??""),{data:n,isLoading:s,error:a}=r6(e,t),{data:i,isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=Z9({datasetId:e,experimentId:t,experimentStatus:n?.status});return!e||!t?null:s?o.jsx(Ir,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(It,{})})}):a&&As(a)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):a&&Os(a)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):a||!n?o.jsx(Ir,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",a instanceof Error?a.message:"Unknown error"]})}):o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:r?.name}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(eSt,{experimentId:t,experiment:n}),o.jsx(Jwt,{experimentId:t,experimentStatus:n?.status,results:i??[],isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function WEn(){const{datasetId:e}=ba(),[t,r]=vo(),{data:n,error:s}=jg(e??""),a=t.get("baseline")??"",i=t.get("contender")??"";return s&&As(s)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):s&&Os(s)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):!e||!a||!i?o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsxs(dr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(qm,{})}),"Compare Experiments"]})]})}),o.jsx(of,{children:o.jsxs("div",{className:"text-neutral4 text-center py-8",children:[o.jsx("p",{children:"Select two experiments to compare."}),o.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:n?.name??e?.slice(0,8)}),o.jsxs(dr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(qm,{})}),"Experiments Comparison"]})]})}),o.jsx(of,{children:o.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(qm,{})," Dataset Experiments Comparison"]}),o.jsxs(Ar.Description,{children:["Comparing"," ",o.jsx(nr,{to:`/datasets/${e}/experiments/${a}`,children:a.slice(0,8)})," vs"," ",o.jsx(nr,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),o.jsx(Ar.Column,{children:o.jsxs(ve,{as:nr,to:`/datasets/${e}`,children:[o.jsx(xp,{}),"Back to Dataset"]})})]}),o.jsx(TEn,{datasetId:e,experimentIdA:a,experimentIdB:i,onSwap:()=>{r({baseline:i,contender:a})}})]})})]})}function GEn(){const{datasetId:e,itemId:t}=ba(),{Link:r}=lr(),n=ad(),{data:s,isLoading:a,error:i}=iye(e??"",t??""),{updateItem:l,deleteItem:c}=ei(),{data:u}=jg(e??""),d=s?.[0]??null,f=d?.isDeleted??!1,[h,p]=b.useState(null),m=b.useMemo(()=>!d||f?{input:"",groundTruth:"",metadata:""}:{input:JSON.stringify(d.input,null,2),groundTruth:d.groundTruth?JSON.stringify(d.groundTruth,null,2):"",metadata:d.metadata?JSON.stringify(d.metadata,null,2):""},[d,f]),g=d?.datasetVersion??0,[y,x]=b.useState(!1),[w,O]=b.useState(m.input),[k,_]=b.useState(m.groundTruth),[E,T]=b.useState(m.metadata),[j,A]=b.useState(g);g!==j&&(A(g),O(m.input),_(m.groundTruth),T(m.metadata));const[I,P]=b.useState(!1),R=q=>{p(f?q:q.isLatest?null:q)},B=()=>{p(null)},D=!f&&h!=null,F=()=>{D||x(!0)},U=()=>{D||P(!0)},z=async()=>{if(!e||!t)return;let q;try{q=JSON.parse(w)}catch{Ue.error("Input must be valid JSON");return}let M;if(k.trim())try{M=JSON.parse(k)}catch{Ue.error("Ground Truth must be valid JSON");return}let Q;if(E.trim())try{Q=JSON.parse(E)}catch{Ue.error("Metadata must be valid JSON");return}try{await l.mutateAsync({datasetId:e,itemId:t,input:q,groundTruth:M,metadata:Q}),Ue.success("Item updated successfully"),x(!1)}catch(G){Ue.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},V=()=>{d&&(O(JSON.stringify(d.input,null,2)),_(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),T(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),Ue.success("Item deleted successfully"),P(!1),n(`/datasets/${e}`)}catch(q){Ue.error(`Failed to delete item: ${q instanceof Error?q.message:"Unknown error"}`)}},L=h??d,Y=L?{id:t??"",datasetId:e??"",datasetVersion:L.datasetVersion,input:L.input,groundTruth:L.groundTruth,metadata:L.metadata,createdAt:L.createdAt,updatedAt:L.updatedAt}:null;return i&&As(i)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):i&&Os(i)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):a?null:!e||!t||!s||s.length===0?o.jsx(Ir,{children:o.jsx(of,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):o.jsxs(o.Fragment,{children:[o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:u?.name}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Item"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(wx,{}),t," ",o.jsx(Ya,{content:t})]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:["Item of ",o.jsx(Ca,{})," ",u?.name]})}),o.jsxs(Ar.Description,{children:[o.jsxs(us,{children:[o.jsx(s_,{})," Created at"," ",d?.createdAt?or(new Date(d.createdAt),"MMM d, yyyy"):""]}),o.jsxs(us,{children:[o.jsx(qx,{})," Latest version v",d?.datasetVersion??""]})]})]}),o.jsx(Ar.Column,{children:!y&&!f&&o.jsxs(ws,{children:[o.jsxs(ve,{onClick:F,disabled:D,title:D?"Return to latest version to edit":void 0,children:[o.jsx(TWe,{})," Edit"]}),o.jsxs(ve,{onClick:U,disabled:D,title:D?"Return to latest version to delete":void 0,children:[o.jsx(Ku,{})," Delete"]})]})})]}),o.jsxs(Xd,{className:y?"grid-cols-1":"grid-cols-[1fr_auto]",children:[o.jsxs(gr,{withRightSeparator:!y,children:[f&&d&&o.jsxs(hl,{variant:"destructive",children:[o.jsx(gh,{}),o.jsxs(hl.Message,{children:["This item was deleted at version v",d.datasetVersion]})]}),!f&&D&&h&&o.jsx(o.Fragment,{children:o.jsxs(hl,{variant:"warning",children:[o.jsx(gh,{}),o.jsxs(hl.Message,{children:["Viewing version v",h.datasetVersion]}),o.jsxs(hl.Button,{onClick:B,children:[o.jsx(Xf,{})," Return to the latest version"]})]})}),y?o.jsx(Wwt,{inputValue:w,setInputValue:O,groundTruthValue:k,setGroundTruthValue:_,metadataValue:E,setMetadataValue:T,validationErrors:null,onSave:z,onCancel:V,isSaving:l.isPending}):Y?o.jsx(r8,{item:Y,Link:r}):o.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!y&&o.jsx(gr,{children:o.jsx(NEn,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:R,onCompareVersionsClick:q=>{n(`/datasets/${e}/items/${t}/versions?ids=${q.join(",")}`)},activeVersion:h?.datasetVersion??null})})]})]})})]}),o.jsx($t,{open:I,onOpenChange:P,children:o.jsxs($t.Content,{children:[o.jsxs($t.Header,{children:[o.jsx($t.Title,{children:"Delete Item"}),o.jsx($t.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),o.jsxs($t.Footer,{children:[o.jsx($t.Cancel,{children:"Cancel"}),o.jsx($t.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function h8e(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function ZEn(){const{datasetId:e}=ba(),[t,r]=vo(),n=t.get("items")?.split(",").filter(Boolean)??[],{data:s,error:a}=jg(e??""),{Link:i}=lr(),[l,c]=b.useState(!1),{data:u}=doe(e??"",n[0]??""),{data:d}=doe(e??"",n[1]??"");return a&&As(a)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):a&&Os(a)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):!e||n.length<2?o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),o.jsx(of,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two items to compare."})})})]}):o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Items"})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:`/datasets/${e}`,variant:"outline",children:[o.jsx(Ce,{children:o.jsx(xp,{})}),"Back to Dataset"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Z("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":l}),children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(qm,{}),"Compare Dataset Items"]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:["Comparing ",n.length," items of"," ",o.jsx(nr,{to:`/datasets/${e}`,className:"text-info1 hover:underline",children:s?.name||e?.slice(0,8)})]})})]}),o.jsx(Ar.Column,{children:o.jsxs(ws,{children:[o.jsxs(ve,{as:nr,to:`/datasets/${e}`,children:[o.jsx(xp,{}),"Back to Dataset"]}),o.jsx(ve,{variant:"primary",onClick:()=>c(f=>!f),children:l?o.jsxs(o.Fragment,{children:[o.jsx(bWe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(BBt,{})," Diff View"]})})]})})]}),o.jsx(Xd,{className:"grid-cols-[1fr_3vw_1fr]",children:n.map((f,h)=>o.jsxs(b.Fragment,{children:[o.jsx(YEn,{datasetId:e,itemId:f,Link:i,idx:h,itemIds:n,showContent:!l,onItemChange:p=>{const m=[...n];m[h]=p,r({items:m.join(",")})}}),h==0&&o.jsx("div",{className:Z("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),l&&u&&d&&o.jsx(mct,{codeA:h8e(u),codeB:h8e(d)})]})})]})}function YEn({datasetId:e,itemId:t,Link:r,idx:n,itemIds:s,onItemChange:a,showContent:i=!0}){const{data:l,isLoading:c}=doe(e,t),{data:u}=J_(e),d=new Set(s.filter((h,p)=>p!==n)),f=(u??[]).map(h=>({value:h.id,label:h.id,disabled:d.has(h.id)}));return o.jsxs(gr,{children:[o.jsxs(gr.Toolbar,{className:"flex gap-4",children:[o.jsx(Epe,{label:"Item",name:`compare-item-${n}`,value:t,onValueChange:a,options:f,placeholder:"Select item",labelIsHidden:!0}),o.jsxs(ve,{as:r,to:`/datasets/${e}/items/${t}`,children:[o.jsx(qx,{}),"Versions"]})]}),i&&o.jsx(gr.Content,{children:c?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):l?o.jsxs(o.Fragment,{children:[o.jsx(Gwt,{item:l}),o.jsx(r8,{item:l,Link:r})]}):o.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function p8e(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function XEn(){const{datasetId:e,itemId:t}=ba(),[r,n]=vo(),[s,a]=b.useState(!1),i=r.get("ids")?.split(",").map(Number).filter(p=>!isNaN(p)&&p>0)??[],{data:l,error:c}=jg(e??""),{Link:u}=lr(),{data:d}=iye(e??"",t??""),{data:f}=goe(e??"",t??"",i[0]??0,l?.version),{data:h}=goe(e??"",t??"",i[1]??0,l?.version);return c&&As(c)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):c&&Os(c)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):!e||!t||i.length<2?o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(of,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]}):o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:l?.name}),o.jsx(dr,{as:nr,to:`/datasets/${e}/items/${t}`,children:"Item"}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[o.jsx(Ce,{children:o.jsx(xp,{})}),"Back to Item"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Z("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":s}),children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(qm,{}),"Compare Dataset Item Versions"]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:["Comparing ",i.length," versions of"," ",o.jsx(nr,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),o.jsx(Ar.Column,{children:o.jsxs(ws,{children:[o.jsxs(ve,{as:nr,to:`/datasets/${e}/items/${t}`,children:[o.jsx(xp,{}),"Back to Item"]}),o.jsx(ve,{variant:"primary",onClick:()=>a(p=>!p),children:s?o.jsxs(o.Fragment,{children:[o.jsx(bWe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(k7t,{})," Diff View"]})})]})})]}),o.jsx(Xd,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((p,m)=>o.jsxs(b.Fragment,{children:[o.jsx(KEn,{datasetId:e,itemId:t,datasetVersion:p,latestVersion:l?.version,allVersions:d??[],versionNumbers:i,Link:u,idx:m,showContent:!s,onVersionChange:g=>{const y=[...i];y[m]=g,n({ids:y.join(",")})}}),m===0&&o.jsx("div",{className:Z("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},p))}),s&&f&&h&&o.jsx(mct,{codeA:p8e(f),codeB:p8e(h)})]})})]})}function KEn({datasetId:e,itemId:t,datasetVersion:r,latestVersion:n,allVersions:s,versionNumbers:a,Link:i,idx:l,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=goe(e,t,r,n),h=new Set(a.filter((g,y)=>y!==l)),p=s.map(g=>{const y=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:o.jsxs(o.Fragment,{children:[o.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",or(y,"MMM d, yyyy h:mm a"),g.isLatest?o.jsx($a,{color:"blue",size:"small",children:"Latest"}):null]}),disabled:h.has(g.datasetVersion)}}),m=d?{id:d.id,datasetId:e,datasetVersion:d.datasetVersion,input:d.input,groundTruth:d.groundTruth,metadata:d.metadata,createdAt:d.createdAt,updatedAt:d.updatedAt}:null;return o.jsxs(gr,{children:[o.jsxs(gr.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[o.jsx(qx,{className:"w-6 h-6 opacity-50"}),o.jsx(Epe,{label:"Version",name:`compare-version-${l}`,value:String(r),onValueChange:g=>u(Number(g)),options:p,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&o.jsx(gr.Content,{children:f?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?o.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",r," not found"]}):o.jsx(r8,{item:m,Link:i})})]})}function JEn(){const{datasetId:e}=ba(),[t]=vo(),r=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],n=ad(),{data:s,error:a}=jg(e??""),i=J_(e??"",void 0,r[0]??null),l=J_(e??"",void 0,r[1]??null),c=b.useMemo(()=>i.data??[],[i.data]),u=b.useMemo(()=>l.data??[],[l.data]),d=b.useMemo(()=>{const g=new Map;for(const y of[...c,...u])g.has(y.id)||g.set(y.id,{id:y.id,createdAt:new Date(y.createdAt)});return[...g.values()].sort((y,x)=>x.createdAt.getTime()-y.createdAt.getTime())},[c,u]),f=b.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),h=b.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(a&&As(a))return o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})});if(a&&Os(a))return o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})});if(!e||r.length<2)return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(of,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]});const p=(g,y,x)=>{n(`/datasets/${e}/items/${g}/versions?ids=${y?.datasetVersion??""},${x?.datasetVersion??""}`)},m=(g,y)=>{n(`/datasets/${e}/versions?ids=${g},${y}`,{replace:!0})};return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),o.jsxs(dr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(Z1e,{})}),"Compare Versions"]})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(Z1e,{})," Compare Dataset Versions"]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:[o.jsx(qx,{})," Comparing ",r.length," versions of"," ",s?.name||e?.slice(0,8)]})})]}),o.jsx(Ar.Column,{children:o.jsxs(ve,{as:nr,to:`/datasets/${e}`,children:[o.jsx(xp,{}),"Back to Dataset"]})})]}),o.jsx(Xd,{children:o.jsxs(gr,{children:[o.jsx(REn,{datasetId:e,versionA:String(r[0]),versionB:String(r[1]),onVersionChange:m}),o.jsx(LEn,{datasetId:e,versionA:r[0],versionB:r[1],allItems:d,itemsAMap:f,itemsBMap:h,onItemClick:p})]})})]})})]})}function eCn(e){if(!e||e.length<2)return null;const t=[...e].sort((i,l)=>new Date(i.createdAt).getTime()-new Date(l.createdAt).getTime()),r=Math.floor(t.length/2),n=r,s=t.length-r;if(n===0)return null;const a=(s-n)/n*100;return{changePct:Math.round(a*10)/10,prevValue:String(n)}}function tCn({scorers:e,datasets:t,experiments:r,avgScore:n,prevAvgScore:s,totalNeedsReview:a,isLoadingScorers:i,isLoadingDatasets:l,isLoadingExperiments:c,isLoadingScores:u,isLoadingReview:d}){const f=e?Object.keys(e).length:void 0,h=t?.length,p=r?.length,m=n!=null&&s!=null&&s!==0?{changePct:Math.round((n-s)/s*100*10)/10,prevValue:String(s)}:null,g=eCn(r);return o.jsxs(o.Fragment,{children:[o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Scorers"}),i?o.jsx(fr.Loading,{}):f!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(f)}),o.jsx(fr.NoChange,{message:"Static count"})]}):o.jsx(fr.NoData,{})]}),o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Datasets"}),l?o.jsx(fr.Loading,{}):h!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(h)}),o.jsx(fr.NoChange,{message:"Static count"})]}):o.jsx(fr.NoData,{})]}),o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Avg Score"}),u?o.jsx(fr.Loading,{}):n!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(n)}),m?o.jsx(fr.Change,{changePct:m.changePct,prevValue:m.prevValue}):o.jsx(fr.NoChange,{})]}):o.jsx(fr.NoData,{})]}),o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Experiments"}),c?o.jsx(fr.Loading,{}):p!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(p)}),g?o.jsx(fr.Change,{changePct:g.changePct,prevValue:g.prevValue}):o.jsx(fr.NoChange,{})]}):o.jsx(fr.NoData,{})]}),o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Needs Review"}),d?o.jsx(fr.Loading,{}):a!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(a)}),a>0?o.jsx(fr.NoChange,{message:"items pending review"}):o.jsx(fr.NoChange,{message:"All caught up"})]}):o.jsx(fr.NoData,{})]})]})}const rCn=[{value:"all",label:"All statuses"},{value:"completed",label:"Completed"},{value:"running",label:"Running"},{value:"failed",label:"Failed"},{value:"pending",label:"Pending"}],m8e="auto 1fr auto auto auto auto auto auto auto";function nCn(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}const sCn={completed:"success",running:"warning",failed:"error",pending:"neutral"};function aCn({experiments:e,datasets:t,reviewByExperiment:r,isLoading:n,search:s="",statusFilter:a="all",datasetFilter:i="all"}){const{paths:l,Link:c}=lr(),u=b.useMemo(()=>{const h=new Map;return t?.forEach(p=>h.set(p.id,p.name)),h},[t]),d=b.useMemo(()=>[...e].sort((h,p)=>{const m=h.createdAt?new Date(h.createdAt).getTime():0;return(p.createdAt?new Date(p.createdAt).getTime():0)-m}),[e]),f=b.useMemo(()=>{const h=s.toLowerCase();return d.filter(p=>{const m=p.datasetId?u.get(p.datasetId)??"":"",g=!h||p.id.toLowerCase().includes(h)||m.toLowerCase().includes(h)||(p.targetId??"").toLowerCase().includes(h),y=a==="all"||p.status===a,x=i==="all"||p.datasetId===i;return g&&y&&x})},[d,s,u,a,i]);return n?o.jsx(fh,{columns:m8e}):o.jsxs(xe,{columns:m8e,children:[o.jsxs(xe.Top,{children:[o.jsx(xe.TopCell,{children:"Experiment"}),o.jsx(xe.TopCell,{children:"Dataset"}),o.jsx(xe.TopCell,{children:"Target"}),o.jsx(xe.TopCell,{children:"Status"}),o.jsx(xe.TopCell,{className:"text-center",children:"Items"}),o.jsx(xe.TopCell,{className:"text-center",children:"Succeeded"}),o.jsx(xe.TopCell,{className:"text-center",children:"Failed"}),o.jsx(xe.TopCell,{className:"text-center",children:"Review"}),o.jsx(xe.TopCell,{children:"Date"})]}),f.map(h=>{const p=h.datasetId?u.get(h.datasetId)??h.datasetId.slice(0,8):"—",m=h.status??"pending",g=h.succeededCount??0,y=h.failedCount??0,x=h.totalItems??0,w=x>0?Math.round(g/x*100):0;return o.jsxs(xe.RowLink,{to:l.experimentLink(h.id),LinkComponent:c,children:[o.jsx(xe.NameCell,{className:"font-mono",children:h.id.slice(0,8)}),o.jsx(xe.TextCell,{children:p}),o.jsx(xe.Cell,{children:o.jsxs("span",{className:"truncate",children:[h.targetType," ",h.targetId]})}),o.jsx(xe.Cell,{children:o.jsx(lP,{variant:sCn[m]??"neutral",withDot:!0,children:m})}),o.jsx(xe.TextCell,{className:"text-center",children:x}),o.jsx(xe.TextCell,{className:"text-center",children:o.jsxs("span",{className:g>0?"text-accent1":"",children:[g," (",w,"%)"]})}),o.jsx(xe.TextCell,{className:"text-center",children:o.jsx("span",{className:y>0?"text-accent2":"",children:y})}),o.jsx(xe.Cell,{className:"text-center",children:(()=>{const O=r?.get(h.id);if(!O)return o.jsx("span",{className:"text-neutral2",children:"—"});const k=O.needsReview+O.complete;return k===0?o.jsx("span",{className:"text-neutral2",children:"—"}):O.needsReview>0?o.jsxs(vt,{variant:"warning",children:[O.needsReview," pending"]}):o.jsxs(vt,{variant:"success",children:[O.complete,"/",k," reviewed"]})})()}),o.jsx(xe.TextCell,{children:nCn(h.createdAt)})]},h.id)})]})}function iCn(e){return[{value:"all",label:"All datasets"},...(e??[]).map(t=>({value:t.id,label:t.name}))]}const hL={completed:"#22c55e",running:"#facc15",pending:"#fb923c",failed:"#f87171"},oCn=[{label:"Completed",color:hL.completed},{label:"Running",color:hL.running},{label:"Pending",color:hL.pending},{label:"Failed",color:hL.failed}];function lCn({experiments:e,datasets:t,isLoading:r,isError:n}){const{data:s,maxVal:a}=b.useMemo(()=>{if(!e||e.length===0)return{data:[],maxVal:0};const l=new Map;if(t)for(const f of t)l.set(f.id,f.name);const c=new Map;for(const f of e){const h=f.datasetId??"unknown";c.has(h)||c.set(h,{completed:0,running:0,pending:0,failed:0});const p=c.get(h),m=f.status;m in p&&p[m]++}let u=0;return{data:Array.from(c.entries()).map(([f,h])=>{const p=h.completed+h.running+h.pending+h.failed;return p>u&&(u=p),{name:l.get(f)??f.slice(0,12),values:[h.completed,h.running,h.pending,h.failed]}}),maxVal:u}},[e,t]),i=s.length>0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Experiments by Dataset",description:"Experiment status breakdown per dataset."}),i&&o.jsx(qt.Summary,{value:String(e?.length??0),label:"Total experiments"})]}),r?o.jsx(qt.Loading,{}):n?o.jsx(qt.Error,{message:"Failed to load experiments data"}):o.jsx(qt.Content,{children:i?o.jsx(E_,{data:s,segments:oCn,maxVal:a,fmt:l=>String(l)}):o.jsx(qt.NoData,{message:"No experiments have been run yet"})})]})}const cCn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No Experiments yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Run an experiment from a dataset to evaluate ",o.jsx("br",{}),"your agents and workflows."]}),actionSlot:o.jsx("div",{className:"flex flex-col items-center gap-2",children:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",children:["Experiments Documentation ",o.jsx(Aa,{})]})})})});function uCn({search:e,onSearchChange:t,statusFilter:r,onStatusFilterChange:n,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:i,onReset:l,hasActiveFilters:c}){return o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(Ah,{label:"Search experiments",placeholder:"Filter by experiment, dataset, or target",value:e,onSearch:t}),o.jsxs(ws,{children:[o.jsx(Po,{label:"Status",labelIsHidden:!0,name:"filter-status",options:[...rCn],value:r,onValueChange:n,className:"whitespace-nowrap"}),o.jsx(Po,{label:"Dataset",labelIsHidden:!0,name:"filter-dataset",options:i,value:s,onValueChange:a,className:"whitespace-nowrap"}),l&&c&&o.jsxs(ve,{onClick:l,size:"sm",variant:"light",children:[o.jsx(vn,{className:"size-3"})," Reset"]})]})]})}function dCn(){const{data:e,isLoading:t,error:r}=_f(),{data:n,isLoading:s,error:a}=Rh(),{data:i,isLoading:l,error:c}=t8(),{data:u,isLoading:d,isError:f,error:h}=_xn(),{data:p,isLoading:m,isError:g,error:y}=cye(),x=n?.datasets,w=i?.experiments,O=b.useMemo(()=>BEn(p),[p]),k=r||a||c||h||y;return k&&As(k)?o.jsx(Vr,{title:"Evaluation",icon:o.jsx(Eu,{}),children:o.jsx(na,{})}):k&&Os(k)?o.jsx(Vr,{title:"Evaluation",icon:o.jsx(Eu,{}),children:o.jsx(Zs,{resource:"evaluation"})}):k?o.jsx(Vr,{title:"Evaluation",icon:o.jsx(Eu,{}),children:o.jsx(sd,{title:"Failed to load evaluation data",message:k.message})}):o.jsxs(Ft,{width:"wide",height:"full",children:[o.jsx(Ft.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(Eu,{})," Evaluation"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Evaluation documentation",children:o.jsx(Io,{})})})]})}),o.jsxs("div",{className:"flex flex-col gap-6 pt-4",children:[o.jsx(Jse,{children:o.jsx(tCn,{scorers:e,datasets:x,experiments:w,avgScore:u?.avgScore??null,prevAvgScore:u?.prevAvgScore??null,totalNeedsReview:O.needsReview,isLoadingScorers:t,isLoadingDatasets:s,isLoadingExperiments:l,isLoadingScores:d,isLoadingReview:m})}),o.jsx(pxn,{summaryData:u?.summaryData??[],overTimeData:u?.overTimeData??[],scorerNames:u?.scorerNames??[],avgScore:u?.avgScore??null,isLoading:d,isError:f}),o.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[o.jsx(u_n,{experiments:w,isLoading:l,isError:!!c}),o.jsx(lCn,{experiments:w,datasets:x,isLoading:l,isError:!!c})]}),o.jsx(FEn,{reviewSummary:p,experiments:w,datasets:x,isLoading:m,isError:!!g})]})]})}function fCn(){const[e,t]=b.useState(""),[r,n]=b.useState("all"),[s,a]=b.useState("all"),{data:i,isLoading:l,error:c}=Rh(),{data:u,isLoading:d,error:f}=t8(),{data:h}=cye(),p=b.useMemo(()=>i?.datasets??[],[i?.datasets]),m=b.useMemo(()=>u?.experiments??[],[u?.experiments]),g=b.useMemo(()=>iCn(p),[p]),y=b.useMemo(()=>tSt(h),[h]),x=l||d,w=f||c;if(w&&As(w))return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(na,{})});if(f&&Os(f))return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(Zs,{resource:"experiments"})});if(c&&Os(c))return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(Zs,{resource:"datasets"})});if(w)return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(sd,{title:"Failed to load experiments",message:w.message})});if(m.length===0&&!x)return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(cCn,{})});const O=r!=="all"||s!=="all"||e!=="",k=()=>{t(""),n("all"),a("all")};return o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:x,children:[o.jsx(Eu,{})," Experiments"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Experiments documentation",children:o.jsx(Io,{})})})]}),o.jsx(uCn,{search:e,onSearchChange:t,statusFilter:r,onStatusFilterChange:n,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:g,onReset:k,hasActiveFilters:O})]}),o.jsx(aCn,{experiments:m,datasets:p,reviewByExperiment:y,isLoading:x,search:e,statusFilter:r,datasetFilter:s})]})}function hCn(){const{experimentId:e}=ba(),{data:t,isLoading:r}=t8(),s=t?.experiments?.find(p=>p.id===e)?.datasetId??"",{data:a,isLoading:i,error:l}=r6(s,e??""),{data:c,isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h}=Z9({datasetId:s,experimentId:e??"",experimentStatus:a?.status});return e?r||i||!s?o.jsx(Ir,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(It,{})})}):l&&As(l)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):l&&Os(l)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):l||!a?o.jsx(Ir,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",l instanceof Error?l.message:"Unknown error"]})}):o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/experiments",children:[o.jsx(Ce,{children:o.jsx(Eu,{})}),"Experiments"]}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(eSt,{experimentId:e,experiment:a}),o.jsx(Jwt,{experimentId:e,experimentStatus:a?.status,results:c??[],isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h})]})})]}):null}function rSt({redirectUri:e,onSuccess:t,initialMode:r="signin",errorMessage:n}){const{data:s,isLoading:a}=UE(),{mutate:i,isPending:l,error:c}=bkn(),{mutate:u,isPending:d,error:f}=xkn(),{mutate:h,isPending:p}=qwt(),[m,g]=b.useState(r),[y,x]=b.useState(""),[w,O]=b.useState(""),[k,_]=b.useState("");if(a)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsx("div",{className:"text-neutral3",children:"Loading..."})});if(!s?.enabled||!s?.login)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsx("div",{className:"text-neutral3",children:"Authentication is not configured"})});const{login:E}=s,T=E.type==="sso"||E.type==="both",j=E.type==="credentials"||E.type==="both",A=E.sso,I=E.signUpEnabled!==!1,P=m==="signin"||!I,R=P?l:d,B=P?c:f,D=()=>{t?t():e?window.location.href=e:window.location.href="/"},F=V=>{V.preventDefault(),P?i({email:w,password:k},{onSuccess:D}):u({email:w,password:k,name:y||void 0},{onSuccess:D})},U=()=>{h({redirectUri:e},{onSuccess:V=>{window.location.href=V.url}})},z=()=>{g(P?"signup":"signin")};return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsxs("div",{className:"w-full max-w-sm space-y-6 rounded-lg border border-border1 bg-surface2 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[o.jsx(Xb,{className:"h-10 w-10"}),o.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:P?"Sign in to Mastra Studio":"Create your account"})]}),n&&o.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:n}),j&&o.jsxs("form",{onSubmit:F,className:"space-y-4",children:[!P&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"name",className:"block text-sm text-neutral4",children:"Name"}),o.jsx(cr,{id:"name",type:"text",value:y,onChange:V=>x(V.target.value),placeholder:"Your name",variant:"default",size:"lg"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"email",className:"block text-sm text-neutral4",children:"Email"}),o.jsx(cr,{id:"email",type:"email",value:w,onChange:V=>O(V.target.value),placeholder:"you@example.com",required:!0,variant:"default",size:"lg"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"password",className:"block text-sm text-neutral4",children:"Password"}),o.jsx(cr,{id:"password",type:"password",value:k,onChange:V=>_(V.target.value),placeholder:P?"Enter your password":"Create a password",required:!0,variant:"default",size:"lg"})]}),B&&o.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:B.message}),o.jsx(ve,{type:"submit",disabled:R,className:"w-full",size:"lg",children:R?P?"Signing in...":"Creating account...":P?"Sign in":"Create account"}),I&&o.jsxs("div",{className:"text-center text-sm",children:[o.jsx("span",{className:"text-neutral3",children:P?"Don't have an account? ":"Already have an account? "}),o.jsx("button",{type:"button",onClick:z,className:"text-neutral6 hover:underline",children:P?"Sign up":"Sign in"})]})]}),T&&j&&o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("div",{className:"w-full border-t border-border1"})}),o.jsx("div",{className:"relative flex justify-center text-sm",children:o.jsx("span",{className:"bg-surface2 px-2 text-neutral3",children:"or continue with"})})]}),T&&A&&o.jsxs(ve,{onClick:U,disabled:p,className:"w-full",size:"lg",variant:"outline",children:[A.icon&&o.jsx("span",{className:"mr-2",children:A.icon}),p?"Redirecting...":A.text||"Sign in"]})]})})}function pCn(){const[e]=vo(),t=ad(),r=e.get("redirect")||"/",s=e.get("mode")==="signup"?"signup":"signin",a=e.get("error_description")||e.get("error")||null,i=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return o.jsx(rSt,{redirectUri:r,onSuccess:i,initialMode:s,errorMessage:a})}const gu=mi.KeyValueList;function mCn(e){return e instanceof Date?e:new Date(e)}function gCn({log:e,onClose:t,onTraceClick:r,onSpanClick:n,onPrevious:s,onNext:a,collapsed:i,onCollapsedChange:l}){const[c,u]=b.useState(!1),d=i??c,f=l??u,h=mCn(e.timestamp);return o.jsxs(mi,{collapsed:d,children:[o.jsxs(mi.Header,{children:[o.jsxs(mi.Heading,{children:["Log ",o.jsx("b",{children:or(h,"MMM dd, HH:mm:ss.SSS")})]}),o.jsxs(ws,{className:"ml-auto shrink-0",children:[l&&o.jsx(xs,{size:"md",tooltipContent:d?"Expand panel":"Collapse panel",onClick:()=>f(!d),children:d?o.jsx(cWe,{}):o.jsx(iWe,{})}),o.jsxs(ws,{spacing:"close",children:[o.jsx(xs,{size:"md",tooltipContent:"Previous log",onClick:s,disabled:!s,children:o.jsx(q6,{})}),o.jsx(xs,{size:"md",tooltipContent:"Next log",onClick:a,disabled:!a,children:o.jsx(lce,{})})]}),o.jsx(mi.CloseButton,{onClick:t})]})]}),!d&&o.jsxs(mi.Content,{children:[o.jsx("p",{className:"text-ui-md text-neutral4 font-mono wrap-break-word whitespace-pre-wrap",children:e.message}),(e.traceId||e.spanId)&&o.jsxs("div",{className:Z("grid gap-2 my-8","[&>button]:justify-between [&>button]:overflow-hidden"),children:[e.traceId&&o.jsxs(ws,{spacing:"close",className:"min-w-0 w-full",children:[o.jsxs(ve,{size:"md",className:"min-w-0 flex-1 overflow-hidden",onClick:()=>r?.(e.traceId),children:[o.jsx(qd,{}),o.jsx("span",{children:"Trace"}),o.jsxs("span",{className:" ml-auto text-ui-sm text-neutral2 min-w-0 truncate",children:["# ",e.traceId]})]}),o.jsx(Ya,{content:e.traceId,size:"md",tooltip:"Copy Trace ID to clipboard"})]}),e.spanId&&o.jsxs(ws,{spacing:"close",className:"min-w-0 w-full",children:[o.jsxs(ve,{size:"md",className:"min-w-0 flex-1 overflow-hidden",disabled:!e.traceId||!n,onClick:()=>e.traceId&&n?.(e.traceId,e.spanId),children:[o.jsx(qd,{}),o.jsx("span",{children:"Span"}),o.jsxs("span",{className:" ml-auto text-ui-sm text-neutral2 min-w-0 truncate",children:["# ",e.spanId]})]}),o.jsx(Ya,{content:e.spanId,size:"md",tooltip:"Copy Span ID to clipboard"})]})]}),o.jsxs(gu,{className:"mb-6",children:[e.entityType&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Entity Type"}),o.jsx(gu.Value,{children:e.entityType})]}),e.entityName&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Entity Name"}),o.jsx(gu.Value,{children:e.entityName})]}),e.serviceName&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Service"}),o.jsx(gu.Value,{children:e.serviceName})]}),e.environment&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Environment"}),o.jsx(gu.Value,{children:e.environment})]}),e.source&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Source"}),o.jsx(gu.Value,{children:e.source})]}),e.metadata&&Object.keys(e.metadata).length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Header,{children:"Metadata"}),Object.entries(e.metadata).map(([p,m])=>o.jsxs(b.Fragment,{children:[o.jsx(gu.Key,{children:p}),o.jsx(gu.Value,{children:String(m)})]},p))]})]}),e.data&&Object.keys(e.data).length>0&&o.jsx(mi.CodeSection,{title:"Data",codeStr:JSON.stringify(e.data,null,2),className:"mt-6"})]})]})}function yCn(e){const t=Ze();return kt({queryKey:["trace-spans",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await t.getTrace(e)},enabled:!!e})}const vCn=e=>{if(!e||e.length===0)return[];const t=e.reduce((l,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!l||u>l)?u:l},null),r=new Map,n=[];e.forEach(l=>{const c=new Date(l.startedAt),u=l.endedAt?new Date(l.endedAt):void 0,d={id:l.spanId,name:l.name,type:l.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:l.parentSpanId};r.set(l.spanId,d)}),e.forEach(l=>{const c=r.get(l.spanId);if(l?.parentSpanId==null){if(t&&c.endTime&&t>new Date(c.endTime)){c.endTime=t.toISOString();const u=new Date(t).getTime(),d=new Date(c.startTime).getTime();c.latency=u-d}n.push(c)}else{const u=r.get(l.parentSpanId);u?u.spans.push(c):n.push(c)}});const s=l=>l.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(n),i=l=>{l.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function uye(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(r=>{t.push(r.id),t.push(...uye(r))}),t}function dye(e){const t=[];for(const r of e)t.push(r.id),t.push(...uye(r));return t}const g8e=["agent","workflow","model","mcp","tool","memory","workspace","other"],bCn={agent:{icon:o.jsx(pa,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:o.jsx(Ii,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:o.jsx(ip,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},mcp:{icon:o.jsx(ml,{}),color:"oklch(0.75 0.15 160)",label:"MCP",bgColor:"oklch(0.75 0.15 160 / 0.1)",typePrefix:"mcp"},tool:{icon:o.jsx(Ai,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"},memory:{icon:o.jsx(Rz,{}),color:"oklch(0.75 0.15 60)",label:"Memory",bgColor:"oklch(0.75 0.15 60 / 0.1)",typePrefix:"memory"},workspace:{icon:o.jsx(Pz,{}),color:"oklch(0.75 0.15 40)",label:"Workspace",bgColor:"oklch(0.75 0.15 40 / 0.1)",typePrefix:"workspace"}},xCn={color:"oklch(0.65 0 0)",label:"Other",typePrefix:"other"};function nSt(e){const t=e?.toLowerCase().split("_")[0];return bCn[t]??xCn}function wCn({isSelected:e,isFaded:t,isExpanded:r,toggleChildren:n,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:l}){return o.jsx("div",{className:Z("flex items-center justify-end h-full px-1.5",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:l&&l>0?o.jsxs("div",{className:"flex gap-1",children:[o.jsxs(y8e,{onClick:()=>n?.(),children:[i?a:l," ",r?i?o.jsx(dce,{}):o.jsx(uv,{}):o.jsx(Un,{})]}),a>l&&!i&&o.jsxs(y8e,{onClick:()=>s?.(),children:[a," ",o.jsx(uce,{})]})]}):null})}function y8e({onClick:e,children:t,className:r}){return o.jsx("button",{onClick:e,className:Z("h-full",r),children:o.jsx("div",{className:Z("flex items-center gap-[0.1rem] text-ui-xs text-neutral5 border border-border1 pl-1.5 pr-0.5 rounded-md transition-all","hover:text-yellow-500","[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-[0.85rem] [&>svg]:h-[0.85rem] [&>svg]:transition-all"),children:t})})}function SCn({isLastChild:e}){return o.jsx("div",{className:Z("w-[0.5rem] h-[1.8rem] relative opacity-100 shrink-0",'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-[0px] after:border-l-[1px] after:border-neutral3 after:border-dashed ','before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-[0px] before:border-b-[1px] before:border-neutral3 before:border-dashed',{"after:bottom-[50%]":e})})}function OCn({span:e,spanUI:t,isFaded:r,depth:n=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:l,isRootSpan:c,isExpanded:u}){return o.jsxs("div",{"data-span-id":e.id,"aria-label":`View details for span ${e.name}`,className:Z("rounded-md flex opacity-80 min-h-8 items-center rounded-l-lg",{"opacity-30 [&:hover]:opacity-60":r,"bg-surface4":a===e.id}),style:{paddingLeft:`${n*1}rem`},children:[!c&&o.jsx(SCn,{isLastChild:i}),o.jsx("button",{onClick:()=>s?.(e.id),className:Z("text-ui-sm flex items-center text-left gap-1.5 text-neutral6 w-full min-w-0 rounded-md h-full px-2 py-1 transition-colors","[&>svg]:transition-all [&>svg]:shrink-0 [&>svg]:opacity-0 [&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:ml-auto","hover:bg-surface4 [&:hover>svg]:opacity-60"),children:o.jsx("span",{className:"min-w-0 truncate",children:e.name})})]})}function kCn({span:e,selectedSpanId:t,isFaded:r,overallLatency:n,overallStartTime:s,color:a}){const i=n?Math.ceil(e.latency/n*100):0,l=s?new Date(s):null,c=e.startTime?new Date(e.startTime):null,u=c&&l?c.getTime()-l.getTime():0,d=n&&Math.floor(u/n*100);return o.jsxs(Xue,{openDelay:250,children:[o.jsxs(Kue,{className:Z("h-8 min-w-32 p-1 grid grid-cols-[1fr_auto] gap-2 items-center cursor-help pr-2 rounded-r-md","[&:hover>div]:bg-surface5",{"opacity-30 [&:hover]:opacity-60":r,"bg-surface4":t===e.id}),children:[o.jsx("div",{className:Z("w-full p-1.5 rounded-md bg-surface4 transition-colors duration-1000"),children:o.jsx("div",{className:"relative w-full h-1.5 rounded-sm overflow-hidden",children:o.jsx("div",{className:Z("bg-neutral1 absolute rounded-sm h-1.5 top-0"),style:{width:i?`${i}%`:"2px",left:`${d||0}%`,backgroundColor:a}})})}),o.jsxs("div",{className:Z("flex justify-end text-neutral3 text-ui-xs"),children:[(e.latency/1e3).toFixed(3)," s"]})]}),o.jsx(Jue,{children:o.jsxs(ede,{className:"z-50 w-auto max-w-[25rem] rounded-md bg-surface4 p-2 px-4 pr-6 text-ui-sm text-neutral5 text-center border border-border1",sideOffset:5,side:"top",children:[o.jsxs("div",{className:Z("text-ui-md flex items-center gap-2 mb-4","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:shrink-0 [&>svg]:opacity-50"),children:[o.jsx(KN,{})," Span Timing"]}),o.jsx(n0,{className:" [&>dd]:text-ui-md [&>dt]:text-ui-md [&>dt]:min-h-0 [&>dd]:min-h-0",data:[{key:"Latency",label:"Latency",value:`${e.latency} ms`,icon:o.jsx(oWe,{})},{key:"startTime",label:"Started at",value:e.startTime?or(new Date(e.startTime),"hh:mm:ss:SSS a"):"-",icon:o.jsx(nWe,{})},{key:"endTime",label:"Ended at",value:e.endTime?or(new Date(e.endTime),"hh:mm:ss:SSS a"):"-",icon:o.jsx(sWe,{})},{key:"startShift",label:"Start Shift",value:`${u}ms`,icon:o.jsx(lWe,{})}]}),o.jsx(tde,{className:"fill-surface5"})]})})]})}function fye({span:e,depth:t=0,onSpanClick:r,selectedSpanId:n,isLastChild:s,overallLatency:a,overallStartTime:i,fadedTypes:l,searchPhrase:c,featuredSpanIds:u,expandedSpanIds:d,setExpandedSpanIds:f}){const h=e.spans&&e.spans.length>0,p=e.spans?e.spans.length:0,m=uye(e),g=m.length,y=t===0,x=nSt(e?.type),w=d?d.includes(e.id):!1,O=u&&u.length>0?!u.includes(e.id):!1,_=(l&&l.length>0?l.includes(x?.typePrefix||""):!1)||O;b.useEffect(()=>{if(!u||m.length===0||w)return;m.some(I=>u.includes(I))&&f&&f(I=>!I||I.includes(e.id)?I??[e.id]:[...I,e.id])},[u,m]);const E=()=>{f&&f(A=>{if(!A)return A;const I=new Set([e.id,...m]);return w?A.filter(P=>!I.has(P)):[...A,e.id]})},T=()=>{f&&f(A=>A&&Array.from(new Set([...A,e.id,...m])))},j=m.every(A=>d?.includes(A));return o.jsxs(o.Fragment,{children:[o.jsx(OCn,{span:e,spanUI:x,isFaded:_,depth:t,onSpanClick:r,selectedSpanId:n,isLastChild:s,hasChildren:h,isRootSpan:y,isExpanded:w}),o.jsx(wCn,{isSelected:n===e.id,isFaded:_,isExpanded:w,toggleChildren:E,expandAllDescendants:T,totalDescendants:g,allDescendantsExpanded:j,numOfChildren:p}),o.jsx(kCn,{span:e,selectedSpanId:n,isFaded:_,overallLatency:a,overallStartTime:i,color:x?.color}),h&&w&&e.spans?.map((A,I,P)=>{const R=I===P.length-1;return o.jsx(fye,{span:A,depth:t+1,onSpanClick:r,selectedSpanId:n,isLastChild:R,overallLatency:a,overallStartTime:i,fadedTypes:l,searchPhrase:c,expandedSpanIds:d,setExpandedSpanIds:f,featuredSpanIds:u},A.id)})]})}function _Cn({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:r,isLoading:n,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:l}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"";return o.jsx(o.Fragment,{children:n?o.jsxs("div",{className:Z("flex items-center text-ui-sm gap-3 bg-surface3/50 rounded-md p-3 justify-center text-neutral3","[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"),children:[o.jsx(It,{})," Loading Trace Timeline ..."]}):o.jsx("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_auto] items-start content-start gap-y-px overflow-hidden py-1",children:e?.map(d=>o.jsx(fye,{span:d,onSpanClick:t,selectedSpanId:r,overallLatency:c,overallStartTime:u,fadedTypes:s,featuredSpanIds:l,expandedSpanIds:a,setExpandedSpanIds:i},d.id))})})}function ECn({traceId:e,onClose:t,onSpanSelect:r,initialSpanId:n}){const{data:s,isLoading:a}=yCn(e),[i,l]=b.useState(n??void 0);b.useEffect(()=>{if(n&&s?.spans){const h=s.spans.find(p=>p.spanId===n);if(h){l(n),r?.(h);return}}l(void 0),r?.(void 0)},[n,s?.spans]);const c=b.useMemo(()=>vCn(s?.spans??[]),[s?.spans]),[u,d]=b.useState([]);b.useEffect(()=>{c.length>0&&d(dye(c))},[c]);const f=h=>{const p=i===h?void 0:h;l(p);const m=p?s?.spans?.find(g=>g.spanId===p):void 0;r?.(m)};return o.jsxs(mi,{children:[o.jsxs(mi.Header,{children:[o.jsxs(mi.Heading,{children:["Trace ",o.jsxs("b",{children:["# ",e]})]}),o.jsx(mi.CloseButton,{onClick:t})]}),a?o.jsx(mi.LoadingData,{children:"Loading trace..."}):c.length===0?o.jsx(mi.NoData,{children:"No spans found for this trace."}):o.jsx(mi.Content,{children:o.jsx(_Cn,{hierarchicalSpans:c,onSpanClick:f,selectedSpanId:i,expandedSpanIds:u,setExpandedSpanIds:d})})]})}const ay=mi.KeyValueList;function CCn({span:e,onClose:t}){const r=e.startedAt&&e.endedAt?new Date(e.endedAt).getTime()-new Date(e.startedAt).getTime():null;return o.jsxs(mi,{children:[o.jsxs(mi.Header,{children:[o.jsxs(mi.Heading,{children:["Span ",o.jsxs("b",{children:["# ",e.spanId]})]}),o.jsx(mi.CloseButton,{onClick:t})]}),o.jsxs(mi.Content,{children:[o.jsxs(ay,{children:[e.spanType&&o.jsxs(o.Fragment,{children:[o.jsx(ay.Key,{children:"Type"}),o.jsx(ay.Value,{children:e.spanType})]}),e.startedAt&&o.jsxs(o.Fragment,{children:[o.jsx(ay.Key,{children:"Started"}),o.jsx(ay.Value,{children:or(new Date(e.startedAt),"MMM dd, HH:mm:ss.SSS")})]}),e.endedAt&&o.jsxs(o.Fragment,{children:[o.jsx(ay.Key,{children:"Ended"}),o.jsx(ay.Value,{children:or(new Date(e.endedAt),"MMM dd, HH:mm:ss.SSS")})]}),r!=null&&o.jsxs(o.Fragment,{children:[o.jsx(ay.Key,{children:"Duration"}),o.jsx(ay.Value,{children:r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`})]})]}),o.jsx("br",{}),o.jsx(mi.CodeSection,{title:"Input",icon:o.jsx(wp,{}),codeStr:JSON.stringify(e.input??null,null,2)}),o.jsx(mi.CodeSection,{title:"Output",icon:o.jsx(yc,{}),codeStr:JSON.stringify(e.output??null,null,2)}),o.jsx(mi.CodeSection,{title:"Metadata",icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.metadata??null,null,2)}),o.jsx(mi.CodeSection,{title:"Attributes",icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.attributes??null,null,2)})]})]})}function jCn(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return(t>>>0).toString(36)}function TCn(e){const t=new Map,r=new Map;for(const n of e){const s=n.timestamp instanceof Date?n.timestamp.toISOString():n.timestamp,a=jCn(`${s}${n.message??""}${n.data?JSON.stringify(n.data):""}`),i=r.get(a)??0;r.set(a,i+1),t.set(n,i>0?`${a}-${i}`:a)}return t}const v8e="auto auto auto auto minmax(5rem,1fr) minmax(5rem,1fr)";function NCn({logs:e,isLoading:t,isFetchingNextPage:r,hasNextPage:n,setEndOfListElement:s,featuredLogId:a,featuredTraceId:i,featuredSpanId:l,onFeaturedChange:c}){const[u,d]=b.useState({}),f=a??u.logId??null,h=i??u.traceId??null,p=l??u.spanId??null,m=b.useCallback(V=>{const W={logId:V.logId!==void 0?V.logId:f,traceId:V.traceId!==void 0?V.traceId:h,spanId:V.spanId!==void 0?V.spanId:p};c?c(W):d(W)},[c,f,h,p]),[g,y]=b.useState(),[x,w]=b.useState(!1);b.useEffect(()=>{(!p||g&&g.spanId!==p)&&y(void 0)},[p,g]);const O=b.useMemo(()=>TCn(e),[e]),k=b.useMemo(()=>{const V=new Map;for(let W=0;W<e.length;W++){const L=O.get(e[W]);L&&V.set(L,{log:e[W],idx:W})}return V},[e,O]),E=(f?k.get(f):void 0)?.idx??-1,T=E>=0?e[E]:null,j=E>0?()=>{const V=e[E-1],W=O.get(V);h?(m({logId:W,traceId:V.traceId??null,spanId:null}),y(void 0)):m({logId:W})}:void 0,A=E>=0&&E<e.length-1?()=>{const V=e[E+1],W=O.get(V);h?(m({logId:W,traceId:V.traceId??null,spanId:null}),y(void 0)):m({logId:W})}:void 0,I=b.useCallback(V=>{const W=O.get(V);if(f===W){m({logId:null});return}h?(m({logId:W,traceId:V.traceId??null,spanId:null}),y(void 0)):m({logId:W})},[f,h,m,O]),P=b.useCallback(V=>{m({traceId:V,spanId:null}),y(void 0)},[m]),R=b.useCallback((V,W)=>{m({traceId:V,spanId:W})},[m]),B=b.useCallback(()=>{m({traceId:null,spanId:null}),w(!1),y(void 0)},[m]),D=b.useCallback(V=>{m({spanId:V?.spanId??null}),y(V)},[m]),F=b.useCallback(()=>{m({spanId:null}),y(void 0)},[m]),U=b.useCallback(()=>{m({logId:null})},[m]);if(t)return o.jsx(Fhe,{columns:v8e});const z=!!T;return o.jsxs("div",{className:Z("grid h-full min-h-0 gap-4 items-start",z?"grid-cols-[1fr_1fr]":"grid-cols-[1fr]"),children:[o.jsxs(Al,{columns:v8e,className:"min-w-0",children:[o.jsxs(Al.Top,{children:[o.jsx(Al.TopCell,{children:"Date"}),o.jsx(Al.TopCell,{children:"Time"}),o.jsx(Al.TopCell,{children:"Level"}),o.jsx(Al.TopCell,{children:"Entity"}),o.jsx(Al.TopCell,{children:"Message"}),o.jsx(Al.TopCell,{children:"Data"})]}),e.length===0?o.jsx(Al.NoMatch,{message:"No logs match your search"}):e.map(V=>{const W=O.get(V),L=W===f;return o.jsxs(Al.RowButton,{onClick:()=>I(V),className:Z(L&&"bg-surface4"),children:[o.jsx(Al.DateCell,{timestamp:V.timestamp}),o.jsx(Al.TimeCell,{timestamp:V.timestamp}),o.jsx(Al.LevelCell,{level:V.level}),o.jsx(Al.EntityCell,{entityType:V.entityType,entityName:V.entityName}),o.jsx(Al.MessageCell,{message:V.message}),o.jsx(Al.DataCell,{data:V.data})]},W)}),o.jsx(Al.NextPageLoading,{isLoading:r,hasMore:n,setEndOfListElement:s})]}),T&&o.jsxs("div",{className:Z("grid gap-4 h-full overflow-auto ",x&&h&&g?"grid-rows-[auto_1fr_1fr]":x&&h?"grid-rows-[auto_1fr]":h&&g?"grid-rows-[1fr_1fr_1fr]":h?"grid-rows-[1fr_1fr]":x?"grid-rows-[auto]":"grid-rows-[1fr]"),children:[o.jsx(gCn,{log:T,onClose:U,onTraceClick:P,onSpanClick:R,onPrevious:j,onNext:A,collapsed:x,onCollapsedChange:w}),h&&o.jsx(ECn,{traceId:h,onClose:B,onSpanSelect:D,initialSpanId:p}),g&&o.jsx(CCn,{span:g,onClose:F})]})]})}const ACn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No logs yet",descriptionSlot:"Logs will appear here once agents, workflows, or tools are executed."})}),Yee={"24h":"Last 24 hours","3d":"Last 3 days","7d":"Last 7 days","14d":"Last 14 days","30d":"Last 30 days"};function ICn({onSearchChange:e,datePreset:t,onDatePresetChange:r,filterGroups:n,filterColumns:s,onToggleComparator:a,onRemoveFilterGroup:i,onClearAllFilters:l,onFilterGroupsChange:c,onReset:u,isLoading:d,hasActiveFilters:f}){const h=b.useMemo(()=>s.map(m=>({id:m.field,label:m.field,values:m.values.map(g=>({value:g,label:g})),mode:"multi"})),[s]),p=b.useMemo(()=>{const m={};for(const g of n)m[g.field]=g.values;return m},[n]);return o.jsx("div",{className:"flex flex-col gap-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ah,{onSearch:e,size:"md",label:"Search logs",placeholder:"Search name, ID, content..."}),o.jsxs(dt,{children:[o.jsx(dt.Trigger,{asChild:!0,children:o.jsxs(ve,{variant:"inputLike",size:"md",children:[o.jsx(cce,{})," ",Yee[t]," ",o.jsx(Un,{})]})}),o.jsx(dt.Content,{children:Object.keys(Yee).map(m=>o.jsx(dt.Item,{onSelect:()=>r(m),children:Yee[m]},m))})]}),o.jsx(jct,{categories:h,value:p,onChange:c,align:"end",disabled:d}),u&&f&&o.jsxs(ve,{variant:"outline",size:"md",disabled:d,onClick:u,className:"ml-auto",children:[o.jsx(vn,{}),"Reset"]})]})})}const sSt={debug:"DEBUG",info:"INFO",warn:"WARN",error:"ERROR",fatal:"FATAL"},aSt={AGENT:"Agent",WORKFLOW:"Workflow",TOOL:"Tool",SYSTEM:"System"};function RCn(e,t){switch(t){case"Level":return sSt[e.level];case"Entity type":return aSt[e.entityType??""]??e.entityType??"";case"Entity name":return e.entityName??"";default:return""}}function PCn(e){const[t,r]=b.useState(""),[n,s]=b.useState([]),a=b.useMemo(()=>{const f=h=>Array.from(new Set(h.filter(Boolean))).sort();return[{field:"Level",plural:"levels",values:f(e.map(h=>sSt[h.level]))},{field:"Entity type",plural:"types",values:f(e.map(h=>aSt[h.entityType??""]??h.entityType??""))},{field:"Entity name",plural:"names",values:f(e.map(h=>h.entityName??""))}]},[e]),i=b.useCallback(f=>{s(h=>h.map(p=>p.id===f?{...p,comparator:p.comparator==="is"?"is not":"is"}:p))},[]),l=b.useCallback(f=>{s(h=>h.filter(p=>p.id!==f))},[]),c=b.useCallback(()=>{s([])},[]),u=b.useCallback(f=>{s(h=>{const p=[],m=new Set;for(const g of h){const y=f[g.field];y&&y.length>0&&(p.push({...g,values:y}),m.add(g.field))}for(const[g,y]of Object.entries(f))m.has(g)||y.length===0||p.push({id:`${g}-${Date.now()}`,field:g,comparator:"is",values:y});return p})},[]),d=b.useMemo(()=>e.filter(f=>{if(t){const h=t.toLowerCase();if(!(f.message.toLowerCase().includes(h)||(f.entityName??"").toLowerCase().includes(h)||(f.traceId??"").toLowerCase().includes(h)))return!1}for(const h of n){const p=RCn(f,h.field),m=h.values.includes(p);if(h.comparator==="is"&&!m||h.comparator==="is not"&&m)return!1}return!0}),[e,t,n]);return{searchQuery:t,setSearchQuery:r,filterGroups:n,filterColumns:a,toggleComparator:i,removeFilterGroup:l,clearAllFilters:c,updateFilterGroups:u,filteredLogs:d}}const MCn=[{label:"Last 24 hours",value:"24h"},{label:"Last 3 days",value:"3d"},{label:"Last 7 days",value:"7d"},{label:"Last 14 days",value:"14d"},{label:"Last 30 days",value:"30d"}];function DCn(e){return MCn.some(t=>t.value===e)}const LCn=20;function $Cn(e,t,r){if(e?.pagination?.hasMore)return r+1}function FCn(e){return e.pages.flatMap(t=>t.logs??[])}const zCn=({filters:e}={})=>{const t=Ze(),{inView:r,setRef:n}=zE(),s=o1({queryKey:["logs",e],queryFn:({pageParam:c})=>t.listLogsVNext({pagination:{page:c,perPage:LCn},filters:e,orderBy:{field:"timestamp",direction:"DESC"}}),initialPageParam:0,getNextPageParam:$Cn,select:FCn,retry:!1,refetchInterval:3e3}),{hasNextPage:a,isFetchingNextPage:i,fetchNextPage:l}=s;return b.useEffect(()=>{r&&a&&!i&&l()},[r,a,i,l]),{...s,data:s.data,setEndOfListElement:n}},Xee="period",b8e="logId",x8e="traceId",w8e="spanId",BCn={"24h":1440*60*1e3,"3d":4320*60*1e3,"7d":10080*60*1e3,"14d":336*60*60*1e3,"30d":720*60*60*1e3};function UCn(){const[e,t]=vo(),r=e.get(Xee),n=DCn(r)?r:"24h",s=e.get(b8e),a=e.get(x8e),i=e.get(w8e),l=b.useCallback(I=>{t(P=>{const R=new URLSearchParams(P);return I==="24h"?R.delete(Xee):R.set(Xee,I),R},{replace:!0})},[t]),c=b.useCallback(I=>{t(P=>{const R=new URLSearchParams(P);for(const[B,D]of Object.entries(I)){const F=B==="logId"?b8e:B==="traceId"?x8e:w8e;D?R.set(F,D):R.delete(F)}return R},{replace:!0})},[t]),u=b.useMemo(()=>{const I=BCn[n];if(I)return{timestamp:{start:new Date(Date.now()-I)}}},[n]),{data:d=[],isLoading:f,error:h,isFetchingNextPage:p,hasNextPage:m,setEndOfListElement:g}=zCn({filters:u}),{searchQuery:y,setSearchQuery:x,filterGroups:w,filterColumns:O,toggleComparator:k,removeFilterGroup:_,clearAllFilters:E,updateFilterGroups:T,filteredLogs:j}=PCn(d);if(h&&As(h))return o.jsx(Vr,{title:"Logs",icon:o.jsx(OO,{}),children:o.jsx(na,{})});if(h&&Os(h))return o.jsx(Vr,{title:"Logs",icon:o.jsx(OO,{}),children:o.jsx(Zs,{resource:"logs"})});if(h)return o.jsx(Vr,{title:"Logs",icon:o.jsx(OO,{}),children:o.jsx(sd,{title:"Failed to load logs",message:h?.message??"Unknown error"})});const A=y.length>0||w.length>0||n!=="24h";return d.length===0&&!f&&!A?o.jsx(Vr,{title:"Logs",icon:o.jsx(OO,{}),children:o.jsx(ACn,{})}):o.jsxs(Ft,{width:"wide",height:"full",children:[o.jsxs(Ft.TopArea,{children:[o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(OO,{})," Logs"]})}),o.jsx(ICn,{onSearchChange:x,datePreset:n,onDatePresetChange:l,filterGroups:w,filterColumns:O,onToggleComparator:k,onRemoveFilterGroup:_,onClearAllFilters:E,onFilterGroupsChange:T,onReset:()=>{x(""),E(),l("24h")},isLoading:f,hasActiveFilters:A})]}),o.jsx(NCn,{logs:j,isLoading:f,isFetchingNextPage:p,hasNextPage:m,setEndOfListElement:g,featuredLogId:s,featuredTraceId:a,featuredSpanId:i,onFeaturedChange:c})]})}const iSt=e=>{const t=Ze();return kt({queryKey:["mcpserver-tools",e?.id],queryFn:async()=>{const n=(await t.getMcpServerTools(e?.id)).tools,s={};return n.forEach(a=>{s[a.id]=a}),s},retry:!1,refetchOnWindowFocus:!1})};function VCn({server:e}){const{paths:t,Link:r}=lr(),s=Ze().options.baseUrl,a=s?`${s}/api/mcp/${e.id}/sse`:"",{data:i}=iSt(e),l=Object.values(i||{}),c=l.length,u=l.filter(h=>h.toolType==="agent").length,d=l.filter(h=>h.toolType==="workflow").length,f=Ep(e.name,50);return o.jsxs(xe.RowLink,{to:t.mcpServerLink(e.id),LinkComponent:r,children:[o.jsx(xe.NameCell,{children:f}),o.jsx(xe.DescriptionCell,{children:a}),o.jsx(xe.TextCell,{className:"text-center",children:u||""}),o.jsx(xe.TextCell,{className:"text-center",children:c||""}),o.jsx(xe.TextCell,{className:"text-center",children:d||""})]})}function qCn({mcpServers:e,isLoading:t,search:r=""}){const n=b.useMemo(()=>{const s=r.toLowerCase();return e.filter(a=>a.name?.toLowerCase().includes(s)||a.id?.toLowerCase().includes(s))},[e,r]);return t?o.jsx(fh,{columns:"auto 1fr auto auto auto"}):o.jsxs(xe,{columns:"auto 1fr auto auto auto",children:[o.jsxs(xe.Top,{children:[o.jsx(xe.TopCell,{children:"Name"}),o.jsx(xe.TopCell,{children:"URL"}),o.jsx(xe.TopCellSmart,{long:"Agents",short:o.jsx(pa,{}),tooltip:"Agent Tools",className:"text-center"}),o.jsx(xe.TopCellSmart,{long:"Tools",short:o.jsx(Ai,{}),tooltip:"Tools",className:"text-center"}),o.jsx(xe.TopCellSmart,{long:"Workflows",short:o.jsx(Ii,{}),tooltip:"Workflow Tools",className:"text-center"})]}),n.length===0&&r?o.jsx(xe.NoMatch,{message:"No MCP Servers match your search"}):null,n.map(s=>o.jsx(VCn,{server:s},s.id))]})}const HCn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No MCP Servers yet",descriptionSlot:o.jsxs(o.Fragment,{children:["MCP servers are not configured yet. ",o.jsx("br",{}),"More information in the documentation."]}),actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",children:["MCP Documentation ",o.jsx(Aa,{})]})})}),QCn=()=>{const{data:e=[],isLoading:t,error:r}=zP(),[n,s]=b.useState("");return r&&As(r)?o.jsx(Vr,{title:"MCP Servers",icon:o.jsx(ml,{}),children:o.jsx(na,{})}):r&&Os(r)?o.jsx(Vr,{title:"MCP Servers",icon:o.jsx(ml,{}),children:o.jsx(Zs,{resource:"MCP servers"})}):r?o.jsx(Vr,{title:"MCP Servers",icon:o.jsx(ml,{}),children:o.jsx(sd,{title:"Failed to load MCP servers",message:r.message})}):e.length===0&&!t?o.jsx(Vr,{title:"MCP Servers",icon:o.jsx(ml,{}),children:o.jsx(HCn,{})}):o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:t,children:[o.jsx(ml,{})," MCP Servers"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to MCP documentation",children:o.jsx(Io,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(Ah,{onSearch:s,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),o.jsx(qCn,{mcpServers:e,isLoading:t,search:n})]})},WCn=(e,t)=>{const r=new Map,n=Object.keys(t);for(const s of n){const a=t[s],i=a.tools,l=Object.keys(i);for(const c of l){const u=i[c];r.has(u.id)||r.set(u.id,{...u,agents:[]}),r.get(u.id).agents.push({...a,id:s})}}for(const[s,a]of Object.entries(e))r.has(a.id)||r.set(a.id,{...a,agents:[]});return Array.from(r.values())};function GCn({tools:e,agents:t,isLoading:r,search:n=""}){const{paths:s,Link:a}=lr(),i=b.useMemo(()=>WCn(e,t),[e,t]),l=b.useMemo(()=>i.filter(c=>c.id.toLowerCase().includes(n.toLowerCase())),[i,n]);return r?o.jsx(fh,{columns:"auto 1fr auto"}):o.jsxs(xe,{columns:"auto 1fr auto",children:[o.jsxs(xe.Top,{children:[o.jsx(xe.TopCell,{children:"Name"}),o.jsx(xe.TopCell,{children:"Description"}),o.jsx(xe.TopCellSmart,{long:"Agents",short:o.jsx(pa,{}),tooltip:"Attached Agents",className:"text-center"})]}),l.length===0&&n?o.jsx(xe.NoMatch,{message:"No Tools match your search"}):null,l.map(c=>{const u=Ep(c.id,50),d=Ep(c.description??"",200),f=c.agents.length;return o.jsxs(xe.RowLink,{to:s.toolLink(c.id),LinkComponent:a,children:[o.jsx(xe.NameCell,{children:u}),o.jsx(xe.DescriptionCell,{children:d}),o.jsx(xe.TextCell,{className:"text-center",children:f||""})]},c.id)})]})}const ZCn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No Tools yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Mastra tools are not configured yet. ",o.jsx("br",{}),"More information in the documentation."]}),actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",children:["Tools Documentation ",o.jsx(Aa,{})]})})}),YCn=()=>{const e=Ze();return Kr({mutationFn:async({toolId:t,input:r,requestContext:n})=>{const s=new n_;Object.entries(n??{}).forEach(([a,i])=>{s.set(a,i)});try{return await e.getTool(t).execute({data:r,requestContext:s})}catch(a){throw Ue.error("Error executing dev tool"),console.error("Error executing dev tool:",a),a}}})},XCn=({toolId:e})=>{const{canExecute:t}=jv(),r=t("tools"),{data:n={}}=Bp(),s=b.useMemo(()=>{for(const g of Object.values(n))if(g.tools){const y=Object.values(g.tools).find(x=>x.id===e);if(y)return y}return null},[n,e]),{data:a,isLoading:i,error:l}=Y0n(e,{enabled:!s}),c=s||a,{mutateAsync:u,isPending:d,data:f}=YCn(),{requestContext:h}=Hn();b.useEffect(()=>{if(l){const g=l instanceof Error?l.message:"Failed to load tool";Ue.error(`Error loading tool: ${g}`)}},[l]);const p=async(g,y)=>{if(!c)return;const x={...h??{},...y??{}};return u({toolId:c.id,input:g,requestContext:x})},m=c?.inputSchema?og(sg(ev(c?.inputSchema))):Gn({});return i?o.jsxs("div",{className:"p-6",children:[o.jsx(In,{className:"h-8 w-48 mb-4"}),o.jsx(In,{className:"h-32 w-full"})]}):l?null:c?r?o.jsx(Mge,{executionResult:f,isExecutingTool:d,zodInputSchema:m,handleExecuteTool:p,toolDescription:c.description,toolId:c.id,requestContextSchema:c.requestContextSchema}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})})};function KCn({value:e,onValueChange:t,placeholder:r="Select a tool...",searchPlaceholder:n="Search tools...",emptyText:s="No tools found.",className:a,disabled:i=!1,variant:l="inputLike"}){const{data:c={},isLoading:u,isError:d,error:f}=W9(),{data:h={},isLoading:p,isError:m,error:g}=Bp(),{navigate:y,paths:x}=lr();b.useEffect(()=>{if(d){const _=f instanceof Error?f.message:"Failed to load tools";Ue.error(`Error loading tools: ${_}`)}},[d,f]),b.useEffect(()=>{if(m){const _=g instanceof Error?g.message:"Failed to load agents";Ue.error(`Error loading agents: ${_}`)}},[m,g]);const w=new Map;Object.values(h).forEach(_=>{_.tools&&Object.values(_.tools).forEach(E=>{w.has(E.id)||w.set(E.id,E)})}),Object.values(c).forEach(_=>{w.has(_.id)||w.set(_.id,_)});const O=Array.from(w.values()).map(_=>({label:_.id,value:_.id})),k=_=>{t?t(_):_&&_!==e&&y(x.toolLink(_))};return o.jsx(Zl,{options:O,value:e,onValueChange:k,placeholder:u||p?"Loading tools...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||p||d||m,variant:l})}const JCn=({isLoading:e,server:t})=>{const[{sseUrl:r,httpStreamUrl:n},s]=b.useState({sseUrl:"",httpStreamUrl:""});if(b.useEffect(()=>{if(!t)return;const i=window.MASTRA_SERVER_HOST,l=window.MASTRA_SERVER_PORT;let c=null;i&&l&&(c=`http://${i}:${l}`);const u=c||"http://localhost:4111",d=`${u}/api/mcp/${t.id}/sse`,f=`${u}/api/mcp/${t.id}/mcp`;s({sseUrl:d,httpStreamUrl:f})},[t]),e)return null;if(!t)return o.jsx(of,{children:o.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral3 font-medium py-20 text-center",children:"Server not found"})});const a=`npx -y mcp-remote ${r}`;return o.jsxs(of,{isDivided:!0,children:[o.jsxs("div",{className:"px-8 py-12 mx-auto max-w-2xl w-full",children:[o.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral6 font-medium pb-4",children:t.name}),o.jsxs("div",{className:"flex items-center gap-1 pb-6",children:[o.jsx(vt,{icon:o.jsx(Pz,{className:"text-neutral6"}),className:"rounded-r-sm text-neutral4!",children:"Version"}),o.jsx(vt,{className:"rounded-l-sm text-neutral4!",children:t.version_detail.version})]}),o.jsx(me,{className:"text-neutral3 pb-4",children:"This MCP server can be accessed through multiple transport methods. Choose the one that best fits your use case."}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(vt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"HTTP"}),children:"Regular HTTP Endpoint"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for stateless HTTP transport with streamable responses."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:n}),o.jsx("div",{className:"pt-1",children:o.jsx(Ya,{tooltip:"Copy HTTP Stream URL",content:n})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(vt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"SSE"}),children:"Server-Sent Events"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for real-time communication via SSE."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:r}),o.jsx("div",{className:"pt-1",children:o.jsx(Ya,{tooltip:"Copy SSE URL",content:r})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(vt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"CLI"}),children:"Command Line"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for local command-line access via npx and mcp-remote."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:a}),o.jsx("div",{className:"pt-1",children:o.jsx(Ya,{tooltip:"Copy Command Line Config",content:a})})]})]})]})]}),o.jsx("div",{className:"h-full overflow-y-scroll border-l border-border1",children:o.jsx(ejn,{server:t})})]})},ejn=({server:e})=>{const{data:t={},isLoading:r}=iSt(e);if(r)return null;const n=Object.keys(t);return o.jsxs("div",{className:"p-5 overflow-y-scroll",children:[o.jsxs("div",{className:"text-neutral6 flex gap-2 items-center",children:[o.jsx(Ce,{size:"lg",className:"bg-surface4 rounded-md p-1",children:o.jsx(ml,{})}),o.jsx(me,{variant:"header-md",as:"h2",className:"font-medium",children:"Available Tools"})]}),o.jsx("div",{className:"flex flex-col gap-2 pt-6",children:n.map(s=>{const a=t[s];return o.jsx(tjn,{tool:a,serverId:e.id},s)})})]})},tjn=({tool:e,serverId:t})=>{const r=b.useRef(null),{Link:n,paths:s}=lr(),a=Jxt[e.toolType||"tool"];return o.jsxs(yf,{onClick:()=>r.current?.click(),children:[o.jsx(hlt,{children:o.jsx(a,{className:"group-hover/entity:text-accent6"})}),o.jsxs(xf,{children:[o.jsx(vf,{children:o.jsx(n,{ref:r,href:s.mcpServerToolLink(t,e.id),children:e.id})}),o.jsx(bf,{children:e.description})]})]})},rjn=()=>{const{serverId:e}=ba(),{data:t=[],isLoading:r}=zP(),n=t.find(s=>s.id===e);return o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/mcps",children:[o.jsx(Ce,{children:o.jsx(ml,{})}),"MCP Servers"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:o.jsx(g0t,{value:e,variant:"ghost"})})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(kv,{}),"MCP documentation"]})})]}),o.jsx(JCn,{isLoading:r,server:n})]})},oSt=(e,t)=>{const{requestContext:r}=Hn(),n=Ze();return kt({queryKey:["mcp-server-tool",e,t],queryFn:()=>n.getMcpServerTool(e,t).details(r)})},njn=(e,t)=>{const{requestContext:r}=Hn(),n=Ze();return Kr({mutationFn:s=>n.getMcpServerTool(e,t).execute({data:s,requestContext:r})})},sjn=({toolId:e,serverId:t})=>{const{canExecute:r}=jv(),n=r("tools"),{data:s,isLoading:a,error:i}=oSt(t,e),{mutateAsync:l,isPending:c,data:u}=njn(t,e);b.useEffect(()=>{if(i){const h=i instanceof Error?i.message:"Failed to load tool";Ue.error(`Error loading tool: ${h}`)}},[i]);const d=async h=>{if(s)return await l(h)};if(a)return o.jsxs("div",{className:"p-6",children:[o.jsx(In,{className:"h-8 w-48 mb-4"}),o.jsx(In,{className:"h-32 w-full"})]});if(i)return null;if(!s)return o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})});if(!n)return o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})});let f;try{f=og(sg(s.inputSchema))}catch(h){console.error("Error processing input schema:",h),Ue.error("Failed to process tool input schema."),f=Gn({})}return o.jsx(Mge,{executionResult:u,isExecutingTool:c,zodInputSchema:f,handleExecuteTool:d,toolDescription:s.description||"",toolId:s.id})},ajn=()=>{const{data:e}=zP(),{serverId:t,toolId:r}=ba(),{data:n,isLoading:s}=oSt(t,r),a=e?.find(c=>c.id===t),i=n?.name,l=a?.name||"";return s||!n?null:o.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-hidden",children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/mcps",children:[o.jsx(Ce,{children:o.jsx(ml,{})}),"MCP Servers"]}),o.jsx(dr,{as:nr,to:`/mcps/${t}`,children:l}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:i})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(kv,{}),"MCP documentation"]})})]}),o.jsx(sjn,{toolId:r,serverId:t})]})},lSt=[{label:"Last 24 hours",value:"24h"},{label:"Last 3 days",value:"3d"},{label:"Last 7 days",value:"7d"},{label:"Last 14 days",value:"14d"},{label:"Last 30 days",value:"30d"}],ijn=new Set(lSt.map(e=>e.value));function ojn(e){return typeof e=="string"&&(ijn.has(e)||e==="custom")}const ljn={"24h":1,"3d":3,"7d":7,"14d":14,"30d":30},cjn={"Studio Cloud":42,Production:31,Staging:18,Dev:7,"CI / Preview":2};function ujn(e,t,r){let n=1;e!=="custom"?n=ljn[e]??1:t?.from&&t?.to&&(n=Math.max(1,Nar(t.to,t.from)+1));const s=r.filter(i=>i.field==="Environment"&&i.comparator==="is"),a=s.length===0?100:s.flatMap(i=>i.values).reduce((i,l)=>i+(cjn[l]??0),0);return n*(a/100)}const cSt=b.createContext({datePreset:"24h",setDatePreset:()=>{},customRange:void 0,setCustomRange:()=>{},dateRangeLabel:"Last 24 hours",filterGroups:[],setFilterGroups:()=>{},multiplier:1});function uSt(){return b.useContext(cSt)}function djn(e,t){return e!=="custom"?lSt.find(r=>r.value===e).label:t?.from?t.to?`${or(t.from,"MMM d, yyyy")} – ${or(t.to,"MMM d, yyyy")}`:or(t.from,"MMM d, yyyy"):"Custom range"}function fjn({children:e,initialPreset:t,onPresetChange:r}){const[n,s]=b.useState(t??"24h"),[a,i]=b.useState(void 0),[l,c]=b.useState([]),u=djn(n,a),d=ujn(n,a,l);b.useEffect(()=>{t&&t!==n&&s(t)},[t]);const f=b.useCallback(h=>{s(h),r?.(h)},[r]);return o.jsx(cSt.Provider,{value:{datePreset:n,setDatePreset:f,customRange:a,setCustomRange:i,dateRangeLabel:u,filterGroups:l,setFilterGroups:c,multiplier:d},children:e})}const Kee={"24h":1440*60*1e3,"3d":4320*60*1e3,"7d":10080*60*1e3,"14d":336*60*60*1e3,"30d":720*60*60*1e3};function hjn(e,t){const r=new Date;if(e!=="custom"){const n=Kee[e]??Kee["24h"];return{start:new Date(r.getTime()-n),end:r}}return{start:t?.from??new Date(r.getTime()-Kee["24h"]),end:t?.to??r}}function Iv(){const{datePreset:e,customRange:t}=uSt(),r=hjn(e,t);return{datePreset:e,customRange:t,timestamp:r}}async function Jee(e,t,r){const n=await e.getMetricPercentiles({name:t,percentiles:[.5,.95],interval:"1h",filters:{timestamp:r}}),s=n.series.find(l=>l.percentile===.5),a=n.series.find(l=>l.percentile===.95);if(!s||!a)return[];const i=new Map(a.points.map(l=>[new Date(l.timestamp).getTime(),l.value]));return s.points.map(l=>{const c=new Date(l.timestamp);return{time:c.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),p50:Math.round(l.value),p95:Math.round(i.get(c.getTime())??0)}})}function pjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","latency",t,r],queryFn:async()=>{const[s,a,i]=await Promise.all([Jee(e,"mastra_agent_duration_ms",n),Jee(e,"mastra_workflow_duration_ms",n),Jee(e,"mastra_tool_duration_ms",n)]);return{agentData:s,workflowData:a,toolData:i}}})}const mjn=[{dataKey:"p50",label:"p50",color:dc.blue,aggregate:e=>({value:e.length>0?`${Math.round(e.reduce((t,r)=>t+r.p50,0)/e.length)}`:"0",suffix:"avg ms"})},{dataKey:"p95",label:"p95",color:dc.yellow,aggregate:e=>({value:e.length>0?`${Math.round(e.reduce((t,r)=>t+r.p95,0)/e.length)}`:"0",suffix:"avg ms"})}];function ete({data:e}){return e.length===0?o.jsx(qt.NoData,{message:"No latency data yet"}):o.jsx(Uhe,{data:e,series:mjn})}function gjn(){const{data:e,isLoading:t,isError:r}=pjn(),n=!!e&&(e.agentData.length>0||e.workflowData.length>0||e.toolData.length>0),s=e&&e.agentData.length>0?`${Math.round(e.agentData.reduce((a,i)=>a+i.p50,0)/e.agentData.length)}ms`:"—";return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Latency",description:"Hourly p50 and p95 latency."}),n&&o.jsx(qt.Summary,{value:s,label:"Avg p50"})]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load latency data"}):o.jsx(qt.Content,{children:n?o.jsxs(wf,{defaultTab:"agents",className:"overflow-visible",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"agents",children:"Agents"}),o.jsx(vs,{value:"workflows",children:"Workflows"}),o.jsx(vs,{value:"tools",children:"Tools"})]}),o.jsx(Ns,{value:"agents",children:o.jsx(ete,{data:e.agentData})}),o.jsx(Ns,{value:"workflows",children:o.jsx(ete,{data:e.workflowData})}),o.jsx(Ns,{value:"tools",children:o.jsx(ete,{data:e.toolData})})]}):o.jsx(qt.NoData,{message:"No latency data yet"})})]})}function dSt(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","agent-runs-kpi",t,r],queryFn:()=>e.getMetricAggregate({name:["mastra_agent_duration_ms"],aggregation:"count",filters:{timestamp:n},comparePeriod:"previous_period"})})}function yjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","avg-score-kpi",t,r],queryFn:async()=>{const s=await e.listScorers(),a=Object.keys(s??{});if(a.length===0)return{value:null,previousValue:null,changePercent:null};const i={timestamp:{start:n.start,end:n.end}},c=(await Promise.all(a.map(async h=>{const[p,m]=await Promise.all([e.getScoreAggregate({scorerId:h,aggregation:"avg",filters:i}),e.getScoreAggregate({scorerId:h,aggregation:"count",filters:i})]);return{avg:p.value??0,count:m.value??0}}))).filter(h=>h.count>0);if(c.length===0)return{value:null,previousValue:null,changePercent:null};const u=c.reduce((h,p)=>h+p.count,0),f=c.reduce((h,p)=>h+p.avg*p.count,0)/u;return{value:Math.round(f*100)/100,previousValue:null,changePercent:null}}})}function vjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","model-cost-kpi",t,r],queryFn:async()=>{const s=await e.getMetricAggregate({name:["mastra_model_total_input_tokens","mastra_model_total_output_tokens"],aggregation:"sum",filters:{timestamp:n},comparePeriod:"previous_period"});return{cost:s.estimatedCost??null,costUnit:s.costUnit??null,previousCost:s.previousEstimatedCost??null,costChangePercent:s.costChangePercent??null}}})}function bjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","total-tokens-kpi",t,r],queryFn:async()=>{const[s,a]=await Promise.all([e.getMetricAggregate({name:["mastra_model_total_input_tokens"],aggregation:"sum",filters:{timestamp:n},comparePeriod:"previous_period"}),e.getMetricAggregate({name:["mastra_model_total_output_tokens"],aggregation:"sum",filters:{timestamp:n},comparePeriod:"previous_period"})]),i=s.value!=null||a.value!=null,l=s.previousValue!=null||a.previousValue!=null,c=(s.value??0)+(a.value??0),u=(s.previousValue??0)+(a.previousValue??0),d=l&&u>0?(c-u)/u*100:null;return{value:i?c:null,previousValue:l?u:null,changePercent:d}}})}function xjn(){const{data:e,isLoading:t,isError:r}=dSt(),n=e?.value!=null;return o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Agent Runs"}),o.jsx(fr.Value,{className:n?void 0:"invisible",children:n?e.value.toLocaleString():"—"}),r?o.jsx(fr.Error,{}):t?o.jsx(fr.Loading,{}):n?e.changePercent!=null?o.jsx(fr.Change,{changePct:e.changePercent,prevValue:e.previousValue?.toLocaleString()}):o.jsx(fr.NoChange,{}):o.jsx(fr.NoData,{})]})}function wjn(){const{data:e,isLoading:t,isError:r}=vjn(),n=e?.cost!=null;return o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Model Cost"}),o.jsx(fr.Value,{className:n?void 0:"invisible",children:n?eE(e.cost,e.costUnit):"—"}),r?o.jsx(fr.Error,{}):t?o.jsx(fr.Loading,{}):n?e.costChangePercent!=null?o.jsx(fr.Change,{changePct:e.costChangePercent,prevValue:e.previousCost!=null?eE(e.previousCost,e.costUnit):void 0}):o.jsx(fr.NoChange,{}):o.jsx(fr.NoData,{})]})}function Sjn(){const{data:e,isLoading:t,isError:r}=bjn(),n=e?.value!=null;return o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Tokens"}),o.jsx(fr.Value,{className:n?void 0:"invisible",children:n?Bm(e.value):"—"}),r?o.jsx(fr.Error,{}):t?o.jsx(fr.Loading,{}):n?e.changePercent!=null?o.jsx(fr.Change,{changePct:e.changePercent,prevValue:e.previousValue!=null?Bm(e.previousValue):void 0}):o.jsx(fr.NoChange,{}):o.jsx(fr.NoData,{})]})}function Ojn(){const{data:e,isLoading:t,isError:r}=yjn(),n=e?.value!=null;return o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Avg Score"}),o.jsx(fr.Value,{className:n?void 0:"invisible",children:n?String(e.value):"—"}),r?o.jsx(fr.Error,{}):t?o.jsx(fr.Loading,{}):n?e.changePercent!=null?o.jsx(fr.Change,{changePct:e.changePercent,prevValue:e.previousValue!=null?String(e.previousValue):void 0}):o.jsx(fr.NoChange,{}):o.jsx(fr.NoData,{})]})}function kjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","model-usage-cost",t,r],queryFn:async()=>{const s=["mastra_model_total_input_tokens","mastra_model_total_output_tokens","mastra_model_input_cache_read_tokens","mastra_model_input_cache_write_tokens"],[a,i,l,c]=await Promise.all(s.map(h=>e.getMetricBreakdown({name:[h],groupBy:["model"],aggregation:"sum",filters:{timestamp:n}}))),u=new Map,d=h=>(u.has(h)||u.set(h,{input:0,output:0,cacheRead:0,cacheWrite:0,cost:null,costUnit:null}),u.get(h)),f=(h,p)=>{p.estimatedCost!=null&&(h.cost=(h.cost??0)+p.estimatedCost,p.costUnit&&(h.costUnit=p.costUnit))};for(const h of a.groups){const p=h.dimensions.model??"unknown",m=d(p);m.input=h.value,f(m,h)}for(const h of i.groups){const p=h.dimensions.model??"unknown",m=d(p);m.output=h.value,f(m,h)}for(const h of l.groups){const p=h.dimensions.model??"unknown",m=d(p);m.cacheRead=h.value,f(m,h)}for(const h of c.groups){const p=h.dimensions.model??"unknown",m=d(p);m.cacheWrite=h.value,f(m,h)}return Array.from(u.entries()).map(([h,p])=>({model:h,input:Bm(p.input),output:Bm(p.output),cacheRead:Bm(p.cacheRead),cacheWrite:Bm(p.cacheWrite),cost:p.cost,costUnit:p.costUnit})).sort((h,p)=>h.model.localeCompare(p.model))}})}function _jn(){const{data:e,isLoading:t,isError:r}=kjn(),n=!!e&&e.length>0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Model Usage & Cost",description:"Token consumption by model."}),n&&(()=>{const s=e.reduce((i,l)=>i+(l.cost??0),0),a=e.find(i=>i.costUnit)?.costUnit;return o.jsx(qt.Summary,{value:s>0?eE(s,a):"—",label:"Total cost"})})()]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load model usage data"}):o.jsx(qt.Content,{children:n?o.jsx(Bhe,{columns:[{label:"Model",value:s=>s.model},{label:"Input",value:s=>s.input},{label:"Output",value:s=>s.output},{label:"Cache Read",value:s=>s.cacheRead},{label:"Cache Write",value:s=>s.cacheWrite},{label:"Cost",value:s=>s.cost!=null?eE(s.cost,s.costUnit):"—",highlight:!0}],data:e.map(s=>({...s,key:s.model}))}):o.jsx(qt.NoData,{message:"No model usage data yet"})})]})}function Ejn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","scores-card",t,r],queryFn:async()=>{const s={timestamp:{start:n.start,end:n.end}},a=await e.listScorers(),i=Object.keys(a??{});if(i.length===0)return{summaryData:[],overTimeData:[],scorerNames:[],avgScore:null};const c=(await Promise.all(i.map(async x=>{const[w,O,k,_]=await Promise.all([e.getScoreAggregate({scorerId:x,aggregation:"avg",filters:s}),e.getScoreAggregate({scorerId:x,aggregation:"min",filters:s}),e.getScoreAggregate({scorerId:x,aggregation:"max",filters:s}),e.getScoreAggregate({scorerId:x,aggregation:"count",filters:s})]);return{scorer:x,avg:w.value??0,min:O.value??0,max:k.value??0,count:_.value??0}}))).filter(x=>x.count>0),u=c.map(x=>x.scorer);if(c.length===0)return{summaryData:[],overTimeData:[],scorerNames:[],avgScore:null};const d=c.reduce((x,w)=>x+w.avg*w.count,0),f=c.reduce((x,w)=>x+w.count,0),h=f?Math.round(d/f*100)/100:0,p="1h",m=await Promise.all(u.map(x=>e.getScoreTimeSeries({scorerId:x,interval:p,aggregation:"avg",filters:s}))),g=new Map;for(let x=0;x<u.length;x++){const w=u[x],O=m[x]?.series??[];for(const k of O)for(const _ of k.points){const T=new Date(_.timestamp).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});g.has(T)||g.set(T,new Map);const j=g.get(T);j.has(w)||j.set(w,{sum:0,count:0});const A=j.get(w);A.sum+=_.value,A.count+=1}}const y=Array.from(g.entries()).sort(([x],[w])=>x.localeCompare(w)).map(([x,w])=>{const O={time:x};for(const[k,_]of w)O[k]=+(_.sum/_.count).toFixed(2);return O});return{summaryData:c,overTimeData:y,scorerNames:u,avgScore:h}}})}const S8e=[dc.green,dc.blue,dc.purple,dc.orange,dc.pink,dc.yellow];function Cjn(){const{data:e,isLoading:t,isError:r}=Ejn(),n=!!e&&e.summaryData.length>0,s=b.useMemo(()=>e?.scorerNames?e.scorerNames.map((a,i)=>({dataKey:a,label:a,color:S8e[i%S8e.length],aggregate:l=>({value:l.length>0?(l.reduce((c,u)=>c+(u[a]??0),0)/l.length).toFixed(2):"0",suffix:"avg"})})):[],[e?.scorerNames]);return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Scores",description:"Evaluation scorer performance."}),n&&o.jsx(qt.Summary,{value:e?.avgScore!=null?`avg ${e.avgScore}`:"—",label:"Across all scorers"})]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load scores data"}):o.jsx(qt.Content,{children:n?o.jsxs(wf,{defaultTab:"over-time",className:"overflow-visible",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"over-time",children:"Over Time"}),o.jsx(vs,{value:"summary",children:"Summary"})]}),o.jsx(Ns,{value:"over-time",className:"pb-0",children:e.overTimeData.length>0?o.jsx(Uhe,{data:e.overTimeData,series:s,yDomain:[0,1]}):o.jsx(qt.NoData,{message:"No time series data yet"})}),o.jsx(Ns,{value:"summary",children:o.jsx(Bhe,{columns:[{label:"Scorer",value:a=>a.scorer},{label:"Avg",value:a=>a.avg.toFixed(2),highlight:!0},{label:"Min",value:a=>a.min.toFixed(2)},{label:"Max",value:a=>a.max.toFixed(2)},{label:"Count",value:a=>a.count.toLocaleString()}],data:e.summaryData.map(a=>({...a,key:a.scorer}))})})]}):o.jsx(qt.NoData,{message:"No scores data yet"})})]})}function jjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","token-usage-by-agent",t,r],queryFn:async()=>{const[s,a,i,l]=await Promise.all([e.getMetricBreakdown({name:["mastra_model_total_input_tokens"],groupBy:["entityName"],aggregation:"sum",filters:{timestamp:n}}),e.getMetricBreakdown({name:["mastra_model_total_output_tokens"],groupBy:["entityName"],aggregation:"sum",filters:{timestamp:n}}),e.getMetricBreakdown({name:["mastra_model_input_cache_read_tokens"],groupBy:["entityName"],aggregation:"sum",filters:{timestamp:n}}),e.getMetricBreakdown({name:["mastra_model_input_cache_write_tokens"],groupBy:["entityName"],aggregation:"sum",filters:{timestamp:n}})]),c=new Map,u=f=>(c.has(f)||c.set(f,{input:0,output:0,cost:null,costUnit:null}),c.get(f)),d=(f,h)=>{h.estimatedCost!=null&&(f.cost=(f.cost??0)+h.estimatedCost,h.costUnit&&(f.costUnit=h.costUnit))};for(const f of s.groups){const h=f.dimensions.entityName??"unknown",p=u(h);p.input=f.value,d(p,f)}for(const f of a.groups){const h=f.dimensions.entityName??"unknown",p=u(h);p.output=f.value,d(p,f)}for(const f of i.groups){const h=f.dimensions.entityName??"unknown",p=u(h);d(p,f)}for(const f of l.groups){const h=f.dimensions.entityName??"unknown",p=u(h);d(p,f)}return Array.from(c.entries()).map(([f,h])=>({name:f,input:h.input,output:h.output,total:h.input+h.output,cost:h.cost,costUnit:h.costUnit})).sort((f,h)=>h.total-f.total)}})}function Tjn(){const{data:e,isLoading:t,isError:r}=jjn(),[n,s]=b.useState("tokens"),a=!!e&&e.length>0,i=e?.reduce((p,m)=>p+m.total,0)??0,l=e?.filter(p=>p.cost!=null&&p.cost>0)??[],u=new Set(l.map(p=>p.costUnit??"usd")).size<=1,d=u?l[0]?.costUnit??null:null,f=u?l.reduce((p,m)=>p+(m.cost??0),0):0,h=u&&f>0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Token Usage by Agent",description:"Token consumption grouped by agent."}),a&&(n==="cost"&&h?o.jsx(qt.Summary,{value:eE(f,d),label:"Total cost"}):o.jsx(qt.Summary,{value:Bm(i),label:"Total tokens"}))]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load token usage data"}):o.jsx(qt.Content,{children:a?o.jsxs(wf,{defaultTab:"tokens",value:n,onValueChange:p=>s(p),className:"grid grid-rows-[auto_1fr] overflow-y-auto h-full",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"tokens",children:"Tokens"}),o.jsx(vs,{value:"cost",children:"Cost"})]}),o.jsx(Ns,{value:"tokens",children:o.jsx(E_,{data:e.map(p=>({name:p.name,values:[p.input,p.output]})),segments:[{label:"Input",color:dc.blueDark},{label:"Output",color:dc.blue}],maxVal:Math.max(...e.map(p=>p.input+p.output)),fmt:Bm})}),o.jsx(Ns,{value:"cost",children:h?o.jsx(E_,{data:e.filter(p=>p.cost!=null&&p.cost>0).sort((p,m)=>(m.cost??0)-(p.cost??0)).map(p=>({name:p.name,values:[p.cost]})),segments:[{label:"Cost",color:dc.purple}],maxVal:Math.max(...e.map(p=>p.cost??0)),fmt:p=>eE(p,d)}):o.jsx(qt.NoData,{message:"No cost data yet"})})]}):o.jsx(qt.NoData,{message:"No token usage data yet"})})]})}async function tte(e,t,r){const n=await e.getMetricBreakdown({name:[t],groupBy:["entityName","status"],aggregation:"count",filters:{timestamp:r}}),s=new Map;for(const a of n.groups){const i=a.dimensions.entityName??"unknown",l=a.dimensions.status??"ok";s.has(i)||s.set(i,{completed:0,errors:0});const c=s.get(i);l==="error"?c.errors+=a.value:c.completed+=a.value}return Array.from(s.entries()).map(([a,i])=>({name:a,...i})).sort((a,i)=>i.completed+i.errors-(a.completed+a.errors))}function Njn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","trace-volume",t,r],queryFn:async()=>{const[s,a,i]=await Promise.all([tte(e,"mastra_agent_duration_ms",n),tte(e,"mastra_workflow_duration_ms",n),tte(e,"mastra_tool_duration_ms",n)]);return{agentData:s,workflowData:a,toolData:i}}})}function rte({data:e}){return o.jsx(E_,{data:e.map(t=>({name:t.name,values:[t.completed,t.errors]})),segments:[{label:"Completed",color:dc.blueDark},{label:"Errors",color:dc.pink}],maxVal:Math.max(...e.map(t=>t.completed+t.errors)),fmt:Bm})}function Ajn(){const{data:e,isLoading:t,isError:r}=Njn(),n=!!e&&(e.agentData.length>0||e.workflowData.length>0||e.toolData.length>0),s=e?[...e.agentData,...e.workflowData,...e.toolData].reduce((a,i)=>a+i.completed+i.errors,0):0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Trace Volume",description:"Runs and call counts."}),n&&o.jsx(qt.Summary,{value:Bm(s),label:"Total runs"})]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load trace volume data"}):o.jsx(qt.Content,{children:n?o.jsxs(wf,{defaultTab:"agents",className:"grid grid-rows-[auto_1fr] overflow-y-auto h-full",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"agents",children:"Agents"}),o.jsx(vs,{value:"workflows",children:"Workflows"}),o.jsx(vs,{value:"tools",children:"Tools"})]}),o.jsx(Ns,{value:"agents",children:e.agentData.length>0?o.jsx(rte,{data:e.agentData}):o.jsx(qt.NoData,{message:"No agent data yet"})}),o.jsx(Ns,{value:"workflows",children:e.workflowData.length>0?o.jsx(rte,{data:e.workflowData}):o.jsx(qt.NoData,{message:"No workflow data yet"})}),o.jsx(Ns,{value:"tools",children:e.toolData.length>0?o.jsx(rte,{data:e.toolData}):o.jsx(qt.NoData,{message:"No tool data yet"})})]}):o.jsx(qt.NoData,{message:"No trace volume data yet"})})]})}const Ijn=new Set(["ObservabilityStorageClickhouseVNext","ObservabilityStorageDuckDB","ObservabilityInMemory"]);function Rjn(){const{data:e,isLoading:t}=z9(),r=e?.observabilityStorageType,n=r?Ijn.has(r):!1,s=r==="ObservabilityInMemory";return t?null:n?o.jsxs("div",{className:"grid gap-8 content-start pb-10",children:[s&&o.jsxs(Ll,{variant:"info",children:[o.jsx($l,{children:"Metrics are not persisted"}),o.jsx(Iu,{as:"p",children:"This project uses in-memory storage for observability. Metrics will be lost on every server restart. For persistent metrics, switch the observability storage to ClickHouse or DuckDB."})]}),o.jsxs(Jse,{children:[o.jsx(xjn,{}),o.jsx(wjn,{}),o.jsx(Sjn,{}),o.jsx(Ojn,{})]}),o.jsxs(Jse,{children:[o.jsx(_jn,{}),o.jsx(Tjn,{}),o.jsx(Cjn,{}),o.jsx(Ajn,{}),o.jsx(gjn,{})]})]}):o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"Metrics are not available with your current storage",descriptionSlot:"Metrics require ClickHouse, DuckDB, or in-memory storage for observability. Relational databases (PostgreSQL, LibSQL) do not support metrics collection. To enable metrics on an existing project, switch the observability storage in the Mastra configuration.",actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/observability/metrics/overview",target:"_blank",rel:"noopener noreferrer",children:["Metrics Documentation ",o.jsx(Aa,{})]})})})}const Pjn=[{label:"Last 24 hours",value:"24h"},{label:"Last 3 days",value:"3d"},{label:"Last 7 days",value:"7d"},{label:"Last 14 days",value:"14d"},{label:"Last 30 days",value:"30d"}];function Mjn(){const{datePreset:e,setDatePreset:t}=uSt();return o.jsx(Po,{name:"date-range",labelIsHidden:!0,value:e,options:Pjn,onValueChange:r=>t(r)})}const nte="period";function Djn(){const[e,t]=vo(),r=e.get(nte),n=ojn(r)?r:"24h",s=b.useCallback(a=>{t(i=>{const l=new URLSearchParams(i);return a==="24h"?l.delete(nte):l.set(nte,a),l},{replace:!0})},[t]);return o.jsx(fjn,{initialPreset:n,onPresetChange:s,children:o.jsx(Ljn,{})})}function Ljn(){const{error:e}=dSt();return e&&As(e)?o.jsx(Vr,{title:"Metrics",icon:o.jsx(zO,{}),children:o.jsx(na,{})}):e&&Os(e)?o.jsx(Vr,{title:"Metrics",icon:o.jsx(zO,{}),children:o.jsx(Zs,{resource:"metrics"})}):e?o.jsx(Vr,{title:"Metrics",icon:o.jsx(zO,{}),children:o.jsx(sd,{title:"Failed to load metrics",message:e.message})}):o.jsxs(Ft,{width:"wide",height:"full",children:[o.jsx(Ft.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(zO,{})," Metrics"]})})}),o.jsxs(Ft.Column,{className:"flex justify-end gap-2",children:[o.jsx(Mjn,{}),o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:o.jsx(Io,{})})]})]})}),o.jsx(Rjn,{})]})}const $jn=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:zO,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:Wi,href:"/observability"}];function Fjn(){return o.jsxs(WO,{children:[o.jsx(WO.Top,{children:o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{children:[o.jsx(Wi,{})," Observability"]})})})}),o.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:$jn.map(e=>o.jsxs(nr,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}const zjn=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:pa,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:Qi,href:"/prompts"},{title:"Workflows",description:"Build step-based execution flows with suspend, resume, and branching.",icon:Ii,href:"/workflows"},{title:"Processors",description:"Configure data processors for transforming and routing information.",icon:Xw,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:ml,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:Ai,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:sc,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:mE,href:"/request-context"}];function Bjn(){return o.jsxs(Ft,{width:"narrow",children:[o.jsx(Ft.TopArea,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(A7t,{})," Primitives"]})})}),o.jsx(Ft.MainArea,{children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:zjn.map(e=>o.jsxs(nr,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function Ujn(){const{paths:e}=lr(),{data:t,isLoading:r,error:n}=a0t(),{isCmsAvailable:s}=FP(),[a,i]=b.useState(""),l=t?.promptBlocks??[];return n&&As(n)?o.jsx(Vr,{title:"Prompts",icon:o.jsx(Qi,{}),children:o.jsx(na,{})}):n&&Os(n)?o.jsx(Vr,{title:"Prompts",icon:o.jsx(Qi,{}),children:o.jsx(Zs,{resource:"prompt blocks"})}):n?o.jsx(Vr,{title:"Prompts",icon:o.jsx(Qi,{}),children:o.jsx(sd,{title:"Failed to load prompt blocks",message:n.message})}):l.length===0&&!r?o.jsx(Vr,{title:"Prompts",icon:o.jsx(Qi,{}),children:o.jsx(z0n,{})}):o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:r,children:[o.jsx(Qi,{})," Prompts"]})})}),o.jsxs(Ft.Column,{className:"flex justify-end gap-2",children:[o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Prompts documentation",children:o.jsx(Io,{})}),s&&o.jsxs(ve,{as:nr,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[o.jsx(is,{}),"Create Prompt"]})]})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(Ah,{onSearch:i,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),o.jsx(F0n,{promptBlocks:l,isLoading:r,search:a})]})}function Vjn(){return o.jsxs(Ft,{width:"narrow",children:[o.jsx(Ft.TopArea,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(mE,{})," Request Context"]})})}),o.jsx(Ft.MainArea,{children:o.jsx(pbn,{children:o.jsx($xt,{})})})]})}const qjn=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:QBt,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:Io,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:Aa,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:mce,href:"https://discord.gg/BTYqqHKUrf",external:!0},{title:"Share with your team",description:"Running Mastra Studio locally? Deploy to the cloud so your team can collaborate.",icon:yWe,href:"https://mastra.ai/cloud",external:!0},{title:"Talk to our Sales team",description:"Get a custom demo, discuss on-prem deployments, and how we can help you accelerate getting agents into production.",icon:V8t,href:"https://mastra.ai/contact?ref=studio",external:!0}];function Hjn(){return o.jsxs(Ft,{width:"narrow",children:[o.jsx(Ft.TopArea,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(Io,{})," Resources"]})})}),o.jsx(Ft.MainArea,{children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:qjn.map(e=>o.jsxs("a",{href:e.href,...e.external?{target:"_blank",rel:"noreferrer"}:{},className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title}),e.external&&o.jsx(Aa,{className:"h-3.5 w-3.5 text-icon3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function Qjn(){const{data:e={},isLoading:t,error:r}=_f(),[n,s]=b.useState(""),[a,i]=b.useState("all");if(r&&As(r))return o.jsx(Vr,{title:"Scorers",icon:o.jsx(Hs,{}),children:o.jsx(na,{})});if(r&&Os(r))return o.jsx(Vr,{title:"Scorers",icon:o.jsx(Hs,{}),children:o.jsx(Zs,{resource:"scorers"})});if(r)return o.jsx(Vr,{title:"Scorers",icon:o.jsx(Hs,{}),children:o.jsx(sd,{title:"Failed to load scorers",message:r.message})});if(Object.keys(e).length===0&&!t)return o.jsx(Vr,{title:"Scorers",icon:o.jsx(Hs,{}),children:o.jsx(yxn,{})});const l=a!=="all"||n!=="",c=()=>{s(""),i("all")};return o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:t,children:[o.jsx(Hs,{})," Scorers"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Scorers documentation",children:o.jsx(Io,{})})})]}),o.jsx(vxn,{search:n,onSearchChange:s,sourceFilter:a,onSourceFilterChange:i,onReset:c,hasActiveFilters:l})]}),o.jsx(gxn,{scorers:e,isLoading:t,search:n,sourceFilter:a})]})}function Wjn(){const{scorerId:e}=ba(),[t,r]=vo(),n=t.get("scoreId")??void 0,[s,a]=b.useState(n),[i,l]=b.useState(0),[c,u]=b.useState(!!n),[d,f]=b.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:h,isLoading:p,error:m}=fxn(e),{data:g={},isLoading:y,error:x}=Bp(),{data:w,isLoading:O,error:k}=Cv(),{data:_,isLoading:E,error:T}=dxn({scorerId:e,page:i,entityId:d?.value==="all"?void 0:d?.value,entityType:d?.type==="ALL"?void 0:d?.type}),j=b.useMemo(()=>h?.agentIds?.filter(Q=>g[Q]).map(Q=>({value:Q,label:g[Q].name,type:"AGENT"}))||[],[h?.agentIds,g]),A=b.useMemo(()=>h?.workflowIds?.map(Q=>({value:Q,label:Q,type:"WORKFLOW"}))||[],[h?.workflowIds]),I=b.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...j,...A],[j,A]),P=t.get("entity"),R=I.find(Q=>Q.value===P);R&&R.value!==d?.value&&f(R),b.useEffect(()=>{if(m){const Q=m instanceof Error?m.message:"Failed to load scorer";Ue.error(`Error loading scorer: ${Q}`)}},[m]),b.useEffect(()=>{if(x){const Q=x instanceof Error?x.message:"Failed to load agents";Ue.error(`Error loading agents: ${Q}`)}},[x]),b.useEffect(()=>{if(k){const Q=k instanceof Error?k.message:"Failed to load workflows";Ue.error(`Error loading workflows: ${Q}`)}},[k]);const B=b.useMemo(()=>_?.scores||[],[_?.scores]),D=_?.pagination,F=h?.agentIds?.map(Q=>({name:Q,id:Object.entries(g).find(([,G])=>G.name===Q)?.[0]}))||[],U=h?.workflowIds?.map(Q=>({name:Q,id:Object.entries(w||{}).find(([,G])=>G.name===Q)?.[0]}))||[],V=[{key:"entities",label:"Entities",value:([...F.map(Q=>({id:Q.id,name:Q.name,type:"AGENT"})),...U.map(Q=>({id:Q.id,name:Q.name,type:"WORKFLOW"}))]||[]).map(Q=>({id:Q.id,name:Q.name||Q.id,path:`${Q.type==="AGENT"?"/agents":"/workflows"}/${Q.name}`}))}],W=Q=>{Q?.value&&r(G=>{const J=new URLSearchParams(G);return J.set("entity",Q.value),J})};if(b.useEffect(()=>{const Q=t.get("scoreId")??void 0;if(Q===s)return;if(!Q){a(void 0),u(!1);return}B.find(J=>J.id===Q)&&(a(Q),u(!0))},[t,B]),As(m)||As(x)||As(k))return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/scorers",children:[o.jsx(Ce,{children:o.jsx(Hs,{})}),"Scorers"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})]});if(m&&Os(m))return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/scorers",children:[o.jsx(Ce,{children:o.jsx(Hs,{})}),"Scorers"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"scorers"})})]});if(p||m||x||k)return null;const L=Q=>{a(Q),u(!0),r(G=>{const J=new URLSearchParams(G);return J.set("scoreId",Q),J})},Y=Q=>{a(Q),r(G=>{const J=new URLSearchParams(G);return Q?J.set("scoreId",Q):J.delete("scoreId"),J})},q=jhe({entries:B,id:s,update:Y}),M=The({entries:B,id:s,update:Y});return o.jsxs(o.Fragment,{children:[o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/scorers",children:[o.jsx(Ce,{children:o.jsx(Hs,{})}),"Scorers"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:o.jsx(hxn,{value:e,variant:"ghost"})})]}),o.jsxs(Ec,{children:[h?.scorer?.source==="stored"&&o.jsxs(ve,{variant:"light",as:nr,to:`/cms/scorers/${e}/edit`,children:[o.jsx(Ce,{children:o.jsx(dv,{})}),"Edit"]}),o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/evals/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(kv,{}),"Scorers documentation"]})]})]}),o.jsx("div",{className:Z("grid overflow-y-auto h-full"),children:o.jsxs("div",{className:Z("max-w-400 w-full px-12 mx-auto grid content-start gap-8 h-full"),children:[o.jsxs(Cn,{children:[o.jsxs(Cn.Title,{isLoading:p,children:[o.jsx(Hs,{})," ",h?.scorer?.config?.name]}),(p||h?.scorer?.config?.description)&&o.jsx(Cn.Description,{isLoading:p,children:h?.scorer?.config?.description})]}),o.jsx(n0,{data:V,LinkComponent:nr,isLoading:y||O}),o.jsx(uxn,{selectedEntity:d,entityOptions:I,onEntityChange:W,onReset:()=>{r(Q=>{const G=new URLSearchParams(Q);return G.set("entity","all"),G})},isLoading:E||y||O}),E?o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(It,{})}):o.jsx(sxn,{scores:B,selectedScoreId:s,pagination:{total:D?.total||0,hasMore:D?.hasMore||!1,perPage:D?.perPage||0,page:D?.page||0},onScoreClick:L,onPageChange:l,errorMsg:T?.message})]})})]}),o.jsx(Hxt,{scorerName:h?.scorer?.config?.name,score:Gjn(B.find(Q=>Q.id===s)),isOpen:c,onClose:()=>{u(!1),a(void 0),r(Q=>{const G=new URLSearchParams(Q);return G.delete("scoreId"),G})},onNext:q,onPrevious:M,computeTraceLink:(Q,G)=>`/observability?traceId=${Q}${G?`&spanId=${G}`:""}`})]})}const Gjn=e=>{if(e)return{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt)}},Zjn=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],Yjn=()=>{const{baseUrl:e,headers:t,apiPrefix:r}=Yhe(),{theme:n,setTheme:s}=Hn(),[a,i]=b.useState(n),l=b.useRef(n);return b.useEffect(()=>{i(n),l.current=n},[n]),o.jsxs(Ft,{width:"narrow",children:[o.jsx(Ft.TopArea,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(_he,{})," Settings"]})})}),o.jsxs(Ft.MainArea,{className:"grid gap-8 mt-6",children:[o.jsx("section",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-icon6 font-medium",children:"Theme"}),o.jsx(Jlt,{name:"theme",label:"Theme mode",value:a,onValueChange:c=>{const u=c;l.current=u,i(u)},options:Zjn.map(c=>({...c}))})]})}),o.jsx(uut,{initialConfig:{baseUrl:e,headers:t,apiPrefix:r},onSave:()=>{s(l.current)}})]})]})};function Xjn(){const[e]=vo(),t=ad(),r=e.get("redirect")||"/",n=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return o.jsx(rSt,{redirectUri:r,onSuccess:n,initialMode:"signup"})}function Kjn(e){return e.replace(/\/$/,"").split("/").pop()}function n8({children:e,className:t}){return o.jsx("div",{className:Z("border border-border1 rounded-lg mt-12 py-8 lg:min-h-[25rem] transition-height px-4 lg:px-12",t),children:e})}function Jjn({templates:e,linkComponent:t,className:r,isLoading:n}){const s=t||"a";return n?o.jsx("div",{className:Z("grid gap-y-4",r),children:Array.from({length:5}).map((a,i)=>o.jsx("div",{className:"h-16 bg-surface3 animate-pulse rounded-lg"},i))}):o.jsx("div",{className:Z("grid gap-y-4",r),children:e.map(a=>{const i=a?.agents||a?.tools||a?.networks||a?.workflows||a?.mcp;return o.jsxs("article",{className:Z("border border-border1 rounded-lg overflow-hidden w-full grid grid-cols-[1fr_auto] bg-surface3 transition-colors hover:bg-surface4"),children:[o.jsxs(s,{to:`/templates/${a.slug}`,className:Z("grid [&:hover_p]:text-neutral5",{"grid-cols-[8rem_1fr] lg:grid-cols-[12rem_1fr]":a.imageURL}),children:[a.imageURL&&o.jsx("div",{className:Z("overflow-hidden"),children:o.jsx("div",{className:"w-full h-full bg-cover thumb transition-scale duration-150",style:{backgroundImage:`url(${a.imageURL})`}})}),o.jsxs("div",{className:Z("grid py-3 px-6 w-full gap-0.5","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[o.jsx("h2",{className:"text-ui-lg text-neutral5",children:a.title}),o.jsx("p",{className:"text-ui-md text-neutral4 transition-colors duration-500",children:a.description}),o.jsxs("div",{className:"hidden 2xl:flex text-neutral3 text-ui-md flex-wrap items-center gap-4 mt-3",children:[i&&o.jsxs("ul",{className:Z("flex gap-4 text-ui-md text-neutral3 m-0 p-0 list-none","[&>li]:flex [&>li]:items-center [&>li]:gap-0.5 text-neutral4"),children:[a?.agents&&a.agents.length>0&&o.jsxs("li",{children:[o.jsx(pa,{})," ",a.agents.length]}),a?.tools&&a.tools.length>0&&o.jsxs("li",{children:[o.jsx(Ai,{})," ",a.tools.length]}),a?.networks&&a.networks.length>0&&o.jsxs("li",{children:[o.jsx(_We,{})," ",a.networks.length]}),a?.workflows&&a.workflows.length>0&&o.jsxs("li",{children:[o.jsx(X6,{})," ",a.workflows.length]}),a?.mcp&&a.mcp.length>0&&o.jsxs("li",{children:[o.jsx(ml,{})," ",a.mcp.length]})]}),i&&a.supportedProviders&&o.jsx("small",{children:"|"}),o.jsx("div",{className:"flex items-center text-neutral3 gap-4",children:a.supportedProviders.map(l=>o.jsx("span",{className:"",children:l},l))})]})]})]}),o.jsx("a",{href:a.githubUrl,className:Z("group items-center gap-2 text-ui-md ml-auto pr-4 hidden","lg:flex"),target:"_blank",rel:"noopener noreferrer",children:o.jsxs("span",{className:"flex items-center gap-2 px-2 py-1 rounded bg-surface1 group-hover:bg-surface2 text-neutral3 transition-colors group-hover:text-neutral5",children:[o.jsx(llt,{})," ",Kjn(a.githubUrl)]})})]},a.slug)})})}function eTn({tagOptions:e,selectedTag:t,providerOptions:r,selectedProvider:n,onTagChange:s,onProviderChange:a,searchTerm:i,onSearchChange:l,onReset:c,className:u,isLoading:d}){return d?o.jsxs("div",{className:Z("h-[6.5rem] flex items-center gap-8","[&>div]:bg-surface3 [&>div]:w-48 [&>div]:h-8 [&>div]:animate-pulse",u),children:[o.jsx("div",{})," ",o.jsx("div",{})," ",o.jsx("div",{})]}):o.jsxs("div",{className:Z("flex flex-wrap mx-auto sticky top-0 gap-4 bg-surface2 py-8",u),children:[o.jsx(Cx,{name:"search-templates",label:"Search templates",labelIsHidden:!0,value:i,onChange:f=>l?.(f.target.value),placeholder:"Search Template"}),o.jsx(Po,{label:"Filter by tag",labelIsHidden:!0,name:"filter-tag",value:t,onValueChange:s,options:e}),o.jsx(Po,{label:"Filter by provider",labelIsHidden:!0,name:"filter-provider",value:n,onValueChange:a,options:r}),c&&o.jsxs(ve,{onClick:c,children:["Reset ",o.jsx(vn,{})]})]})}function tTn(){const{data:e,isLoading:t}=Y3r(),{templates:r,tags:n,providers:s}=e??{templates:[],tags:[],providers:[]},[a,i]=b.useState("all"),[l,c]=b.useState("all"),[u,d]=b.useState(""),f=[{value:"all",label:"Any tag"}];(n||[]).forEach(w=>{f.push({value:w,label:w})});const h=[{value:"all",label:"Any provider"}];(s||[]).forEach(w=>{h.push({value:w,label:w})});const p=(w,O)=>{O==="tag"?i(w):O==="provider"&&c(w)},m=w=>{d(w)},g=()=>{i("all"),c("all"),d("")},y=r.filter(w=>!(u&&!w.title.toLowerCase().includes(u)&&!w.description.toLowerCase().includes(u)||a!=="all"&&!w.tags.includes(a)||l!=="all"&&!w.supportedProviders.includes(l))),x=u||a!=="all"||l!=="all";return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(Vu,{children:[o.jsx(Ce,{children:o.jsx(Ub,{})}),"Templates"]})}),o.jsxs("div",{className:Z("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[o.jsx(eTn,{selectedTag:a,onTagChange:w=>p(w,"tag"),tagOptions:f,selectedProvider:l,onProviderChange:w=>p(w,"provider"),providerOptions:h,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),o.jsx(Jjn,{templates:y,linkComponent:nr,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const rTn="1.25.1-alpha.0";function nTn({errorMsg:e,validationErrors:t}){const r=typeof e=="string"?e:e!=null?String(e):void 0,n=r?.includes("Invalid schema for function"),s=r?.includes("validation issue")||t&&t.length>0,a=()=>s?"Template installation completed but some validation issues remain. The template may still be functional, but you should review and fix these issues.":n?"There was an issue with the AI model configuration. This may be related to the selected model or AI SDK version compatibility.":"An unexpected error occurred during template installation.",i=()=>s?{icon:o.jsx(gh,{className:"text-yellow-500"}),title:"Template Installed with Warnings"}:{icon:o.jsx(b7t,{}),title:"Template Installation Failed"},{icon:l,title:c}=i();return o.jsxs(n8,{className:"space-y-4 text-neutral3 mb-8 content-center",children:[o.jsxs("div",{className:Z("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[l,o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-ui-md font-medium text-neutral5",children:c}),o.jsx("p",{className:"text-ui-md text-neutral3",children:a()})]})]}),t&&t.length>0&&o.jsxs("details",{className:"text-xs",children:[o.jsxs("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:["Show Validation Issues (",t.length,")"]}),o.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto max-h-60 text-left space-y-2",children:t.map((u,d)=>o.jsxs("div",{className:"border-l-2 border-red-400 pl-2",children:[o.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:u.type==="typescript"?"🔴 TypeScript Error":"⚠️ Lint Error"}),o.jsx("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-300 mt-1 whitespace-pre-wrap wrap-break-word",children:u.message})]},d))})]}),r&&!s&&o.jsxs("details",{className:"text-xs",children:[o.jsx("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:"Show Details"}),o.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs font-mono overflow-auto max-h-60 text-left",children:o.jsx("div",{className:"whitespace-pre-wrap wrap-break-word",children:r})})]})]})}function sTn({providerOptions:e,selectedProvider:t,onProviderChange:r,variables:n,errors:s,handleInstallTemplate:a,handleVariableChange:i,isLoadingEnvVars:l,isInstalling:c,defaultModelProvider:u,defaultModelId:d,onModelUpdate:f}){return o.jsx(n8,{children:o.jsxs("div",{className:"max-w-[40rem] my-4 p-4 lg:p-8 mx-auto gap-8 grid",children:[o.jsxs("h2",{className:Z("text-neutral4 text-header-sm font-semibold flex items-center gap-2","[&>svg]:w-[1.2em] [&_svg]:h-[1.2em] [&_svg]:opacity-70"),children:["Install Template ",o.jsx(EWe,{})]}),o.jsx(Po,{name:"template-provider",options:e,label:"Template AI Model Provider",onValueChange:r,value:t,placeholder:"Select",layout:"horizontal"}),t&&Object.entries(n||{}).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"text-neutral3 text-ui-md",children:"Set required Environmental Variables"}),o.jsx("div",{className:"grid grid-cols-[1fr_1fr] gap-4 items-start",children:l?o.jsxs("div",{className:Z("flex items-center justify-center col-span-2 text-neutral3 text-ui-sm gap-4","[&_svg]:opacity-50 [&_svg]:w-[1.1em] [&_svg]:h-[1.1em]","animate-in fade-in duration-300"),children:[o.jsx(It,{})," Loading variables..."]}):Object.entries(n).map(([h,p])=>o.jsxs(b.Fragment,{children:[o.jsx(Ex,{name:`env-${h}`,labelIsHidden:!0,label:"Key",value:h,disabled:!0,className:"w-full"}),o.jsx(Ex,{name:h,labelIsHidden:!0,label:"Value",value:p,onChange:i,errorMsg:s.includes(h)?"Value is required.":"",autoComplete:"off",className:"w-full"})]},h))}),o.jsxs("div",{className:"border-t border-border1 pt-12 mt-3.5 relative",children:[o.jsx("div",{className:"absolute w-8 h-8 rounded-full bg-surface2 top-0 left-1/2 -translate-x-1/2 -translate-y-4 text-ui-sm text-neutral3 flex items-center justify-center",children:"And"}),o.jsx("h3",{className:"text-neutral4 text-ui-lg",children:"Set AI Model for Template Installation"}),o.jsx("p",{className:"text-neutral3 text-ui-md mt-2 mb-8",children:"This model will be used by the workflow to process and install the template"}),o.jsx(Fxt,{defaultProvider:u||"",defaultModel:d||"",updateModel:f||(()=>Promise.resolve({message:"Updated"})),closeEditor:()=>{},autoSave:!0,selectProviderPlaceholder:"Provider"})]})]}),t&&!l&&o.jsx(ve,{className:Z("flex items-center gap-2 mt-4 justify-center text-ui-md w-full bg-surface5 min-h-10 rounded-lg text-neutral5 hover:bg-surface6 transition-colors","[&>svg]:w-[1.1em] [&_svg]:h-[1.1em] [&_svg]:text-neutral5"),onClick:a,disabled:!t||!u||!d||s.length>0||c,children:c?o.jsxs(o.Fragment,{children:[o.jsx(It,{className:"w-4 h-4"})," Installing..."]}):o.jsxs(o.Fragment,{children:["Install ",o.jsx(qd,{})]})})]})})}function aTn({title:e,description:t,githubUrl:r,isLoading:n,infoData:s,templateSlug:a}){const i=a?`feat/install-template-${a}`:"feat/install-template-[slug]";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Z("grid mt-8 items-center"),children:o.jsxs("div",{className:Z("text-header-lg flex items-center gap-3","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",{"[&>svg]:opacity-20":n}),children:[o.jsx(Ub,{}),o.jsx("h2",{className:Z({"bg-surface4 flex rounded-lg min-w-[50%]":n}),children:n?o.jsx(o.Fragment,{children:" "}):e})]})}),o.jsxs("div",{className:"grid lg:grid-cols-[1fr_1fr] gap-x-24",children:[o.jsxs("div",{className:"grid",children:[o.jsx("p",{className:Z("mb-4 text-ui-md text-neutral4 mt-2 leading-7",{"bg-surface4 rounded-lg ":n}),children:n?o.jsx(o.Fragment,{children:" "}):t}),!n&&a&&o.jsxs("div",{className:Z("bg-surface2 border border-surface4 rounded-lg p-4 mb-4","flex items-start gap-3"),children:[o.jsx("div",{className:"shrink-0 mt-0.5",children:o.jsx(qy,{className:"w-[1.1em] h-[1.1em] text-blue-500"})}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(W6,{className:"w-[1em] h-[1em] text-neutral4"}),o.jsx("span",{className:"text-ui-md font-medium text-neutral5",children:"A new Git branch will be created"})]}),o.jsxs("div",{className:"text-ui-sm text-neutral4 space-y-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium",children:"Branch name:"})," ",o.jsx("code",{className:"bg-surface3 px-1.5 py-0.5 rounded text-ui-sm font-mono",children:i})]}),o.jsx("div",{children:"This ensures safe installation with easy rollback if needed. Your main branch remains unchanged."})]})]})]}),r&&o.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 mt-auto text-neutral3 text-ui-md hover:text-neutral5",children:[o.jsx(llt,{}),r?.split("/")?.pop()]})]}),s&&o.jsx(n0,{data:s,labelsAreHidden:!0,isLoading:n})]})]})}function iTn({name:e,streamResult:t,workflowInfo:r}){const n=t?.phase||"initializing",s=t?.payload?.workflowState,a=t?.payload?.currentStep,i=t?.error,l=s?.steps||{},c=Object.keys(l).length>0,u=m=>m==="input"||m.endsWith(".input")||m.startsWith("Mapping_")&&/[0-9a-f]{8}/.test(m)||/[0-9a-f]{8,}/.test(m)?!1:r?.allSteps?m in r.allSteps:!0,d=Object.entries(l).filter(([m,g])=>u(m)),f=d.length,h=()=>{switch(n){case"initializing":return"Preparing template installation...";case"processing":return`Installing ${e} template`;case"completed":return"Template installation completed!";case"error":return"Template installation failed";default:return"Installing template..."}},p=d.map(([m,g])=>({id:m,status:g?.status,description:g?.description,title:m.charAt(0).toUpperCase()+m.slice(1).replace(/-/g," "),isActive:a?.id===m}));return o.jsxs(n8,{className:"space-y-6 text-neutral3 mb-8 content-center",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("h3",{className:"text-lg font-semibold text-neutral5",children:h()}),t?.runId&&o.jsxs("div",{className:"mt-2 text-ui-sm text-neutral3",children:["Run ID: ",t.runId]})]}),c&&f>0&&!["error"].includes(n)&&o.jsx("div",{className:"max-w-[30rem] w-full mx-auto px-6",children:o.jsx(NPr,{steps:p})}),i&&n==="error"&&o.jsxs("div",{className:Z("rounded-lg text-neutral5 p-6 flex items-center gap-3 text-ui-md bg-red-500/10","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:opacity-70 [&>svg]:text-red-500"),children:[o.jsx(hUt,{}),i||"Something went wrong"]}),c&&o.jsx(TPr,{steps:p,currentStep:a,className:"pb-4"}),!c&&n==="initializing"&&o.jsxs("div",{className:"text-center text-sm text-neutral3 grid gap-4 justify-items-center",children:[o.jsx(It,{}),o.jsx("p",{children:"This may take some time..."})]})]})}function oTn({name:e,installedEntities:t}){return o.jsxs(n8,{className:Z("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[o.jsx(EWe,{}),o.jsx("h2",{className:"text-header-md",children:"Done!"}),o.jsxs("p",{className:"text-ui-md text-center text-neutral3 ",children:["The ",o.jsx("b",{className:"text-neutral4",children:e})," template has been successfully installed.",t&&t.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("br",{})," Installed entities are listed below."]})]}),t&&t.length>0&&o.jsx(n0,{data:t})]})}function lTn(){const{templateSlug:e}=ba(),[t,r]=vo(),[n,s]=b.useState(""),[a,i]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState({}),[f,h]=b.useState([]),[p,m]=b.useState(null),[g,y]=b.useState(!1),[x,w]=b.useState(""),[O,k]=b.useState(!1),[_,E]=b.useState(!1),[T,j]=b.useState([]),{data:A,isLoading:I}=X3r({repoOrSlug:e,owner:"mastra-ai"}),R=rTn?.includes("beta")??!1?"beta":"main",{data:B,isLoading:D}=K3r({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:R}),{data:F,isLoading:U}=J3r(),{mutateAsync:z,isPending:V}=e5r(),{mutateAsync:W}=t5r(),{streamInstall:L,streamResult:Y,isStreaming:q}=n5r(F),{observeInstall:M,streamResult:Q,isStreaming:G}=s5r(F);b.useEffect(()=>{const re=t.get("runId");re&&!g&&!p&&!q&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:re}),w(re),W({runId:re}).then(le=>{const pe=le.snapshot;if(pe?.status==="success"&&pe?.result?.success)y(!0);else if(pe?.result?.success===!1)if(pe?.result?.validationResults&&!pe?.result?.validationResults?.valid&&pe?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ue,errors:we}=pe.result.validationResults,ke=`Template installation completed but ${ue} validation issue${ue>1?"s":""} remain unresolved.`;m(ke),j(we||[])}else{const ue=pe?.result?.message||pe?.result?.error||"Template installation failed";m(typeof ue=="string"?ue:String(ue))}}).catch(le=>{console.error("❌ Failed to fetch run details:",le),m("Failed to retrieve installation status after reload")}))},[t,g,p,q,G,W]),b.useEffect(()=>{const re=t.get("runId"),le=t.get("resume"),pe=t.get("provider");if(re&&le==="true"&&pe&&!q&&!G&&!O&&!_&&F){w(re),k(!0);try{W({runId:re}).then(ce=>{if(ce.snapshot?.status==="running")return M.mutateAsync({runId:re})}).then(()=>{r(ce=>{const ue=new URLSearchParams(ce);return ue.delete("resume"),ue})}).catch(ce=>{console.error("❌ Failed to resume template installation:",ce),ce.message?.includes("404")||ce.message?.includes("not found")?m("Template installation run not found. It may have expired or been completed."):m("Failed to resume template installation. Please try again.")})}catch(ce){console.error("❌ Auto-resume failed with error:",ce),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,q,G,O,_,F,W,M,r]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ie=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(re=>re).join(", "):"n/a",icon:o.jsx(Ai,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(re=>re).join(", "):"n/a",icon:o.jsx(pa,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(re=>re).join(", "):"n/a",icon:o.jsx(X6,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:o.jsx(ip,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:o.jsx(yE,{})}],te=[{...ie[0]},{...ie[1]},{...ie[2]}].filter(re=>re.value!=="n/a");b.useEffect(()=>{B&&d(B)},[B]),b.useEffect(()=>{const re=Y||Q;re?.phase==="error"&&re?.error&&m(typeof re.error=="string"?re.error:String(re.error))},[Y?.phase,Y?.error,Q?.phase,Q?.error]);const se=re=>{s(re)},oe=async re=>(i(re.provider),c(re.modelId),{message:"Model updated successfully"}),he=async()=>{const re=Object.entries(u).reduce((le,[pe,ce])=>(ce===""&&le.push(pe),le),[]);if(re.length>0){h(re);return}if(A){m(null),y(!1),w(""),E(!0);try{const pe={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:R,slug:A.slug,variables:u},{runId:ce}=await z({});w(ce),r(ue=>{const we=new URLSearchParams(ue);return we.set("runId",ce),we.set("resume","true"),we.set("provider",n||"openai"),we}),await L.mutateAsync({inputData:pe,selectedModel:{provider:a,modelId:l},runId:ce})}catch(le){E(!1),m(le?.message||"Template installation failed"),console.error("Template installation failed",le)}}},K=re=>{const{name:le,value:pe}=re.target;pe.trim()===""?h(ce=>[...ce,le]):h(ce=>ce.filter(ue=>ue!==le)),d(ce=>({...ce,[le]:pe}))};return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/templates",children:[o.jsx(Ce,{children:o.jsx(Ub,{})}),"Templates"]}),o.jsx(dr,{as:nr,to:`/templates/${A?.slug}`,isCurrent:!0,children:A?.title&&A.title})]})}),o.jsx("div",{className:Z("w-full lg:px-12 h-full overflow-y-scroll"),children:o.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[o.jsx(aTn,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:ie,templateSlug:e}),A&&o.jsxs(o.Fragment,{children:[(q||G)&&o.jsx(iTn,{name:A.title,streamResult:G?Q:Y,runId:x,workflowInfo:F}),g&&o.jsx(oTn,{name:A.title,installedEntities:te,linkComponent:nr}),p&&o.jsx(nTn,{errorMsg:p,validationErrors:T.length>0?T:Y?.validationResults?.errors||Q?.validationResults?.errors}),!q&&!G&&!g&&!p&&o.jsx(sTn,{providerOptions:J,selectedProvider:n,onProviderChange:se,variables:u,setVariables:d,errors:f,setErrors:h,handleInstallTemplate:he,handleVariableChange:K,isLoadingEnvVars:D||U,isInstalling:V,defaultModelProvider:a,defaultModelId:l,onModelUpdate:oe})]})]})})]})}const cTn=()=>{const{toolId:e,agentId:t}=ba();return o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/agents",children:[o.jsx(Ce,{children:o.jsx(pa,{})}),"Agents"]}),o.jsx(dr,{as:nr,to:`/agents/${t}/chat`,children:t}),o.jsx(dr,{as:nr,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[o.jsx(Ce,{children:o.jsx(kv,{})}),"Tools documentation"]})})]}),o.jsx(Hxn,{toolId:e,agentId:t})]})},uTn=()=>{const{toolId:e}=ba();return o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/tools",children:[o.jsx(Ce,{children:o.jsx(Ai,{})}),"Tools"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:o.jsx(KCn,{value:e,variant:"ghost"})})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(kv,{}),"Tools documentation"]})})]}),o.jsx(XCn,{toolId:e})]})},dTn=()=>{const e=Ze();return kt({queryKey:["observability-environments"],queryFn:async()=>{try{return await e.getEnvironments()}catch{return{environments:[]}}},select:t=>t?.environments??[],retry:!1})},fTn=()=>{const e=Ze();return kt({queryKey:["observability-service-names"],queryFn:async()=>{try{return await e.getServiceNames()}catch{return{serviceNames:[]}}},select:t=>t?.serviceNames??[],retry:!1})},hTn=()=>{const e=Ze();return kt({queryKey:["observability-tags"],queryFn:async()=>{try{return await e.getTags()}catch{return{tags:[]}}},select:t=>t?.tags??[],retry:!1})},pTn=async({client:e,page:t,perPage:r,filters:n})=>e.listTraces({pagination:{page:t,perPage:r},filters:n}),mTn=25;function gTn(e,t,r){if(e?.pagination?.hasMore)return r+1}function yTn(e){const t=new Set,r=e.pages.flatMap(s=>s.spans??[]).filter(s=>t.has(s.traceId)?!1:(t.add(s.traceId),!0)),n={};for(const s of e.pages)s.threadTitles&&Object.assign(n,s.threadTitles);return{spans:r,threadTitles:n}}const vTn=({filters:e})=>{const t=Ze(),{inView:r,setRef:n}=zE(),s=o1({queryKey:["traces",e],queryFn:({pageParam:c})=>pTn({client:t,page:c,perPage:mTn,filters:e}),initialPageParam:0,getNextPageParam:gTn,select:yTn,placeholderData:M2r,retry:!1,refetchInterval:c=>Os(c.state.error)?!1:3e3}),{hasNextPage:a,isFetchingNextPage:i,fetchNextPage:l}=s;return b.useEffect(()=>{r&&a&&!i&&l()},[r,a,i,l]),{...s,setEndOfListElement:n}};function fSt(e){const t=Ze();return kt({queryKey:["trace-spans",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await t.getTrace(e)},enabled:!!e})}function bTn(e){const t=new Map,r=[];for(const s of e)if(s.threadId){const a=t.get(s.threadId);a?a.push(s):t.set(s.threadId,[s])}else r.push(s);const n=Array.from(t.entries()).map(([s,a])=>({threadId:s,traces:a}));return n.sort((s,a)=>{const i=Math.max(...s.traces.map(c=>new Date(c.createdAt).getTime()));return Math.max(...a.traces.map(c=>new Date(c.createdAt).getTime()))-i}),{groups:n,ungrouped:r}}function xTn(e,t=100){if(e==null)return"";const r=Array.isArray(e)?e:e&&typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.messages)?e.messages:null;if(r){const i=r.filter(l=>l?.role==="user").map(l=>typeof l.content=="string"?l.content:Array.isArray(l.content)?l.content.map(c=>typeof c=="string"?c:c?.type==="text"&&typeof c.text=="string"?c.text:"").filter(Boolean).join(" "):"").filter(Boolean).join(" | ");return i.length>t?i.slice(0,t)+"…":i}if(typeof e=="string")return e.length>t?e.slice(0,t)+"…":e;const n=JSON.stringify(e);return n.length>t?n.slice(0,t)+"…":n}function wTn(e){return e?.attributes?.finishReason==="length"}function STn(e){const t=e?.attributes?.usage;if(!t)return"The model stopped generating because it reached the maximum token limit. The response was truncated and may be incomplete.";const r=t.inputTokens??0,n=t.outputTokens??0,s=t.totalTokens??r+n;return r>0||n>0?`The model stopped generating because it reached the maximum token limit. The response was truncated and may be incomplete.
549
+ ]`})]})]})}function G_n({errors:e,maxErrors:t=5}){if(e.length===0)return null;const r=e.slice(0,t),n=e.length-t;return o.jsxs("div",{className:"bg-accent2/10 border border-accent2/30 rounded-md p-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-accent2 mb-2",children:[o.jsx(Ce,{children:o.jsx(gh,{className:"w-4 h-4"})}),o.jsxs("span",{className:"font-medium text-sm",children:[e.length," validation error",e.length!==1?"s":""]})]}),o.jsx("ul",{className:"text-sm text-accent2/80 space-y-1",children:r.map((s,a)=>o.jsxs("li",{className:"flex gap-2",children:[o.jsx("span",{className:"shrink-0",children:"•"}),o.jsx("span",{children:s.message})]},a))}),n>0&&o.jsxs("div",{className:"text-xs text-accent2/60 mt-2",children:["+",n," more error",n!==1?"s":""]})]})}function Z_n({datasetId:e,open:t,onOpenChange:r,onSuccess:n}){const[s,a]=b.useState("upload"),[i,l]=b.useState(null),[c,u]=b.useState({current:0,total:0}),[d,f]=b.useState(null),[h,p]=b.useState(!1),{parseFile:m,isParsing:g,error:y}=e_n(),{batchInsertItems:x}=ei(),w=b.useCallback(async I=>{try{const P=await m(I);l(P),a("preview")}catch{}},[m]),O=b.useCallback(async()=>{if(!i||i.items.length===0)return;a("importing"),p(!0);const{items:I}=i;u({current:0,total:I.length});try{await x.mutateAsync({datasetId:e,items:I.map(P=>({input:P.input,groundTruth:P.groundTruth,metadata:P.metadata}))}),f({success:I.length,errors:0})}catch{f({success:0,errors:I.length})}u({current:I.length,total:I.length}),p(!1),a("complete")},[i,x,e]),k=b.useCallback(()=>{r(!1),n?.(),d&&d.success>0&&Ue.success(`Imported ${d.success} item${d.success!==1?"s":""}`),setTimeout(()=>{a("upload"),l(null),u({current:0,total:0}),f(null)},150)},[r,n,d]),_=b.useCallback(()=>{h||(r(!1),setTimeout(()=>{a("upload"),l(null),u({current:0,total:0}),f(null)},150))},[h,r]),E=i&&i.items.length>0&&i.errors.length===0,T=()=>{switch(s){case"upload":return o.jsx(W_n,{onFileSelect:w,isParsing:g,error:y?.message});case"preview":return i?o.jsx("div",{className:"flex flex-col gap-4",children:i.errors.length>0?o.jsxs(o.Fragment,{children:[o.jsx(G_n,{errors:i.errors}),o.jsx("div",{className:"text-sm text-neutral4",children:"Please fix the errors in your JSON file and try again."})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"text-sm text-neutral4",children:["Found ",i.items.length," valid item",i.items.length!==1?"s":""," to import."]}),o.jsx(Q_n,{items:i.items,maxRows:5})]})}):null;case"importing":return o.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[o.jsx(It,{size:"lg"}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Importing items..."}),o.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[c.current," of ",c.total]})]})]});case"complete":return o.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[o.jsx("div",{className:"text-4xl",children:d&&d.errors===0?"✓":"⚠"}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-medium text-neutral1",children:"Import Complete"}),o.jsxs("div",{className:"text-sm text-neutral4 mt-1",children:[d?.success??0," item",d?.success!==1?"s":""," imported",d&&d.errors>0&&o.jsxs("span",{className:"text-accent2",children:[" ","(",d.errors," error",d.errors!==1?"s":"",")"]})]})]})]})}},j=()=>{switch(s){case"upload":return o.jsx(ve,{onClick:_,children:"Cancel"});case"preview":return o.jsxs(o.Fragment,{children:[o.jsx(ve,{onClick:()=>a("upload"),children:"Back"}),o.jsxs(ve,{variant:"primary",onClick:O,disabled:!E,children:["Import ",i?.items.length??0," Item",i?.items.length!==1?"s":""]})]});case"importing":return null;case"complete":return o.jsx(ve,{variant:"primary",onClick:k,children:"Done"})}},A={upload:"Import JSON",preview:"Preview Data",importing:"Importing",complete:"Import Complete"};return o.jsx(kn,{open:t,onOpenChange:_,children:o.jsxs(wn,{className:"max-w-2xl max-h-[90vh]",children:[o.jsxs(_n,{children:[o.jsx(Sn,{children:A[s]}),o.jsx(ea,{children:"Import dataset items from a JSON file."})]}),o.jsx(Vn,{className:"min-h-[200px] max-h-[50vh] overflow-y-auto",children:T()}),o.jsx(af,{className:"px-6 pt-4 flex justify-end gap-2",children:j()})]})})}function Y_n({dataset:e,isLoading:t=!1,onEditClick:r,onDuplicateClick:n,onDeleteClick:s,experimentTriggerSlot:a,disableExperimentTrigger:i=!1,onExperimentClick:l,className:c}){return o.jsxs(Ar,{className:c,children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{isLoading:t,children:[o.jsx(Ca,{})," ",e?.name]}),o.jsx(Ar.Description,{isLoading:t,children:e?.description}),o.jsxs(Ar.Description,{isLoading:t,children:[o.jsxs(us,{children:[o.jsx(s_,{})," Created at ",e?.createdAt?or(new Date(e.createdAt),"MMM d, yyyy"):""]}),o.jsxs(us,{children:[o.jsx(qx,{})," Latest version v",e?.version??""]})]})]}),o.jsx(Ar.Column,{children:o.jsxs(ws,{children:[a?i?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{className:"cursor-not-allowed",children:o.jsx("div",{className:"pointer-events-none opacity-50",inert:!0,"aria-disabled":"true",children:a})})}),o.jsx(Wr,{children:"Add items to the dataset before running an experiment"})]}):a:l?i?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{className:"cursor-not-allowed",children:o.jsxs(ve,{disabled:!0,tabIndex:-1,children:[o.jsx(Sx,{}),"Run Experiment"]})})}),o.jsx(Wr,{children:"Add items to the dataset before running an experiment"})]}):o.jsxs(ve,{onClick:l,children:[o.jsx(Sx,{}),"Run Experiment"]}):null,o.jsxs(dt,{children:[o.jsx(dt.Trigger,{asChild:!0,children:o.jsx(ve,{size:"default","aria-label":"Dataset actions menu",children:o.jsx(xWe,{})})}),o.jsxs(dt.Content,{align:"end",className:"w-48",children:[o.jsxs(dt.Item,{onSelect:r,children:[o.jsx(dv,{})," Edit Dataset"]}),o.jsxs(dt.Item,{onSelect:n,children:[o.jsx(Jc,{})," Duplicate Dataset"]}),o.jsxs(dt.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[o.jsx(Ku,{})," Delete Dataset"]})]})]})]})})]})}const Zwt=e=>{const t=Ze(),{data:r}=WI(e),n=r?.experiments;return kt({queryKey:["dataset-review-items",e,n?.map(s=>s.id)],queryFn:async()=>!n||n.length===0?[]:(await Promise.all(n.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(l=>l.status==="needs-review").map(l=>({id:l.id,input:l.input,output:l.output,error:l.error,itemId:l.itemId,experimentId:l.experimentId,datasetId:a.datasetId??void 0,traceId:l.traceId??void 0,scores:l.scores?Object.fromEntries(l.scores.map(c=>[c.scorerId,c.score??0])):{},tags:l.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!n&&n.length>0,refetchOnWindowFocus:!1})},X_n=e=>{const t=Ze(),{data:r}=WI(e),n=r?.experiments;return kt({queryKey:["dataset-completed-items",e,n?.map(s=>s.id)],queryFn:async()=>!n||n.length===0?[]:(await Promise.all(n.map(async a=>{if(!a.datasetId)return[];try{const{results:i}=await t.listDatasetExperimentResults(a.datasetId,a.id);return i.filter(l=>l.status==="complete").map(l=>({id:l.id,input:l.input,output:l.output,error:l.error,itemId:l.itemId,experimentId:l.experimentId,datasetId:a.datasetId??void 0,traceId:l.traceId??void 0,scores:l.scores?Object.fromEntries(l.scores.map(c=>[c.scorerId,c.score??0])):{},tags:l.tags??[],comment:""}))}catch{return[]}}))).flat(),enabled:!!e&&!!n&&n.length>0,refetchOnWindowFocus:!1})};function K_n(e,t){if(typeof e=="string")return e.length>t?e.slice(0,t)+"...":e;try{const r=JSON.stringify(e);return r.length>t?r.slice(0,t)+"...":r}catch{return String(e)}}const J_n=Z("bg-surface5 backdrop-blur-xl z-50 min-w-32 overflow-auto rounded-lg p-2 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95");function a8e({className:e,children:t,...r}){return o.jsx(TR,{children:o.jsx(NR,{className:Z(J_n,e),...r,children:t})})}function eEn({datasetId:e}){const t=Ze(),{data:r}=jg(e),{data:n,isLoading:s}=Zwt(e),{data:a,isLoading:i}=X_n(e),{updateExperimentResult:l}=ei(),[c,u]=b.useState(null),[d,f]=b.useState(null),[h,p]=b.useState(new Set),[m,g]=b.useState(!1),[y,x]=b.useState(!1),[w,O]=b.useState(!1),[k,_]=b.useState(""),[E,T]=b.useState(""),[j,A]=b.useState(""),[I,P]=b.useState([]),[R,B]=b.useState(!1),[D,F]=b.useState(null),U=D??n??[];b.useEffect(()=>{n&&D===null&&F(n)},[n]);const z=b.useMemo(()=>{const ge=new Set;if(r?.tags)for(const Ee of r.tags)ge.add(Ee);for(const Ee of U)for(const Fe of Ee.tags)ge.add(Fe);return[...ge].sort()},[r,U]),V=b.useCallback(ge=>{!r||!e||(r.tags??[]).includes(ge)},[r,e]),W=b.useMemo(()=>d?d==="__untagged__"?U.filter(ge=>ge.tags.length===0):U.filter(ge=>ge.tags.includes(d)):U,[U,d]),L=b.useMemo(()=>{const ge=new Map;for(const Ee of U)for(const Fe of Ee.tags)ge.set(Fe,(ge.get(Fe)??0)+1);return[...ge.entries()].sort((Ee,Fe)=>Fe[1]-Ee[1])},[U]),Y=b.useMemo(()=>U.filter(ge=>ge.tags.length===0).length,[U]),q=b.useMemo(()=>{let ge=0;return d&&ge++,m&&ge++,ge},[d,m]),M=b.useCallback((ge,Ee)=>{F(He=>(He??[]).map(Xe=>Xe.id===ge?{...Xe,tags:Ee}:Xe));const Fe=U.find(He=>He.id===ge);Fe?.experimentId&&Fe?.datasetId&&l.mutate({datasetId:Fe.datasetId,experimentId:Fe.experimentId,resultId:Fe.id,tags:Ee})},[U,l]),Q=b.useCallback((ge,Ee)=>{const Fe=U.find(He=>He.id===ge);Fe?.traceId&&Ee!==void 0&&t.createFeedback({feedback:{traceId:Fe.traceId,source:"studio",feedbackSource:"studio",feedbackType:"rating",value:Ee==="positive"?1:-1,experimentId:Fe.experimentId??void 0,sourceId:Fe.id}}).catch(()=>{}),F(He=>(He??[]).map(Xe=>Xe.id===ge?{...Xe,rating:Ee}:Xe))},[U,t]),G=b.useCallback((ge,Ee)=>{const Fe=U.find(He=>He.id===ge);Fe?.traceId&&t.createFeedback({feedback:{traceId:Fe.traceId,source:"studio",feedbackSource:"studio",feedbackType:"comment",value:Ee,comment:Ee,experimentId:Fe.experimentId??void 0,sourceId:Fe.id}}).catch(()=>{}),F(He=>(He??[]).map(Xe=>Xe.id===ge?{...Xe,comment:Ee}:Xe))},[U,t]),J=b.useCallback(ge=>{const Ee=U.find(Fe=>Fe.id===ge);F(Fe=>(Fe??[]).filter(He=>He.id!==ge)),p(Fe=>{const He=new Set(Fe);return He.delete(ge),He}),c===ge&&u(null),Ee?.experimentId&&Ee?.datasetId&&l.mutate({datasetId:Ee.datasetId,experimentId:Ee.experimentId,resultId:Ee.id,status:null})},[U,l,c]),ie=b.useCallback(ge=>{const Ee=U.find(Fe=>Fe.id===ge);F(Fe=>(Fe??[]).filter(He=>He.id!==ge)),p(Fe=>{const He=new Set(Fe);return He.delete(ge),He}),c===ge&&u(null),Ee?.experimentId&&Ee?.datasetId&&l.mutate({datasetId:Ee.datasetId,experimentId:Ee.experimentId,resultId:Ee.id,status:"complete"})},[U,l,c]),te=b.useMemo(()=>{const ge=m?a??[]:W;return!m||!d?ge:d==="__untagged__"?ge.filter(Ee=>Ee.tags.length===0):ge.filter(Ee=>Ee.tags.includes(d))},[m,a,W,d]),se=m?i:!1,oe=b.useMemo(()=>new Set(te.map(ge=>ge.id)),[te]),he=b.useMemo(()=>[...h].filter(ge=>oe.has(ge)).length,[h,oe]),K=te.length>0&&he===te.length,re=he>0&&!K,le=b.useCallback(ge=>{p(Ee=>{const Fe=new Set(Ee);return Fe.has(ge)?Fe.delete(ge):Fe.add(ge),Fe})},[]),pe=b.useCallback(()=>{p(K?new Set:new Set(te.map(ge=>ge.id)))},[K,te]),ce=b.useCallback(ge=>{for(const Ee of h){const Fe=U.find(He=>He.id===Ee);Fe&&!Fe.tags.includes(ge)&&M(Ee,[...Fe.tags,ge])}},[U,h,M]),ue=b.useCallback(ge=>{for(const Ee of h){const Fe=U.find(He=>He.id===Ee);Fe&&Fe.tags.includes(ge)&&M(Ee,Fe.tags.filter(He=>He!==ge))}},[U,h,M]),we=b.useCallback(()=>{for(const ge of h)ie(ge);p(new Set)},[h,ie]),ke=b.useCallback(()=>{for(const ge of h)J(ge);p(new Set)},[h,J]),Re=b.useCallback(()=>{_(""),O(!0)},[]),X=b.useCallback(async()=>{if(!(!E||!j)){x(!0),O(!1);try{const ge=U.filter(Fe=>h.has(Fe.id));if(ge.length===0){x(!1);return}const Ee=await t.clusterFailures({modelId:`${E}/${j}`,items:ge.map(Fe=>({id:Fe.id,input:Fe.input,output:Fe.output??void 0,error:typeof Fe.error=="string"?Fe.error:Fe.error?String(Fe.error):void 0,scores:Fe.scores,existingTags:Fe.tags.length>0?Fe.tags:void 0})),availableTags:z.length>0?z:void 0,prompt:k||void 0});Ee.proposedTags&&Ee.proposedTags.length>0&&(P(Ee.proposedTags.map(Fe=>({...Fe,accepted:!0}))),B(!0))}catch(ge){console.error("Analysis failed:",ge)}finally{x(!1)}}},[E,j,U,h,t,z,k]),ae=b.useCallback(()=>{for(const ge of I){if(!ge.accepted)continue;const Ee=U.find(Fe=>Fe.id===ge.itemId);if(Ee){const Fe=[...new Set([...Ee.tags,...ge.tags])];M(Ee.id,Fe)}}B(!1)},[I,U,M]),be=b.useCallback(ge=>{u(Ee=>Ee===ge?null:ge)},[]),Ae=b.useMemo(()=>c?te.find(ge=>ge.id===c)??null:null,[c,te]),De=b.useCallback(()=>{if(!c||te.length===0)return;const ge=te.findIndex(Ee=>Ee.id===c);ge<te.length-1&&u(te[ge+1].id)},[c,te]),ye=b.useCallback(()=>{if(!c||te.length===0)return;const ge=te.findIndex(Ee=>Ee.id===c);ge>0&&u(te[ge-1].id)},[c,te]),_e=Ae?"2rem 1fr 10rem 8rem":"2rem 1fr 10rem 8rem 6rem 6rem";return s?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(It,{className:"w-6 h-6"})}):o.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o.jsx(kn,{open:w,onOpenChange:O,children:o.jsxs(wn,{children:[o.jsxs(_n,{children:[o.jsx(Sn,{children:"Analyze Items"}),o.jsx(ea,{children:"Use an LLM to automatically suggest tags for the selected items."})]}),o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs mb-1 block",children:"Provider"}),o.jsx(Tg,{value:E,onValueChange:T})]}),o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs mb-1 block",children:"Model"}),o.jsx(Ng,{llmId:E,value:j,onValueChange:A})]})]}),o.jsxs(me,{variant:"ui-xs",className:"text-neutral3",children:[h.size," item",h.size!==1?"s":""," will be analyzed"]}),o.jsxs("div",{children:[o.jsx(xt,{className:"text-xs",children:"Instructions (optional)"}),o.jsx(vc,{value:k,onChange:ge=>_(ge.target.value),placeholder:"E.g., Focus on safety issues and factual errors...",rows:3,className:"text-xs mt-1"})]})]}),o.jsxs(af,{children:[o.jsx(ve,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),o.jsxs(ve,{onClick:X,disabled:!E||!j||y,children:[y?o.jsx(It,{className:"w-4 h-4 mr-1"}):null,"Analyze"]})]})]})}),o.jsx(kn,{open:R,onOpenChange:B,children:o.jsxs(wn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(_n,{children:[o.jsx(Sn,{children:"Review Proposed Tags"}),o.jsxs(ea,{children:[I.filter(ge=>ge.accepted).length," of ",I.length," proposals selected"]})]}),o.jsx("div",{className:"space-y-3 py-2",children:I.map((ge,Ee)=>{const Fe=U.find(He=>He.id===ge.itemId);return o.jsx("div",{className:Z("p-3 border rounded-lg",!ge.accepted&&"opacity-50"),children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(bi,{checked:ge.accepted,onCheckedChange:He=>P(Xe=>Xe.map((St,ze)=>ze===Ee?{...St,accepted:!!He}:St))}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate block",children:Fe?typeof Fe.input=="string"?Fe.input.slice(0,100):JSON.stringify(Fe.input).slice(0,100):ge.itemId}),o.jsx("div",{className:"flex gap-1 flex-wrap mt-1.5",children:ge.tags.map((He,Xe)=>o.jsx(Rwt,{tag:He,onRename:St=>P(ze=>ze.map((Be,Te)=>Te===Ee?{...Be,tags:Be.tags.map(($e,Ie)=>Ie===Xe?St:$e)}:Be)),onRemove:()=>P(St=>St.map((ze,Be)=>Be===Ee?{...ze,tags:ze.tags.filter((Te,$e)=>$e!==Xe)}:ze))},`${He}-${Xe}`))}),ge.reason&&o.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-1 block italic",children:ge.reason})]})]})},ge.itemId)})}),o.jsxs(af,{children:[o.jsx(ve,{variant:"outline",onClick:()=>B(!1),children:"Cancel"}),o.jsxs(ve,{onClick:ae,disabled:I.filter(ge=>ge.accepted).length===0,children:["Accept ",I.filter(ge=>ge.accepted).length," proposals"]})]})]})}),o.jsxs(Xd,{className:Ae?"grid-cols-[1fr_1fr]":"",children:[o.jsxs(gr,{children:[o.jsxs(gr.Toolbar,{children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(dt,{children:[o.jsx(dt.Trigger,{asChild:!0,children:o.jsxs(ve,{variant:"outline",size:"md",children:[o.jsx(wWe,{}),"Filter",q>0&&o.jsx("span",{className:Z("ml-0.5 inline-flex items-center justify-center rounded-full bg-accent1/50 text-neutral5 text-ui-sm w-5 h-5"),children:q})]})}),o.jsxs(dt.Content,{align:"start",className:Z("min-w-48"),children:[o.jsxs(dt.Sub,{children:[o.jsxs(dt.SubTrigger,{children:["Status",m&&o.jsx("span",{className:Z("ml-auto text-ui-sm text-accent1"),children:"1"})]}),o.jsxs(a8e,{children:[o.jsx(dt.CheckboxItem,{checked:!m,onCheckedChange:()=>{g(!1),u(null)},onSelect:ge=>ge.preventDefault(),children:"Review Queue"}),o.jsx(dt.CheckboxItem,{checked:m,onCheckedChange:()=>{g(!0),u(null)},onSelect:ge=>ge.preventDefault(),children:"Completed"})]})]}),o.jsxs(dt.Sub,{children:[o.jsxs(dt.SubTrigger,{children:["Tags",d&&o.jsx("span",{className:Z("ml-auto text-ui-sm text-accent1"),children:"1"})]}),o.jsxs(a8e,{children:[o.jsx(dt.CheckboxItem,{checked:!d,onCheckedChange:()=>f(null),onSelect:ge=>ge.preventDefault(),children:"All"}),Y>0&&o.jsx(dt.CheckboxItem,{checked:d==="__untagged__",onCheckedChange:()=>f(d==="__untagged__"?null:"__untagged__"),onSelect:ge=>ge.preventDefault(),children:"Untagged"}),L.length>0&&o.jsx(dt.Separator,{}),L.map(([ge])=>o.jsx(dt.CheckboxItem,{checked:d===ge,onCheckedChange:()=>f(d===ge?null:ge),onSelect:Ee=>Ee.preventDefault(),children:ge},ge))]})]}),q>0&&o.jsxs(o.Fragment,{children:[o.jsx(dt.Separator,{}),o.jsxs(dt.Item,{onSelect:()=>{f(null),g(!1),u(null)},children:[o.jsx(vn,{}),"Clear all filters"]})]})]})]}),q>0&&o.jsxs(ve,{variant:"outline",size:"md",onClick:()=>{f(null),g(!1),u(null)},children:[o.jsx(vn,{}),"Reset"]})]}),!m&&h.size>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Iwt,{selectedCount:h.size,vocabulary:z,onApplyTag:ce,onRemoveTag:ue,onNewTag:ge=>ce(ge)}),o.jsxs(dt,{children:[o.jsx(dt.Trigger,{asChild:!0,children:o.jsxs(ve,{disabled:y,children:[y?o.jsx(It,{className:"w-4 h-4"}):o.jsx(Ce,{size:"sm",children:o.jsx(Un,{})}),"Actions"]})}),o.jsxs(dt.Content,{align:"end",children:[o.jsxs(dt.Item,{onSelect:we,children:[o.jsx(Ce,{size:"sm",children:o.jsx(xx,{})}),"Complete"]}),o.jsxs(dt.Item,{onSelect:ke,children:[o.jsx(Ce,{size:"sm",children:o.jsx(Ku,{})}),"Remove"]}),o.jsx(dt.Separator,{}),o.jsxs(dt.Item,{onSelect:Re,children:[o.jsx(Ce,{size:"sm",children:o.jsx(a_,{})}),"Analyze"]})]})]})]})]}),se?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(It,{className:"w-6 h-6"})}):te.length===0?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"text-center px-8",children:[o.jsx(me,{variant:"ui-sm",className:"text-neutral3 block",children:m?"No completed reviews yet":"No items to review"}),o.jsx(me,{variant:"ui-xs",className:"text-neutral3 mt-2 block",children:m?"Items marked as complete will appear here for auditing.":"When experiment results are flagged for review, they will appear here."})]})}):o.jsxs(xe,{columns:_e,children:[o.jsxs(xe.Top,{children:[!m&&o.jsx(xe.TopCell,{children:o.jsx(bi,{checked:K?!0:re?"indeterminate":!1,onCheckedChange:()=>pe(),"aria-label":"Select all"})}),m&&o.jsx(xe.TopCell,{children:" "}),o.jsx(xe.TopCell,{children:"Input"}),o.jsx(xe.TopCell,{children:"Comment"}),o.jsx(xe.TopCell,{children:"Tags"}),!Ae&&o.jsx(xe.TopCell,{children:"Rating"}),!Ae&&o.jsx(xe.TopCell,{children:"Scores"})]}),o.jsx(xe.Rows,{children:te.map(ge=>{const Ee=ge.scores?Object.entries(ge.scores):[];return o.jsxs(xe.Row,{onClick:()=>be(ge.id),selected:c===ge.id,children:[o.jsx(xe.Cell,{children:m?ge.error?o.jsx("div",{className:"w-2 h-2 rounded-full bg-red-700",title:"Error"}):o.jsx("div",{className:"w-2 h-2 rounded-full bg-green-600",title:"Success"}):o.jsx(bi,{checked:h.has(ge.id),onCheckedChange:()=>le(ge.id),onClick:Fe=>Fe.stopPropagation(),"aria-label":`Select item ${ge.id}`})}),o.jsx(xe.NameCell,{children:K_n(ge.input,80)}),o.jsx(xe.Cell,{children:ge.comment?o.jsx(me,{variant:"ui-xs",className:"text-neutral3 truncate",children:ge.comment}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),o.jsx(xe.Cell,{children:ge.tags.length>0?o.jsx(me,{variant:"ui-xs",className:"text-neutral4 truncate",children:ge.tags.join(", ")}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})}),!Ae&&o.jsxs(xe.Cell,{children:[ge.rating==="positive"&&o.jsx(Ce,{size:"sm",className:"text-positive1",children:o.jsx(bce,{})}),ge.rating==="negative"&&o.jsx(Ce,{size:"sm",className:"text-negative1",children:o.jsx(vce,{})}),!ge.rating&&o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})]}),!Ae&&o.jsx(xe.Cell,{children:Ee.length>0?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ce,{size:"sm",className:"text-neutral3",children:o.jsx(Hs,{})}),o.jsx(me,{variant:"ui-xs",className:"text-neutral4 font-mono",children:Ee[0][1].toFixed(2)}),Ee.length>1&&o.jsxs(vt,{variant:"default",children:["+",Ee.length-1]})]}):o.jsx(me,{variant:"ui-xs",className:"text-neutral2",children:"—"})})]},ge.id)})})]})]}),Ae&&o.jsx(Awt,{item:Ae,isCompleted:m,tagVocabulary:z,onRate:ge=>Q(Ae.id,ge),onSetTags:ge=>{M(Ae.id,ge);for(const Ee of ge)z.includes(Ee)||V(Ee)},onComment:ge=>G(Ae.id,ge),onRemove:()=>J(Ae.id),onComplete:m?void 0:()=>ie(Ae.id),onPrevious:ye,onNext:De,onClose:()=>u(null)})]})]})}function tEn({datasetId:e,onExperimentClick:t,onEditClick:r,onDeleteClick:n,onAddItemClick:s,experimentTriggerSlot:a,onNavigateToDataset:i,activeDatasetVersion:l,onVersionSelect:c,initialTab:u,onTabChange:d}){const{navigate:f}=lr(),[h,p]=b.useState(u??"items"),m=zt=>{p(zt),d?.(zt)},[g,y]=b.useState(!1),[x,w]=b.useState(!1),[O,k]=b.useState(!1),[_,E]=b.useState([]),[T,j]=b.useState(!1),[A,I]=b.useState([]),[P,R]=b.useState(!1),[B,D]=b.useState([]),[F,U]=b.useState(!1),[z,V]=b.useState(0),[W,L]=b.useState(null),[Y,q]=b.useState(""),[M]=Zsr(Y,300),[Q,G]=b.useState(null),ie=l!==void 0?l:Q,{data:te,isLoading:se}=jg(e),{data:oe=[],total:he,isLoading:K,setEndOfListElement:re,isFetchingNextPage:le,hasNextPage:pe}=J_(e,M||void 0,ie),{data:ce=[],total:ue,isLoading:we}=J_(e,void 0,ie),[ke,Re]=b.useState({}),{data:X,isLoading:ae}=WI(e,void 0,ke),{data:be}=WI(e),{deleteItems:Ae}=ei(),De=X?.experiments??[],ye=be?.experiments??[],_e=v_n({hasSearchQuery:!!M,filteredItemsLength:oe.length,unfilteredItemsTotal:ue,itemsTotal:he}),{data:ge}=Zwt(e),Ee=ge?.length??0,Fe=zt=>{L(zt)},He=()=>{L(null)},Xe=zt=>{const $r=zt.isCurrent?null:zt;c?c($r):G(zt.isCurrent?null:zt.version)},St=zt=>{E(zt),k(!0)},ze=zt=>{I(zt),j(!0)},Be=zt=>{j(zt),zt||(I([]),V($r=>$r+1))},Te=zt=>{f(`/datasets/${e}/items?items=${zt.join(",")}`)},$e=zt=>{f(`/datasets/${e}/versions?ids=${zt.join(",")}`)},Ie=zt=>{D(zt),R(!0)},lt=async()=>{await Ae.mutateAsync({datasetId:e,itemIds:B}),Ue.success(`Deleted ${B.length} items`),R(!1),D([]),V(zt=>zt+1)},st=zt=>{k(!1),E([]),V($r=>$r+1),i?.(zt)},mt=zt=>{k(zt),zt||(E([]),V($r=>$r+1))};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsx("div",{className:Z("h-full w-full",nn.allSlow),children:o.jsxs("div",{className:Z("grid grid-rows-[auto_1fr] mx-auto h-full w-full m-auto",W?"max-w-[120rem]":"max-w-[90rem]"),children:[o.jsx(Y_n,{dataset:te,isLoading:se,onEditClick:r,onDuplicateClick:()=>U(!0),onDeleteClick:n,experimentTriggerSlot:a,disableExperimentTrigger:!we&&ce.length===0,onExperimentClick:t}),o.jsx("div",{className:"flex-1 overflow-hidden flex flex-col",children:o.jsxs(wf,{defaultTab:"items",value:h,onValueChange:m,className:"grid grid-rows-[auto_1fr] h-full",children:[o.jsxs(Sf,{children:[o.jsxs(vs,{value:"items",children:["Items ",o.jsx($a,{color:"gray",children:_e})]}),o.jsxs(vs,{value:"experiments",children:["Experiments",o.jsx($a,{color:"gray",children:De.length})]}),o.jsxs(vs,{value:"review",children:["Review",Ee>0&&o.jsx($a,{color:"orange",children:Ee})]})]}),o.jsx(Ns,{value:"items",className:"grid overflow-auto mt-5",children:o.jsx(H_n,{datasetId:e,items:oe,isLoading:K,featuredItemId:W,onItemSelect:Fe,onItemClose:He,onAddClick:s??(()=>{}),onImportClick:()=>y(!0),onImportJsonClick:()=>w(!0),onBulkDeleteClick:Ie,onCreateDatasetClick:St,onAddToDatasetClick:ze,onCompareItemsClick:Te,datasetName:te?.name,clearSelectionTrigger:z,setEndOfListElement:re,isFetchingNextPage:le,hasNextPage:pe,searchQuery:Y,onSearchChange:q,activeDatasetVersion:ie,currentDatasetVersion:te?.version,onVersionSelect:Xe,onCompareVersionsClick:$e})}),o.jsx(Ns,{value:"experiments",className:"grid overflow-auto mt-5",children:o.jsx(P_n,{experiments:De,allExperiments:ye,isLoading:ae,datasetId:e,filters:ke,onFiltersChange:Re})}),o.jsx(Ns,{value:"review",className:"overflow-auto mt-0",children:o.jsx(eEn,{datasetId:e})})]})})]})})}),o.jsx(E_n,{datasetId:e,open:g,onOpenChange:y}),o.jsx(Z_n,{datasetId:e,open:x,onOpenChange:w}),o.jsx(f_n,{open:O,onOpenChange:mt,items:_,onSuccess:st}),o.jsx(h_n,{open:T,onOpenChange:Be,items:A,currentDatasetId:e}),o.jsx(p_n,{open:F,onOpenChange:U,sourceDatasetId:e,sourceDatasetName:te?.name||"",sourceDatasetDescription:te?.description,onSuccess:i}),o.jsx($t,{open:P,onOpenChange:R,children:o.jsxs($t.Content,{children:[o.jsxs($t.Header,{children:[o.jsx($t.Title,{children:"Delete Items"}),o.jsxs($t.Description,{children:["Are you sure you want to delete ",B.length," item",B.length!==1?"s":"","? This action cannot be undone."]})]}),o.jsxs($t.Footer,{children:[o.jsx($t.Cancel,{children:"Cancel"}),o.jsx($t.Action,{onClick:lt,children:Ae.isPending?"Deleting...":"Delete"})]})]})})]})}function rEn(e){if(!(e instanceof Error))return null;const t=e.message.match(/- ({.*})$/);if(!t)return null;try{const r=JSON.parse(t[1]);if(r.field&&Array.isArray(r.errors))return{field:r.field,errors:r.errors}}catch{}return null}function i8e({field:e,errors:t}){return t.length?o.jsx("div",{className:"mt-2 space-y-1",children:t.map((r,n)=>o.jsxs("p",{className:"text-xs text-destructive",children:[o.jsxs("code",{className:"bg-destructive/10 px-1 rounded",children:[e,r.path!=="/"?r.path:""]}),": ",r.message]},n))}):null}function nEn({datasetId:e,open:t,onOpenChange:r,onSuccess:n}){const[s,a]=b.useState("{}"),[i,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState(null),{addItem:h}=ei(),p=async x=>{x.preventDefault();let w;try{w=JSON.parse(s)}catch{Ue.error("Input must be valid JSON");return}let O;if(i.trim())try{O=JSON.parse(i)}catch{Ue.error("Ground Truth must be valid JSON");return}let k;if(c.trim())try{k=JSON.parse(c)}catch{Ue.error("Expected Trajectory must be valid JSON");return}try{await h.mutateAsync({datasetId:e,input:w,groundTruth:O,expectedTrajectory:k}),Ue.success("Item added successfully"),f(null),a("{}"),l(""),u(""),r(!1),n?.()}catch(_){const E=rEn(_);E?f(E):Ue.error(`Failed to add item: ${_ instanceof Error?_.message:"Unknown error"}`)}},m=x=>{a(x),d?.field==="input"&&f(null)},g=x=>{l(x),d?.field==="groundTruth"&&f(null)},y=()=>{a("{}"),l(""),u(""),f(null),r(!1)};return o.jsx(kn,{open:t,onOpenChange:r,children:o.jsxs(wn,{className:"max-w-lg",children:[o.jsx(_n,{children:o.jsx(Sn,{children:"Add Item"})}),o.jsx(Vn,{children:o.jsxs("form",{onSubmit:p,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-input",children:"Input (JSON) *"}),o.jsx(ds,{value:s,onChange:m,showCopyButton:!1,className:"min-h-[120px]"}),d?.field==="input"&&o.jsx(i8e,{field:"input",errors:d.errors})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-ground-truth",children:"Ground Truth (JSON, optional)"}),o.jsx(ds,{value:i,onChange:g,showCopyButton:!1,className:"min-h-[80px]"}),d?.field==="groundTruth"&&o.jsx(i8e,{field:"groundTruth",errors:d.errors})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(xt,{htmlFor:"item-trajectory",children:"Expected Trajectory (JSON, optional)"}),o.jsx(ds,{value:c,onChange:u,showCopyButton:!1,className:"min-h-[80px]"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[o.jsx(ve,{type:"button",onClick:y,children:"Cancel"}),o.jsx(ve,{type:"submit",variant:"primary",disabled:h.isPending,children:h.isPending?"Adding...":"Add Item"})]})]})})]})})}function sEn({selectedScorers:e,setSelectedScorers:t,disabled:r=!1,container:n}){const{data:s,isLoading:a}=_f(),i=b.useMemo(()=>s?Object.entries(s).map(([l,c])=>({value:l,label:c.scorer?.config?.name||l,description:c.scorer?.config?.description||""})):[],[s]);return o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:"Scorers (Optional)"}),o.jsx($Ir,{options:i,value:e,onValueChange:t,placeholder:"Select scorers...",searchPlaceholder:"Search scorers...",emptyText:"No scorers available",disabled:r||a,container:n})]})}const aEn=[{value:"agent",label:"Agent"},{value:"workflow",label:"Workflow"},{value:"scorer",label:"Scorer"}];function iEn({targetType:e,setTargetType:t,targetId:r,setTargetId:n,container:s}){const{data:a,isLoading:i}=Bp(),{data:l,isLoading:c}=Cv(),{data:u,isLoading:d}=_f(),f=e==="agent"?Object.entries(a??{}).map(([g,y])=>({value:g,label:y.name??g})):e==="workflow"?Object.entries(l??{}).map(([g,y])=>({value:g,label:y.name??g})):e==="scorer"?Object.entries(u??{}).map(([g,y])=>({value:g,label:y.scorer?.config?.name??g})):[],h=e==="agent"&&i||e==="workflow"&&c||e==="scorer"&&d,p=g=>{t(g),n("")},m=e==="agent"?"Agent":e==="workflow"?"Workflow":"Scorer";return o.jsxs("div",{className:"grid gap-6",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:"Target Type"}),o.jsx(Zl,{options:aEn,value:e,onValueChange:p,placeholder:"Select target type",searchPlaceholder:"Search types...",emptyText:"No types available",container:s})]}),e&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(xt,{children:m}),o.jsx(Zl,{options:f,value:r,onValueChange:n,placeholder:`Select ${e}`,searchPlaceholder:"Search...",emptyText:"No targets available",disabled:h,container:s})]})]})}function oEn({datasetId:e,version:t,open:r,onOpenChange:n,onSuccess:s}){const a=b.useRef(null),[i,l]=b.useState(""),[c,u]=b.useState(""),[d,f]=b.useState([]),{triggerExperiment:h}=ei(),p=i&&c,m=h.isPending,g=async()=>{if(p)try{const x=await h.mutateAsync({datasetId:e,targetType:i,targetId:c,scorerIds:d.length>0?d:void 0,version:t});gc.success("Experiment triggered successfully"),n(!1),s?.(x.experimentId),l(""),u(""),f([])}catch(x){const w=x instanceof Error?x.message:"Failed to trigger experiment";gc.error(w)}},y=()=>{m||(n(!1),l(""),u(""),f([]))};return o.jsx(kn,{open:r,onOpenChange:y,children:o.jsxs(wn,{ref:a,children:[o.jsxs(_n,{children:[o.jsx(Sn,{children:"Run Experiment"}),o.jsx(ea,{children:t?`Execute items from ${or(new Date(t),"MMM d, yyyy")} version against a target.`:"Execute all items in this dataset against a target."})]}),o.jsxs(Vn,{className:"grid gap-6",children:[o.jsx(iEn,{targetType:i,setTargetType:l,targetId:c,setTargetId:u,container:a}),i&&i!=="scorer"&&o.jsx(sEn,{selectedScorers:d,setSelectedScorers:f,disabled:m,container:a})]}),o.jsxs(af,{className:"px-6 pt-4",children:[o.jsx(ve,{onClick:y,disabled:m,children:"Cancel"}),o.jsx(ve,{variant:"primary",onClick:g,disabled:!p||m,children:m?o.jsxs(o.Fragment,{children:[o.jsx(It,{className:"w-4 h-4"}),"Running..."]}):"Run"})]})]})})}const oye=e=>{const t=Ze();return kt({queryKey:["experiment-trace",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return t.getTrace(e)},enabled:!!e})},o8e=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"score",label:"Score",size:"1fr"}];function lEn({result:e,scores:t,onPrevious:r,onNext:n,onClose:s,onShowTrace:a,onScoreClick:i,featuredScoreId:l}){const c=!!e?.error,u=Gee(e?.input),d=Gee(e?.output);return o.jsxs(o.Fragment,{children:[o.jsxs(gr.Toolbar,{children:[o.jsx(FE,{onPrevious:r,onNext:n,previousAriaLabel:"View previous result details",nextAriaLabel:"View next result details"}),o.jsxs(ws,{children:[o.jsxs(ve,{onClick:a,disabled:!e.traceId,children:[o.jsx(yce,{}),"Show Trace"]}),o.jsx(ve,{onClick:s,"aria-label":"Close result details panel",children:o.jsx(vn,{})})]})]}),o.jsxs(gr.Content,{children:[o.jsx(Ar,{withMargins:!1,children:o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(Sx,{})," ",e.id]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:[o.jsx(wx,{})," ",e.itemId]})})]})}),c&&o.jsxs(hl,{variant:"destructive",children:[o.jsx(dUt,{}),o.jsxs(hl.Message,{children:[o.jsx("strong",{children:"Error: "}),Gee(e?.error&&typeof e.error=="object"?e.error.message:e?.error)]})]}),t&&t.length>0&&o.jsxs(At,{className:"grid-rows-[auto_auto] overflow-visible",children:[o.jsxs(At.Header,{columns:o8e,children:[o.jsx(At.HeaderCol,{children:"Scorer"}),o.jsx(At.HeaderCol,{children:"Score"})]}),o.jsx(At.Items,{children:t.map(f=>o.jsx(At.Row,{children:o.jsxs(At.RowButton,{item:{id:f.id},columns:o8e,isFeatured:l===f.id,onClick:i,children:[o.jsx(At.TextCell,{children:f.scorerId}),o.jsx(At.TextCell,{className:"font-mono",children:f.score.toFixed(3)})]})},f.id))})]}),(e.status||Array.isArray(e.tags)&&e.tags.length>0)&&o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[o.jsx(yE,{className:"w-4 h-4"})," Review Status"]}),o.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[e.status&&o.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${e.status==="needs-review"?"bg-warning/10 text-warning":e.status==="complete"?"bg-accent1/10 text-accent1":"bg-neutral3/10 text-neutral4"}`,children:e.status}),Array.isArray(e.tags)&&e.tags.length>0&&e.tags.map(f=>o.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-surface4 text-neutral4",children:f},f))]})]}),o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(wx,{}),codeStr:u}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(yc,{}),codeStr:d}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("h4",{className:"text-sm font-medium text-neutral5 flex items-center gap-2",children:[o.jsx(s_,{className:"w-4 h-4"})," Created"]}),o.jsx("p",{className:"text-sm text-neutral4",children:or(new Date(e.createdAt),"MMM d, yyyy 'at' h:mm a")})]})]})]})}function Gee(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function cEn({span:e}){return e?o.jsxs(o.Fragment,{children:[o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(wp,{}),codeStr:JSON.stringify(e.input||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(yc,{}),codeStr:JSON.stringify(e.output||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Metadata",icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.metadata||null,null,2)}),o.jsx(Xt.CodeSection,{title:"Attributes",icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.attributes||null,null,2)})]}):null}function uEn({traceId:e,spanId:t,onNext:r,onPrevious:n,onClose:s}){const{data:a}=oye(e),i=a?.spans?.find(l=>l.spanId===t);return o.jsxs(o.Fragment,{children:[o.jsxs(gr.Toolbar,{children:[o.jsx(FE,{onPrevious:n,onNext:r,previousAriaLabel:"View previous span details",nextAriaLabel:"View next span details"}),o.jsx(ve,{onClick:s,"aria-label":"Close span details",children:o.jsx(vn,{})})]}),o.jsxs(gr.Content,{children:[o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(yl,{})," Span ",Yd(t)]})})}),o.jsx(cEn,{span:i})]})]})}const dEn=e=>{if(!e||e.length===0)return[];const t=e.reduce((l,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!l||u>l)?u:l},null),r=new Map,n=[];e.forEach(l=>{const c=new Date(l.startedAt),u=l.endedAt?new Date(l.endedAt):void 0,d={id:l.spanId,name:l.name,type:l.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:l.parentSpanId};r.set(l.spanId,d)}),e.forEach(l=>{const c=r.get(l.spanId);if(l?.parentSpanId==null){if(t&&c.endTime&&t>new Date(c.endTime)){c.endTime=t.toISOString();const u=new Date(t).getTime(),d=new Date(c.startTime).getTime();c.latency=u-d}n.push(c)}else{const u=r.get(l.parentSpanId);u?u.spans.push(c):n.push(c)}});const s=l=>l.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(n),i=l=>{l.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function Ywt(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(r=>{t.push(r.id),t.push(...Ywt(r))}),t}const l8e=["agent","workflow","model","mcp","tool","workspace","other"];function Xwt(e){const t=e?.toLowerCase().split("_")[0],r={agent:{icon:o.jsx(pa,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"bg-oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:o.jsx(Ii,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"bg-oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:o.jsx(ip,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"bg-oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},mcp:{icon:o.jsx(ml,{}),color:"oklch(0.75 0.15 160)",label:"MCP",bgColor:"bg-oklch(0.75 0.15 160 / 0.1)",typePrefix:"mcp"},tool:{icon:o.jsx(Ai,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"bg-oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"},workspace:{icon:o.jsx(Pz,{}),color:"oklch(0.75 0.15 40)",label:"Workspace",bgColor:"bg-oklch(0.75 0.15 40 / 0.1)",typePrefix:"workspace"}};return t in r?r[t]:{typePrefix:"other"}}function fEn({isSelected:e,isFaded:t,isExpanded:r,toggleChildren:n,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:l}){return o.jsx("div",{className:Z("flex items-center justify-end h-full px-3",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:l&&l>0?o.jsxs("div",{className:"flex gap-1",children:[o.jsxs(c8e,{onClick:()=>n?.(),children:[i?a:l," ",r?i?o.jsx(dce,{}):o.jsx(uv,{}):o.jsx(Un,{})]}),a>(l??0)&&!i&&o.jsxs(c8e,{onClick:()=>s?.(),children:[a," ",o.jsx(uce,{})]})]}):null})}function c8e({onClick:e,children:t,className:r}){return o.jsx("button",{onClick:e,className:Z("h-full",r),children:o.jsx("div",{className:Z("flex items-center gap-[0.1rem] text-ui-sm text-neutral5 border border-border1 pl-2 pr-1 rounded-lg transition-all","hover:text-yellow-500","[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-4 [&>svg]:h-4 [&>svg]:transition-all"),children:t})})}function hEn({isLastChild:e,hasChildren:t=!1,expanded:r=!1}){return o.jsx("div",{className:Z("w-12 h-[2.8rem] relative opacity-100",'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-0 after:border-l after:border-neutral3 after:border-dashed ','before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-0 before:border-b before:border-neutral3 before:border-dashed',"[&_svg]:transition-all","[&:hover_svg]:text-yellow-500 [&:hover_svg]:scale-[1.3] [&:hover_svg]:opacity-100",{"after:bottom-[50%]":e}),children:t&&o.jsx("span",{className:Z("flex absolute left-[50%] top-[50%] translate-y-[-50%] translate-x-[-50%] items-center justify-center bg-surface2 p-1","[&>svg]:shrink-0 [&>svg]:opacity-60 [&>svg]:w-[0.8rem] [&>svg]:h-[0.8rem]"),children:r?o.jsx(fWe,{}):o.jsx(dWe,{})})})}function pEn({span:e,spanUI:t,isFaded:r,depth:n=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:l,isRootSpan:c,isExpanded:u,toggleChildren:d}){return o.jsxs("div",{className:"flex overflow-x-auto",style:{paddingLeft:`${n*1.5}rem`},children:[!c&&o.jsx("button",{onClick:()=>d?.(),disabled:!l,className:Z({"cursor-default":!l,"cursor-pointer":l}),children:o.jsx(hEn,{isLastChild:i,hasChildren:!!l,expanded:u})}),o.jsx("button",{className:"truncate",onClick:()=>s?.(e.id),children:e.name})]})}function Kwt({span:e,depth:t=0,onSpanClick:r,selectedSpanId:n,isLastChild:s,overallLatency:a,overallStartTime:i,overallEndTime:l,fadedTypes:c,searchPhrase:u,featuredSpanIds:d,expandedSpanIds:f,setExpandedSpanIds:h}){const p=e.spans&&e.spans.length>0,m=e.spans?e.spans.length:0,g=Ywt(e),y=g.length,x=t===0,w=Xwt(e?.type),O=f?f.includes(e.id):!1,k=d&&d.length>0?!d.includes(e.id):!1,E=(c&&c.length>0?c.includes(w?.typePrefix||""):!1)||k;b.useEffect(()=>{x&&h?.([e.id])},[x,e.id,h]),b.useEffect(()=>{if(!d||!e.spans||e.spans.length===0)return;const I=e.spans.some(P=>d.includes(P.id));!O&&I&&T()},[d,e.spans,e.id,O,h,f]);const T=()=>{if(!(!h||!f))if(O){const I=[e.id,...g];h(f.filter(P=>!I.includes(P)))}else h([...f,e.id])},j=()=>{!h||!f||h([...f,e.id,...g])},A=g.every(I=>f?.includes(I));return o.jsxs(o.Fragment,{children:[o.jsx(pEn,{span:e,spanUI:w,isFaded:E,depth:t,onSpanClick:r,selectedSpanId:n,isLastChild:s,hasChildren:p,isRootSpan:x,isExpanded:O,toggleChildren:T}),o.jsx(fEn,{isSelected:n===e.id,isFaded:E,isExpanded:O,toggleChildren:T,expandAllDescendants:j,totalDescendants:y,allDescendantsExpanded:A,numOfChildren:m}),p&&O&&e.spans?.map((I,P,R)=>{const B=P===R.length-1;return o.jsx(Kwt,{span:I,depth:t+1,onSpanClick:r,selectedSpanId:n,isLastChild:B,overallLatency:a,overallStartTime:i,fadedTypes:c,searchPhrase:u,expandedSpanIds:f,setExpandedSpanIds:h,featuredSpanIds:d},I.id)})]})}function mEn({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:r,isLoading:n,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:l}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"",d=e?.[0]?.endTime||"";return o.jsx(o.Fragment,{children:n?o.jsxs("div",{className:Z("flex items-center text-ui-md gap-4 bg-surface3/50 rounded-md p-6 justify-center text-neutral3","[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"),children:[o.jsx(It,{})," Loading Trace Timeline ..."]}):o.jsx("div",{className:"grid grid-cols-[1fr_auto]",children:e?.map(f=>o.jsx(Kwt,{span:f,onSpanClick:t,selectedSpanId:r,overallLatency:c,overallStartTime:u,overallEndTime:d,fadedTypes:s,featuredSpanIds:l,expandedSpanIds:a,setExpandedSpanIds:i},f.id))})})}function gEn({spans:e=[],fadedTypes:t,onLegendClick:r,onLegendReset:n,onSearchPhraseChange:s,traceId:a}){const[i,l]=b.useState("");b.useEffect(()=>{l("")},[a]);const c=l8e.filter(h=>e.some(p=>p?.spanType?.startsWith(h)))||[],u=e.some(h=>!l8e.some(m=>h?.spanType?.startsWith(m))),d=h=>{r?.(h)};b.useEffect(()=>{f(i)},[i,s]);const f=QJe(h=>{s?.(h)},1e3);return o.jsxs("div",{className:"flex gap-3 items-center justify-between",children:[o.jsx("div",{className:"flex",children:o.jsx(Cx,{name:"search-spans",label:"Find span by name",labelIsHidden:!0,placeholder:"Look for span name",value:i,onChange:h=>{l(h.target.value)},onReset:()=>l("")})}),o.jsxs(Wlt,{children:[c.map(h=>{const p=Xwt(h),m=t?.includes(h);return o.jsx(b.Fragment,{children:o.jsxs(ve,{onClick:()=>d(h),className:m?"opacity-40":"",style:{color:m?void 0:p?.color,backgroundColor:p?.bgColor},children:[p?.icon&&o.jsx(Ce,{children:p.icon}),p?.label]})},h)}),u&&o.jsxs(ve,{onClick:()=>d("other"),className:t?.includes("other")?"opacity-40":"",children:[o.jsx(Ce,{children:o.jsx(H6,{})}),"Other"]}),o.jsx(ve,{onClick:n,disabled:t?.length===0,children:o.jsx(Ce,{children:o.jsx(vn,{})})})]})]})}function yEn({traceId:e,selectedSpanId:t,onSpanSelect:r,onClose:n}){const{data:s,isLoading:a}=oye(e),i=s?.spans??[],[l,c]=b.useState(""),[u,d]=b.useState([]),[f,h]=b.useState([]),[p,m]=b.useState([]),g=b.useMemo(()=>dEn(i),[i]);b.useEffect(()=>{if(l.trim()===""){h([]);return}const O=l.toLowerCase(),k=i.filter(_=>_.name.toLowerCase().includes(O)).map(_=>_.spanId);h(k)},[l,i]),b.useEffect(()=>{c(""),d([]),h([]),m([])},[e]);const y=O=>{r?.(t===O?void 0:O)},x=O=>{d(k=>k.includes(O)?k.filter(_=>_!==O):[...k,O])},w=()=>{d([])};return o.jsxs(o.Fragment,{children:[o.jsx(gr.Toolbar,{children:o.jsx(ve,{onClick:n,"aria-label":"Close trace panel",children:o.jsx(vn,{})})}),o.jsxs(gr.Content,{children:[o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(Wi,{})," Trace ",Yd(e)]})})}),o.jsx(gEn,{spans:i,fadedTypes:u,onLegendClick:x,onLegendReset:w,searchPhrase:l,onSearchPhraseChange:c,traceId:e}),o.jsx(mEn,{hierarchicalSpans:g,onSpanClick:y,selectedSpanId:t,isLoading:a,fadedTypes:u,expandedSpanIds:p,setExpandedSpanIds:m,featuredSpanIds:f})]})]})}function vEn({results:e,isLoading:t,featuredResultId:r,onResultClick:n,columns:s,scoresByItemId:a,scorerIds:i,setEndOfListElement:l,isFetchingNextPage:c,hasNextPage:u}){const d=s.map(f=>f.size).join(" ");return t?o.jsxs(xe,{columns:d,children:[o.jsx(xe.Top,{children:s.map(f=>o.jsx(xe.TopCell,{children:f.label},f.name))}),o.jsx("div",{className:"flex items-center justify-center py-20 col-span-full",children:o.jsx(It,{})})]}):e.length===0?o.jsxs(xe,{columns:d,children:[o.jsx(xe.Top,{children:s.map(f=>o.jsx(xe.TopCell,{children:f.label},f.name))}),o.jsx(xe.NoMatch,{message:"No results yet"})]}):o.jsxs(xe,{columns:d,children:[o.jsx(xe.Top,{children:s.map(f=>o.jsx(xe.TopCell,{children:f.label},f.name))}),o.jsxs(xe.Rows,{children:[e.map(f=>{const h=!!f.error,p=f.id===r;return o.jsxs(xe.Row,{onClick:()=>n(f.id),selected:p,children:[o.jsx(xe.TextCell,{children:o.jsx("span",{className:"truncate block font-mono",children:f.itemId})}),o.jsx(xe.Cell,{children:o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("div",{className:"flex items-center justify-center w-10 relative bg-transparent h-full",children:o.jsx("div",{className:Z("w-2 h-2 rounded-full",h?"bg-red-700":"bg-green-600")})})}),o.jsx(Wr,{children:h?"Error":"Success"})]})}),s.some(m=>m.name==="input")&&o.jsx(xe.TextCell,{children:o.jsx("span",{className:"truncate block font-mono",children:xEn(bEn(f.input),200)})}),i?.map(m=>{const y=a?.[f.itemId]?.find(x=>x.scorerId===m);return o.jsx(xe.TextCell,{children:o.jsx("span",{className:"font-mono",children:y!=null?y.score.toFixed(3):"-"})},m)})]},f.id)}),o.jsxs("div",{ref:l,className:"h-1 col-span-full",children:[c&&o.jsx("div",{className:"flex justify-center py-4",children:o.jsx(It,{})}),!u&&e.length>0&&o.jsx(me,{variant:"ui-xs",className:"text-icon3 text-center py-4 block",children:"All results loaded"})]})]})]})}function bEn(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function xEn(e,t){return e.length<=t?e:e.slice(0,t-1)+"..."}function wEn(e){const t=e.scorer;return t?.hasJudge===!1?!0:t?.hasJudge===!0?!1:!e.preprocessPrompt&&!e.analyzePrompt&&!e.generateScorePrompt&&!e.generateReasonPrompt}function SEn({score:e,onNext:t,onPrevious:r,onClose:n}){const s=wEn(e),a=s?"N/A — code-based scorer":"N/A — step not configured";return o.jsxs(o.Fragment,{children:[o.jsxs(gr.Toolbar,{children:[o.jsx(FE,{onPrevious:r,onNext:t,previousAriaLabel:"View previous score details",nextAriaLabel:"View next score details"}),o.jsx(ve,{onClick:n,"aria-label":"Close score details",children:o.jsx(vn,{})})]}),o.jsxs(gr.Content,{children:[o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(Hs,{})," ",e.scorerId]})})}),o.jsxs(bS,{children:[o.jsx(Xt.CodeSection,{title:`Score: ${e.score}`,icon:o.jsx(Hs,{}),codeStr:e.reason||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Input",icon:o.jsx(wx,{}),codeStr:JSON.stringify(e.input??null,null,2)}),o.jsx(Xt.CodeSection,{title:"Output",icon:o.jsx(yc,{}),codeStr:JSON.stringify(e.output??null,null,2)}),!s&&o.jsxs(o.Fragment,{children:[o.jsx(Xt.CodeSection,{title:"Preprocess Prompt",icon:o.jsx(ac,{}),codeStr:e.preprocessPrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Analyze Prompt",icon:o.jsx(ac,{}),codeStr:e.analyzePrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Generate Score Prompt",icon:o.jsx(ac,{}),codeStr:e.generateScorePrompt||a,simplified:!0}),o.jsx(Xt.CodeSection,{title:"Generate Reason Prompt",icon:o.jsx(ac,{}),codeStr:e.generateReasonPrompt||a,simplified:!0})]})]})]})]})}const u8e=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"avg",label:"Avg Score",size:"1fr"},{name:"count",label:"Items Scored",size:"1fr"}];function OEn({scoresByItemId:e,experimentStatus:t}){const r=b.useMemo(()=>{if(!e)return[];const n={};for(const s of Object.values(e))for(const a of s)n[a.scorerId]||(n[a.scorerId]={sum:0,count:0}),n[a.scorerId].sum+=a.score,n[a.scorerId].count++;return Object.entries(n).map(([s,{sum:a,count:i}])=>({scorerId:s,avg:a/i,count:i})).sort((s,a)=>s.scorerId.localeCompare(a.scorerId))},[e]);if(r.length===0){const n=t==="running"||t==="pending",s=e!==void 0;let a,i;return n?(a="Experiment in progress",i="Summary metrics will appear here once the experiment completes."):s?(a="No scorers configured",i="Add scorers when triggering an experiment to evaluate results and see summary metrics here."):(a="Loading scores",i="Fetching scorer results…"),o.jsx("div",{className:"flex h-full items-center justify-center py-12",children:o.jsx(li,{iconSlot:o.jsx(Hs,{className:"w-8 h-8 text-neutral3"}),titleSlot:a,descriptionSlot:i})})}return o.jsxs(At,{children:[o.jsxs(At.Header,{columns:u8e,children:[o.jsx(At.HeaderCol,{children:"Scorer"}),o.jsx(At.HeaderCol,{children:"Avg Score"}),o.jsx(At.HeaderCol,{children:"Items Scored"})]}),o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:r.map(({scorerId:n,avg:s,count:a})=>o.jsxs(At.Row,{columns:u8e,children:[o.jsx(At.TextCell,{children:n}),o.jsx(At.TextCell,{className:"font-mono",children:s.toFixed(3)}),o.jsx(At.TextCell,{className:"font-mono",children:a})]},n))})})]})}function Jwt({experimentId:e,experimentStatus:t,results:r,isLoading:n,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i}){const[l,c]=b.useState(null),[u,d]=b.useState(null),[f,h]=b.useState(void 0),[p,m]=b.useState(null),g=r.find(z=>z.id===l)??null,{data:y}=L0t(e,t),x=b.useMemo(()=>{if(!y)return[];const z=new Set;for(const V of Object.values(y))for(const W of V)z.add(W.scorerId);return[...z].sort()},[y]),{data:w}=oye(u),O=w?.spans??[],k=()=>{if(!f)return;const z=O.findIndex(V=>V.spanId===f);if(z>=0&&z<O.length-1)return()=>h(O[z+1].spanId)},_=()=>{if(!f)return;const z=O.findIndex(V=>V.spanId===f);if(z>0)return()=>h(O[z-1].spanId)},E=z=>{c(z),d(null),h(void 0),m(null)},T=z=>{E(z===l?null:z)},j=()=>{E(null)},A=()=>{if(!g)return;const z=r.findIndex(V=>V.id===g.id);if(z>=0&&z<r.length-1)return()=>E(r[z+1].id)},I=()=>{if(!g)return;const z=r.findIndex(V=>V.id===g.id);if(z>0)return()=>E(r[z-1].id)},P=g?y?.[g.itemId]:void 0,R=P?.find(z=>z.id===p)??null,B=z=>{m(z===p?null:z),d(null),h(void 0)},D=()=>{if(!p||!P)return;const z=P.findIndex(V=>V.id===p);if(z>=0&&z<P.length-1)return()=>m(P[z+1].id)},F=()=>{if(!p||!P)return;const z=P.findIndex(V=>V.id===p);if(z>0)return()=>m(P[z-1].id)},U=b.useMemo(()=>[{name:"itemId",label:"Item ID",size:"5rem"},{name:"status",label:"Status",size:"3rem"},{name:"input",label:"Input",size:"1fr"},...l?[]:x.map(z=>({name:z,label:z,size:"1fr"}))],[l,x]);return o.jsxs(wf,{defaultTab:"summary",className:"grid grid-rows-[auto_1fr] h-full overflow-hidden",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"summary",children:"Summary"}),o.jsx(vs,{value:"results",children:"Results"})]}),o.jsx(Ns,{value:"summary",className:"overflow-y-auto mt-5",children:o.jsx(OEn,{scoresByItemId:y,experimentStatus:t})}),o.jsx(Ns,{value:"results",className:"grid overflow-hidden mt-5",children:o.jsxs(Xd,{className:g?"grid-cols-[1fr_2fr]":void 0,children:[o.jsx(gr,{children:o.jsx(vEn,{results:r,isLoading:n,featuredResultId:l,onResultClick:T,columns:U,scoresByItemId:y,scorerIds:l?void 0:x,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i})}),g&&o.jsxs(DPr,{numOfColumns:1+(!u&&p?1:0)+(u?1:0)+(f?1:0),minColumnWidth:"35rem",children:[g&&o.jsx(gr,{withLeftSeparator:!0,children:o.jsx(lEn,{result:g,scores:P,onPrevious:I(),onNext:A(),onClose:j,onScoreClick:B,featuredScoreId:p,onShowTrace:()=>{d(g.traceId??null),h(void 0),m(null)}})}),g&&!u&&R&&o.jsx(gr,{withLeftSeparator:!0,children:o.jsx(SEn,{score:R,onNext:D(),onPrevious:F(),onClose:()=>m(null)})}),g&&u&&o.jsx(gr,{withLeftSeparator:!0,children:o.jsx(yEn,{traceId:u,selectedSpanId:f,onSpanSelect:h,onClose:()=>{d(null),h(void 0)}})}),g&&u&&f&&o.jsx(gr,{withLeftSeparator:!0,children:o.jsx(uEn,{traceId:u,spanId:f,onNext:k(),onPrevious:_(),onClose:()=>h(void 0)})})]})]})})]})}const kEn={pending:o.jsx(hE,{}),running:o.jsx(KN,{}),completed:o.jsx(ra,{}),failed:o.jsx(vn,{})};function _En({experiment:e,className:t}){const r=e.status,n=e.totalItems-e.succeededCount-e.failedCount;return o.jsxs("div",{className:Z("grid justify-items-end gap-3",t),children:[o.jsxs("div",{className:"flex p-1 px-3 text-ui-lg capitalize text-neutral4 gap-2 items-center bg-surface5 rounded-lg ",children:[o.jsx("span",{className:Z("w-5 h-5 flex items-center justify-center rounded-full text-black","[&>svg]:w-4 [&>svg]:h-4",{"bg-green-700":r==="completed","bg-red-700":r==="failed","bg-cyan-600":r==="running","bg-yellow-600":r==="pending"}),children:kEn[r]}),e.status]}),o.jsxs("div",{className:Z("flex items-center gap-3 text-neutral3 text-ui-md ","[&>span]:flex [&>span]:gap-1 [&>span]:items-center ","[&_b]:text-neutral4 [&_b]:font-semibold"),children:[o.jsxs("span",{children:["Total: ",o.jsx("b",{children:e.totalItems})]}),o.jsxs("span",{children:["Succeeded: ",o.jsx("b",{children:e.succeededCount})]}),o.jsxs("span",{children:["Failed: ",o.jsx("b",{children:e.failedCount})]}),(r==="pending"||r==="running")&&o.jsxs("span",{children:["Pending: ",o.jsx("b",{children:n})]})]})]})}function eSt({experimentId:e,experiment:t}){const{Link:r,paths:n}=lr(),{data:s}=Bp(),{data:a}=Cv(),{data:i}=_f(),l=()=>{switch(t.targetType){case"agent":return n.agentLink(t.targetId);case"workflow":return n.workflowLink(t.targetId);case"scorer":return n.scorerLink(t.targetId);default:return"#"}},c=()=>{const u=t.targetId;if(!u)return u;switch(t.targetType){case"agent":return s?.[u]?.name??u;case"workflow":return a?.[u]?.name??u;case"scorer":return i?.[u]?.scorer?.config?.name??u;default:return u}};return o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(pWe,{}),e," ",e&&o.jsx(Ya,{content:e})]}),o.jsxs(Ar.Description,{children:[o.jsxs(us,{children:[o.jsx(s_,{})," Created at ",or(new Date(t.createdAt),"MMM d, yyyy 'at' h:mm a")]}),t.completedAt&&o.jsxs(us,{children:[o.jsx(s_,{})," Completed at ",or(new Date(t.completedAt),"MMM d, yyyy 'at' h:mm a")]})]}),o.jsxs(Ar.Description,{children:[o.jsxs(us,{children:[o.jsx($Bt,{})," Target",o.jsx(r,{href:l(),children:c()})]}),t.agentVersion&&o.jsxs(us,{children:[o.jsx(W6,{})," Version",t.targetType==="agent"&&t.targetId?o.jsx(r,{href:`${n.agentLink(t.targetId)}/editor?version=${encodeURIComponent(t.agentVersion)}`,className:"font-mono text-xs underline hover:text-accent1",children:t.agentVersion}):o.jsx("span",{className:"font-mono text-xs",children:t.agentVersion}),o.jsx(Ya,{content:t.agentVersion})]})]})]}),o.jsx(Ar.Column,{children:o.jsx(_En,{experiment:t})})]})}function lye({delta:e}){const t=e>0?o.jsx($a,{size:"small",color:"green",intensity:"muted",children:o.jsx(q6,{})}):e<0?o.jsx($a,{size:"small",color:"red",intensity:"muted",children:o.jsx(lce,{})}):null;return o.jsxs("span",{className:Z("font-mono text-sm text-neutral4 min-w-20"),children:[o.jsx("span",{className:"w-3 inline-block",children:e>0?"+ ":e<0?"- ":""}),Math.abs(e).toFixed(2)," ",t]})}function fL(e){return e==null?"-":typeof e=="string"?e:JSON.stringify(e,null,2)}function EEn({item:e,baselineId:t,contenderId:r,baselineVersion:n,contenderVersion:s,onPrevious:a,onNext:i,onClose:l}){const c=e.results[t],u=e.results[r],d=!!(c&&u),f=new Set;if(c)for(const p of Object.keys(c.scores))f.add(p);if(u)for(const p of Object.keys(u.scores))f.add(p);const h=[...f].sort();return o.jsxs(gr,{withLeftSeparator:!0,children:[o.jsxs(gr.Toolbar,{children:[o.jsx(FE,{onPrevious:a,onNext:i,previousAriaLabel:"Previous comparison item",nextAriaLabel:"Next comparison item"}),o.jsx(ws,{children:o.jsx(ve,{onClick:l,"aria-label":"Close comparison detail panel",children:o.jsx(vn,{})})})]}),o.jsxs(gr.Content,{className:"pb-6",children:[o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{size:"smaller",children:[o.jsx(wx,{})," ",e.itemId]})})}),d?o.jsx(o.Fragment,{children:o.jsxs(bS,{children:[h.length>0&&o.jsxs("div",{className:"grid gap-3",children:[o.jsx("h4",{className:"text-sm font-medium text-neutral5",children:"Scores"}),o.jsx("div",{className:"grid gap-2",children:h.map(p=>{const m=c?.scores[p]??null,g=u?.scores[p]??null,y=m!=null&&g!=null?g-m:null;return o.jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2 rounded-lg bg-surface2",children:[o.jsx("span",{className:"text-sm text-neutral5 font-medium",children:p}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"text-sm text-neutral3",children:[m!=null?m.toFixed(3):"-"," →"," ",g!=null?g.toFixed(3):"-"]}),y!=null&&o.jsx(lye,{delta:y})]})]},p)})})]}),o.jsx(Xt.CodeSection,{title:o.jsxs(o.Fragment,{children:[o.jsx($a,{color:"purple",children:"Baseline "})," Experiment Output"]}),icon:o.jsx(yc,{}),codeStr:fL(c?.output)}),o.jsx(Xt.CodeSection,{title:o.jsxs(o.Fragment,{children:[o.jsx($a,{color:"cyan",children:"Contender "})," Experiment Output"]}),icon:o.jsx(yc,{}),codeStr:fL(u?.output)}),o.jsx(Xt.CodeSection,{title:"Item Input",icon:o.jsx(wp,{}),codeStr:fL(e.input)}),o.jsx(Xt.CodeSection,{title:"Item Ground Truth",icon:o.jsx(NWe,{}),codeStr:fL(e.groundTruth)})]})}):o.jsxs(hl,{variant:"warning",children:[o.jsx(gh,{}),o.jsx(hl.Message,{children:(()=>{const p=c?"Contender":"Baseline",m=c?s:n;return o.jsxs(o.Fragment,{children:["The ",p," experiment was run against dataset",m!=null?` v. ${m}`:"",", which does not contain this item. Comparison is not available."]})})()})]})]})]})}function CEn({items:e,baselineId:t,contenderId:r,scorerIds:n,featuredItemId:s,columns:a,onItemClick:i}){return o.jsx(gr,{children:o.jsxs(At,{children:[o.jsxs(At.Header,{columns:a,children:[o.jsx(At.HeaderCol,{children:"Item ID"}),!s&&n.map(l=>o.jsx(At.HeaderCol,{className:"flex justify-center",children:l},l))]}),o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:e.map(l=>{const c=l.results[t],u=l.results[r],d=!!(c&&u);return o.jsx(At.Row,{children:o.jsxs(At.RowButton,{item:{id:l.itemId},columns:a,isFeatured:s===l.itemId,onClick:i,children:[o.jsx(At.IdCell,{id:l.itemId,className:d?"":"text-neutral1"}),!s&&o.jsx(o.Fragment,{children:n.map(f=>{const h=c?.scores[f]??null,p=u?.scores[f]??null,m=h!=null&&p!=null?p-h:null;return o.jsx(At.Cell,{className:"flex items-center gap-5 justify-center font-mono",children:m!=null?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex items-center text-neutral2 min-w-24",children:[h?.toFixed(2)," → ",p?.toFixed(2)]}),o.jsx(lye,{delta:m})]}):o.jsx("span",{className:"text-neutral1",children:"-"})},f)})})]})},l.itemId)})})})]})})}const jEn={baseline:{label:"Baseline",color:"purple",customStyle:"items-end justify-items-end [&>div]:justify-end border-r-0 rounded-r-none"},contender:{label:"Contender",color:"cyan",customStyle:"items-start justify-items-start [&>div]:justify-start border-l-0 rounded-l-none"}};function d8e({datasetId:e,experiment:t,type:r}){const{Link:n}=lr(),{label:s,color:a,customStyle:i}=jEn[r];if(!t)return null;const l=t.createdAt?new Date(t.createdAt):null;return o.jsxs("div",{className:`grid border-2 border-border1 rounded-lg p-5 gap-3 ${i}`,children:[o.jsxs("div",{className:"flex items-center gap-3 w-full overflow-clip",children:[r==="contender"&&o.jsxs($a,{size:"small",color:a,children:[s,o.jsx(qd,{})]}),o.jsx(ve,{as:n,href:`/datasets/${e}/experiments/${t.id}`,children:o.jsx("span",{className:"truncate min-w-0",children:t.id})}),r==="baseline"&&o.jsxs($a,{size:"small",color:a,children:[o.jsx(xp,{})," ",s]})]}),o.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-ui-sm text-neutral3",children:[o.jsxs(us,{children:[o.jsx(NWe,{})," ",t.targetType," / ",t.targetId]}),o.jsxs(us,{children:[o.jsx(SWe,{})," v",t.datasetVersion??"—"]}),l&&o.jsxs(us,{children:[o.jsx(cce,{})," ",or(l,"MMM d, yyyy HH:mm")]})]})]})}function TEn({datasetId:e,experimentIdA:t,experimentIdB:r,onSwap:n}){const[s,a]=b.useState(null),{data:i,isLoading:l,error:c}=qkn(e,t,r),{data:u}=r6(e,t),{data:d}=r6(e,r),f=u&&d&&u.datasetVersion!==d.datasetVersion,h=b.useMemo(()=>{if(!i)return[];const T=new Set;for(const j of i.items)for(const A of Object.values(j.results))if(A)for(const I of Object.keys(A.scores))T.add(I);return[...T].sort()},[i]),p=b.useMemo(()=>{if(!i||h.length===0)return[];const T=i.baselineId,j=t===T?r:t;return h.map(A=>{let I=0,P=0,R=0,B=0;for(const z of i.items){const V=z.results[T]?.scores[A],W=z.results[j]?.scores[A];V!=null&&(I+=V,R++),W!=null&&(P+=W,B++)}const D=R>0?I/R:null,F=B>0?P/B:null,U=D!=null&&F!=null?F-D:null;return{scorerId:A,avgA:D,avgB:F,delta:U}})},[i,h,t,r]),m=[{name:"scorer",label:"Scorer",size:"1fr"},{name:"baselineAvg",label:"Baseline Avg",size:"1fr"},{name:"comparisonAvg",label:"Comparison Avg",size:"1fr"},{name:"delta",label:"Delta",size:"1fr"}],g=b.useMemo(()=>[{name:"itemId",label:"Item ID",size:"8rem"},...s?[]:h.map(T=>({name:T,label:T,size:"1fr"}))],[h,s]),y=i?.items.find(T=>T.itemId===s)??null,x=T=>{a(T===s?null:T)},w=()=>{a(null)},O=()=>{if(!i||!s)return;const T=i.items.findIndex(j=>j.itemId===s);if(T>=0&&T<i.items.length-1)return()=>a(i.items[T+1].itemId)},k=()=>{if(!i||!s)return;const T=i.items.findIndex(j=>j.itemId===s);if(T>0)return()=>a(i.items[T-1].itemId)};if(l)return o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx(It,{})});if(c)return o.jsxs(hl,{variant:"warning",children:[o.jsx(gh,{}),o.jsxs(hl.Column,{children:[o.jsx(hl.Title,{children:"Error loading comparison"}),o.jsx(hl.Message,{children:c instanceof Error?c.message:"Unknown error"})]})]});if(!i||i.items.length===0)return o.jsx("div",{className:"text-neutral4 text-sm text-center py-8",children:"No comparison data"});const _=i.baselineId,E=t===_?r:t;return o.jsxs("div",{className:"grid gap-10",children:[u&&d&&o.jsxs("div",{className:Z("relative grid xl:grid-cols-[1fr_auto_1fr] gap-4 xl:gap-0"),children:[o.jsx(d8e,{datasetId:e,experiment:u,type:"baseline"}),o.jsx("div",{className:"relative flex items-center justify-center px-[2vw] before:absolute before:inset-y-0 before:left-1/2 before:-translate-x-1/2 before:w-[2px] before:bg-border1",children:o.jsx("div",{className:"relative z-1 bg-surface2 rounded-lg p-2",children:o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(ve,{onClick:n,children:"VS"})}),o.jsx(Wr,{children:"Switch the order"})]})})}),o.jsx(d8e,{datasetId:e,experiment:d,type:"contender"})]}),f&&o.jsxs(hl,{variant:"warning",children:[o.jsx(gh,{}),o.jsxs(hl.Message,{children:[o.jsx("strong",{children:"Version mismatch!"})," These experiments used different dataset versions (v",u.datasetVersion," vs v",d.datasetVersion,"). Results may not be directly comparable."]})]}),p.length>0&&o.jsxs(At,{children:[o.jsxs(At.Header,{columns:m,children:[o.jsx(At.HeaderCol,{children:"Scorer"}),o.jsx(At.HeaderCol,{className:"flex justify-center",children:o.jsxs(aAe,{children:[o.jsx($a,{color:"purple",size:"small",intensity:"muted",children:"Baseline"}),o.jsx($a,{color:"purple",size:"small",children:"Avg"})]})}),o.jsx(At.HeaderCol,{className:"flex justify-center",children:o.jsxs(aAe,{children:[o.jsx($a,{color:"cyan",size:"small",intensity:"muted",children:"Contender"}),o.jsx($a,{color:"cyan",size:"small",children:"Avg"})]})}),o.jsx(At.HeaderCol,{className:"flex justify-center",children:"Delta"})]}),o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:p.map(({scorerId:T,avgA:j,avgB:A,delta:I})=>o.jsxs(At.Row,{columns:m,children:[o.jsx(At.TextCell,{children:T}),o.jsx(At.TextCell,{className:"text-center font-mono",children:j!=null?j.toFixed(3):"-"}),o.jsx(At.TextCell,{className:"text-center font-mono",children:A!=null?A.toFixed(3):"-"}),o.jsx(At.TextCell,{className:"flex justify-center",children:I!=null?o.jsx(lye,{delta:I}):"-"})]},T))})})]}),o.jsxs(Xd,{className:Z({"grid-cols-[1fr_2fr]":!!y}),children:[o.jsx(CEn,{items:i.items,baselineId:_,contenderId:E,scorerIds:h,featuredItemId:s,columns:g,onItemClick:x}),!!y&&o.jsx(EEn,{item:y,baselineId:_,contenderId:E,baselineVersion:u?.datasetVersion,contenderVersion:d?.datasetVersion,onPrevious:k(),onNext:O(),onClose:w})]})]})}function NEn({datasetId:e,itemId:t,onVersionSelect:r,onCompareVersionsClick:n,activeVersion:s}){const{data:a,isLoading:i}=iye(e,t),[l,c]=b.useState(!1),[u,d]=b.useState(new Set),f=x=>{r?.(x)},h=x=>s==null?x.isLatest:x.datasetVersion===s,p=x=>{d(w=>{const O=new Set(w);if(O.has(x))O.delete(x);else if(O.size>=2){const[k]=Array.from(O);return new Set([k,x])}else O.add(x);return O})},m=()=>{c(!1),d(new Set)},g=()=>{c(!0)},y=()=>{u.size===2&&n?.([...u])};return o.jsxs(gr,{className:"min-w-56",children:[l?o.jsx(gr.Toolbar,{className:"grid justify-stretch gap-3 w-full",children:o.jsxs(ws,{children:[o.jsx(ve,{onClick:m,children:"Cancel"}),o.jsx(xs,{variant:"primary",disabled:u.size!==2,onClick:y,tooltipContent:u.size!==2?"Check 2 versions to compare":void 0,className:"grow",children:"Compare"})]})}):o.jsx(o.Fragment,{children:(a||[]).length>1&&o.jsx(gr.Toolbar,{children:o.jsxs(ve,{onClick:g,className:"w-full",children:[o.jsx(qm,{})," Compare Ver."]})})}),i?o.jsx(AEn,{}):o.jsxs(At,{children:[o.jsx(At.Header,{children:o.jsx(At.HeaderCol,{children:"Item Version History"})}),o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:a?.map(x=>{const w=String(x.datasetVersion),O=typeof x.updatedAt=="string"?new Date(x.updatedAt):x.updatedAt;return o.jsxs(At.Row,{isSelected:l&&u.has(w),children:[l&&o.jsx(At.LabelCell,{children:o.jsx(bi,{checked:u.has(w),disabled:x.isDeleted,onCheckedChange:()=>{},onClick:k=>{k.stopPropagation(),x.isDeleted||p(w)},"aria-label":`Select version ${x.datasetVersion}`})}),o.jsx(At.RowButton,{item:x,columns:[{name:"version",label:"Item Version History",size:"1fr"}],isFeatured:h(x),onClick:()=>f(x),className:"py-2",children:o.jsx(At.VersionCell,{version:x.datasetVersion,date:O,isLatest:x.isLatest,isDeleted:x.isDeleted})})]},String(x.datasetVersion))})})})]})]})}function AEn(){return o.jsxs(At,{children:[o.jsx(At.Header,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:o.jsx(At.HeaderCol,{children:"Item Version History"})}),o.jsx(At.Items,{children:Array.from({length:3}).map((e,t)=>o.jsx(At.Row,{children:o.jsx(At.RowButton,{columns:[{name:"version",label:"Item Version History",size:"1fr"}],children:o.jsx(At.TextCell,{isLoading:!0,children:"Loading..."})})},t))})]})}function IEn(e,t){if(t){const r=typeof t=="string"?new Date(t):t;return`v${e} ${or(r,"MMM dd 'at' H:mm:ss a")}`}return`v${e}`}function REn({datasetId:e,versionA:t,versionB:r,onVersionChange:n}){const{data:s}=tye(e),a=(s??[]).map(i=>({value:String(i.version),label:`${IEn(i.version,i.createdAt)}${i.isCurrent?" (current)":""}`}));return o.jsxs(gr.Toolbar,{className:"grid grid-cols-[1fr_1fr_1fr_10rem] gap-4 w-full",children:[o.jsx("div",{}),o.jsx(Po,{label:"Version A",labelIsHidden:!0,name:"version-a",placeholder:"Select version",options:a,value:t??"",onValueChange:i=>n?.(i,r??"")}),o.jsx(Po,{label:"Version B",labelIsHidden:!0,name:"version-b",options:a,value:r??"",onValueChange:i=>n?.(t??"",i)}),o.jsx("div",{})]})}const PEn=[{name:"id",label:"ID",size:"1fr"},{name:"versionA",label:"Version A",size:"1fr"},{name:"versionB",label:"Version B",size:"1fr"},{name:"compare",label:"Compare",size:"10rem"}],MEn={added:{color:"blue",borderColor:"border-blue-900",icon:o.jsx(is,{}),tooltip:"Added in this version"},changed:{color:"orange",borderColor:"border-yellow-900",icon:o.jsx(TWe,{}),tooltip:"Changed in this version"},same:{color:"green",borderColor:"border-green-900",icon:o.jsx(ZBt,{}),tooltip:"Same in both versions"}};function Zee({red:e=!1,tooltip:t}){return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx(A8t,{className:Z("text-neutral3/40 w-5 h-5 ",{"text-red-900":e})})}),t&&o.jsx(Wr,{children:t})]})}function W0({variant:e,version:t}){if(!e)return o.jsxs("span",{className:"text-ui-md text-neutral4",children:["v. ",t]});const{color:r,icon:n,tooltip:s}=MEn[e];return o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsxs("div",{className:"grid grid-cols-[1fr_auto]",children:[t!==void 0&&o.jsxs("span",{className:"pr-3 text-ui-md text-neutral4 min-w-16 flex justify-end",children:["v. ",t]}),o.jsx($a,{color:r,size:"small",children:n})]})}),o.jsx(Wr,{children:s})]})}function DEn(e,t){return e&&t&&e.datasetVersion===t.datasetVersion?"same":e&&t&&e.datasetVersion!==t.datasetVersion?"changed":e?"added":"removed"}function LEn({datasetId:e,versionA:t,versionB:r,allItems:n,itemsAMap:s,itemsBMap:a}){const{Link:i}=lr(),l=t>r;return o.jsx(At,{children:o.jsx(At.Scroller,{children:o.jsx(At.Items,{children:n.map(({id:c})=>{const u=s.get(c),d=a.get(c),f=DEn(u,d);return o.jsxs(At.Row,{columns:PEn,children:[o.jsx(At.IdCell,{id:c,isShortened:!1}),f!=="same"?o.jsxs(o.Fragment,{children:[u?.datasetVersion?o.jsx(At.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!d&&l?o.jsx(W0,{variant:"added",version:u.datasetVersion}):f==="changed"&&l?o.jsx(W0,{variant:"changed",version:u.datasetVersion}):o.jsx(W0,{version:u.datasetVersion})}):o.jsx(At.Cell,{className:"justify-center flex items-center",children:o.jsx(Zee,{red:l,tooltip:l?"Deleted in this version":"Not present in this version"})}),d?.datasetVersion?o.jsx(At.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"gap-2",children:!u&&!l?o.jsx(W0,{variant:"added",version:d.datasetVersion}):f==="changed"&&!l?o.jsx(W0,{variant:"changed",version:d.datasetVersion}):o.jsx(W0,{version:d.datasetVersion})}):o.jsx(At.Cell,{className:"justify-center flex items-center",children:o.jsx(Zee,{red:!l,tooltip:l?"Not present in this version":"Deleted in this version"})})]}):o.jsx(At.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}`,className:"col-span-2 gap-2",children:o.jsx(W0,{variant:"same",version:d?.datasetVersion})}),f==="changed"?o.jsx(At.LinkCell,{LinkComponent:i,href:`/datasets/${e}/items/${c}/versions?ids=${u?.datasetVersion},${d?.datasetVersion}`,children:"Compare"}):o.jsx(At.Cell,{children:o.jsx(Zee,{tooltip:o.jsxs(o.Fragment,{children:["Comparing is available",o.jsx("br",{})," only for changed items"]})})})]},c)})})})})}const f8e={needsReview:"#facc15",complete:"#22c55e"},$En=[{label:"Needs Review",color:f8e.needsReview},{label:"Reviewed",color:f8e.complete}];function FEn({reviewSummary:e,experiments:t,datasets:r,isLoading:n,isError:s}){const{data:a,maxVal:i,totalInPipeline:l}=b.useMemo(()=>{if(!e?.counts||!t)return{data:[],maxVal:0,totalInPipeline:0};const u=new Map;for(const m of t)u.set(m.id,m);const d=new Map;if(r)for(const m of r)d.set(m.id,m.name);let f=0,h=0;const p=[];for(const m of e.counts){const g=m.needsReview+m.complete;if(g===0)continue;h+=g,g>f&&(f=g);const y=u.get(m.experimentId),x=y?.datasetId?d.get(y.datasetId):void 0,w=x?`${x} · ${m.experimentId.slice(0,8)}`:m.experimentId.slice(0,8);p.push({name:w,values:[m.needsReview,m.complete]})}return{data:p,maxVal:f,totalInPipeline:h}},[e,t,r]),c=a.length>0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Review Pipeline",description:"Items in review across experiments."}),c&&o.jsx(qt.Summary,{value:String(l),label:"Items in pipeline"})]}),n?o.jsx(qt.Loading,{}):s?o.jsx(qt.Error,{message:"Failed to load review data"}):o.jsx(qt.Content,{children:c?o.jsx(E_,{data:a,segments:$En,maxVal:i,fmt:u=>String(u)}):o.jsx(qt.NoData,{message:"No items have been sent to review yet"})})]})}function cye(){const e=Ze();return kt({queryKey:["experiment-review-summary"],queryFn:()=>e.getExperimentReviewSummary()})}function tSt(e){const t=new Map;if(!e?.counts)return t;for(const r of e.counts)t.set(r.experimentId,{needsReview:r.needsReview,complete:r.complete,total:r.total});return t}function zEn(e,t){const r=new Map,n=tSt(e);if(!n.size||!t)return r;for(const s of t){const a=n.get(s.id);if(!a||!s.datasetId||a.needsReview+a.complete===0)continue;const l=r.get(s.datasetId)??{needsReview:0,complete:0};l.needsReview+=a.needsReview,l.complete+=a.complete,r.set(s.datasetId,l)}return r}function BEn(e){return e?.counts?e.counts.reduce((t,r)=>({needsReview:t.needsReview+r.needsReview,complete:t.complete+r.complete,inPipeline:t.inPipeline+r.needsReview+r.complete}),{needsReview:0,complete:0,inPipeline:0}):{needsReview:0,complete:0,inPipeline:0}}const UEn=10;function VEn(){const[e,t]=b.useState(!1),[r,n]=b.useState(""),[s,a]=b.useState("all"),[i,l]=b.useState("all"),[c,u]=b.useState("all"),[d,f]=b.useState(0),{data:h,isLoading:p,error:m}=Rh({page:d,perPage:UEn}),{data:g,isLoading:y,error:x}=t8(),{data:w}=cye(),O=b.useMemo(()=>h?.datasets??[],[h?.datasets]),k=h?.pagination?.hasMore??!1,_=b.useMemo(()=>g?.experiments??[],[g?.experiments]),E=b.useMemo(()=>l_n(O),[O]),T=b.useMemo(()=>zEn(w,_),[w,_]),j=p||y,A=m||x,I=()=>t(!0),P=b.useCallback(()=>f(W=>W+1),[]),R=b.useCallback(()=>f(W=>Math.max(0,W-1)),[]),B=b.useCallback(W=>{n(W),f(0)},[]),D=b.useCallback(W=>{a(W),f(0)},[]),F=b.useCallback(W=>{l(W),f(0)},[]),U=b.useCallback(W=>{u(W),f(0)},[]);if(A&&As(A))return o.jsx(Vr,{title:"Datasets",icon:o.jsx(Ca,{}),children:o.jsx(na,{})});if(A&&Os(A))return o.jsx(Vr,{title:"Datasets",icon:o.jsx(Ca,{}),children:o.jsx(Zs,{resource:"datasets"})});if(A)return o.jsx(Vr,{title:"Datasets",icon:o.jsx(Ca,{}),children:o.jsx(sd,{title:"Failed to load datasets",message:A.message})});if(O.length===0&&!j&&d===0)return o.jsxs(o.Fragment,{children:[o.jsx(Vr,{title:"Datasets",icon:o.jsx(Ca,{}),children:o.jsx(c_n,{onCreateClick:I})}),o.jsx(poe,{open:e,onOpenChange:t})]});const z=s!=="all"||i!=="all"||c!=="all"||r!=="",V=()=>{n(""),a("all"),l("all"),u("all"),f(0)};return o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:j,children:[o.jsx(Ca,{})," Datasets"]})})}),o.jsxs(Ft.Column,{className:"flex justify-end gap-2",children:[o.jsx(xs,{onClick:I,tooltipContent:"Create a dataset",children:o.jsx(is,{})}),o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Datasets documentation",children:o.jsx(Io,{})})]})]}),o.jsx(d_n,{search:r,onSearchChange:B,targetFilter:s,onTargetFilterChange:D,experimentFilter:i,onExperimentFilterChange:F,tagFilter:c,onTagFilterChange:U,tagOptions:E,onReset:V,hasActiveFilters:z})]}),o.jsx(a_n,{datasets:O,experiments:_,reviewByDataset:T,isLoading:j,search:r,targetFilter:s,experimentFilter:i,tagFilter:c,currentPage:d,hasMore:k,onNextPage:P,onPrevPage:R}),o.jsx(poe,{open:e,onOpenChange:t})]})}const qEn=new Set(["items","experiments","review"]);function HEn(){const{datasetId:e}=ba(),t=ad(),[r,n]=vo(),s=r.get("tab"),a=s&&qEn.has(s)?s:"items",i=E=>{n(E==="items"?{}:{tab:E},{replace:!0})},[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,y]=b.useState(null),{data:x,error:w}=jg(e??"");if(!e)return o.jsx(Ir,{children:o.jsx(of,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&As(w))return o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})});if(w&&Os(w))return o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})});const O=E=>{t(`/datasets/${e}/experiments/${E}`)},k=()=>{t("/datasets")},_=E=>{y(E?.version??null)};return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:o.jsx(y_n,{value:e,variant:"ghost"})})]})}),o.jsxs(of,{className:"content-stretch",children:[o.jsx(tEn,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>h(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:_,initialTab:a,onTabChange:i,experimentTriggerSlot:o.jsxs(ve,{variant:"primary",onClick:()=>c(!0),children:[o.jsx(Sx,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),o.jsx(oEn,{datasetId:e,version:g??void 0,open:l,onOpenChange:c,onSuccess:O}),o.jsx(nEn,{datasetId:e,open:u,onOpenChange:d}),x&&o.jsx(m_n,{open:f,onOpenChange:h,dataset:{id:x.id,name:x.name,description:x?.description||"",inputSchema:x.inputSchema,groundTruthSchema:x.groundTruthSchema}}),x&&o.jsx(g_n,{open:p,onOpenChange:m,datasetId:x.id,datasetName:x.name,onSuccess:k})]})]})}function QEn(){const{datasetId:e,experimentId:t}=ba(),{data:r}=jg(e??""),{data:n,isLoading:s,error:a}=r6(e,t),{data:i,isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=Z9({datasetId:e,experimentId:t,experimentStatus:n?.status});return!e||!t?null:s?o.jsx(Ir,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(It,{})})}):a&&As(a)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):a&&Os(a)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):a||!n?o.jsx(Ir,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",a instanceof Error?a.message:"Unknown error"]})}):o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:r?.name}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(eSt,{experimentId:t,experiment:n}),o.jsx(Jwt,{experimentId:t,experimentStatus:n?.status,results:i??[],isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function WEn(){const{datasetId:e}=ba(),[t,r]=vo(),{data:n,error:s}=jg(e??""),a=t.get("baseline")??"",i=t.get("contender")??"";return s&&As(s)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):s&&Os(s)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):!e||!a||!i?o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsxs(dr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(qm,{})}),"Compare Experiments"]})]})}),o.jsx(of,{children:o.jsxs("div",{className:"text-neutral4 text-center py-8",children:[o.jsx("p",{children:"Select two experiments to compare."}),o.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:n?.name??e?.slice(0,8)}),o.jsxs(dr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(qm,{})}),"Experiments Comparison"]})]})}),o.jsx(of,{children:o.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(qm,{})," Dataset Experiments Comparison"]}),o.jsxs(Ar.Description,{children:["Comparing"," ",o.jsx(nr,{to:`/datasets/${e}/experiments/${a}`,children:a.slice(0,8)})," vs"," ",o.jsx(nr,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),o.jsx(Ar.Column,{children:o.jsxs(ve,{as:nr,to:`/datasets/${e}`,children:[o.jsx(xp,{}),"Back to Dataset"]})})]}),o.jsx(TEn,{datasetId:e,experimentIdA:a,experimentIdB:i,onSwap:()=>{r({baseline:i,contender:a})}})]})})]})}function GEn(){const{datasetId:e,itemId:t}=ba(),{Link:r}=lr(),n=ad(),{data:s,isLoading:a,error:i}=iye(e??"",t??""),{updateItem:l,deleteItem:c}=ei(),{data:u}=jg(e??""),d=s?.[0]??null,f=d?.isDeleted??!1,[h,p]=b.useState(null),m=b.useMemo(()=>!d||f?{input:"",groundTruth:"",metadata:""}:{input:JSON.stringify(d.input,null,2),groundTruth:d.groundTruth?JSON.stringify(d.groundTruth,null,2):"",metadata:d.metadata?JSON.stringify(d.metadata,null,2):""},[d,f]),g=d?.datasetVersion??0,[y,x]=b.useState(!1),[w,O]=b.useState(m.input),[k,_]=b.useState(m.groundTruth),[E,T]=b.useState(m.metadata),[j,A]=b.useState(g);g!==j&&(A(g),O(m.input),_(m.groundTruth),T(m.metadata));const[I,P]=b.useState(!1),R=q=>{p(f?q:q.isLatest?null:q)},B=()=>{p(null)},D=!f&&h!=null,F=()=>{D||x(!0)},U=()=>{D||P(!0)},z=async()=>{if(!e||!t)return;let q;try{q=JSON.parse(w)}catch{Ue.error("Input must be valid JSON");return}let M;if(k.trim())try{M=JSON.parse(k)}catch{Ue.error("Ground Truth must be valid JSON");return}let Q;if(E.trim())try{Q=JSON.parse(E)}catch{Ue.error("Metadata must be valid JSON");return}try{await l.mutateAsync({datasetId:e,itemId:t,input:q,groundTruth:M,metadata:Q}),Ue.success("Item updated successfully"),x(!1)}catch(G){Ue.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},V=()=>{d&&(O(JSON.stringify(d.input,null,2)),_(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),T(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),Ue.success("Item deleted successfully"),P(!1),n(`/datasets/${e}`)}catch(q){Ue.error(`Failed to delete item: ${q instanceof Error?q.message:"Unknown error"}`)}},L=h??d,Y=L?{id:t??"",datasetId:e??"",datasetVersion:L.datasetVersion,input:L.input,groundTruth:L.groundTruth,metadata:L.metadata,createdAt:L.createdAt,updatedAt:L.updatedAt}:null;return i&&As(i)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):i&&Os(i)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):a?null:!e||!t||!s||s.length===0?o.jsx(Ir,{children:o.jsx(of,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):o.jsxs(o.Fragment,{children:[o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:u?.name}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Item"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(wx,{}),t," ",o.jsx(Ya,{content:t})]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:["Item of ",o.jsx(Ca,{})," ",u?.name]})}),o.jsxs(Ar.Description,{children:[o.jsxs(us,{children:[o.jsx(s_,{})," Created at"," ",d?.createdAt?or(new Date(d.createdAt),"MMM d, yyyy"):""]}),o.jsxs(us,{children:[o.jsx(qx,{})," Latest version v",d?.datasetVersion??""]})]})]}),o.jsx(Ar.Column,{children:!y&&!f&&o.jsxs(ws,{children:[o.jsxs(ve,{onClick:F,disabled:D,title:D?"Return to latest version to edit":void 0,children:[o.jsx(TWe,{})," Edit"]}),o.jsxs(ve,{onClick:U,disabled:D,title:D?"Return to latest version to delete":void 0,children:[o.jsx(Ku,{})," Delete"]})]})})]}),o.jsxs(Xd,{className:y?"grid-cols-1":"grid-cols-[1fr_auto]",children:[o.jsxs(gr,{withRightSeparator:!y,children:[f&&d&&o.jsxs(hl,{variant:"destructive",children:[o.jsx(gh,{}),o.jsxs(hl.Message,{children:["This item was deleted at version v",d.datasetVersion]})]}),!f&&D&&h&&o.jsx(o.Fragment,{children:o.jsxs(hl,{variant:"warning",children:[o.jsx(gh,{}),o.jsxs(hl.Message,{children:["Viewing version v",h.datasetVersion]}),o.jsxs(hl.Button,{onClick:B,children:[o.jsx(Xf,{})," Return to the latest version"]})]})}),y?o.jsx(Wwt,{inputValue:w,setInputValue:O,groundTruthValue:k,setGroundTruthValue:_,metadataValue:E,setMetadataValue:T,validationErrors:null,onSave:z,onCancel:V,isSaving:l.isPending}):Y?o.jsx(r8,{item:Y,Link:r}):o.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!y&&o.jsx(gr,{children:o.jsx(NEn,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:R,onCompareVersionsClick:q=>{n(`/datasets/${e}/items/${t}/versions?ids=${q.join(",")}`)},activeVersion:h?.datasetVersion??null})})]})]})})]}),o.jsx($t,{open:I,onOpenChange:P,children:o.jsxs($t.Content,{children:[o.jsxs($t.Header,{children:[o.jsx($t.Title,{children:"Delete Item"}),o.jsx($t.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),o.jsxs($t.Footer,{children:[o.jsx($t.Cancel,{children:"Cancel"}),o.jsx($t.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function h8e(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function ZEn(){const{datasetId:e}=ba(),[t,r]=vo(),n=t.get("items")?.split(",").filter(Boolean)??[],{data:s,error:a}=jg(e??""),{Link:i}=lr(),[l,c]=b.useState(!1),{data:u}=doe(e??"",n[0]??""),{data:d}=doe(e??"",n[1]??"");return a&&As(a)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):a&&Os(a)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):!e||n.length<2?o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),o.jsx(of,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two items to compare."})})})]}):o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Items"})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:`/datasets/${e}`,variant:"outline",children:[o.jsx(Ce,{children:o.jsx(xp,{})}),"Back to Dataset"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Z("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":l}),children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(qm,{}),"Compare Dataset Items"]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:["Comparing ",n.length," items of"," ",o.jsx(nr,{to:`/datasets/${e}`,className:"text-info1 hover:underline",children:s?.name||e?.slice(0,8)})]})})]}),o.jsx(Ar.Column,{children:o.jsxs(ws,{children:[o.jsxs(ve,{as:nr,to:`/datasets/${e}`,children:[o.jsx(xp,{}),"Back to Dataset"]}),o.jsx(ve,{variant:"primary",onClick:()=>c(f=>!f),children:l?o.jsxs(o.Fragment,{children:[o.jsx(bWe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(BBt,{})," Diff View"]})})]})})]}),o.jsx(Xd,{className:"grid-cols-[1fr_3vw_1fr]",children:n.map((f,h)=>o.jsxs(b.Fragment,{children:[o.jsx(YEn,{datasetId:e,itemId:f,Link:i,idx:h,itemIds:n,showContent:!l,onItemChange:p=>{const m=[...n];m[h]=p,r({items:m.join(",")})}}),h==0&&o.jsx("div",{className:Z("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),l&&u&&d&&o.jsx(mct,{codeA:h8e(u),codeB:h8e(d)})]})})]})}function YEn({datasetId:e,itemId:t,Link:r,idx:n,itemIds:s,onItemChange:a,showContent:i=!0}){const{data:l,isLoading:c}=doe(e,t),{data:u}=J_(e),d=new Set(s.filter((h,p)=>p!==n)),f=(u??[]).map(h=>({value:h.id,label:h.id,disabled:d.has(h.id)}));return o.jsxs(gr,{children:[o.jsxs(gr.Toolbar,{className:"flex gap-4",children:[o.jsx(Epe,{label:"Item",name:`compare-item-${n}`,value:t,onValueChange:a,options:f,placeholder:"Select item",labelIsHidden:!0}),o.jsxs(ve,{as:r,to:`/datasets/${e}/items/${t}`,children:[o.jsx(qx,{}),"Versions"]})]}),i&&o.jsx(gr.Content,{children:c?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):l?o.jsxs(o.Fragment,{children:[o.jsx(Gwt,{item:l}),o.jsx(r8,{item:l,Link:r})]}):o.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function p8e(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function XEn(){const{datasetId:e,itemId:t}=ba(),[r,n]=vo(),[s,a]=b.useState(!1),i=r.get("ids")?.split(",").map(Number).filter(p=>!isNaN(p)&&p>0)??[],{data:l,error:c}=jg(e??""),{Link:u}=lr(),{data:d}=iye(e??"",t??""),{data:f}=goe(e??"",t??"",i[0]??0,l?.version),{data:h}=goe(e??"",t??"",i[1]??0,l?.version);return c&&As(c)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):c&&Os(c)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):!e||!t||i.length<2?o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(of,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]}):o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:l?.name}),o.jsx(dr,{as:nr,to:`/datasets/${e}/items/${t}`,children:"Item"}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[o.jsx(Ce,{children:o.jsx(xp,{})}),"Back to Item"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Z("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":s}),children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(qm,{}),"Compare Dataset Item Versions"]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:["Comparing ",i.length," versions of"," ",o.jsx(nr,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),o.jsx(Ar.Column,{children:o.jsxs(ws,{children:[o.jsxs(ve,{as:nr,to:`/datasets/${e}/items/${t}`,children:[o.jsx(xp,{}),"Back to Item"]}),o.jsx(ve,{variant:"primary",onClick:()=>a(p=>!p),children:s?o.jsxs(o.Fragment,{children:[o.jsx(bWe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(k7t,{})," Diff View"]})})]})})]}),o.jsx(Xd,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((p,m)=>o.jsxs(b.Fragment,{children:[o.jsx(KEn,{datasetId:e,itemId:t,datasetVersion:p,latestVersion:l?.version,allVersions:d??[],versionNumbers:i,Link:u,idx:m,showContent:!s,onVersionChange:g=>{const y=[...i];y[m]=g,n({ids:y.join(",")})}}),m===0&&o.jsx("div",{className:Z("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},p))}),s&&f&&h&&o.jsx(mct,{codeA:p8e(f),codeB:p8e(h)})]})})]})}function KEn({datasetId:e,itemId:t,datasetVersion:r,latestVersion:n,allVersions:s,versionNumbers:a,Link:i,idx:l,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=goe(e,t,r,n),h=new Set(a.filter((g,y)=>y!==l)),p=s.map(g=>{const y=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:o.jsxs(o.Fragment,{children:[o.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",or(y,"MMM d, yyyy h:mm a"),g.isLatest?o.jsx($a,{color:"blue",size:"small",children:"Latest"}):null]}),disabled:h.has(g.datasetVersion)}}),m=d?{id:d.id,datasetId:e,datasetVersion:d.datasetVersion,input:d.input,groundTruth:d.groundTruth,metadata:d.metadata,createdAt:d.createdAt,updatedAt:d.updatedAt}:null;return o.jsxs(gr,{children:[o.jsxs(gr.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[o.jsx(qx,{className:"w-6 h-6 opacity-50"}),o.jsx(Epe,{label:"Version",name:`compare-version-${l}`,value:String(r),onValueChange:g=>u(Number(g)),options:p,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&o.jsx(gr.Content,{children:f?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?o.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",r," not found"]}):o.jsx(r8,{item:m,Link:i})})]})}function JEn(){const{datasetId:e}=ba(),[t]=vo(),r=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],n=ad(),{data:s,error:a}=jg(e??""),i=J_(e??"",void 0,r[0]??null),l=J_(e??"",void 0,r[1]??null),c=b.useMemo(()=>i.data??[],[i.data]),u=b.useMemo(()=>l.data??[],[l.data]),d=b.useMemo(()=>{const g=new Map;for(const y of[...c,...u])g.has(y.id)||g.set(y.id,{id:y.id,createdAt:new Date(y.createdAt)});return[...g.values()].sort((y,x)=>x.createdAt.getTime()-y.createdAt.getTime())},[c,u]),f=b.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),h=b.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(a&&As(a))return o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})});if(a&&Os(a))return o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})});if(!e||r.length<2)return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(of,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]});const p=(g,y,x)=>{n(`/datasets/${e}/items/${g}/versions?ids=${y?.datasetVersion??""},${x?.datasetVersion??""}`)},m=(g,y)=>{n(`/datasets/${e}/versions?ids=${g},${y}`,{replace:!0})};return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/datasets",children:[o.jsx(Ce,{children:o.jsx(Ca,{})}),"Datasets"]}),o.jsx(dr,{as:nr,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),o.jsxs(dr,{isCurrent:!0,as:"span",children:[o.jsx(Ce,{children:o.jsx(Z1e,{})}),"Compare Versions"]})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(Ar,{children:[o.jsxs(Ar.Column,{children:[o.jsxs(Ar.Title,{children:[o.jsx(Z1e,{})," Compare Dataset Versions"]}),o.jsx(Ar.Description,{children:o.jsxs(us,{children:[o.jsx(qx,{})," Comparing ",r.length," versions of"," ",s?.name||e?.slice(0,8)]})})]}),o.jsx(Ar.Column,{children:o.jsxs(ve,{as:nr,to:`/datasets/${e}`,children:[o.jsx(xp,{}),"Back to Dataset"]})})]}),o.jsx(Xd,{children:o.jsxs(gr,{children:[o.jsx(REn,{datasetId:e,versionA:String(r[0]),versionB:String(r[1]),onVersionChange:m}),o.jsx(LEn,{datasetId:e,versionA:r[0],versionB:r[1],allItems:d,itemsAMap:f,itemsBMap:h,onItemClick:p})]})})]})})]})}function eCn(e){if(!e||e.length<2)return null;const t=[...e].sort((i,l)=>new Date(i.createdAt).getTime()-new Date(l.createdAt).getTime()),r=Math.floor(t.length/2),n=r,s=t.length-r;if(n===0)return null;const a=(s-n)/n*100;return{changePct:Math.round(a*10)/10,prevValue:String(n)}}function tCn({scorers:e,datasets:t,experiments:r,avgScore:n,prevAvgScore:s,totalNeedsReview:a,isLoadingScorers:i,isLoadingDatasets:l,isLoadingExperiments:c,isLoadingScores:u,isLoadingReview:d}){const f=e?Object.keys(e).length:void 0,h=t?.length,p=r?.length,m=n!=null&&s!=null&&s!==0?{changePct:Math.round((n-s)/s*100*10)/10,prevValue:String(s)}:null,g=eCn(r);return o.jsxs(o.Fragment,{children:[o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Scorers"}),i?o.jsx(fr.Loading,{}):f!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(f)}),o.jsx(fr.NoChange,{message:"Static count"})]}):o.jsx(fr.NoData,{})]}),o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Datasets"}),l?o.jsx(fr.Loading,{}):h!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(h)}),o.jsx(fr.NoChange,{message:"Static count"})]}):o.jsx(fr.NoData,{})]}),o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Avg Score"}),u?o.jsx(fr.Loading,{}):n!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(n)}),m?o.jsx(fr.Change,{changePct:m.changePct,prevValue:m.prevValue}):o.jsx(fr.NoChange,{})]}):o.jsx(fr.NoData,{})]}),o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Experiments"}),c?o.jsx(fr.Loading,{}):p!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(p)}),g?o.jsx(fr.Change,{changePct:g.changePct,prevValue:g.prevValue}):o.jsx(fr.NoChange,{})]}):o.jsx(fr.NoData,{})]}),o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Needs Review"}),d?o.jsx(fr.Loading,{}):a!=null?o.jsxs(o.Fragment,{children:[o.jsx(fr.Value,{children:String(a)}),a>0?o.jsx(fr.NoChange,{message:"items pending review"}):o.jsx(fr.NoChange,{message:"All caught up"})]}):o.jsx(fr.NoData,{})]})]})}const rCn=[{value:"all",label:"All statuses"},{value:"completed",label:"Completed"},{value:"running",label:"Running"},{value:"failed",label:"Failed"},{value:"pending",label:"Pending"}],m8e="auto 1fr auto auto auto auto auto auto auto";function nCn(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}const sCn={completed:"success",running:"warning",failed:"error",pending:"neutral"};function aCn({experiments:e,datasets:t,reviewByExperiment:r,isLoading:n,search:s="",statusFilter:a="all",datasetFilter:i="all"}){const{paths:l,Link:c}=lr(),u=b.useMemo(()=>{const h=new Map;return t?.forEach(p=>h.set(p.id,p.name)),h},[t]),d=b.useMemo(()=>[...e].sort((h,p)=>{const m=h.createdAt?new Date(h.createdAt).getTime():0;return(p.createdAt?new Date(p.createdAt).getTime():0)-m}),[e]),f=b.useMemo(()=>{const h=s.toLowerCase();return d.filter(p=>{const m=p.datasetId?u.get(p.datasetId)??"":"",g=!h||p.id.toLowerCase().includes(h)||m.toLowerCase().includes(h)||(p.targetId??"").toLowerCase().includes(h),y=a==="all"||p.status===a,x=i==="all"||p.datasetId===i;return g&&y&&x})},[d,s,u,a,i]);return n?o.jsx(fh,{columns:m8e}):o.jsxs(xe,{columns:m8e,children:[o.jsxs(xe.Top,{children:[o.jsx(xe.TopCell,{children:"Experiment"}),o.jsx(xe.TopCell,{children:"Dataset"}),o.jsx(xe.TopCell,{children:"Target"}),o.jsx(xe.TopCell,{children:"Status"}),o.jsx(xe.TopCell,{className:"text-center",children:"Items"}),o.jsx(xe.TopCell,{className:"text-center",children:"Succeeded"}),o.jsx(xe.TopCell,{className:"text-center",children:"Failed"}),o.jsx(xe.TopCell,{className:"text-center",children:"Review"}),o.jsx(xe.TopCell,{children:"Date"})]}),f.map(h=>{const p=h.datasetId?u.get(h.datasetId)??h.datasetId.slice(0,8):"—",m=h.status??"pending",g=h.succeededCount??0,y=h.failedCount??0,x=h.totalItems??0,w=x>0?Math.round(g/x*100):0;return o.jsxs(xe.RowLink,{to:l.experimentLink(h.id),LinkComponent:c,children:[o.jsx(xe.NameCell,{className:"font-mono",children:h.id.slice(0,8)}),o.jsx(xe.TextCell,{children:p}),o.jsx(xe.Cell,{children:o.jsxs("span",{className:"truncate",children:[h.targetType," ",h.targetId]})}),o.jsx(xe.Cell,{children:o.jsx(lP,{variant:sCn[m]??"neutral",withDot:!0,children:m})}),o.jsx(xe.TextCell,{className:"text-center",children:x}),o.jsx(xe.TextCell,{className:"text-center",children:o.jsxs("span",{className:g>0?"text-accent1":"",children:[g," (",w,"%)"]})}),o.jsx(xe.TextCell,{className:"text-center",children:o.jsx("span",{className:y>0?"text-accent2":"",children:y})}),o.jsx(xe.Cell,{className:"text-center",children:(()=>{const O=r?.get(h.id);if(!O)return o.jsx("span",{className:"text-neutral2",children:"—"});const k=O.needsReview+O.complete;return k===0?o.jsx("span",{className:"text-neutral2",children:"—"}):O.needsReview>0?o.jsxs(vt,{variant:"warning",children:[O.needsReview," pending"]}):o.jsxs(vt,{variant:"success",children:[O.complete,"/",k," reviewed"]})})()}),o.jsx(xe.TextCell,{children:nCn(h.createdAt)})]},h.id)})]})}function iCn(e){return[{value:"all",label:"All datasets"},...(e??[]).map(t=>({value:t.id,label:t.name}))]}const hL={completed:"#22c55e",running:"#facc15",pending:"#fb923c",failed:"#f87171"},oCn=[{label:"Completed",color:hL.completed},{label:"Running",color:hL.running},{label:"Pending",color:hL.pending},{label:"Failed",color:hL.failed}];function lCn({experiments:e,datasets:t,isLoading:r,isError:n}){const{data:s,maxVal:a}=b.useMemo(()=>{if(!e||e.length===0)return{data:[],maxVal:0};const l=new Map;if(t)for(const f of t)l.set(f.id,f.name);const c=new Map;for(const f of e){const h=f.datasetId??"unknown";c.has(h)||c.set(h,{completed:0,running:0,pending:0,failed:0});const p=c.get(h),m=f.status;m in p&&p[m]++}let u=0;return{data:Array.from(c.entries()).map(([f,h])=>{const p=h.completed+h.running+h.pending+h.failed;return p>u&&(u=p),{name:l.get(f)??f.slice(0,12),values:[h.completed,h.running,h.pending,h.failed]}}),maxVal:u}},[e,t]),i=s.length>0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Experiments by Dataset",description:"Experiment status breakdown per dataset."}),i&&o.jsx(qt.Summary,{value:String(e?.length??0),label:"Total experiments"})]}),r?o.jsx(qt.Loading,{}):n?o.jsx(qt.Error,{message:"Failed to load experiments data"}):o.jsx(qt.Content,{children:i?o.jsx(E_,{data:s,segments:oCn,maxVal:a,fmt:l=>String(l)}):o.jsx(qt.NoData,{message:"No experiments have been run yet"})})]})}const cCn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No Experiments yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Run an experiment from a dataset to evaluate ",o.jsx("br",{}),"your agents and workflows."]}),actionSlot:o.jsx("div",{className:"flex flex-col items-center gap-2",children:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",children:["Experiments Documentation ",o.jsx(Aa,{})]})})})});function uCn({search:e,onSearchChange:t,statusFilter:r,onStatusFilterChange:n,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:i,onReset:l,hasActiveFilters:c}){return o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(Ah,{label:"Search experiments",placeholder:"Filter by experiment, dataset, or target",value:e,onSearch:t}),o.jsxs(ws,{children:[o.jsx(Po,{label:"Status",labelIsHidden:!0,name:"filter-status",options:[...rCn],value:r,onValueChange:n,className:"whitespace-nowrap"}),o.jsx(Po,{label:"Dataset",labelIsHidden:!0,name:"filter-dataset",options:i,value:s,onValueChange:a,className:"whitespace-nowrap"}),l&&c&&o.jsxs(ve,{onClick:l,size:"sm",variant:"light",children:[o.jsx(vn,{className:"size-3"})," Reset"]})]})]})}function dCn(){const{data:e,isLoading:t,error:r}=_f(),{data:n,isLoading:s,error:a}=Rh(),{data:i,isLoading:l,error:c}=t8(),{data:u,isLoading:d,isError:f,error:h}=_xn(),{data:p,isLoading:m,isError:g,error:y}=cye(),x=n?.datasets,w=i?.experiments,O=b.useMemo(()=>BEn(p),[p]),k=r||a||c||h||y;return k&&As(k)?o.jsx(Vr,{title:"Evaluation",icon:o.jsx(Eu,{}),children:o.jsx(na,{})}):k&&Os(k)?o.jsx(Vr,{title:"Evaluation",icon:o.jsx(Eu,{}),children:o.jsx(Zs,{resource:"evaluation"})}):k?o.jsx(Vr,{title:"Evaluation",icon:o.jsx(Eu,{}),children:o.jsx(sd,{title:"Failed to load evaluation data",message:k.message})}):o.jsxs(Ft,{width:"wide",height:"full",children:[o.jsx(Ft.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(Eu,{})," Evaluation"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Evaluation documentation",children:o.jsx(Io,{})})})]})}),o.jsxs("div",{className:"flex flex-col gap-6 pt-4",children:[o.jsx(Jse,{children:o.jsx(tCn,{scorers:e,datasets:x,experiments:w,avgScore:u?.avgScore??null,prevAvgScore:u?.prevAvgScore??null,totalNeedsReview:O.needsReview,isLoadingScorers:t,isLoadingDatasets:s,isLoadingExperiments:l,isLoadingScores:d,isLoadingReview:m})}),o.jsx(pxn,{summaryData:u?.summaryData??[],overTimeData:u?.overTimeData??[],scorerNames:u?.scorerNames??[],avgScore:u?.avgScore??null,isLoading:d,isError:f}),o.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[o.jsx(u_n,{experiments:w,isLoading:l,isError:!!c}),o.jsx(lCn,{experiments:w,datasets:x,isLoading:l,isError:!!c})]}),o.jsx(FEn,{reviewSummary:p,experiments:w,datasets:x,isLoading:m,isError:!!g})]})]})}function fCn(){const[e,t]=b.useState(""),[r,n]=b.useState("all"),[s,a]=b.useState("all"),{data:i,isLoading:l,error:c}=Rh(),{data:u,isLoading:d,error:f}=t8(),{data:h}=cye(),p=b.useMemo(()=>i?.datasets??[],[i?.datasets]),m=b.useMemo(()=>u?.experiments??[],[u?.experiments]),g=b.useMemo(()=>iCn(p),[p]),y=b.useMemo(()=>tSt(h),[h]),x=l||d,w=f||c;if(w&&As(w))return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(na,{})});if(f&&Os(f))return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(Zs,{resource:"experiments"})});if(c&&Os(c))return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(Zs,{resource:"datasets"})});if(w)return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(sd,{title:"Failed to load experiments",message:w.message})});if(m.length===0&&!x)return o.jsx(Vr,{title:"Experiments",icon:o.jsx(Eu,{}),children:o.jsx(cCn,{})});const O=r!=="all"||s!=="all"||e!=="",k=()=>{t(""),n("all"),a("all")};return o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:x,children:[o.jsx(Eu,{})," Experiments"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/evals/datasets/running-experiments",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Experiments documentation",children:o.jsx(Io,{})})})]}),o.jsx(uCn,{search:e,onSearchChange:t,statusFilter:r,onStatusFilterChange:n,datasetFilter:s,onDatasetFilterChange:a,datasetOptions:g,onReset:k,hasActiveFilters:O})]}),o.jsx(aCn,{experiments:m,datasets:p,reviewByExperiment:y,isLoading:x,search:e,statusFilter:r,datasetFilter:s})]})}function hCn(){const{experimentId:e}=ba(),{data:t,isLoading:r}=t8(),s=t?.experiments?.find(p=>p.id===e)?.datasetId??"",{data:a,isLoading:i,error:l}=r6(s,e??""),{data:c,isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h}=Z9({datasetId:s,experimentId:e??"",experimentStatus:a?.status});return e?r||i||!s?o.jsx(Ir,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(It,{})})}):l&&As(l)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})}):l&&Os(l)?o.jsx(Ir,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"datasets"})})}):l||!a?o.jsx(Ir,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",l instanceof Error?l.message:"Unknown error"]})}):o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/experiments",children:[o.jsx(Ce,{children:o.jsx(Eu,{})}),"Experiments"]}),o.jsx(dr,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(eSt,{experimentId:e,experiment:a}),o.jsx(Jwt,{experimentId:e,experimentStatus:a?.status,results:c??[],isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h})]})})]}):null}function rSt({redirectUri:e,onSuccess:t,initialMode:r="signin",errorMessage:n}){const{data:s,isLoading:a}=UE(),{mutate:i,isPending:l,error:c}=bkn(),{mutate:u,isPending:d,error:f}=xkn(),{mutate:h,isPending:p}=qwt(),[m,g]=b.useState(r),[y,x]=b.useState(""),[w,O]=b.useState(""),[k,_]=b.useState("");if(a)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsx("div",{className:"text-neutral3",children:"Loading..."})});if(!s?.enabled||!s?.login)return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsx("div",{className:"text-neutral3",children:"Authentication is not configured"})});const{login:E}=s,T=E.type==="sso"||E.type==="both",j=E.type==="credentials"||E.type==="both",A=E.sso,I=E.signUpEnabled!==!1,P=m==="signin"||!I,R=P?l:d,B=P?c:f,D=()=>{t?t():e?window.location.href=e:window.location.href="/"},F=V=>{V.preventDefault(),P?i({email:w,password:k},{onSuccess:D}):u({email:w,password:k,name:y||void 0},{onSuccess:D})},U=()=>{h({redirectUri:e},{onSuccess:V=>{window.location.href=V.url}})},z=()=>{g(P?"signup":"signin")};return o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface1",children:o.jsxs("div",{className:"w-full max-w-sm space-y-6 rounded-lg border border-border1 bg-surface2 p-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[o.jsx(Xb,{className:"h-10 w-10"}),o.jsx("h1",{className:"text-xl font-semibold text-neutral6",children:P?"Sign in to Mastra Studio":"Create your account"})]}),n&&o.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:n}),j&&o.jsxs("form",{onSubmit:F,className:"space-y-4",children:[!P&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"name",className:"block text-sm text-neutral4",children:"Name"}),o.jsx(cr,{id:"name",type:"text",value:y,onChange:V=>x(V.target.value),placeholder:"Your name",variant:"default",size:"lg"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"email",className:"block text-sm text-neutral4",children:"Email"}),o.jsx(cr,{id:"email",type:"email",value:w,onChange:V=>O(V.target.value),placeholder:"you@example.com",required:!0,variant:"default",size:"lg"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"password",className:"block text-sm text-neutral4",children:"Password"}),o.jsx(cr,{id:"password",type:"password",value:k,onChange:V=>_(V.target.value),placeholder:P?"Enter your password":"Create a password",required:!0,variant:"default",size:"lg"})]}),B&&o.jsx("div",{className:"rounded-md bg-red-500/10 p-3 text-sm text-red-400",children:B.message}),o.jsx(ve,{type:"submit",disabled:R,className:"w-full",size:"lg",children:R?P?"Signing in...":"Creating account...":P?"Sign in":"Create account"}),I&&o.jsxs("div",{className:"text-center text-sm",children:[o.jsx("span",{className:"text-neutral3",children:P?"Don't have an account? ":"Already have an account? "}),o.jsx("button",{type:"button",onClick:z,className:"text-neutral6 hover:underline",children:P?"Sign up":"Sign in"})]})]}),T&&j&&o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("div",{className:"w-full border-t border-border1"})}),o.jsx("div",{className:"relative flex justify-center text-sm",children:o.jsx("span",{className:"bg-surface2 px-2 text-neutral3",children:"or continue with"})})]}),T&&A&&o.jsxs(ve,{onClick:U,disabled:p,className:"w-full",size:"lg",variant:"outline",children:[A.icon&&o.jsx("span",{className:"mr-2",children:A.icon}),p?"Redirecting...":A.text||"Sign in"]})]})})}function pCn(){const[e]=vo(),t=ad(),r=e.get("redirect")||"/",s=e.get("mode")==="signup"?"signup":"signin",a=e.get("error_description")||e.get("error")||null,i=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return o.jsx(rSt,{redirectUri:r,onSuccess:i,initialMode:s,errorMessage:a})}const gu=mi.KeyValueList;function mCn(e){return e instanceof Date?e:new Date(e)}function gCn({log:e,onClose:t,onTraceClick:r,onSpanClick:n,onPrevious:s,onNext:a,collapsed:i,onCollapsedChange:l}){const[c,u]=b.useState(!1),d=i??c,f=l??u,h=mCn(e.timestamp);return o.jsxs(mi,{collapsed:d,children:[o.jsxs(mi.Header,{children:[o.jsxs(mi.Heading,{children:["Log ",o.jsx("b",{children:or(h,"MMM dd, HH:mm:ss.SSS")})]}),o.jsxs(ws,{className:"ml-auto shrink-0",children:[l&&o.jsx(xs,{size:"md",tooltipContent:d?"Expand panel":"Collapse panel",onClick:()=>f(!d),children:d?o.jsx(cWe,{}):o.jsx(iWe,{})}),o.jsxs(ws,{spacing:"close",children:[o.jsx(xs,{size:"md",tooltipContent:"Previous log",onClick:s,disabled:!s,children:o.jsx(q6,{})}),o.jsx(xs,{size:"md",tooltipContent:"Next log",onClick:a,disabled:!a,children:o.jsx(lce,{})})]}),o.jsx(mi.CloseButton,{onClick:t})]})]}),!d&&o.jsxs(mi.Content,{children:[o.jsx("p",{className:"text-ui-md text-neutral4 font-mono wrap-break-word whitespace-pre-wrap",children:e.message}),(e.traceId||e.spanId)&&o.jsxs("div",{className:Z("grid gap-2 my-8","[&>button]:justify-between [&>button]:overflow-hidden"),children:[e.traceId&&o.jsxs(ws,{spacing:"close",className:"min-w-0 w-full",children:[o.jsxs(ve,{size:"md",className:"min-w-0 flex-1 overflow-hidden",onClick:()=>r?.(e.traceId),children:[o.jsx(qd,{}),o.jsx("span",{children:"Trace"}),o.jsxs("span",{className:" ml-auto text-ui-sm text-neutral2 min-w-0 truncate",children:["# ",e.traceId]})]}),o.jsx(Ya,{content:e.traceId,size:"md",tooltip:"Copy Trace ID to clipboard"})]}),e.spanId&&o.jsxs(ws,{spacing:"close",className:"min-w-0 w-full",children:[o.jsxs(ve,{size:"md",className:"min-w-0 flex-1 overflow-hidden",disabled:!e.traceId||!n,onClick:()=>e.traceId&&n?.(e.traceId,e.spanId),children:[o.jsx(qd,{}),o.jsx("span",{children:"Span"}),o.jsxs("span",{className:" ml-auto text-ui-sm text-neutral2 min-w-0 truncate",children:["# ",e.spanId]})]}),o.jsx(Ya,{content:e.spanId,size:"md",tooltip:"Copy Span ID to clipboard"})]})]}),o.jsxs(gu,{className:"mb-6",children:[e.entityType&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Entity Type"}),o.jsx(gu.Value,{children:e.entityType})]}),e.entityName&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Entity Name"}),o.jsx(gu.Value,{children:e.entityName})]}),e.serviceName&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Service"}),o.jsx(gu.Value,{children:e.serviceName})]}),e.environment&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Environment"}),o.jsx(gu.Value,{children:e.environment})]}),e.source&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Key,{children:"Source"}),o.jsx(gu.Value,{children:e.source})]}),e.metadata&&Object.keys(e.metadata).length>0&&o.jsxs(o.Fragment,{children:[o.jsx(gu.Header,{children:"Metadata"}),Object.entries(e.metadata).map(([p,m])=>o.jsxs(b.Fragment,{children:[o.jsx(gu.Key,{children:p}),o.jsx(gu.Value,{children:String(m)})]},p))]})]}),e.data&&Object.keys(e.data).length>0&&o.jsx(mi.CodeSection,{title:"Data",codeStr:JSON.stringify(e.data,null,2),className:"mt-6"})]})]})}function yCn(e){const t=Ze();return kt({queryKey:["trace-spans",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await t.getTrace(e)},enabled:!!e})}const vCn=e=>{if(!e||e.length===0)return[];const t=e.reduce((l,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!l||u>l)?u:l},null),r=new Map,n=[];e.forEach(l=>{const c=new Date(l.startedAt),u=l.endedAt?new Date(l.endedAt):void 0,d={id:l.spanId,name:l.name,type:l.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:l.parentSpanId};r.set(l.spanId,d)}),e.forEach(l=>{const c=r.get(l.spanId);if(l?.parentSpanId==null){if(t&&c.endTime&&t>new Date(c.endTime)){c.endTime=t.toISOString();const u=new Date(t).getTime(),d=new Date(c.startTime).getTime();c.latency=u-d}n.push(c)}else{const u=r.get(l.parentSpanId);u?u.spans.push(c):n.push(c)}});const s=l=>l.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(n),i=l=>{l.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function uye(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(r=>{t.push(r.id),t.push(...uye(r))}),t}function dye(e){const t=[];for(const r of e)t.push(r.id),t.push(...uye(r));return t}const g8e=["agent","workflow","model","mcp","tool","memory","workspace","other"],bCn={agent:{icon:o.jsx(pa,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:o.jsx(Ii,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:o.jsx(ip,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},mcp:{icon:o.jsx(ml,{}),color:"oklch(0.75 0.15 160)",label:"MCP",bgColor:"oklch(0.75 0.15 160 / 0.1)",typePrefix:"mcp"},tool:{icon:o.jsx(Ai,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"},memory:{icon:o.jsx(Rz,{}),color:"oklch(0.75 0.15 60)",label:"Memory",bgColor:"oklch(0.75 0.15 60 / 0.1)",typePrefix:"memory"},workspace:{icon:o.jsx(Pz,{}),color:"oklch(0.75 0.15 40)",label:"Workspace",bgColor:"oklch(0.75 0.15 40 / 0.1)",typePrefix:"workspace"}},xCn={color:"oklch(0.65 0 0)",label:"Other",typePrefix:"other"};function nSt(e){const t=e?.toLowerCase().split("_")[0];return bCn[t]??xCn}function wCn({isSelected:e,isFaded:t,isExpanded:r,toggleChildren:n,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:l}){return o.jsx("div",{className:Z("flex items-center justify-end h-full px-1.5",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:l&&l>0?o.jsxs("div",{className:"flex gap-1",children:[o.jsxs(y8e,{onClick:()=>n?.(),children:[i?a:l," ",r?i?o.jsx(dce,{}):o.jsx(uv,{}):o.jsx(Un,{})]}),a>l&&!i&&o.jsxs(y8e,{onClick:()=>s?.(),children:[a," ",o.jsx(uce,{})]})]}):null})}function y8e({onClick:e,children:t,className:r}){return o.jsx("button",{onClick:e,className:Z("h-full",r),children:o.jsx("div",{className:Z("flex items-center gap-[0.1rem] text-ui-xs text-neutral5 border border-border1 pl-1.5 pr-0.5 rounded-md transition-all","hover:text-yellow-500","[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-[0.85rem] [&>svg]:h-[0.85rem] [&>svg]:transition-all"),children:t})})}function SCn({isLastChild:e}){return o.jsx("div",{className:Z("w-[0.5rem] h-[1.8rem] relative opacity-100 shrink-0",'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-[0px] after:border-l-[1px] after:border-neutral3 after:border-dashed ','before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-[0px] before:border-b-[1px] before:border-neutral3 before:border-dashed',{"after:bottom-[50%]":e})})}function OCn({span:e,spanUI:t,isFaded:r,depth:n=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:l,isRootSpan:c,isExpanded:u}){return o.jsxs("div",{"data-span-id":e.id,"aria-label":`View details for span ${e.name}`,className:Z("rounded-md flex opacity-80 min-h-8 items-center rounded-l-lg",{"opacity-30 [&:hover]:opacity-60":r,"bg-surface4":a===e.id}),style:{paddingLeft:`${n*1}rem`},children:[!c&&o.jsx(SCn,{isLastChild:i}),o.jsx("button",{onClick:()=>s?.(e.id),className:Z("text-ui-sm flex items-center text-left gap-1.5 text-neutral6 w-full min-w-0 rounded-md h-full px-2 py-1 transition-colors","[&>svg]:transition-all [&>svg]:shrink-0 [&>svg]:opacity-0 [&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:ml-auto","hover:bg-surface4 [&:hover>svg]:opacity-60"),children:o.jsx("span",{className:"min-w-0 truncate",children:e.name})})]})}function kCn({span:e,selectedSpanId:t,isFaded:r,overallLatency:n,overallStartTime:s,color:a}){const i=n?Math.ceil(e.latency/n*100):0,l=s?new Date(s):null,c=e.startTime?new Date(e.startTime):null,u=c&&l?c.getTime()-l.getTime():0,d=n&&Math.floor(u/n*100);return o.jsxs(Xue,{openDelay:250,children:[o.jsxs(Kue,{className:Z("h-8 min-w-32 p-1 grid grid-cols-[1fr_auto] gap-2 items-center cursor-help pr-2 rounded-r-md","[&:hover>div]:bg-surface5",{"opacity-30 [&:hover]:opacity-60":r,"bg-surface4":t===e.id}),children:[o.jsx("div",{className:Z("w-full p-1.5 rounded-md bg-surface4 transition-colors duration-1000"),children:o.jsx("div",{className:"relative w-full h-1.5 rounded-sm overflow-hidden",children:o.jsx("div",{className:Z("bg-neutral1 absolute rounded-sm h-1.5 top-0"),style:{width:i?`${i}%`:"2px",left:`${d||0}%`,backgroundColor:a}})})}),o.jsxs("div",{className:Z("flex justify-end text-neutral3 text-ui-xs"),children:[(e.latency/1e3).toFixed(3)," s"]})]}),o.jsx(Jue,{children:o.jsxs(ede,{className:"z-50 w-auto max-w-[25rem] rounded-md bg-surface4 p-2 px-4 pr-6 text-ui-sm text-neutral5 text-center border border-border1",sideOffset:5,side:"top",children:[o.jsxs("div",{className:Z("text-ui-md flex items-center gap-2 mb-4","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:shrink-0 [&>svg]:opacity-50"),children:[o.jsx(KN,{})," Span Timing"]}),o.jsx(n0,{className:" [&>dd]:text-ui-md [&>dt]:text-ui-md [&>dt]:min-h-0 [&>dd]:min-h-0",data:[{key:"Latency",label:"Latency",value:`${e.latency} ms`,icon:o.jsx(oWe,{})},{key:"startTime",label:"Started at",value:e.startTime?or(new Date(e.startTime),"hh:mm:ss:SSS a"):"-",icon:o.jsx(nWe,{})},{key:"endTime",label:"Ended at",value:e.endTime?or(new Date(e.endTime),"hh:mm:ss:SSS a"):"-",icon:o.jsx(sWe,{})},{key:"startShift",label:"Start Shift",value:`${u}ms`,icon:o.jsx(lWe,{})}]}),o.jsx(tde,{className:"fill-surface5"})]})})]})}function fye({span:e,depth:t=0,onSpanClick:r,selectedSpanId:n,isLastChild:s,overallLatency:a,overallStartTime:i,fadedTypes:l,searchPhrase:c,featuredSpanIds:u,expandedSpanIds:d,setExpandedSpanIds:f}){const h=e.spans&&e.spans.length>0,p=e.spans?e.spans.length:0,m=uye(e),g=m.length,y=t===0,x=nSt(e?.type),w=d?d.includes(e.id):!1,O=u&&u.length>0?!u.includes(e.id):!1,_=(l&&l.length>0?l.includes(x?.typePrefix||""):!1)||O;b.useEffect(()=>{if(!u||m.length===0||w)return;m.some(I=>u.includes(I))&&f&&f(I=>!I||I.includes(e.id)?I??[e.id]:[...I,e.id])},[u,m]);const E=()=>{f&&f(A=>{if(!A)return A;const I=new Set([e.id,...m]);return w?A.filter(P=>!I.has(P)):[...A,e.id]})},T=()=>{f&&f(A=>A&&Array.from(new Set([...A,e.id,...m])))},j=m.every(A=>d?.includes(A));return o.jsxs(o.Fragment,{children:[o.jsx(OCn,{span:e,spanUI:x,isFaded:_,depth:t,onSpanClick:r,selectedSpanId:n,isLastChild:s,hasChildren:h,isRootSpan:y,isExpanded:w}),o.jsx(wCn,{isSelected:n===e.id,isFaded:_,isExpanded:w,toggleChildren:E,expandAllDescendants:T,totalDescendants:g,allDescendantsExpanded:j,numOfChildren:p}),o.jsx(kCn,{span:e,selectedSpanId:n,isFaded:_,overallLatency:a,overallStartTime:i,color:x?.color}),h&&w&&e.spans?.map((A,I,P)=>{const R=I===P.length-1;return o.jsx(fye,{span:A,depth:t+1,onSpanClick:r,selectedSpanId:n,isLastChild:R,overallLatency:a,overallStartTime:i,fadedTypes:l,searchPhrase:c,expandedSpanIds:d,setExpandedSpanIds:f,featuredSpanIds:u},A.id)})]})}function _Cn({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:r,isLoading:n,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:l}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"";return o.jsx(o.Fragment,{children:n?o.jsxs("div",{className:Z("flex items-center text-ui-sm gap-3 bg-surface3/50 rounded-md p-3 justify-center text-neutral3","[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"),children:[o.jsx(It,{})," Loading Trace Timeline ..."]}):o.jsx("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_auto] items-start content-start gap-y-px overflow-hidden py-1",children:e?.map(d=>o.jsx(fye,{span:d,onSpanClick:t,selectedSpanId:r,overallLatency:c,overallStartTime:u,fadedTypes:s,featuredSpanIds:l,expandedSpanIds:a,setExpandedSpanIds:i},d.id))})})}function ECn({traceId:e,onClose:t,onSpanSelect:r,initialSpanId:n}){const{data:s,isLoading:a}=yCn(e),[i,l]=b.useState(n??void 0);b.useEffect(()=>{if(n&&s?.spans){const h=s.spans.find(p=>p.spanId===n);if(h){l(n),r?.(h);return}}l(void 0),r?.(void 0)},[n,s?.spans]);const c=b.useMemo(()=>vCn(s?.spans??[]),[s?.spans]),[u,d]=b.useState([]);b.useEffect(()=>{c.length>0&&d(dye(c))},[c]);const f=h=>{const p=i===h?void 0:h;l(p);const m=p?s?.spans?.find(g=>g.spanId===p):void 0;r?.(m)};return o.jsxs(mi,{children:[o.jsxs(mi.Header,{children:[o.jsxs(mi.Heading,{children:["Trace ",o.jsxs("b",{children:["# ",e]})]}),o.jsx(mi.CloseButton,{onClick:t})]}),a?o.jsx(mi.LoadingData,{children:"Loading trace..."}):c.length===0?o.jsx(mi.NoData,{children:"No spans found for this trace."}):o.jsx(mi.Content,{children:o.jsx(_Cn,{hierarchicalSpans:c,onSpanClick:f,selectedSpanId:i,expandedSpanIds:u,setExpandedSpanIds:d})})]})}const ay=mi.KeyValueList;function CCn({span:e,onClose:t}){const r=e.startedAt&&e.endedAt?new Date(e.endedAt).getTime()-new Date(e.startedAt).getTime():null;return o.jsxs(mi,{children:[o.jsxs(mi.Header,{children:[o.jsxs(mi.Heading,{children:["Span ",o.jsxs("b",{children:["# ",e.spanId]})]}),o.jsx(mi.CloseButton,{onClick:t})]}),o.jsxs(mi.Content,{children:[o.jsxs(ay,{children:[e.spanType&&o.jsxs(o.Fragment,{children:[o.jsx(ay.Key,{children:"Type"}),o.jsx(ay.Value,{children:e.spanType})]}),e.startedAt&&o.jsxs(o.Fragment,{children:[o.jsx(ay.Key,{children:"Started"}),o.jsx(ay.Value,{children:or(new Date(e.startedAt),"MMM dd, HH:mm:ss.SSS")})]}),e.endedAt&&o.jsxs(o.Fragment,{children:[o.jsx(ay.Key,{children:"Ended"}),o.jsx(ay.Value,{children:or(new Date(e.endedAt),"MMM dd, HH:mm:ss.SSS")})]}),r!=null&&o.jsxs(o.Fragment,{children:[o.jsx(ay.Key,{children:"Duration"}),o.jsx(ay.Value,{children:r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`})]})]}),o.jsx("br",{}),o.jsx(mi.CodeSection,{title:"Input",icon:o.jsx(wp,{}),codeStr:JSON.stringify(e.input??null,null,2)}),o.jsx(mi.CodeSection,{title:"Output",icon:o.jsx(yc,{}),codeStr:JSON.stringify(e.output??null,null,2)}),o.jsx(mi.CodeSection,{title:"Metadata",icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.metadata??null,null,2)}),o.jsx(mi.CodeSection,{title:"Attributes",icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.attributes??null,null,2)})]})]})}function jCn(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return(t>>>0).toString(36)}function TCn(e){const t=new Map,r=new Map;for(const n of e){const s=n.timestamp instanceof Date?n.timestamp.toISOString():n.timestamp,a=jCn(`${s}${n.message??""}${n.data?JSON.stringify(n.data):""}`),i=r.get(a)??0;r.set(a,i+1),t.set(n,i>0?`${a}-${i}`:a)}return t}const v8e="auto auto auto auto minmax(5rem,1fr) minmax(5rem,1fr)";function NCn({logs:e,isLoading:t,isFetchingNextPage:r,hasNextPage:n,setEndOfListElement:s,featuredLogId:a,featuredTraceId:i,featuredSpanId:l,onFeaturedChange:c}){const[u,d]=b.useState({}),f=a??u.logId??null,h=i??u.traceId??null,p=l??u.spanId??null,m=b.useCallback(V=>{const W={logId:V.logId!==void 0?V.logId:f,traceId:V.traceId!==void 0?V.traceId:h,spanId:V.spanId!==void 0?V.spanId:p};c?c(W):d(W)},[c,f,h,p]),[g,y]=b.useState(),[x,w]=b.useState(!1);b.useEffect(()=>{(!p||g&&g.spanId!==p)&&y(void 0)},[p,g]);const O=b.useMemo(()=>TCn(e),[e]),k=b.useMemo(()=>{const V=new Map;for(let W=0;W<e.length;W++){const L=O.get(e[W]);L&&V.set(L,{log:e[W],idx:W})}return V},[e,O]),E=(f?k.get(f):void 0)?.idx??-1,T=E>=0?e[E]:null,j=E>0?()=>{const V=e[E-1],W=O.get(V);h?(m({logId:W,traceId:V.traceId??null,spanId:null}),y(void 0)):m({logId:W})}:void 0,A=E>=0&&E<e.length-1?()=>{const V=e[E+1],W=O.get(V);h?(m({logId:W,traceId:V.traceId??null,spanId:null}),y(void 0)):m({logId:W})}:void 0,I=b.useCallback(V=>{const W=O.get(V);if(f===W){m({logId:null});return}h?(m({logId:W,traceId:V.traceId??null,spanId:null}),y(void 0)):m({logId:W})},[f,h,m,O]),P=b.useCallback(V=>{m({traceId:V,spanId:null}),y(void 0)},[m]),R=b.useCallback((V,W)=>{m({traceId:V,spanId:W})},[m]),B=b.useCallback(()=>{m({traceId:null,spanId:null}),w(!1),y(void 0)},[m]),D=b.useCallback(V=>{m({spanId:V?.spanId??null}),y(V)},[m]),F=b.useCallback(()=>{m({spanId:null}),y(void 0)},[m]),U=b.useCallback(()=>{m({logId:null})},[m]);if(t)return o.jsx(Fhe,{columns:v8e});const z=!!T;return o.jsxs("div",{className:Z("grid h-full min-h-0 gap-4 items-start",z?"grid-cols-[1fr_1fr]":"grid-cols-[1fr]"),children:[o.jsxs(Al,{columns:v8e,className:"min-w-0",children:[o.jsxs(Al.Top,{children:[o.jsx(Al.TopCell,{children:"Date"}),o.jsx(Al.TopCell,{children:"Time"}),o.jsx(Al.TopCell,{children:"Level"}),o.jsx(Al.TopCell,{children:"Entity"}),o.jsx(Al.TopCell,{children:"Message"}),o.jsx(Al.TopCell,{children:"Data"})]}),e.length===0?o.jsx(Al.NoMatch,{message:"No logs match your search"}):e.map(V=>{const W=O.get(V),L=W===f;return o.jsxs(Al.RowButton,{onClick:()=>I(V),className:Z(L&&"bg-surface4"),children:[o.jsx(Al.DateCell,{timestamp:V.timestamp}),o.jsx(Al.TimeCell,{timestamp:V.timestamp}),o.jsx(Al.LevelCell,{level:V.level}),o.jsx(Al.EntityCell,{entityType:V.entityType,entityName:V.entityName}),o.jsx(Al.MessageCell,{message:V.message}),o.jsx(Al.DataCell,{data:V.data})]},W)}),o.jsx(Al.NextPageLoading,{isLoading:r,hasMore:n,setEndOfListElement:s})]}),T&&o.jsxs("div",{className:Z("grid gap-4 h-full overflow-auto ",x&&h&&g?"grid-rows-[auto_1fr_1fr]":x&&h?"grid-rows-[auto_1fr]":h&&g?"grid-rows-[1fr_1fr_1fr]":h?"grid-rows-[1fr_1fr]":x?"grid-rows-[auto]":"grid-rows-[1fr]"),children:[o.jsx(gCn,{log:T,onClose:U,onTraceClick:P,onSpanClick:R,onPrevious:j,onNext:A,collapsed:x,onCollapsedChange:w}),h&&o.jsx(ECn,{traceId:h,onClose:B,onSpanSelect:D,initialSpanId:p}),g&&o.jsx(CCn,{span:g,onClose:F})]})]})}const ACn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No logs yet",descriptionSlot:"Logs will appear here once agents, workflows, or tools are executed."})}),Yee={"24h":"Last 24 hours","3d":"Last 3 days","7d":"Last 7 days","14d":"Last 14 days","30d":"Last 30 days"};function ICn({onSearchChange:e,datePreset:t,onDatePresetChange:r,filterGroups:n,filterColumns:s,onToggleComparator:a,onRemoveFilterGroup:i,onClearAllFilters:l,onFilterGroupsChange:c,onReset:u,isLoading:d,hasActiveFilters:f}){const h=b.useMemo(()=>s.map(m=>({id:m.field,label:m.field,values:m.values.map(g=>({value:g,label:g})),mode:"multi"})),[s]),p=b.useMemo(()=>{const m={};for(const g of n)m[g.field]=g.values;return m},[n]);return o.jsx("div",{className:"flex flex-col gap-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ah,{onSearch:e,size:"md",label:"Search logs",placeholder:"Search name, ID, content..."}),o.jsxs(dt,{children:[o.jsx(dt.Trigger,{asChild:!0,children:o.jsxs(ve,{variant:"inputLike",size:"md",children:[o.jsx(cce,{})," ",Yee[t]," ",o.jsx(Un,{})]})}),o.jsx(dt.Content,{children:Object.keys(Yee).map(m=>o.jsx(dt.Item,{onSelect:()=>r(m),children:Yee[m]},m))})]}),o.jsx(jct,{categories:h,value:p,onChange:c,align:"end",disabled:d}),u&&f&&o.jsxs(ve,{variant:"outline",size:"md",disabled:d,onClick:u,className:"ml-auto",children:[o.jsx(vn,{}),"Reset"]})]})})}const sSt={debug:"DEBUG",info:"INFO",warn:"WARN",error:"ERROR",fatal:"FATAL"},aSt={AGENT:"Agent",WORKFLOW:"Workflow",TOOL:"Tool",SYSTEM:"System"};function RCn(e,t){switch(t){case"Level":return sSt[e.level];case"Entity type":return aSt[e.entityType??""]??e.entityType??"";case"Entity name":return e.entityName??"";default:return""}}function PCn(e){const[t,r]=b.useState(""),[n,s]=b.useState([]),a=b.useMemo(()=>{const f=h=>Array.from(new Set(h.filter(Boolean))).sort();return[{field:"Level",plural:"levels",values:f(e.map(h=>sSt[h.level]))},{field:"Entity type",plural:"types",values:f(e.map(h=>aSt[h.entityType??""]??h.entityType??""))},{field:"Entity name",plural:"names",values:f(e.map(h=>h.entityName??""))}]},[e]),i=b.useCallback(f=>{s(h=>h.map(p=>p.id===f?{...p,comparator:p.comparator==="is"?"is not":"is"}:p))},[]),l=b.useCallback(f=>{s(h=>h.filter(p=>p.id!==f))},[]),c=b.useCallback(()=>{s([])},[]),u=b.useCallback(f=>{s(h=>{const p=[],m=new Set;for(const g of h){const y=f[g.field];y&&y.length>0&&(p.push({...g,values:y}),m.add(g.field))}for(const[g,y]of Object.entries(f))m.has(g)||y.length===0||p.push({id:`${g}-${Date.now()}`,field:g,comparator:"is",values:y});return p})},[]),d=b.useMemo(()=>e.filter(f=>{if(t){const h=t.toLowerCase();if(!(f.message.toLowerCase().includes(h)||(f.entityName??"").toLowerCase().includes(h)||(f.traceId??"").toLowerCase().includes(h)))return!1}for(const h of n){const p=RCn(f,h.field),m=h.values.includes(p);if(h.comparator==="is"&&!m||h.comparator==="is not"&&m)return!1}return!0}),[e,t,n]);return{searchQuery:t,setSearchQuery:r,filterGroups:n,filterColumns:a,toggleComparator:i,removeFilterGroup:l,clearAllFilters:c,updateFilterGroups:u,filteredLogs:d}}const MCn=[{label:"Last 24 hours",value:"24h"},{label:"Last 3 days",value:"3d"},{label:"Last 7 days",value:"7d"},{label:"Last 14 days",value:"14d"},{label:"Last 30 days",value:"30d"}];function DCn(e){return MCn.some(t=>t.value===e)}const LCn=20;function $Cn(e,t,r){if(e?.pagination?.hasMore)return r+1}function FCn(e){return e.pages.flatMap(t=>t.logs??[])}const zCn=({filters:e}={})=>{const t=Ze(),{inView:r,setRef:n}=zE(),s=o1({queryKey:["logs",e],queryFn:({pageParam:c})=>t.listLogsVNext({pagination:{page:c,perPage:LCn},filters:e,orderBy:{field:"timestamp",direction:"DESC"}}),initialPageParam:0,getNextPageParam:$Cn,select:FCn,retry:!1,refetchInterval:3e3}),{hasNextPage:a,isFetchingNextPage:i,fetchNextPage:l}=s;return b.useEffect(()=>{r&&a&&!i&&l()},[r,a,i,l]),{...s,data:s.data,setEndOfListElement:n}},Xee="period",b8e="logId",x8e="traceId",w8e="spanId",BCn={"24h":1440*60*1e3,"3d":4320*60*1e3,"7d":10080*60*1e3,"14d":336*60*60*1e3,"30d":720*60*60*1e3};function UCn(){const[e,t]=vo(),r=e.get(Xee),n=DCn(r)?r:"24h",s=e.get(b8e),a=e.get(x8e),i=e.get(w8e),l=b.useCallback(I=>{t(P=>{const R=new URLSearchParams(P);return I==="24h"?R.delete(Xee):R.set(Xee,I),R},{replace:!0})},[t]),c=b.useCallback(I=>{t(P=>{const R=new URLSearchParams(P);for(const[B,D]of Object.entries(I)){const F=B==="logId"?b8e:B==="traceId"?x8e:w8e;D?R.set(F,D):R.delete(F)}return R},{replace:!0})},[t]),u=b.useMemo(()=>{const I=BCn[n];if(I)return{timestamp:{start:new Date(Date.now()-I)}}},[n]),{data:d=[],isLoading:f,error:h,isFetchingNextPage:p,hasNextPage:m,setEndOfListElement:g}=zCn({filters:u}),{searchQuery:y,setSearchQuery:x,filterGroups:w,filterColumns:O,toggleComparator:k,removeFilterGroup:_,clearAllFilters:E,updateFilterGroups:T,filteredLogs:j}=PCn(d);if(h&&As(h))return o.jsx(Vr,{title:"Logs",icon:o.jsx(OO,{}),children:o.jsx(na,{})});if(h&&Os(h))return o.jsx(Vr,{title:"Logs",icon:o.jsx(OO,{}),children:o.jsx(Zs,{resource:"logs"})});if(h)return o.jsx(Vr,{title:"Logs",icon:o.jsx(OO,{}),children:o.jsx(sd,{title:"Failed to load logs",message:h?.message??"Unknown error"})});const A=y.length>0||w.length>0||n!=="24h";return d.length===0&&!f&&!A?o.jsx(Vr,{title:"Logs",icon:o.jsx(OO,{}),children:o.jsx(ACn,{})}):o.jsxs(Ft,{width:"wide",height:"full",children:[o.jsxs(Ft.TopArea,{children:[o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(OO,{})," Logs"]})}),o.jsx(ICn,{onSearchChange:x,datePreset:n,onDatePresetChange:l,filterGroups:w,filterColumns:O,onToggleComparator:k,onRemoveFilterGroup:_,onClearAllFilters:E,onFilterGroupsChange:T,onReset:()=>{x(""),E(),l("24h")},isLoading:f,hasActiveFilters:A})]}),o.jsx(NCn,{logs:j,isLoading:f,isFetchingNextPage:p,hasNextPage:m,setEndOfListElement:g,featuredLogId:s,featuredTraceId:a,featuredSpanId:i,onFeaturedChange:c})]})}const iSt=e=>{const t=Ze();return kt({queryKey:["mcpserver-tools",e?.id],queryFn:async()=>{const n=(await t.getMcpServerTools(e?.id)).tools,s={};return n.forEach(a=>{s[a.id]=a}),s},retry:!1,refetchOnWindowFocus:!1})};function VCn({server:e}){const{paths:t,Link:r}=lr(),s=Ze().options.baseUrl,a=s?`${s}/api/mcp/${e.id}/sse`:"",{data:i}=iSt(e),l=Object.values(i||{}),c=l.length,u=l.filter(h=>h.toolType==="agent").length,d=l.filter(h=>h.toolType==="workflow").length,f=Ep(e.name,50);return o.jsxs(xe.RowLink,{to:t.mcpServerLink(e.id),LinkComponent:r,children:[o.jsx(xe.NameCell,{children:f}),o.jsx(xe.DescriptionCell,{children:a}),o.jsx(xe.TextCell,{className:"text-center",children:u||""}),o.jsx(xe.TextCell,{className:"text-center",children:c||""}),o.jsx(xe.TextCell,{className:"text-center",children:d||""})]})}function qCn({mcpServers:e,isLoading:t,search:r=""}){const n=b.useMemo(()=>{const s=r.toLowerCase();return e.filter(a=>a.name?.toLowerCase().includes(s)||a.id?.toLowerCase().includes(s))},[e,r]);return t?o.jsx(fh,{columns:"auto 1fr auto auto auto"}):o.jsxs(xe,{columns:"auto 1fr auto auto auto",children:[o.jsxs(xe.Top,{children:[o.jsx(xe.TopCell,{children:"Name"}),o.jsx(xe.TopCell,{children:"URL"}),o.jsx(xe.TopCellSmart,{long:"Agents",short:o.jsx(pa,{}),tooltip:"Agent Tools",className:"text-center"}),o.jsx(xe.TopCellSmart,{long:"Tools",short:o.jsx(Ai,{}),tooltip:"Tools",className:"text-center"}),o.jsx(xe.TopCellSmart,{long:"Workflows",short:o.jsx(Ii,{}),tooltip:"Workflow Tools",className:"text-center"})]}),n.length===0&&r?o.jsx(xe.NoMatch,{message:"No MCP Servers match your search"}):null,n.map(s=>o.jsx(VCn,{server:s},s.id))]})}const HCn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No MCP Servers yet",descriptionSlot:o.jsxs(o.Fragment,{children:["MCP servers are not configured yet. ",o.jsx("br",{}),"More information in the documentation."]}),actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",children:["MCP Documentation ",o.jsx(Aa,{})]})})}),QCn=()=>{const{data:e=[],isLoading:t,error:r}=zP(),[n,s]=b.useState("");return r&&As(r)?o.jsx(Vr,{title:"MCP Servers",icon:o.jsx(ml,{}),children:o.jsx(na,{})}):r&&Os(r)?o.jsx(Vr,{title:"MCP Servers",icon:o.jsx(ml,{}),children:o.jsx(Zs,{resource:"MCP servers"})}):r?o.jsx(Vr,{title:"MCP Servers",icon:o.jsx(ml,{}),children:o.jsx(sd,{title:"Failed to load MCP servers",message:r.message})}):e.length===0&&!t?o.jsx(Vr,{title:"MCP Servers",icon:o.jsx(ml,{}),children:o.jsx(HCn,{})}):o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:t,children:[o.jsx(ml,{})," MCP Servers"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to MCP documentation",children:o.jsx(Io,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(Ah,{onSearch:s,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),o.jsx(qCn,{mcpServers:e,isLoading:t,search:n})]})},WCn=(e,t)=>{const r=new Map,n=Object.keys(t);for(const s of n){const a=t[s],i=a.tools,l=Object.keys(i);for(const c of l){const u=i[c];r.has(u.id)||r.set(u.id,{...u,agents:[]}),r.get(u.id).agents.push({...a,id:s})}}for(const[s,a]of Object.entries(e))r.has(a.id)||r.set(a.id,{...a,agents:[]});return Array.from(r.values())};function GCn({tools:e,agents:t,isLoading:r,search:n=""}){const{paths:s,Link:a}=lr(),i=b.useMemo(()=>WCn(e,t),[e,t]),l=b.useMemo(()=>i.filter(c=>c.id.toLowerCase().includes(n.toLowerCase())),[i,n]);return r?o.jsx(fh,{columns:"auto 1fr auto"}):o.jsxs(xe,{columns:"auto 1fr auto",children:[o.jsxs(xe.Top,{children:[o.jsx(xe.TopCell,{children:"Name"}),o.jsx(xe.TopCell,{children:"Description"}),o.jsx(xe.TopCellSmart,{long:"Agents",short:o.jsx(pa,{}),tooltip:"Attached Agents",className:"text-center"})]}),l.length===0&&n?o.jsx(xe.NoMatch,{message:"No Tools match your search"}):null,l.map(c=>{const u=Ep(c.id,50),d=Ep(c.description??"",200),f=c.agents.length;return o.jsxs(xe.RowLink,{to:s.toolLink(c.id),LinkComponent:a,children:[o.jsx(xe.NameCell,{children:u}),o.jsx(xe.DescriptionCell,{children:d}),o.jsx(xe.TextCell,{className:"text-center",children:f||""})]},c.id)})]})}const ZCn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No Tools yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Mastra tools are not configured yet. ",o.jsx("br",{}),"More information in the documentation."]}),actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",children:["Tools Documentation ",o.jsx(Aa,{})]})})}),YCn=()=>{const e=Ze();return Kr({mutationFn:async({toolId:t,input:r,requestContext:n})=>{const s=new n_;Object.entries(n??{}).forEach(([a,i])=>{s.set(a,i)});try{return await e.getTool(t).execute({data:r,requestContext:s})}catch(a){throw Ue.error("Error executing dev tool"),console.error("Error executing dev tool:",a),a}}})},XCn=({toolId:e})=>{const{canExecute:t}=jv(),r=t("tools"),{data:n={}}=Bp(),s=b.useMemo(()=>{for(const g of Object.values(n))if(g.tools){const y=Object.values(g.tools).find(x=>x.id===e);if(y)return y}return null},[n,e]),{data:a,isLoading:i,error:l}=Y0n(e,{enabled:!s}),c=s||a,{mutateAsync:u,isPending:d,data:f}=YCn(),{requestContext:h}=Hn();b.useEffect(()=>{if(l){const g=l instanceof Error?l.message:"Failed to load tool";Ue.error(`Error loading tool: ${g}`)}},[l]);const p=async(g,y)=>{if(!c)return;const x={...h??{},...y??{}};return u({toolId:c.id,input:g,requestContext:x})},m=c?.inputSchema?og(sg(ev(c?.inputSchema))):Gn({});return i?o.jsxs("div",{className:"p-6",children:[o.jsx(In,{className:"h-8 w-48 mb-4"}),o.jsx(In,{className:"h-32 w-full"})]}):l?null:c?r?o.jsx(Mge,{executionResult:f,isExecutingTool:d,zodInputSchema:m,handleExecuteTool:p,toolDescription:c.description,toolId:c.id,requestContextSchema:c.requestContextSchema}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})}):o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})})};function KCn({value:e,onValueChange:t,placeholder:r="Select a tool...",searchPlaceholder:n="Search tools...",emptyText:s="No tools found.",className:a,disabled:i=!1,variant:l="inputLike"}){const{data:c={},isLoading:u,isError:d,error:f}=W9(),{data:h={},isLoading:p,isError:m,error:g}=Bp(),{navigate:y,paths:x}=lr();b.useEffect(()=>{if(d){const _=f instanceof Error?f.message:"Failed to load tools";Ue.error(`Error loading tools: ${_}`)}},[d,f]),b.useEffect(()=>{if(m){const _=g instanceof Error?g.message:"Failed to load agents";Ue.error(`Error loading agents: ${_}`)}},[m,g]);const w=new Map;Object.values(h).forEach(_=>{_.tools&&Object.values(_.tools).forEach(E=>{w.has(E.id)||w.set(E.id,E)})}),Object.values(c).forEach(_=>{w.has(_.id)||w.set(_.id,_)});const O=Array.from(w.values()).map(_=>({label:_.id,value:_.id})),k=_=>{t?t(_):_&&_!==e&&y(x.toolLink(_))};return o.jsx(Zl,{options:O,value:e,onValueChange:k,placeholder:u||p?"Loading tools...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||p||d||m,variant:l})}const JCn=({isLoading:e,server:t})=>{const[{sseUrl:r,httpStreamUrl:n},s]=b.useState({sseUrl:"",httpStreamUrl:""});if(b.useEffect(()=>{if(!t)return;const i=window.MASTRA_SERVER_HOST,l=window.MASTRA_SERVER_PORT;let c=null;i&&l&&(c=`http://${i}:${l}`);const u=c||"http://localhost:4111",d=`${u}/api/mcp/${t.id}/sse`,f=`${u}/api/mcp/${t.id}/mcp`;s({sseUrl:d,httpStreamUrl:f})},[t]),e)return null;if(!t)return o.jsx(of,{children:o.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral3 font-medium py-20 text-center",children:"Server not found"})});const a=`npx -y mcp-remote ${r}`;return o.jsxs(of,{isDivided:!0,children:[o.jsxs("div",{className:"px-8 py-12 mx-auto max-w-2xl w-full",children:[o.jsx(me,{as:"h1",variant:"header-md",className:"text-neutral6 font-medium pb-4",children:t.name}),o.jsxs("div",{className:"flex items-center gap-1 pb-6",children:[o.jsx(vt,{icon:o.jsx(Pz,{className:"text-neutral6"}),className:"rounded-r-sm text-neutral4!",children:"Version"}),o.jsx(vt,{className:"rounded-l-sm text-neutral4!",children:t.version_detail.version})]}),o.jsx(me,{className:"text-neutral3 pb-4",children:"This MCP server can be accessed through multiple transport methods. Choose the one that best fits your use case."}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(vt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"HTTP"}),children:"Regular HTTP Endpoint"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for stateless HTTP transport with streamable responses."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:n}),o.jsx("div",{className:"pt-1",children:o.jsx(Ya,{tooltip:"Copy HTTP Stream URL",content:n})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(vt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"SSE"}),children:"Server-Sent Events"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for real-time communication via SSE."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:r}),o.jsx("div",{className:"pt-1",children:o.jsx(Ya,{tooltip:"Copy SSE URL",content:r})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:[o.jsx(vt,{icon:o.jsx("span",{className:"font-mono w-6 text-accent1 font-medium mr-1",children:"CLI"}),children:"Command Line"}),o.jsx(me,{className:"text-neutral3 pt-1 pb-2",children:"Use for local command-line access via npx and mcp-remote."}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(me,{className:"px-2 py-1 bg-surface4 rounded-lg",children:a}),o.jsx("div",{className:"pt-1",children:o.jsx(Ya,{tooltip:"Copy Command Line Config",content:a})})]})]})]})]}),o.jsx("div",{className:"h-full overflow-y-scroll border-l border-border1",children:o.jsx(ejn,{server:t})})]})},ejn=({server:e})=>{const{data:t={},isLoading:r}=iSt(e);if(r)return null;const n=Object.keys(t);return o.jsxs("div",{className:"p-5 overflow-y-scroll",children:[o.jsxs("div",{className:"text-neutral6 flex gap-2 items-center",children:[o.jsx(Ce,{size:"lg",className:"bg-surface4 rounded-md p-1",children:o.jsx(ml,{})}),o.jsx(me,{variant:"header-md",as:"h2",className:"font-medium",children:"Available Tools"})]}),o.jsx("div",{className:"flex flex-col gap-2 pt-6",children:n.map(s=>{const a=t[s];return o.jsx(tjn,{tool:a,serverId:e.id},s)})})]})},tjn=({tool:e,serverId:t})=>{const r=b.useRef(null),{Link:n,paths:s}=lr(),a=Jxt[e.toolType||"tool"];return o.jsxs(yf,{onClick:()=>r.current?.click(),children:[o.jsx(hlt,{children:o.jsx(a,{className:"group-hover/entity:text-accent6"})}),o.jsxs(xf,{children:[o.jsx(vf,{children:o.jsx(n,{ref:r,href:s.mcpServerToolLink(t,e.id),children:e.id})}),o.jsx(bf,{children:e.description})]})]})},rjn=()=>{const{serverId:e}=ba(),{data:t=[],isLoading:r}=zP(),n=t.find(s=>s.id===e);return o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/mcps",children:[o.jsx(Ce,{children:o.jsx(ml,{})}),"MCP Servers"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:o.jsx(g0t,{value:e,variant:"ghost"})})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(kv,{}),"MCP documentation"]})})]}),o.jsx(JCn,{isLoading:r,server:n})]})},oSt=(e,t)=>{const{requestContext:r}=Hn(),n=Ze();return kt({queryKey:["mcp-server-tool",e,t],queryFn:()=>n.getMcpServerTool(e,t).details(r)})},njn=(e,t)=>{const{requestContext:r}=Hn(),n=Ze();return Kr({mutationFn:s=>n.getMcpServerTool(e,t).execute({data:s,requestContext:r})})},sjn=({toolId:e,serverId:t})=>{const{canExecute:r}=jv(),n=r("tools"),{data:s,isLoading:a,error:i}=oSt(t,e),{mutateAsync:l,isPending:c,data:u}=njn(t,e);b.useEffect(()=>{if(i){const h=i instanceof Error?i.message:"Failed to load tool";Ue.error(`Error loading tool: ${h}`)}},[i]);const d=async h=>{if(s)return await l(h)};if(a)return o.jsxs("div",{className:"p-6",children:[o.jsx(In,{className:"h-8 w-48 mb-4"}),o.jsx(In,{className:"h-32 w-full"})]});if(i)return null;if(!s)return o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})});if(!n)return o.jsx("div",{className:"py-12 text-center px-6",children:o.jsx(me,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})});let f;try{f=og(sg(s.inputSchema))}catch(h){console.error("Error processing input schema:",h),Ue.error("Failed to process tool input schema."),f=Gn({})}return o.jsx(Mge,{executionResult:u,isExecutingTool:c,zodInputSchema:f,handleExecuteTool:d,toolDescription:s.description||"",toolId:s.id})},ajn=()=>{const{data:e}=zP(),{serverId:t,toolId:r}=ba(),{data:n,isLoading:s}=oSt(t,r),a=e?.find(c=>c.id===t),i=n?.name,l=a?.name||"";return s||!n?null:o.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-hidden",children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/mcps",children:[o.jsx(Ce,{children:o.jsx(ml,{})}),"MCP Servers"]}),o.jsx(dr,{as:nr,to:`/mcps/${t}`,children:l}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:i})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(kv,{}),"MCP documentation"]})})]}),o.jsx(sjn,{toolId:r,serverId:t})]})},lSt=[{label:"Last 24 hours",value:"24h"},{label:"Last 3 days",value:"3d"},{label:"Last 7 days",value:"7d"},{label:"Last 14 days",value:"14d"},{label:"Last 30 days",value:"30d"}],ijn=new Set(lSt.map(e=>e.value));function ojn(e){return typeof e=="string"&&(ijn.has(e)||e==="custom")}const ljn={"24h":1,"3d":3,"7d":7,"14d":14,"30d":30},cjn={"Studio Cloud":42,Production:31,Staging:18,Dev:7,"CI / Preview":2};function ujn(e,t,r){let n=1;e!=="custom"?n=ljn[e]??1:t?.from&&t?.to&&(n=Math.max(1,Nar(t.to,t.from)+1));const s=r.filter(i=>i.field==="Environment"&&i.comparator==="is"),a=s.length===0?100:s.flatMap(i=>i.values).reduce((i,l)=>i+(cjn[l]??0),0);return n*(a/100)}const cSt=b.createContext({datePreset:"24h",setDatePreset:()=>{},customRange:void 0,setCustomRange:()=>{},dateRangeLabel:"Last 24 hours",filterGroups:[],setFilterGroups:()=>{},multiplier:1});function uSt(){return b.useContext(cSt)}function djn(e,t){return e!=="custom"?lSt.find(r=>r.value===e).label:t?.from?t.to?`${or(t.from,"MMM d, yyyy")} – ${or(t.to,"MMM d, yyyy")}`:or(t.from,"MMM d, yyyy"):"Custom range"}function fjn({children:e,initialPreset:t,onPresetChange:r}){const[n,s]=b.useState(t??"24h"),[a,i]=b.useState(void 0),[l,c]=b.useState([]),u=djn(n,a),d=ujn(n,a,l);b.useEffect(()=>{t&&t!==n&&s(t)},[t]);const f=b.useCallback(h=>{s(h),r?.(h)},[r]);return o.jsx(cSt.Provider,{value:{datePreset:n,setDatePreset:f,customRange:a,setCustomRange:i,dateRangeLabel:u,filterGroups:l,setFilterGroups:c,multiplier:d},children:e})}const Kee={"24h":1440*60*1e3,"3d":4320*60*1e3,"7d":10080*60*1e3,"14d":336*60*60*1e3,"30d":720*60*60*1e3};function hjn(e,t){const r=new Date;if(e!=="custom"){const n=Kee[e]??Kee["24h"];return{start:new Date(r.getTime()-n),end:r}}return{start:t?.from??new Date(r.getTime()-Kee["24h"]),end:t?.to??r}}function Iv(){const{datePreset:e,customRange:t}=uSt(),r=hjn(e,t);return{datePreset:e,customRange:t,timestamp:r}}async function Jee(e,t,r){const n=await e.getMetricPercentiles({name:t,percentiles:[.5,.95],interval:"1h",filters:{timestamp:r}}),s=n.series.find(l=>l.percentile===.5),a=n.series.find(l=>l.percentile===.95);if(!s||!a)return[];const i=new Map(a.points.map(l=>[new Date(l.timestamp).getTime(),l.value]));return s.points.map(l=>{const c=new Date(l.timestamp);return{time:c.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),p50:Math.round(l.value),p95:Math.round(i.get(c.getTime())??0)}})}function pjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","latency",t,r],queryFn:async()=>{const[s,a,i]=await Promise.all([Jee(e,"mastra_agent_duration_ms",n),Jee(e,"mastra_workflow_duration_ms",n),Jee(e,"mastra_tool_duration_ms",n)]);return{agentData:s,workflowData:a,toolData:i}}})}const mjn=[{dataKey:"p50",label:"p50",color:dc.blue,aggregate:e=>({value:e.length>0?`${Math.round(e.reduce((t,r)=>t+r.p50,0)/e.length)}`:"0",suffix:"avg ms"})},{dataKey:"p95",label:"p95",color:dc.yellow,aggregate:e=>({value:e.length>0?`${Math.round(e.reduce((t,r)=>t+r.p95,0)/e.length)}`:"0",suffix:"avg ms"})}];function ete({data:e}){return e.length===0?o.jsx(qt.NoData,{message:"No latency data yet"}):o.jsx(Uhe,{data:e,series:mjn})}function gjn(){const{data:e,isLoading:t,isError:r}=pjn(),n=!!e&&(e.agentData.length>0||e.workflowData.length>0||e.toolData.length>0),s=e&&e.agentData.length>0?`${Math.round(e.agentData.reduce((a,i)=>a+i.p50,0)/e.agentData.length)}ms`:"—";return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Latency",description:"Hourly p50 and p95 latency."}),n&&o.jsx(qt.Summary,{value:s,label:"Avg p50"})]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load latency data"}):o.jsx(qt.Content,{children:n?o.jsxs(wf,{defaultTab:"agents",className:"overflow-visible",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"agents",children:"Agents"}),o.jsx(vs,{value:"workflows",children:"Workflows"}),o.jsx(vs,{value:"tools",children:"Tools"})]}),o.jsx(Ns,{value:"agents",children:o.jsx(ete,{data:e.agentData})}),o.jsx(Ns,{value:"workflows",children:o.jsx(ete,{data:e.workflowData})}),o.jsx(Ns,{value:"tools",children:o.jsx(ete,{data:e.toolData})})]}):o.jsx(qt.NoData,{message:"No latency data yet"})})]})}function dSt(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","agent-runs-kpi",t,r],queryFn:()=>e.getMetricAggregate({name:["mastra_agent_duration_ms"],aggregation:"count",filters:{timestamp:n},comparePeriod:"previous_period"})})}function yjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","avg-score-kpi",t,r],queryFn:async()=>{const s=await e.listScorers(),a=Object.keys(s??{});if(a.length===0)return{value:null,previousValue:null,changePercent:null};const i={timestamp:{start:n.start,end:n.end}},c=(await Promise.all(a.map(async h=>{const[p,m]=await Promise.all([e.getScoreAggregate({scorerId:h,aggregation:"avg",filters:i}),e.getScoreAggregate({scorerId:h,aggregation:"count",filters:i})]);return{avg:p.value??0,count:m.value??0}}))).filter(h=>h.count>0);if(c.length===0)return{value:null,previousValue:null,changePercent:null};const u=c.reduce((h,p)=>h+p.count,0),f=c.reduce((h,p)=>h+p.avg*p.count,0)/u;return{value:Math.round(f*100)/100,previousValue:null,changePercent:null}}})}function vjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","model-cost-kpi",t,r],queryFn:async()=>{const s=await e.getMetricAggregate({name:["mastra_model_total_input_tokens","mastra_model_total_output_tokens"],aggregation:"sum",filters:{timestamp:n},comparePeriod:"previous_period"});return{cost:s.estimatedCost??null,costUnit:s.costUnit??null,previousCost:s.previousEstimatedCost??null,costChangePercent:s.costChangePercent??null}}})}function bjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","total-tokens-kpi",t,r],queryFn:async()=>{const[s,a]=await Promise.all([e.getMetricAggregate({name:["mastra_model_total_input_tokens"],aggregation:"sum",filters:{timestamp:n},comparePeriod:"previous_period"}),e.getMetricAggregate({name:["mastra_model_total_output_tokens"],aggregation:"sum",filters:{timestamp:n},comparePeriod:"previous_period"})]),i=s.value!=null||a.value!=null,l=s.previousValue!=null||a.previousValue!=null,c=(s.value??0)+(a.value??0),u=(s.previousValue??0)+(a.previousValue??0),d=l&&u>0?(c-u)/u*100:null;return{value:i?c:null,previousValue:l?u:null,changePercent:d}}})}function xjn(){const{data:e,isLoading:t,isError:r}=dSt(),n=e?.value!=null;return o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Agent Runs"}),o.jsx(fr.Value,{className:n?void 0:"invisible",children:n?e.value.toLocaleString():"—"}),r?o.jsx(fr.Error,{}):t?o.jsx(fr.Loading,{}):n?e.changePercent!=null?o.jsx(fr.Change,{changePct:e.changePercent,prevValue:e.previousValue?.toLocaleString()}):o.jsx(fr.NoChange,{}):o.jsx(fr.NoData,{})]})}function wjn(){const{data:e,isLoading:t,isError:r}=vjn(),n=e?.cost!=null;return o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Model Cost"}),o.jsx(fr.Value,{className:n?void 0:"invisible",children:n?eE(e.cost,e.costUnit):"—"}),r?o.jsx(fr.Error,{}):t?o.jsx(fr.Loading,{}):n?e.costChangePercent!=null?o.jsx(fr.Change,{changePct:e.costChangePercent,prevValue:e.previousCost!=null?eE(e.previousCost,e.costUnit):void 0}):o.jsx(fr.NoChange,{}):o.jsx(fr.NoData,{})]})}function Sjn(){const{data:e,isLoading:t,isError:r}=bjn(),n=e?.value!=null;return o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Total Tokens"}),o.jsx(fr.Value,{className:n?void 0:"invisible",children:n?Bm(e.value):"—"}),r?o.jsx(fr.Error,{}):t?o.jsx(fr.Loading,{}):n?e.changePercent!=null?o.jsx(fr.Change,{changePct:e.changePercent,prevValue:e.previousValue!=null?Bm(e.previousValue):void 0}):o.jsx(fr.NoChange,{}):o.jsx(fr.NoData,{})]})}function Ojn(){const{data:e,isLoading:t,isError:r}=yjn(),n=e?.value!=null;return o.jsxs(fr,{children:[o.jsx(fr.Label,{children:"Avg Score"}),o.jsx(fr.Value,{className:n?void 0:"invisible",children:n?String(e.value):"—"}),r?o.jsx(fr.Error,{}):t?o.jsx(fr.Loading,{}):n?e.changePercent!=null?o.jsx(fr.Change,{changePct:e.changePercent,prevValue:e.previousValue!=null?String(e.previousValue):void 0}):o.jsx(fr.NoChange,{}):o.jsx(fr.NoData,{})]})}function kjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","model-usage-cost",t,r],queryFn:async()=>{const s=["mastra_model_total_input_tokens","mastra_model_total_output_tokens","mastra_model_input_cache_read_tokens","mastra_model_input_cache_write_tokens"],[a,i,l,c]=await Promise.all(s.map(h=>e.getMetricBreakdown({name:[h],groupBy:["model"],aggregation:"sum",filters:{timestamp:n}}))),u=new Map,d=h=>(u.has(h)||u.set(h,{input:0,output:0,cacheRead:0,cacheWrite:0,cost:null,costUnit:null}),u.get(h)),f=(h,p)=>{p.estimatedCost!=null&&(h.cost=(h.cost??0)+p.estimatedCost,p.costUnit&&(h.costUnit=p.costUnit))};for(const h of a.groups){const p=h.dimensions.model??"unknown",m=d(p);m.input=h.value,f(m,h)}for(const h of i.groups){const p=h.dimensions.model??"unknown",m=d(p);m.output=h.value,f(m,h)}for(const h of l.groups){const p=h.dimensions.model??"unknown",m=d(p);m.cacheRead=h.value,f(m,h)}for(const h of c.groups){const p=h.dimensions.model??"unknown",m=d(p);m.cacheWrite=h.value,f(m,h)}return Array.from(u.entries()).map(([h,p])=>({model:h,input:Bm(p.input),output:Bm(p.output),cacheRead:Bm(p.cacheRead),cacheWrite:Bm(p.cacheWrite),cost:p.cost,costUnit:p.costUnit})).sort((h,p)=>h.model.localeCompare(p.model))}})}function _jn(){const{data:e,isLoading:t,isError:r}=kjn(),n=!!e&&e.length>0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Model Usage & Cost",description:"Token consumption by model."}),n&&(()=>{const s=e.reduce((i,l)=>i+(l.cost??0),0),a=e.find(i=>i.costUnit)?.costUnit;return o.jsx(qt.Summary,{value:s>0?eE(s,a):"—",label:"Total cost"})})()]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load model usage data"}):o.jsx(qt.Content,{children:n?o.jsx(Bhe,{columns:[{label:"Model",value:s=>s.model},{label:"Input",value:s=>s.input},{label:"Output",value:s=>s.output},{label:"Cache Read",value:s=>s.cacheRead},{label:"Cache Write",value:s=>s.cacheWrite},{label:"Cost",value:s=>s.cost!=null?eE(s.cost,s.costUnit):"—",highlight:!0}],data:e.map(s=>({...s,key:s.model}))}):o.jsx(qt.NoData,{message:"No model usage data yet"})})]})}function Ejn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","scores-card",t,r],queryFn:async()=>{const s={timestamp:{start:n.start,end:n.end}},a=await e.listScorers(),i=Object.keys(a??{});if(i.length===0)return{summaryData:[],overTimeData:[],scorerNames:[],avgScore:null};const c=(await Promise.all(i.map(async x=>{const[w,O,k,_]=await Promise.all([e.getScoreAggregate({scorerId:x,aggregation:"avg",filters:s}),e.getScoreAggregate({scorerId:x,aggregation:"min",filters:s}),e.getScoreAggregate({scorerId:x,aggregation:"max",filters:s}),e.getScoreAggregate({scorerId:x,aggregation:"count",filters:s})]);return{scorer:x,avg:w.value??0,min:O.value??0,max:k.value??0,count:_.value??0}}))).filter(x=>x.count>0),u=c.map(x=>x.scorer);if(c.length===0)return{summaryData:[],overTimeData:[],scorerNames:[],avgScore:null};const d=c.reduce((x,w)=>x+w.avg*w.count,0),f=c.reduce((x,w)=>x+w.count,0),h=f?Math.round(d/f*100)/100:0,p="1h",m=await Promise.all(u.map(x=>e.getScoreTimeSeries({scorerId:x,interval:p,aggregation:"avg",filters:s}))),g=new Map;for(let x=0;x<u.length;x++){const w=u[x],O=m[x]?.series??[];for(const k of O)for(const _ of k.points){const T=new Date(_.timestamp).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1});g.has(T)||g.set(T,new Map);const j=g.get(T);j.has(w)||j.set(w,{sum:0,count:0});const A=j.get(w);A.sum+=_.value,A.count+=1}}const y=Array.from(g.entries()).sort(([x],[w])=>x.localeCompare(w)).map(([x,w])=>{const O={time:x};for(const[k,_]of w)O[k]=+(_.sum/_.count).toFixed(2);return O});return{summaryData:c,overTimeData:y,scorerNames:u,avgScore:h}}})}const S8e=[dc.green,dc.blue,dc.purple,dc.orange,dc.pink,dc.yellow];function Cjn(){const{data:e,isLoading:t,isError:r}=Ejn(),n=!!e&&e.summaryData.length>0,s=b.useMemo(()=>e?.scorerNames?e.scorerNames.map((a,i)=>({dataKey:a,label:a,color:S8e[i%S8e.length],aggregate:l=>({value:l.length>0?(l.reduce((c,u)=>c+(u[a]??0),0)/l.length).toFixed(2):"0",suffix:"avg"})})):[],[e?.scorerNames]);return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Scores",description:"Evaluation scorer performance."}),n&&o.jsx(qt.Summary,{value:e?.avgScore!=null?`avg ${e.avgScore}`:"—",label:"Across all scorers"})]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load scores data"}):o.jsx(qt.Content,{children:n?o.jsxs(wf,{defaultTab:"over-time",className:"overflow-visible",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"over-time",children:"Over Time"}),o.jsx(vs,{value:"summary",children:"Summary"})]}),o.jsx(Ns,{value:"over-time",className:"pb-0",children:e.overTimeData.length>0?o.jsx(Uhe,{data:e.overTimeData,series:s,yDomain:[0,1]}):o.jsx(qt.NoData,{message:"No time series data yet"})}),o.jsx(Ns,{value:"summary",children:o.jsx(Bhe,{columns:[{label:"Scorer",value:a=>a.scorer},{label:"Avg",value:a=>a.avg.toFixed(2),highlight:!0},{label:"Min",value:a=>a.min.toFixed(2)},{label:"Max",value:a=>a.max.toFixed(2)},{label:"Count",value:a=>a.count.toLocaleString()}],data:e.summaryData.map(a=>({...a,key:a.scorer}))})})]}):o.jsx(qt.NoData,{message:"No scores data yet"})})]})}function jjn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","token-usage-by-agent",t,r],queryFn:async()=>{const[s,a,i,l]=await Promise.all([e.getMetricBreakdown({name:["mastra_model_total_input_tokens"],groupBy:["entityName"],aggregation:"sum",filters:{timestamp:n}}),e.getMetricBreakdown({name:["mastra_model_total_output_tokens"],groupBy:["entityName"],aggregation:"sum",filters:{timestamp:n}}),e.getMetricBreakdown({name:["mastra_model_input_cache_read_tokens"],groupBy:["entityName"],aggregation:"sum",filters:{timestamp:n}}),e.getMetricBreakdown({name:["mastra_model_input_cache_write_tokens"],groupBy:["entityName"],aggregation:"sum",filters:{timestamp:n}})]),c=new Map,u=f=>(c.has(f)||c.set(f,{input:0,output:0,cost:null,costUnit:null}),c.get(f)),d=(f,h)=>{h.estimatedCost!=null&&(f.cost=(f.cost??0)+h.estimatedCost,h.costUnit&&(f.costUnit=h.costUnit))};for(const f of s.groups){const h=f.dimensions.entityName??"unknown",p=u(h);p.input=f.value,d(p,f)}for(const f of a.groups){const h=f.dimensions.entityName??"unknown",p=u(h);p.output=f.value,d(p,f)}for(const f of i.groups){const h=f.dimensions.entityName??"unknown",p=u(h);d(p,f)}for(const f of l.groups){const h=f.dimensions.entityName??"unknown",p=u(h);d(p,f)}return Array.from(c.entries()).map(([f,h])=>({name:f,input:h.input,output:h.output,total:h.input+h.output,cost:h.cost,costUnit:h.costUnit})).sort((f,h)=>h.total-f.total)}})}function Tjn(){const{data:e,isLoading:t,isError:r}=jjn(),[n,s]=b.useState("tokens"),a=!!e&&e.length>0,i=e?.reduce((p,m)=>p+m.total,0)??0,l=e?.filter(p=>p.cost!=null&&p.cost>0)??[],u=new Set(l.map(p=>p.costUnit??"usd")).size<=1,d=u?l[0]?.costUnit??null:null,f=u?l.reduce((p,m)=>p+(m.cost??0),0):0,h=u&&f>0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Token Usage by Agent",description:"Token consumption grouped by agent."}),a&&(n==="cost"&&h?o.jsx(qt.Summary,{value:eE(f,d),label:"Total cost"}):o.jsx(qt.Summary,{value:Bm(i),label:"Total tokens"}))]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load token usage data"}):o.jsx(qt.Content,{children:a?o.jsxs(wf,{defaultTab:"tokens",value:n,onValueChange:p=>s(p),className:"grid grid-rows-[auto_1fr] overflow-y-auto h-full",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"tokens",children:"Tokens"}),o.jsx(vs,{value:"cost",children:"Cost"})]}),o.jsx(Ns,{value:"tokens",children:o.jsx(E_,{data:e.map(p=>({name:p.name,values:[p.input,p.output]})),segments:[{label:"Input",color:dc.blueDark},{label:"Output",color:dc.blue}],maxVal:Math.max(...e.map(p=>p.input+p.output)),fmt:Bm})}),o.jsx(Ns,{value:"cost",children:h?o.jsx(E_,{data:e.filter(p=>p.cost!=null&&p.cost>0).sort((p,m)=>(m.cost??0)-(p.cost??0)).map(p=>({name:p.name,values:[p.cost]})),segments:[{label:"Cost",color:dc.purple}],maxVal:Math.max(...e.map(p=>p.cost??0)),fmt:p=>eE(p,d)}):o.jsx(qt.NoData,{message:"No cost data yet"})})]}):o.jsx(qt.NoData,{message:"No token usage data yet"})})]})}async function tte(e,t,r){const n=await e.getMetricBreakdown({name:[t],groupBy:["entityName","status"],aggregation:"count",filters:{timestamp:r}}),s=new Map;for(const a of n.groups){const i=a.dimensions.entityName??"unknown",l=a.dimensions.status??"ok";s.has(i)||s.set(i,{completed:0,errors:0});const c=s.get(i);l==="error"?c.errors+=a.value:c.completed+=a.value}return Array.from(s.entries()).map(([a,i])=>({name:a,...i})).sort((a,i)=>i.completed+i.errors-(a.completed+a.errors))}function Njn(){const e=Ze(),{datePreset:t,customRange:r,timestamp:n}=Iv();return kt({queryKey:["metrics","trace-volume",t,r],queryFn:async()=>{const[s,a,i]=await Promise.all([tte(e,"mastra_agent_duration_ms",n),tte(e,"mastra_workflow_duration_ms",n),tte(e,"mastra_tool_duration_ms",n)]);return{agentData:s,workflowData:a,toolData:i}}})}function rte({data:e}){return o.jsx(E_,{data:e.map(t=>({name:t.name,values:[t.completed,t.errors]})),segments:[{label:"Completed",color:dc.blueDark},{label:"Errors",color:dc.pink}],maxVal:Math.max(...e.map(t=>t.completed+t.errors)),fmt:Bm})}function Ajn(){const{data:e,isLoading:t,isError:r}=Njn(),n=!!e&&(e.agentData.length>0||e.workflowData.length>0||e.toolData.length>0),s=e?[...e.agentData,...e.workflowData,...e.toolData].reduce((a,i)=>a+i.completed+i.errors,0):0;return o.jsxs(qt,{children:[o.jsxs(qt.TopBar,{children:[o.jsx(qt.TitleAndDescription,{title:"Trace Volume",description:"Runs and call counts."}),n&&o.jsx(qt.Summary,{value:Bm(s),label:"Total runs"})]}),t?o.jsx(qt.Loading,{}):r?o.jsx(qt.Error,{message:"Failed to load trace volume data"}):o.jsx(qt.Content,{children:n?o.jsxs(wf,{defaultTab:"agents",className:"grid grid-rows-[auto_1fr] overflow-y-auto h-full",children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"agents",children:"Agents"}),o.jsx(vs,{value:"workflows",children:"Workflows"}),o.jsx(vs,{value:"tools",children:"Tools"})]}),o.jsx(Ns,{value:"agents",children:e.agentData.length>0?o.jsx(rte,{data:e.agentData}):o.jsx(qt.NoData,{message:"No agent data yet"})}),o.jsx(Ns,{value:"workflows",children:e.workflowData.length>0?o.jsx(rte,{data:e.workflowData}):o.jsx(qt.NoData,{message:"No workflow data yet"})}),o.jsx(Ns,{value:"tools",children:e.toolData.length>0?o.jsx(rte,{data:e.toolData}):o.jsx(qt.NoData,{message:"No tool data yet"})})]}):o.jsx(qt.NoData,{message:"No trace volume data yet"})})]})}const Ijn=new Set(["ObservabilityStorageClickhouseVNext","ObservabilityStorageDuckDB","ObservabilityInMemory"]);function Rjn(){const{data:e,isLoading:t}=z9(),r=e?.observabilityStorageType,n=r?Ijn.has(r):!1,s=r==="ObservabilityInMemory";return t?null:n?o.jsxs("div",{className:"grid gap-8 content-start pb-10",children:[s&&o.jsxs(Ll,{variant:"info",children:[o.jsx($l,{children:"Metrics are not persisted"}),o.jsx(Iu,{as:"p",children:"This project uses in-memory storage for observability. Metrics will be lost on every server restart. For persistent metrics, switch the observability storage to ClickHouse or DuckDB."})]}),o.jsxs(Jse,{children:[o.jsx(xjn,{}),o.jsx(wjn,{}),o.jsx(Sjn,{}),o.jsx(Ojn,{})]}),o.jsxs(Jse,{children:[o.jsx(_jn,{}),o.jsx(Tjn,{}),o.jsx(Cjn,{}),o.jsx(Ajn,{}),o.jsx(gjn,{})]})]}):o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"Metrics are not available with your current storage",descriptionSlot:"Metrics require ClickHouse, DuckDB, or in-memory storage for observability. Relational databases (PostgreSQL, LibSQL) do not support metrics collection. To enable metrics on an existing project, switch the observability storage in the Mastra configuration.",actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/docs/observability/metrics/overview",target:"_blank",rel:"noopener noreferrer",children:["Metrics Documentation ",o.jsx(Aa,{})]})})})}const Pjn=[{label:"Last 24 hours",value:"24h"},{label:"Last 3 days",value:"3d"},{label:"Last 7 days",value:"7d"},{label:"Last 14 days",value:"14d"},{label:"Last 30 days",value:"30d"}];function Mjn(){const{datePreset:e,setDatePreset:t}=uSt();return o.jsx(Po,{name:"date-range",labelIsHidden:!0,value:e,options:Pjn,onValueChange:r=>t(r)})}const nte="period";function Djn(){const[e,t]=vo(),r=e.get(nte),n=ojn(r)?r:"24h",s=b.useCallback(a=>{t(i=>{const l=new URLSearchParams(i);return a==="24h"?l.delete(nte):l.set(nte,a),l},{replace:!0})},[t]);return o.jsx(fjn,{initialPreset:n,onPresetChange:s,children:o.jsx(Ljn,{})})}function Ljn(){const{error:e}=dSt();return e&&As(e)?o.jsx(Vr,{title:"Metrics",icon:o.jsx(zO,{}),children:o.jsx(na,{})}):e&&Os(e)?o.jsx(Vr,{title:"Metrics",icon:o.jsx(zO,{}),children:o.jsx(Zs,{resource:"metrics"})}):e?o.jsx(Vr,{title:"Metrics",icon:o.jsx(zO,{}),children:o.jsx(sd,{title:"Failed to load metrics",message:e.message})}):o.jsxs(Ft,{width:"wide",height:"full",children:[o.jsx(Ft.TopArea,{className:"sticky top-0 z-100 bg-surface1 ",children:o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(zO,{})," Metrics"]})})}),o.jsxs(Ft.Column,{className:"flex justify-end gap-2",children:[o.jsx(Mjn,{}),o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:o.jsx(Io,{})})]})]})}),o.jsx(Rjn,{})]})}const $jn=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:zO,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:Wi,href:"/observability"}];function Fjn(){return o.jsxs(WO,{children:[o.jsx(WO.Top,{children:o.jsx(Ar,{withMargins:!1,children:o.jsx(Ar.Column,{children:o.jsxs(Ar.Title,{children:[o.jsx(Wi,{})," Observability"]})})})}),o.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:$jn.map(e=>o.jsxs(nr,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}const zjn=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:pa,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:Qi,href:"/prompts"},{title:"Workflows",description:"Build step-based execution flows with suspend, resume, and branching.",icon:Ii,href:"/workflows"},{title:"Processors",description:"Configure data processors for transforming and routing information.",icon:Xw,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:ml,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:Ai,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:sc,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:mE,href:"/request-context"}];function Bjn(){return o.jsxs(Ft,{width:"narrow",children:[o.jsx(Ft.TopArea,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(A7t,{})," Primitives"]})})}),o.jsx(Ft.MainArea,{children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:zjn.map(e=>o.jsxs(nr,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function Ujn(){const{paths:e}=lr(),{data:t,isLoading:r,error:n}=a0t(),{isCmsAvailable:s}=FP(),[a,i]=b.useState(""),l=t?.promptBlocks??[];return n&&As(n)?o.jsx(Vr,{title:"Prompts",icon:o.jsx(Qi,{}),children:o.jsx(na,{})}):n&&Os(n)?o.jsx(Vr,{title:"Prompts",icon:o.jsx(Qi,{}),children:o.jsx(Zs,{resource:"prompt blocks"})}):n?o.jsx(Vr,{title:"Prompts",icon:o.jsx(Qi,{}),children:o.jsx(sd,{title:"Failed to load prompt blocks",message:n.message})}):l.length===0&&!r?o.jsx(Vr,{title:"Prompts",icon:o.jsx(Qi,{}),children:o.jsx(z0n,{})}):o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:r,children:[o.jsx(Qi,{})," Prompts"]})})}),o.jsxs(Ft.Column,{className:"flex justify-end gap-2",children:[o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Prompts documentation",children:o.jsx(Io,{})}),s&&o.jsxs(ve,{as:nr,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[o.jsx(is,{}),"Create Prompt"]})]})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(Ah,{onSearch:i,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),o.jsx(F0n,{promptBlocks:l,isLoading:r,search:a})]})}function Vjn(){return o.jsxs(Ft,{width:"narrow",children:[o.jsx(Ft.TopArea,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(mE,{})," Request Context"]})})}),o.jsx(Ft.MainArea,{children:o.jsx(pbn,{children:o.jsx($xt,{})})})]})}const qjn=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:QBt,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:Io,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:Aa,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:mce,href:"https://discord.gg/BTYqqHKUrf",external:!0},{title:"Share with your team",description:"Running Mastra Studio locally? Deploy to the cloud so your team can collaborate.",icon:yWe,href:"https://mastra.ai/cloud",external:!0},{title:"Talk to our Sales team",description:"Get a custom demo, discuss on-prem deployments, and how we can help you accelerate getting agents into production.",icon:V8t,href:"https://mastra.ai/contact?ref=studio",external:!0}];function Hjn(){return o.jsxs(Ft,{width:"narrow",children:[o.jsx(Ft.TopArea,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(Io,{})," Resources"]})})}),o.jsx(Ft.MainArea,{children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:qjn.map(e=>o.jsxs("a",{href:e.href,...e.external?{target:"_blank",rel:"noreferrer"}:{},className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title}),e.external&&o.jsx(Aa,{className:"h-3.5 w-3.5 text-icon3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function Qjn(){const{data:e={},isLoading:t,error:r}=_f(),[n,s]=b.useState(""),[a,i]=b.useState("all");if(r&&As(r))return o.jsx(Vr,{title:"Scorers",icon:o.jsx(Hs,{}),children:o.jsx(na,{})});if(r&&Os(r))return o.jsx(Vr,{title:"Scorers",icon:o.jsx(Hs,{}),children:o.jsx(Zs,{resource:"scorers"})});if(r)return o.jsx(Vr,{title:"Scorers",icon:o.jsx(Hs,{}),children:o.jsx(sd,{title:"Failed to load scorers",message:r.message})});if(Object.keys(e).length===0&&!t)return o.jsx(Vr,{title:"Scorers",icon:o.jsx(Hs,{}),children:o.jsx(yxn,{})});const l=a!=="all"||n!=="",c=()=>{s(""),i("all")};return o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:t,children:[o.jsx(Hs,{})," Scorers"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/evals/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Scorers documentation",children:o.jsx(Io,{})})})]}),o.jsx(vxn,{search:n,onSearchChange:s,sourceFilter:a,onSourceFilterChange:i,onReset:c,hasActiveFilters:l})]}),o.jsx(gxn,{scorers:e,isLoading:t,search:n,sourceFilter:a})]})}function Wjn(){const{scorerId:e}=ba(),[t,r]=vo(),n=t.get("scoreId")??void 0,[s,a]=b.useState(n),[i,l]=b.useState(0),[c,u]=b.useState(!!n),[d,f]=b.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:h,isLoading:p,error:m}=fxn(e),{data:g={},isLoading:y,error:x}=Bp(),{data:w,isLoading:O,error:k}=Cv(),{data:_,isLoading:E,error:T}=dxn({scorerId:e,page:i,entityId:d?.value==="all"?void 0:d?.value,entityType:d?.type==="ALL"?void 0:d?.type}),j=b.useMemo(()=>h?.agentIds?.filter(Q=>g[Q]).map(Q=>({value:Q,label:g[Q].name,type:"AGENT"}))||[],[h?.agentIds,g]),A=b.useMemo(()=>h?.workflowIds?.map(Q=>({value:Q,label:Q,type:"WORKFLOW"}))||[],[h?.workflowIds]),I=b.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...j,...A],[j,A]),P=t.get("entity"),R=I.find(Q=>Q.value===P);R&&R.value!==d?.value&&f(R),b.useEffect(()=>{if(m){const Q=m instanceof Error?m.message:"Failed to load scorer";Ue.error(`Error loading scorer: ${Q}`)}},[m]),b.useEffect(()=>{if(x){const Q=x instanceof Error?x.message:"Failed to load agents";Ue.error(`Error loading agents: ${Q}`)}},[x]),b.useEffect(()=>{if(k){const Q=k instanceof Error?k.message:"Failed to load workflows";Ue.error(`Error loading workflows: ${Q}`)}},[k]);const B=b.useMemo(()=>_?.scores||[],[_?.scores]),D=_?.pagination,F=h?.agentIds?.map(Q=>({name:Q,id:Object.entries(g).find(([,G])=>G.name===Q)?.[0]}))||[],U=h?.workflowIds?.map(Q=>({name:Q,id:Object.entries(w||{}).find(([,G])=>G.name===Q)?.[0]}))||[],V=[{key:"entities",label:"Entities",value:([...F.map(Q=>({id:Q.id,name:Q.name,type:"AGENT"})),...U.map(Q=>({id:Q.id,name:Q.name,type:"WORKFLOW"}))]||[]).map(Q=>({id:Q.id,name:Q.name||Q.id,path:`${Q.type==="AGENT"?"/agents":"/workflows"}/${Q.name}`}))}],W=Q=>{Q?.value&&r(G=>{const J=new URLSearchParams(G);return J.set("entity",Q.value),J})};if(b.useEffect(()=>{const Q=t.get("scoreId")??void 0;if(Q===s)return;if(!Q){a(void 0),u(!1);return}B.find(J=>J.id===Q)&&(a(Q),u(!0))},[t,B]),As(m)||As(x)||As(k))return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/scorers",children:[o.jsx(Ce,{children:o.jsx(Hs,{})}),"Scorers"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})})]});if(m&&Os(m))return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/scorers",children:[o.jsx(Ce,{children:o.jsx(Hs,{})}),"Scorers"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"scorers"})})]});if(p||m||x||k)return null;const L=Q=>{a(Q),u(!0),r(G=>{const J=new URLSearchParams(G);return J.set("scoreId",Q),J})},Y=Q=>{a(Q),r(G=>{const J=new URLSearchParams(G);return Q?J.set("scoreId",Q):J.delete("scoreId"),J})},q=jhe({entries:B,id:s,update:Y}),M=The({entries:B,id:s,update:Y});return o.jsxs(o.Fragment,{children:[o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/scorers",children:[o.jsx(Ce,{children:o.jsx(Hs,{})}),"Scorers"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:o.jsx(hxn,{value:e,variant:"ghost"})})]}),o.jsxs(Ec,{children:[h?.scorer?.source==="stored"&&o.jsxs(ve,{variant:"light",as:nr,to:`/cms/scorers/${e}/edit`,children:[o.jsx(Ce,{children:o.jsx(dv,{})}),"Edit"]}),o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/evals/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(kv,{}),"Scorers documentation"]})]})]}),o.jsx("div",{className:Z("grid overflow-y-auto h-full"),children:o.jsxs("div",{className:Z("max-w-400 w-full px-12 mx-auto grid content-start gap-8 h-full"),children:[o.jsxs(Cn,{children:[o.jsxs(Cn.Title,{isLoading:p,children:[o.jsx(Hs,{})," ",h?.scorer?.config?.name]}),(p||h?.scorer?.config?.description)&&o.jsx(Cn.Description,{isLoading:p,children:h?.scorer?.config?.description})]}),o.jsx(n0,{data:V,LinkComponent:nr,isLoading:y||O}),o.jsx(uxn,{selectedEntity:d,entityOptions:I,onEntityChange:W,onReset:()=>{r(Q=>{const G=new URLSearchParams(Q);return G.set("entity","all"),G})},isLoading:E||y||O}),E?o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(It,{})}):o.jsx(sxn,{scores:B,selectedScoreId:s,pagination:{total:D?.total||0,hasMore:D?.hasMore||!1,perPage:D?.perPage||0,page:D?.page||0},onScoreClick:L,onPageChange:l,errorMsg:T?.message})]})})]}),o.jsx(Hxt,{scorerName:h?.scorer?.config?.name,score:Gjn(B.find(Q=>Q.id===s)),isOpen:c,onClose:()=>{u(!1),a(void 0),r(Q=>{const G=new URLSearchParams(Q);return G.delete("scoreId"),G})},onNext:q,onPrevious:M,computeTraceLink:(Q,G)=>`/observability?traceId=${Q}${G?`&spanId=${G}`:""}`})]})}const Gjn=e=>{if(e)return{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt)}},Zjn=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],Yjn=()=>{const{baseUrl:e,headers:t,apiPrefix:r}=Yhe(),{theme:n,setTheme:s}=Hn(),[a,i]=b.useState(n),l=b.useRef(n);return b.useEffect(()=>{i(n),l.current=n},[n]),o.jsxs(Ft,{width:"narrow",children:[o.jsx(Ft.TopArea,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{children:[o.jsx(_he,{})," Settings"]})})}),o.jsxs(Ft.MainArea,{className:"grid gap-8 mt-6",children:[o.jsx("section",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-icon6 font-medium",children:"Theme"}),o.jsx(Jlt,{name:"theme",label:"Theme mode",value:a,onValueChange:c=>{const u=c;l.current=u,i(u)},options:Zjn.map(c=>({...c}))})]})}),o.jsx(uut,{initialConfig:{baseUrl:e,headers:t,apiPrefix:r},onSave:()=>{s(l.current)}})]})]})};function Xjn(){const[e]=vo(),t=ad(),r=e.get("redirect")||"/",n=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return o.jsx(rSt,{redirectUri:r,onSuccess:n,initialMode:"signup"})}function Kjn(e){return e.replace(/\/$/,"").split("/").pop()}function n8({children:e,className:t}){return o.jsx("div",{className:Z("border border-border1 rounded-lg mt-12 py-8 lg:min-h-[25rem] transition-height px-4 lg:px-12",t),children:e})}function Jjn({templates:e,linkComponent:t,className:r,isLoading:n}){const s=t||"a";return n?o.jsx("div",{className:Z("grid gap-y-4",r),children:Array.from({length:5}).map((a,i)=>o.jsx("div",{className:"h-16 bg-surface3 animate-pulse rounded-lg"},i))}):o.jsx("div",{className:Z("grid gap-y-4",r),children:e.map(a=>{const i=a?.agents||a?.tools||a?.networks||a?.workflows||a?.mcp;return o.jsxs("article",{className:Z("border border-border1 rounded-lg overflow-hidden w-full grid grid-cols-[1fr_auto] bg-surface3 transition-colors hover:bg-surface4"),children:[o.jsxs(s,{to:`/templates/${a.slug}`,className:Z("grid [&:hover_p]:text-neutral5",{"grid-cols-[8rem_1fr] lg:grid-cols-[12rem_1fr]":a.imageURL}),children:[a.imageURL&&o.jsx("div",{className:Z("overflow-hidden"),children:o.jsx("div",{className:"w-full h-full bg-cover thumb transition-scale duration-150",style:{backgroundImage:`url(${a.imageURL})`}})}),o.jsxs("div",{className:Z("grid py-3 px-6 w-full gap-0.5","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[o.jsx("h2",{className:"text-ui-lg text-neutral5",children:a.title}),o.jsx("p",{className:"text-ui-md text-neutral4 transition-colors duration-500",children:a.description}),o.jsxs("div",{className:"hidden 2xl:flex text-neutral3 text-ui-md flex-wrap items-center gap-4 mt-3",children:[i&&o.jsxs("ul",{className:Z("flex gap-4 text-ui-md text-neutral3 m-0 p-0 list-none","[&>li]:flex [&>li]:items-center [&>li]:gap-0.5 text-neutral4"),children:[a?.agents&&a.agents.length>0&&o.jsxs("li",{children:[o.jsx(pa,{})," ",a.agents.length]}),a?.tools&&a.tools.length>0&&o.jsxs("li",{children:[o.jsx(Ai,{})," ",a.tools.length]}),a?.networks&&a.networks.length>0&&o.jsxs("li",{children:[o.jsx(_We,{})," ",a.networks.length]}),a?.workflows&&a.workflows.length>0&&o.jsxs("li",{children:[o.jsx(X6,{})," ",a.workflows.length]}),a?.mcp&&a.mcp.length>0&&o.jsxs("li",{children:[o.jsx(ml,{})," ",a.mcp.length]})]}),i&&a.supportedProviders&&o.jsx("small",{children:"|"}),o.jsx("div",{className:"flex items-center text-neutral3 gap-4",children:a.supportedProviders.map(l=>o.jsx("span",{className:"",children:l},l))})]})]})]}),o.jsx("a",{href:a.githubUrl,className:Z("group items-center gap-2 text-ui-md ml-auto pr-4 hidden","lg:flex"),target:"_blank",rel:"noopener noreferrer",children:o.jsxs("span",{className:"flex items-center gap-2 px-2 py-1 rounded bg-surface1 group-hover:bg-surface2 text-neutral3 transition-colors group-hover:text-neutral5",children:[o.jsx(llt,{})," ",Kjn(a.githubUrl)]})})]},a.slug)})})}function eTn({tagOptions:e,selectedTag:t,providerOptions:r,selectedProvider:n,onTagChange:s,onProviderChange:a,searchTerm:i,onSearchChange:l,onReset:c,className:u,isLoading:d}){return d?o.jsxs("div",{className:Z("h-[6.5rem] flex items-center gap-8","[&>div]:bg-surface3 [&>div]:w-48 [&>div]:h-8 [&>div]:animate-pulse",u),children:[o.jsx("div",{})," ",o.jsx("div",{})," ",o.jsx("div",{})]}):o.jsxs("div",{className:Z("flex flex-wrap mx-auto sticky top-0 gap-4 bg-surface2 py-8",u),children:[o.jsx(Cx,{name:"search-templates",label:"Search templates",labelIsHidden:!0,value:i,onChange:f=>l?.(f.target.value),placeholder:"Search Template"}),o.jsx(Po,{label:"Filter by tag",labelIsHidden:!0,name:"filter-tag",value:t,onValueChange:s,options:e}),o.jsx(Po,{label:"Filter by provider",labelIsHidden:!0,name:"filter-provider",value:n,onValueChange:a,options:r}),c&&o.jsxs(ve,{onClick:c,children:["Reset ",o.jsx(vn,{})]})]})}function tTn(){const{data:e,isLoading:t}=Y3r(),{templates:r,tags:n,providers:s}=e??{templates:[],tags:[],providers:[]},[a,i]=b.useState("all"),[l,c]=b.useState("all"),[u,d]=b.useState(""),f=[{value:"all",label:"Any tag"}];(n||[]).forEach(w=>{f.push({value:w,label:w})});const h=[{value:"all",label:"Any provider"}];(s||[]).forEach(w=>{h.push({value:w,label:w})});const p=(w,O)=>{O==="tag"?i(w):O==="provider"&&c(w)},m=w=>{d(w)},g=()=>{i("all"),c("all"),d("")},y=r.filter(w=>!(u&&!w.title.toLowerCase().includes(u)&&!w.description.toLowerCase().includes(u)||a!=="all"&&!w.tags.includes(a)||l!=="all"&&!w.supportedProviders.includes(l))),x=u||a!=="all"||l!=="all";return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(Vu,{children:[o.jsx(Ce,{children:o.jsx(Ub,{})}),"Templates"]})}),o.jsxs("div",{className:Z("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[o.jsx(eTn,{selectedTag:a,onTagChange:w=>p(w,"tag"),tagOptions:f,selectedProvider:l,onProviderChange:w=>p(w,"provider"),providerOptions:h,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),o.jsx(Jjn,{templates:y,linkComponent:nr,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const rTn="1.26.0-alpha.2";function nTn({errorMsg:e,validationErrors:t}){const r=typeof e=="string"?e:e!=null?String(e):void 0,n=r?.includes("Invalid schema for function"),s=r?.includes("validation issue")||t&&t.length>0,a=()=>s?"Template installation completed but some validation issues remain. The template may still be functional, but you should review and fix these issues.":n?"There was an issue with the AI model configuration. This may be related to the selected model or AI SDK version compatibility.":"An unexpected error occurred during template installation.",i=()=>s?{icon:o.jsx(gh,{className:"text-yellow-500"}),title:"Template Installed with Warnings"}:{icon:o.jsx(b7t,{}),title:"Template Installation Failed"},{icon:l,title:c}=i();return o.jsxs(n8,{className:"space-y-4 text-neutral3 mb-8 content-center",children:[o.jsxs("div",{className:Z("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[l,o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-ui-md font-medium text-neutral5",children:c}),o.jsx("p",{className:"text-ui-md text-neutral3",children:a()})]})]}),t&&t.length>0&&o.jsxs("details",{className:"text-xs",children:[o.jsxs("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:["Show Validation Issues (",t.length,")"]}),o.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto max-h-60 text-left space-y-2",children:t.map((u,d)=>o.jsxs("div",{className:"border-l-2 border-red-400 pl-2",children:[o.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:u.type==="typescript"?"🔴 TypeScript Error":"⚠️ Lint Error"}),o.jsx("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-300 mt-1 whitespace-pre-wrap wrap-break-word",children:u.message})]},d))})]}),r&&!s&&o.jsxs("details",{className:"text-xs",children:[o.jsx("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:"Show Details"}),o.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs font-mono overflow-auto max-h-60 text-left",children:o.jsx("div",{className:"whitespace-pre-wrap wrap-break-word",children:r})})]})]})}function sTn({providerOptions:e,selectedProvider:t,onProviderChange:r,variables:n,errors:s,handleInstallTemplate:a,handleVariableChange:i,isLoadingEnvVars:l,isInstalling:c,defaultModelProvider:u,defaultModelId:d,onModelUpdate:f}){return o.jsx(n8,{children:o.jsxs("div",{className:"max-w-[40rem] my-4 p-4 lg:p-8 mx-auto gap-8 grid",children:[o.jsxs("h2",{className:Z("text-neutral4 text-header-sm font-semibold flex items-center gap-2","[&>svg]:w-[1.2em] [&_svg]:h-[1.2em] [&_svg]:opacity-70"),children:["Install Template ",o.jsx(EWe,{})]}),o.jsx(Po,{name:"template-provider",options:e,label:"Template AI Model Provider",onValueChange:r,value:t,placeholder:"Select",layout:"horizontal"}),t&&Object.entries(n||{}).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"text-neutral3 text-ui-md",children:"Set required Environmental Variables"}),o.jsx("div",{className:"grid grid-cols-[1fr_1fr] gap-4 items-start",children:l?o.jsxs("div",{className:Z("flex items-center justify-center col-span-2 text-neutral3 text-ui-sm gap-4","[&_svg]:opacity-50 [&_svg]:w-[1.1em] [&_svg]:h-[1.1em]","animate-in fade-in duration-300"),children:[o.jsx(It,{})," Loading variables..."]}):Object.entries(n).map(([h,p])=>o.jsxs(b.Fragment,{children:[o.jsx(Ex,{name:`env-${h}`,labelIsHidden:!0,label:"Key",value:h,disabled:!0,className:"w-full"}),o.jsx(Ex,{name:h,labelIsHidden:!0,label:"Value",value:p,onChange:i,errorMsg:s.includes(h)?"Value is required.":"",autoComplete:"off",className:"w-full"})]},h))}),o.jsxs("div",{className:"border-t border-border1 pt-12 mt-3.5 relative",children:[o.jsx("div",{className:"absolute w-8 h-8 rounded-full bg-surface2 top-0 left-1/2 -translate-x-1/2 -translate-y-4 text-ui-sm text-neutral3 flex items-center justify-center",children:"And"}),o.jsx("h3",{className:"text-neutral4 text-ui-lg",children:"Set AI Model for Template Installation"}),o.jsx("p",{className:"text-neutral3 text-ui-md mt-2 mb-8",children:"This model will be used by the workflow to process and install the template"}),o.jsx(Fxt,{defaultProvider:u||"",defaultModel:d||"",updateModel:f||(()=>Promise.resolve({message:"Updated"})),closeEditor:()=>{},autoSave:!0,selectProviderPlaceholder:"Provider"})]})]}),t&&!l&&o.jsx(ve,{className:Z("flex items-center gap-2 mt-4 justify-center text-ui-md w-full bg-surface5 min-h-10 rounded-lg text-neutral5 hover:bg-surface6 transition-colors","[&>svg]:w-[1.1em] [&_svg]:h-[1.1em] [&_svg]:text-neutral5"),onClick:a,disabled:!t||!u||!d||s.length>0||c,children:c?o.jsxs(o.Fragment,{children:[o.jsx(It,{className:"w-4 h-4"})," Installing..."]}):o.jsxs(o.Fragment,{children:["Install ",o.jsx(qd,{})]})})]})})}function aTn({title:e,description:t,githubUrl:r,isLoading:n,infoData:s,templateSlug:a}){const i=a?`feat/install-template-${a}`:"feat/install-template-[slug]";return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Z("grid mt-8 items-center"),children:o.jsxs("div",{className:Z("text-header-lg flex items-center gap-3","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",{"[&>svg]:opacity-20":n}),children:[o.jsx(Ub,{}),o.jsx("h2",{className:Z({"bg-surface4 flex rounded-lg min-w-[50%]":n}),children:n?o.jsx(o.Fragment,{children:" "}):e})]})}),o.jsxs("div",{className:"grid lg:grid-cols-[1fr_1fr] gap-x-24",children:[o.jsxs("div",{className:"grid",children:[o.jsx("p",{className:Z("mb-4 text-ui-md text-neutral4 mt-2 leading-7",{"bg-surface4 rounded-lg ":n}),children:n?o.jsx(o.Fragment,{children:" "}):t}),!n&&a&&o.jsxs("div",{className:Z("bg-surface2 border border-surface4 rounded-lg p-4 mb-4","flex items-start gap-3"),children:[o.jsx("div",{className:"shrink-0 mt-0.5",children:o.jsx(qy,{className:"w-[1.1em] h-[1.1em] text-blue-500"})}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(W6,{className:"w-[1em] h-[1em] text-neutral4"}),o.jsx("span",{className:"text-ui-md font-medium text-neutral5",children:"A new Git branch will be created"})]}),o.jsxs("div",{className:"text-ui-sm text-neutral4 space-y-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-medium",children:"Branch name:"})," ",o.jsx("code",{className:"bg-surface3 px-1.5 py-0.5 rounded text-ui-sm font-mono",children:i})]}),o.jsx("div",{children:"This ensures safe installation with easy rollback if needed. Your main branch remains unchanged."})]})]})]}),r&&o.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 mt-auto text-neutral3 text-ui-md hover:text-neutral5",children:[o.jsx(llt,{}),r?.split("/")?.pop()]})]}),s&&o.jsx(n0,{data:s,labelsAreHidden:!0,isLoading:n})]})]})}function iTn({name:e,streamResult:t,workflowInfo:r}){const n=t?.phase||"initializing",s=t?.payload?.workflowState,a=t?.payload?.currentStep,i=t?.error,l=s?.steps||{},c=Object.keys(l).length>0,u=m=>m==="input"||m.endsWith(".input")||m.startsWith("Mapping_")&&/[0-9a-f]{8}/.test(m)||/[0-9a-f]{8,}/.test(m)?!1:r?.allSteps?m in r.allSteps:!0,d=Object.entries(l).filter(([m,g])=>u(m)),f=d.length,h=()=>{switch(n){case"initializing":return"Preparing template installation...";case"processing":return`Installing ${e} template`;case"completed":return"Template installation completed!";case"error":return"Template installation failed";default:return"Installing template..."}},p=d.map(([m,g])=>({id:m,status:g?.status,description:g?.description,title:m.charAt(0).toUpperCase()+m.slice(1).replace(/-/g," "),isActive:a?.id===m}));return o.jsxs(n8,{className:"space-y-6 text-neutral3 mb-8 content-center",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("h3",{className:"text-lg font-semibold text-neutral5",children:h()}),t?.runId&&o.jsxs("div",{className:"mt-2 text-ui-sm text-neutral3",children:["Run ID: ",t.runId]})]}),c&&f>0&&!["error"].includes(n)&&o.jsx("div",{className:"max-w-[30rem] w-full mx-auto px-6",children:o.jsx(NPr,{steps:p})}),i&&n==="error"&&o.jsxs("div",{className:Z("rounded-lg text-neutral5 p-6 flex items-center gap-3 text-ui-md bg-red-500/10","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:opacity-70 [&>svg]:text-red-500"),children:[o.jsx(hUt,{}),i||"Something went wrong"]}),c&&o.jsx(TPr,{steps:p,currentStep:a,className:"pb-4"}),!c&&n==="initializing"&&o.jsxs("div",{className:"text-center text-sm text-neutral3 grid gap-4 justify-items-center",children:[o.jsx(It,{}),o.jsx("p",{children:"This may take some time..."})]})]})}function oTn({name:e,installedEntities:t}){return o.jsxs(n8,{className:Z("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[o.jsx(EWe,{}),o.jsx("h2",{className:"text-header-md",children:"Done!"}),o.jsxs("p",{className:"text-ui-md text-center text-neutral3 ",children:["The ",o.jsx("b",{className:"text-neutral4",children:e})," template has been successfully installed.",t&&t.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("br",{})," Installed entities are listed below."]})]}),t&&t.length>0&&o.jsx(n0,{data:t})]})}function lTn(){const{templateSlug:e}=ba(),[t,r]=vo(),[n,s]=b.useState(""),[a,i]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState({}),[f,h]=b.useState([]),[p,m]=b.useState(null),[g,y]=b.useState(!1),[x,w]=b.useState(""),[O,k]=b.useState(!1),[_,E]=b.useState(!1),[T,j]=b.useState([]),{data:A,isLoading:I}=X3r({repoOrSlug:e,owner:"mastra-ai"}),R=rTn?.includes("beta")??!1?"beta":"main",{data:B,isLoading:D}=K3r({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:R}),{data:F,isLoading:U}=J3r(),{mutateAsync:z,isPending:V}=e5r(),{mutateAsync:W}=t5r(),{streamInstall:L,streamResult:Y,isStreaming:q}=n5r(F),{observeInstall:M,streamResult:Q,isStreaming:G}=s5r(F);b.useEffect(()=>{const re=t.get("runId");re&&!g&&!p&&!q&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:re}),w(re),W({runId:re}).then(le=>{const pe=le.snapshot;if(pe?.status==="success"&&pe?.result?.success)y(!0);else if(pe?.result?.success===!1)if(pe?.result?.validationResults&&!pe?.result?.validationResults?.valid&&pe?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ue,errors:we}=pe.result.validationResults,ke=`Template installation completed but ${ue} validation issue${ue>1?"s":""} remain unresolved.`;m(ke),j(we||[])}else{const ue=pe?.result?.message||pe?.result?.error||"Template installation failed";m(typeof ue=="string"?ue:String(ue))}}).catch(le=>{console.error("❌ Failed to fetch run details:",le),m("Failed to retrieve installation status after reload")}))},[t,g,p,q,G,W]),b.useEffect(()=>{const re=t.get("runId"),le=t.get("resume"),pe=t.get("provider");if(re&&le==="true"&&pe&&!q&&!G&&!O&&!_&&F){w(re),k(!0);try{W({runId:re}).then(ce=>{if(ce.snapshot?.status==="running")return M.mutateAsync({runId:re})}).then(()=>{r(ce=>{const ue=new URLSearchParams(ce);return ue.delete("resume"),ue})}).catch(ce=>{console.error("❌ Failed to resume template installation:",ce),ce.message?.includes("404")||ce.message?.includes("not found")?m("Template installation run not found. It may have expired or been completed."):m("Failed to resume template installation. Please try again.")})}catch(ce){console.error("❌ Auto-resume failed with error:",ce),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,q,G,O,_,F,W,M,r]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ie=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(re=>re).join(", "):"n/a",icon:o.jsx(Ai,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(re=>re).join(", "):"n/a",icon:o.jsx(pa,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(re=>re).join(", "):"n/a",icon:o.jsx(X6,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:o.jsx(ip,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:o.jsx(yE,{})}],te=[{...ie[0]},{...ie[1]},{...ie[2]}].filter(re=>re.value!=="n/a");b.useEffect(()=>{B&&d(B)},[B]),b.useEffect(()=>{const re=Y||Q;re?.phase==="error"&&re?.error&&m(typeof re.error=="string"?re.error:String(re.error))},[Y?.phase,Y?.error,Q?.phase,Q?.error]);const se=re=>{s(re)},oe=async re=>(i(re.provider),c(re.modelId),{message:"Model updated successfully"}),he=async()=>{const re=Object.entries(u).reduce((le,[pe,ce])=>(ce===""&&le.push(pe),le),[]);if(re.length>0){h(re);return}if(A){m(null),y(!1),w(""),E(!0);try{const pe={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:R,slug:A.slug,variables:u},{runId:ce}=await z({});w(ce),r(ue=>{const we=new URLSearchParams(ue);return we.set("runId",ce),we.set("resume","true"),we.set("provider",n||"openai"),we}),await L.mutateAsync({inputData:pe,selectedModel:{provider:a,modelId:l},runId:ce})}catch(le){E(!1),m(le?.message||"Template installation failed"),console.error("Template installation failed",le)}}},K=re=>{const{name:le,value:pe}=re.target;pe.trim()===""?h(ce=>[...ce,le]):h(ce=>ce.filter(ue=>ue!==le)),d(ce=>({...ce,[le]:pe}))};return o.jsxs(Ir,{children:[o.jsx(mn,{children:o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/templates",children:[o.jsx(Ce,{children:o.jsx(Ub,{})}),"Templates"]}),o.jsx(dr,{as:nr,to:`/templates/${A?.slug}`,isCurrent:!0,children:A?.title&&A.title})]})}),o.jsx("div",{className:Z("w-full lg:px-12 h-full overflow-y-scroll"),children:o.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[o.jsx(aTn,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:ie,templateSlug:e}),A&&o.jsxs(o.Fragment,{children:[(q||G)&&o.jsx(iTn,{name:A.title,streamResult:G?Q:Y,runId:x,workflowInfo:F}),g&&o.jsx(oTn,{name:A.title,installedEntities:te,linkComponent:nr}),p&&o.jsx(nTn,{errorMsg:p,validationErrors:T.length>0?T:Y?.validationResults?.errors||Q?.validationResults?.errors}),!q&&!G&&!g&&!p&&o.jsx(sTn,{providerOptions:J,selectedProvider:n,onProviderChange:se,variables:u,setVariables:d,errors:f,setErrors:h,handleInstallTemplate:he,handleVariableChange:K,isLoadingEnvVars:D||U,isInstalling:V,defaultModelProvider:a,defaultModelId:l,onModelUpdate:oe})]})]})})]})}const cTn=()=>{const{toolId:e,agentId:t}=ba();return o.jsxs(Ir,{children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/agents",children:[o.jsx(Ce,{children:o.jsx(pa,{})}),"Agents"]}),o.jsx(dr,{as:nr,to:`/agents/${t}/chat`,children:t}),o.jsx(dr,{as:nr,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[o.jsx(Ce,{children:o.jsx(kv,{})}),"Tools documentation"]})})]}),o.jsx(Hxn,{toolId:e,agentId:t})]})},uTn=()=>{const{toolId:e}=ba();return o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(mn,{children:[o.jsxs(ja,{children:[o.jsxs(dr,{as:nr,to:"/tools",children:[o.jsx(Ce,{children:o.jsx(Ai,{})}),"Tools"]}),o.jsx(dr,{as:"span",to:"",isCurrent:!0,children:o.jsx(KCn,{value:e,variant:"ghost"})})]}),o.jsx(Ec,{children:o.jsxs(ve,{as:nr,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(kv,{}),"Tools documentation"]})})]}),o.jsx(XCn,{toolId:e})]})},dTn=()=>{const e=Ze();return kt({queryKey:["observability-environments"],queryFn:async()=>{try{return await e.getEnvironments()}catch{return{environments:[]}}},select:t=>t?.environments??[],retry:!1})},fTn=()=>{const e=Ze();return kt({queryKey:["observability-service-names"],queryFn:async()=>{try{return await e.getServiceNames()}catch{return{serviceNames:[]}}},select:t=>t?.serviceNames??[],retry:!1})},hTn=()=>{const e=Ze();return kt({queryKey:["observability-tags"],queryFn:async()=>{try{return await e.getTags()}catch{return{tags:[]}}},select:t=>t?.tags??[],retry:!1})},pTn=async({client:e,page:t,perPage:r,filters:n})=>e.listTraces({pagination:{page:t,perPage:r},filters:n}),mTn=25;function gTn(e,t,r){if(e?.pagination?.hasMore)return r+1}function yTn(e){const t=new Set,r=e.pages.flatMap(s=>s.spans??[]).filter(s=>t.has(s.traceId)?!1:(t.add(s.traceId),!0)),n={};for(const s of e.pages)s.threadTitles&&Object.assign(n,s.threadTitles);return{spans:r,threadTitles:n}}const vTn=({filters:e})=>{const t=Ze(),{inView:r,setRef:n}=zE(),s=o1({queryKey:["traces",e],queryFn:({pageParam:c})=>pTn({client:t,page:c,perPage:mTn,filters:e}),initialPageParam:0,getNextPageParam:gTn,select:yTn,placeholderData:M2r,retry:!1,refetchInterval:c=>Os(c.state.error)?!1:3e3}),{hasNextPage:a,isFetchingNextPage:i,fetchNextPage:l}=s;return b.useEffect(()=>{r&&a&&!i&&l()},[r,a,i,l]),{...s,setEndOfListElement:n}};function fSt(e){const t=Ze();return kt({queryKey:["trace-spans",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await t.getTrace(e)},enabled:!!e})}function bTn(e){const t=new Map,r=[];for(const s of e)if(s.threadId){const a=t.get(s.threadId);a?a.push(s):t.set(s.threadId,[s])}else r.push(s);const n=Array.from(t.entries()).map(([s,a])=>({threadId:s,traces:a}));return n.sort((s,a)=>{const i=Math.max(...s.traces.map(c=>new Date(c.createdAt).getTime()));return Math.max(...a.traces.map(c=>new Date(c.createdAt).getTime()))-i}),{groups:n,ungrouped:r}}function xTn(e,t=100){if(e==null)return"";const r=Array.isArray(e)?e:e&&typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.messages)?e.messages:null;if(r){const i=r.filter(l=>l?.role==="user").map(l=>typeof l.content=="string"?l.content:Array.isArray(l.content)?l.content.map(c=>typeof c=="string"?c:c?.type==="text"&&typeof c.text=="string"?c.text:"").filter(Boolean).join(" "):"").filter(Boolean).join(" | ");return i.length>t?i.slice(0,t)+"…":i}if(typeof e=="string")return e.length>t?e.slice(0,t)+"…":e;const n=JSON.stringify(e);return n.length>t?n.slice(0,t)+"…":n}function wTn(e){return e?.attributes?.finishReason==="length"}function STn(e){const t=e?.attributes?.usage;if(!t)return"The model stopped generating because it reached the maximum token limit. The response was truncated and may be incomplete.";const r=t.inputTokens??0,n=t.outputTokens??0,s=t.totalTokens??r+n;return r>0||n>0?`The model stopped generating because it reached the maximum token limit. The response was truncated and may be incomplete.
550
550
 
551
551
  Token usage: ${r} input + ${n} output = ${s} total`:`The model stopped generating because it reached the maximum token limit (${s} tokens). The response was truncated and may be incomplete.`}const hSt=e=>{if(!e||e.length===0)return[];const t=e.reduce((l,c)=>{const u=c?.endedAt?new Date(c.endedAt):void 0;return u&&(!l||u>l)?u:l},null),r=new Map,n=[];e.forEach(l=>{const c=new Date(l.startedAt),u=l.endedAt?new Date(l.endedAt):void 0,d={id:l.spanId,name:l.name,type:l.spanType,latency:u?u.getTime()-c.getTime():0,startTime:c.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:l.parentSpanId};r.set(l.spanId,d)}),e.forEach(l=>{const c=r.get(l.spanId);if(l?.parentSpanId==null){if(t&&c.endTime&&t>new Date(c.endTime)){c.endTime=t.toISOString();const u=new Date(t).getTime(),d=new Date(c.startTime).getTime();c.latency=u-d}n.push(c)}else{const u=r.get(l.parentSpanId);u?u.spans.push(c):n.push(c)}});const s=l=>l.sort((c,u)=>new Date(c.startTime).getTime()-new Date(u.startTime).getTime()),a=s(n),i=l=>{l.forEach(c=>{c.spans&&c.spans.length>0&&(c.spans=s(c.spans),i(c.spans))})};return i(a),a};function OTn(e){if(!e)return!1;const t=e.scorer;return t?.hasJudge===!1?!0:t?.hasJudge===!0?!1:!e.preprocessPrompt&&!e.analyzePrompt&&!e.generateScorePrompt&&!e.generateReasonPrompt}function G0(e,t,r){return o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-neutral2 uppercase tracking-widest [&>svg]:size-3.5",children:[t,e]}),o.jsxs("span",{children:["› Score ",o.jsxs("b",{className:"text-neutral3",children:["#",r.id]})]})]})}function kTn({score:e,onClose:t,onPrevious:r,onNext:n}){const s=OTn(e),a=s?"N/A — code-based scorer does not use prompts":"N/A — step not configured";return o.jsxs(Us,{children:[o.jsxs(Us.Header,{children:[o.jsxs(Us.Heading,{children:["Score ",o.jsxs("b",{children:["# ",e.id]})]}),o.jsxs(ws,{className:"ml-auto shrink-0",children:[o.jsx(Us.NextPrevNav,{onPrevious:r,onNext:n,previousLabel:"Previous score",nextLabel:"Next score"}),o.jsx(Us.CloseButton,{onClick:t})]})]}),o.jsxs(Us.Content,{children:[o.jsxs(ao,{numOfCol:2,children:[e.scorer?.name!=null&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Scorer"}),o.jsx(ao.Value,{children:String(e.scorer.name)})]}),e.createdAt&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Created"}),o.jsx(ao.Value,{children:or(new Date(e.createdAt),"MMM dd, HH:mm:ss.SSS")})]}),e.traceId&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Trace"}),o.jsx(ao.Value,{children:e.traceId})]}),e.spanId&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Span"}),o.jsx(ao.Value,{children:e.spanId})]})]}),o.jsxs("div",{className:"grid gap-3 mt-3",children:[o.jsx(Us.CodeSection,{title:`Score: ${e.score==null||Number.isNaN(e.score)?"n/a":e.score}`,dialogTitle:G0("Score",o.jsx(Hs,{}),e),icon:o.jsx(Hs,{}),codeStr:e.reason||(s?"N/A — code-based scorer does not generate a reason":"N/A — step not configured"),simplified:!0}),o.jsx(Us.CodeSection,{title:"Input",dialogTitle:G0("Input",o.jsx(wp,{}),e),icon:o.jsx(wp,{}),codeStr:JSON.stringify(e.input??null,null,2)}),o.jsx(Us.CodeSection,{title:"Output",dialogTitle:G0("Output",o.jsx(yc,{}),e),icon:o.jsx(yc,{}),codeStr:JSON.stringify(e.output??null,null,2)}),o.jsx(Us.CodeSection,{title:"Preprocess Prompt",dialogTitle:G0("Preprocess Prompt",o.jsx(ac,{}),e),icon:o.jsx(ac,{}),codeStr:e.preprocessPrompt||a,simplified:!0}),o.jsx(Us.CodeSection,{title:"Analyze Prompt",dialogTitle:G0("Analyze Prompt",o.jsx(ac,{}),e),icon:o.jsx(ac,{}),codeStr:e.analyzePrompt||a,simplified:!0}),o.jsx(Us.CodeSection,{title:"Generate Score Prompt",dialogTitle:G0("Generate Score Prompt",o.jsx(ac,{}),e),icon:o.jsx(ac,{}),codeStr:e.generateScorePrompt||a,simplified:!0}),o.jsx(Us.CodeSection,{title:"Generate Reason Prompt",dialogTitle:G0("Generate Reason Prompt",o.jsx(ac,{}),e),icon:o.jsx(ac,{}),codeStr:e.generateReasonPrompt||a,simplified:!0})]})]})]})}const O8e="auto auto auto auto 1fr";function _Tn({scoresData:e,isLoadingScoresData:t,onPageChange:r,onScoreSelect:n}){return t?o.jsx(Fhe,{columns:O8e}):o.jsxs("div",{className:"grid gap-2",children:[o.jsxs(Ac,{columns:O8e,className:"min-w-0",children:[o.jsxs(Ac.Top,{children:[o.jsx(Ac.TopCell,{children:"ID"}),o.jsx(Ac.TopCell,{children:"Date"}),o.jsx(Ac.TopCell,{children:"Time"}),o.jsx(Ac.TopCell,{children:"Score"}),o.jsx(Ac.TopCell,{children:"Scorer"})]}),e?.scores&&e.scores.length>0?e.scores.map(s=>{const a=new Date(s.createdAt),i=mv(a);return o.jsxs(Ac.RowButton,{onClick:()=>n?.(s),children:[o.jsx(Ac.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:Yd(s?.id)||"n/a"}),o.jsx(Ac.Cell,{height:"compact",className:"text-neutral2 text-ui-smd",children:i?"Today":or(a,"MMM dd")}),o.jsx(Ac.Cell,{height:"compact",className:"font-mono text-neutral3 text-ui-smd",children:or(a,"h:mm:ss aaa")}),o.jsx(Ac.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.score??"")}),o.jsx(Ac.Cell,{height:"compact",className:"text-ui-smd",children:String(s?.scorer?.name||s?.scorer?.id||"")})]},s.id)}):o.jsx(Ac.NoMatch,{message:"No scores found"})]}),o.jsx(Ac.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>r?.((e?.pagination?.page||0)+1),onPrevPage:()=>r?.((e?.pagination?.page||0)-1)})]})}function k8e(e){return typeof e=="object"&&e!==null}const ETn={text:"Text",cacheRead:"Cache Read",cacheWrite:"Cache Write",audio:"Audio",image:"Image",reasoning:"Reasoning"};function CTn({usage:e,className:t}){if(!e)return null;const r="inputTokens"in e,n={promptTokens:{label:"Prompt Tokens",icon:o.jsx(qd,{})},completionTokens:{label:"Completion Tokens",icon:o.jsx(Xf,{})}},s={inputTokens:{label:"Input Tokens",icon:o.jsx(qd,{})},outputTokens:{label:"Output Tokens",icon:o.jsx(Xf,{})},reasoningTokens:{label:"Reasoning Tokens",icon:o.jsx(Xf,{})},cachedInputTokens:{label:"Cached Input Tokens",icon:o.jsx(Xf,{})},inputDetails:{label:"Input Details",icon:o.jsx(qd,{})},outputDetails:{label:"Output Details",icon:o.jsx(Xf,{})}},i={...{totalTokens:{label:"Total LLM Tokens",icon:o.jsx(vWe,{})}},...s,...n},l=r?["totalTokens","inputTokens","outputTokens","reasoningTokens","cachedInputTokens","inputDetails","outputDetails"]:["totalTokens","promptTokens","completionTokens"],c=Object.entries(e).filter(u=>{const d=u[1];return typeof d=="number"||k8e(d)}).map(([u,d])=>({key:u,value:d})).sort((u,d)=>l.indexOf(u.key)-l.indexOf(d.key));return o.jsx("div",{className:Z("flex gap-6 flex-wrap",t),children:c.map(({key:u,value:d})=>{const f=k8e(d);return o.jsxs("div",{className:"bg-surface3 p-3 px-4 rounded-lg text-ui-md grow",children:[o.jsxs("div",{className:Z("grid grid-cols-[1.5rem_1fr_auto] gap-2 items-center","[&>svg]:w-[1.5em] [&>svg]:h-[1.5em] [&>svg]:opacity-70"),children:[i?.[u]?.icon,o.jsx("span",{className:"text-ui-md",children:i?.[u]?.label}),!f&&o.jsx("b",{className:"text-ui-lg",children:d})]}),f&&o.jsx("div",{className:"text-ui-md mt-2 pl-8",children:Object.entries(d).map(([h,p])=>typeof p!="number"?null:o.jsxs("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 justify-between text-neutral3",children:[o.jsx("dt",{children:ETn[h]||h}),o.jsx("dd",{children:p})]},h))})]},u)})})}function pL(e,t,r){return o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-neutral2 uppercase tracking-widest [&>svg]:size-3.5",children:[t,e]}),o.jsxs("span",{children:["› Span ",o.jsxs("b",{className:"text-neutral3",children:["#",r.spanId]})]}),o.jsxs("span",{children:["› Trace ",o.jsxs("b",{className:"text-neutral3",children:["#",r.traceId]})]})]})}function jTn({span:e,onClose:t,onPrevious:r,onNext:n,spanScoresData:s,onSpanScoresPageChange:a,isLoadingSpanScoresData:i,onScoreSelect:l,scorers:c,isLoadingScorers:u,activeTab:d,onTabChange:f}){const h=e.startedAt&&e.endedAt?new Date(e.endedAt).getTime()-new Date(e.startedAt).getTime():null,p=e.attributes?.usage;return o.jsxs(Us,{children:[o.jsxs(Us.Header,{children:[o.jsxs(Us.Heading,{children:["Span ",o.jsxs("b",{children:["# ",e.spanId]})]}),o.jsxs(ws,{className:"ml-auto shrink-0",children:[o.jsx(Us.NextPrevNav,{onPrevious:r,onNext:n,previousLabel:"Previous span",nextLabel:"Next span"}),o.jsx(Us.CloseButton,{onClick:t})]})]}),o.jsx(Us.Content,{children:o.jsxs(wf,{defaultTab:"details",value:d,onValueChange:f,children:[o.jsxs(Sf,{children:[o.jsx(vs,{value:"details",children:"Details"}),o.jsxs(vs,{value:"scoring",children:["Scoring ",s?.pagination&&`(${s.pagination.total||0})`]})]}),o.jsxs(Ns,{value:"details",children:[wTn(e)&&o.jsxs(Ll,{variant:"warning",className:"mb-3",children:[o.jsx($l,{children:"Token Limit Exceeded"}),o.jsx(Iu,{as:"p",children:STn(e)})]}),p&&o.jsx(CTn,{usage:p,className:"mb-3"}),o.jsxs(ao,{numOfCol:2,children:[e.name&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Name"}),o.jsx(ao.Value,{className:"col-span-3",children:e.name})]}),e.spanType&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Type"}),o.jsx(ao.Value,{children:e.spanType})]}),e.startedAt&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Started"}),o.jsx(ao.Value,{children:or(new Date(e.startedAt),"MMM dd, HH:mm:ss.SSS")})]}),e.endedAt&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Ended"}),o.jsx(ao.Value,{children:or(new Date(e.endedAt),"MMM dd, HH:mm:ss.SSS")})]}),h!=null&&o.jsxs(o.Fragment,{children:[o.jsx(ao.Key,{children:"Duration"}),o.jsx(ao.Value,{children:h<1e3?`${h}ms`:`${(h/1e3).toFixed(2)}s`})]})]}),o.jsxs("div",{className:"grid gap-3 mt-3",children:[o.jsx(Us.CodeSection,{title:"Input",dialogTitle:pL("Input",o.jsx(wp,{}),e),icon:o.jsx(wp,{}),codeStr:JSON.stringify(e.input??null,null,2)}),o.jsx(Us.CodeSection,{title:"Output",dialogTitle:pL("Output",o.jsx(yc,{}),e),icon:o.jsx(yc,{}),codeStr:JSON.stringify(e.output??null,null,2)}),o.jsx(Us.CodeSection,{title:"Metadata",dialogTitle:pL("Metadata",o.jsx(yl,{}),e),icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.metadata??null,null,2)}),o.jsx(Us.CodeSection,{title:"Attributes",dialogTitle:pL("Attributes",o.jsx(yl,{}),e),icon:o.jsx(yl,{}),codeStr:JSON.stringify(e.attributes??null,null,2)})]})]}),o.jsx(Ns,{value:"scoring",children:o.jsxs("div",{className:"grid gap-6",children:[o.jsx(wwt,{traceId:e.traceId,isTopLevelSpan:!e.parentSpanId,spanId:e.spanId,entityType:e.attributes?.agentId||e.entityType===kh.AGENT?"Agent":e.attributes?.workflowId||e.entityType===kh.WORKFLOW_RUN?"Workflow":void 0,scorers:c,isLoadingScorers:u}),o.jsx(_Tn,{scoresData:s,onPageChange:a,isLoadingScoresData:i,onScoreSelect:l})]})})]})})]})}function TTn({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:r,isLoading:n,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:l}){const c=e?.[0]?.latency||0,u=e?.[0]?.startTime||"",d=b.useMemo(()=>{const f=g=>{const y=new Set;for(const x of g){const w=x.type?.toLowerCase().split("_")[0];if(w&&y.add(w),x.spans)for(const O of f(x.spans))y.add(O)}return y},h=f(e),p=[...h].some(g=>!g8e.includes(g)),m=g8e.filter(g=>g!=="other"&&h.has(g));return p&&m.push("other"),m},[e]);return o.jsx(o.Fragment,{children:n?o.jsxs("div",{className:Z("flex items-center text-ui-sm gap-3 bg-surface3/50 rounded-md p-3 justify-center text-neutral3","[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"),children:[o.jsx(It,{})," Loading Trace Timeline ..."]}):o.jsxs(o.Fragment,{children:[d.length>0&&o.jsx("div",{className:"flex flex-wrap gap-3 px-2 py-1.5 justify-end",children:d.map(f=>{const h=nSt(f);return o.jsxs("div",{className:"flex items-center gap-1 text-ui-sm text-neutral3",children:[o.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:h?.color}}),h?.label||f]},f)})}),o.jsx("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_auto] items-start content-start gap-y-px overflow-hidden py-1",children:e?.map(f=>o.jsx(fye,{span:f,onSpanClick:t,selectedSpanId:r,overallLatency:c,overallStartTime:u,fadedTypes:s,featuredSpanIds:l,expandedSpanIds:a,setExpandedSpanIds:i},f.id))})]})})}function NTn({traceId:e,onClose:t,onSpanSelect:r,onEvaluateTrace:n,initialSpanId:s,onPrevious:a,onNext:i,collapsed:l,onCollapsedChange:c}){const[u,d]=b.useState(!1),f=l??u,h=c??d,p=b.useRef(null),{data:m,isLoading:g}=fSt(e),[y,x]=b.useState(s??void 0);b.useEffect(()=>{if(s&&m?.spans){const I=m.spans.find(P=>P.spanId===s);if(I){x(s),r?.(I);return}}x(void 0),r?.(void 0)},[s,m?.spans]),b.useEffect(()=>{if(!y||!p.current)return;p.current.querySelector(`[data-span-id="${y}"]`)?.scrollIntoView({block:"nearest"})},[y]);const w=b.useMemo(()=>hSt(m?.spans??[]),[m?.spans]),[O,k]=b.useState([]);b.useEffect(()=>{w.length>0&&k(dye(w))},[w]);const _=b.useMemo(()=>m?.spans?.find(I=>I.parentSpanId==null),[m?.spans]),[E,T]=b.useState(!1),j=I=>{const P=y===I?void 0:I;x(P);const R=P?m?.spans?.find(B=>B.spanId===P):void 0;r?.(R)},A=ao;return o.jsxs(o.Fragment,{children:[o.jsxs(Us,{collapsed:f,children:[o.jsxs(Us.Header,{children:[o.jsxs(Us.Heading,{children:["Trace ",o.jsxs("b",{children:["# ",e]})]}),o.jsxs(ws,{className:"ml-auto shrink-0",children:[c&&o.jsx(xs,{size:"md",tooltipContent:f?"Expand panel":"Collapse panel",onClick:()=>h(!f),children:f?o.jsx(cWe,{}):o.jsx(iWe,{})}),o.jsx(Us.NextPrevNav,{onPrevious:a,onNext:i,previousLabel:"Previous trace",nextLabel:"Next trace"}),o.jsx(Us.CloseButton,{onClick:t})]})]}),!f&&(g?o.jsx(Us.LoadingData,{children:"Loading trace..."}):w.length===0?o.jsx(Us.NoData,{children:"No spans found for this trace."}):o.jsxs(Us.Content,{ref:p,children:[_&&o.jsxs(A,{className:"mb-6",numOfCol:2,children:[_.entityId&&o.jsxs(o.Fragment,{children:[o.jsx(A.Key,{children:"Entity Id"}),o.jsx(A.Value,{children:_.entityName||_.entityId})]}),_.entityType&&o.jsxs(o.Fragment,{children:[o.jsx(A.Key,{children:"Entity Type"}),o.jsx(A.Value,{children:_.entityType})]}),o.jsx(A.Key,{children:"Status"}),o.jsx(A.Value,{children:_.attributes?.status||"-"}),_.startedAt&&_.endedAt&&o.jsxs(o.Fragment,{children:[o.jsx(A.Key,{children:"Duration"}),o.jsx(A.Value,{children:`${(new Date(_.endedAt).getTime()-new Date(_.startedAt).getTime()).toLocaleString()}ms`})]}),_.startedAt&&o.jsxs(o.Fragment,{children:[o.jsx(A.Key,{children:"Started at"}),o.jsx(A.Value,{children:or(new Date(_.startedAt),"MMM dd, h:mm:ss.SSS aaa")})]}),_.endedAt&&o.jsxs(o.Fragment,{children:[o.jsx(A.Key,{children:"Ended at"}),o.jsx(A.Value,{children:or(new Date(_.endedAt),"MMM dd, h:mm:ss.SSS aaa")})]})]}),o.jsxs("div",{className:"mb-6 flex justify-between items-center gap-4",children:[n&&o.jsxs(ve,{size:"sm",onClick:n,children:[o.jsx(Ce,{children:o.jsx(m3,{})}),"Evaluate Trace"]}),o.jsxs(ve,{size:"sm",onClick:()=>T(!0),children:[o.jsx(Ce,{children:o.jsx(Qu,{})}),"Save as Dataset Item"]})]}),o.jsx(TTn,{hierarchicalSpans:w,onSpanClick:j,selectedSpanId:y,expandedSpanIds:O,setExpandedSpanIds:k})]}))]}),o.jsx(Owt,{traceDetails:_,traceId:e,isOpen:E,onClose:()=>T(!1)})]})}const _8e="auto auto auto auto minmax(5rem,1fr) auto auto";function ATn({traces:e,isLoading:t,isFetchingNextPage:r,hasNextPage:n,setEndOfListElement:s,filtersApplied:a,selectedTraceId:i,initialSpanId:l,initialSpanTab:c,initialScoreId:u,onTraceClick:d,onSpanChange:f,onSpanTabChange:h,onScoreChange:p,groupByThread:m,threadTitles:g}){const[y,x]=b.useState(i??null),[w,O]=b.useState(),[k,_]=b.useState(l??null),[E,T]=b.useState(0),[j,A]=b.useState(),[I,P]=b.useState(c??"details"),[R,B]=b.useState(!1),{data:D,isLoading:F}=_f(),{data:U,isLoading:z}=Zxt({traceId:y??void 0,spanId:k??void 0,page:E});b.useEffect(()=>{i!==void 0&&x(i??null)},[i]),b.useEffect(()=>{l!==void 0&&_(l??null)},[l]),b.useEffect(()=>{c!==void 0&&P(c)},[c]),b.useEffect(()=>{if(u&&U?.scores&&!j){const X=U.scores.find(ae=>ae.id===u);X&&A(X)}},[u,U?.scores,j]);const V=b.useCallback(()=>{O(void 0),_(null),A(void 0),P("details")},[]),W=b.useCallback(X=>{const ae=X.traceId;if(y===ae){x(null),V(),d?.("");return}x(ae),V(),d?.(ae)},[y,d,V]),L=b.useCallback(()=>{x(null),V(),d?.("")},[d,V]),Y=b.useCallback(X=>{const ae=X?.spanId??null,be=ae===k;_(ae),O(X),be||(A(void 0),P("details"),ae&&f?.(ae))},[k,f]),q=b.useCallback(()=>{_(null),O(void 0),A(void 0),P("details"),f?.(null)},[f]),M=b.useCallback(X=>{P(X),h?.(X)},[h]),Q=b.useCallback(X=>{A(X),p?.(X.id)},[p]),G=b.useCallback(()=>{A(void 0),p?.(null)},[p]),J=b.useMemo(()=>{const X=new Map;for(let ae=0;ae<e.length;ae++)X.set(e[ae].traceId,{trace:e[ae],idx:ae});return X},[e]),te=(y?J.get(y):void 0)?.idx??-1,{data:se}=fSt(y),oe=b.useMemo(()=>se?.spans??[],[se?.spans]),he=b.useCallback(()=>{const X=oe.find(ae=>ae.parentSpanId==null);X&&(_(X.spanId),O(X),P("scoring"),f?.(X.spanId),h?.("scoring"))},[oe,f,h]),K=b.useMemo(()=>dye(hSt(oe)),[oe]),re=b.useMemo(()=>{const X=new Map;for(const ae of oe)X.set(ae.spanId,ae);return X},[oe]),le=k?K.indexOf(k):-1,pe=le>0?()=>{const X=K[le-1];_(X),O(re.get(X)),f?.(X)}:void 0,ce=le>=0&&le<K.length-1?()=>{const X=K[le+1];_(X),O(re.get(X)),f?.(X)}:void 0,ue=te>0?()=>{const X=e[te-1];x(X.traceId),V(),d?.(X.traceId)}:void 0,we=te>=0&&te<e.length-1?()=>{const X=e[te+1];x(X.traceId),V(),d?.(X.traceId)}:void 0;if(t)return o.jsx(Fhe,{columns:_8e});const ke=!!y,Re=X=>X.map(ae=>{const be=ae.traceId===y,Ae=ae.startedAt??ae.createdAt,De=ae.entityName||ae.entityId||ae.attributes?.agentId||ae.attributes?.workflowId;return o.jsxs(_i.RowButton,{onClick:()=>W(ae),className:Z(be&&"bg-surface4"),children:[o.jsx(_i.IdCell,{traceId:ae.traceId}),o.jsx(_i.DateCell,{timestamp:Ae}),o.jsx(_i.TimeCell,{timestamp:Ae}),o.jsx(_i.NameCell,{name:ae.name}),o.jsx(_i.InputCell,{input:xTn(ae.input)}),o.jsx(_i.EntityCell,{entityType:ae.entityType,entityName:De}),o.jsx(_i.StatusCell,{status:ae.attributes?.status})]},ae.traceId)});return o.jsxs("div",{className:Z("grid h-full min-h-0 gap-4 items-start ",ke?"grid-cols-[1fr_1fr]":"grid-cols-[1fr]"),children:[o.jsxs(_i,{columns:_8e,className:"min-w-0",children:[o.jsxs(_i.Top,{children:[o.jsx(_i.TopCell,{children:"ID"}),o.jsx(_i.TopCell,{children:"Date"}),o.jsx(_i.TopCell,{children:"Time"}),o.jsx(_i.TopCell,{children:"Name"}),o.jsx(_i.TopCell,{children:"Input"}),o.jsx(_i.TopCell,{children:"Entity"}),o.jsx(_i.TopCell,{children:"Status"})]}),e.length===0?o.jsx(_i.NoMatch,{message:a?"No traces found for applied filters":"No traces found yet"}):m?(()=>{const{groups:X,ungrouped:ae}=bTn(e);return o.jsxs(o.Fragment,{children:[X.map(be=>o.jsxs(je.Fragment,{children:[o.jsx(_i.Subheader,{children:o.jsxs(_i.SubHeading,{className:"flex gap-2",children:[o.jsx("span",{className:"uppercase",children:"Thread"}),g?.[be.threadId]&&o.jsxs("b",{children:["'",g[be.threadId],"'"]}),o.jsxs("b",{children:["# ",be.threadId]}),o.jsxs("span",{className:"text-neutral2",children:["(",be.traces.length,")"]})]})}),Re(be.traces)]},be.threadId)),ae.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(_i.Subheader,{children:o.jsxs(_i.SubHeading,{className:"flex gap-2 uppercase",children:[o.jsx("span",{children:"No thread"}),o.jsxs("span",{className:"text-neutral2",children:["(",ae.length,")"]})]})}),Re(ae)]})]})})():Re(e),e.length>0&&o.jsx(_i.NextPageLoading,{isLoading:r,hasMore:n,setEndOfListElement:s})]}),y&&o.jsxs("div",{className:Z("grid gap-4 h-full overflow-auto",j?R?"grid-rows-[auto_3fr_3fr]":"grid-rows-[2fr_3fr_3fr]":w?R?"grid-rows-[auto_3fr]":"grid-rows-[2fr_3fr]":R?"grid-rows-[auto]":"grid-rows-[1fr]"),children:[o.jsx(NTn,{traceId:y,onClose:L,onSpanSelect:Y,onEvaluateTrace:he,initialSpanId:k,onPrevious:ue,onNext:we,collapsed:R,onCollapsedChange:B}),w&&o.jsx(jTn,{span:w,onClose:q,onPrevious:pe,onNext:ce,scorers:D,isLoadingScorers:F,spanScoresData:U,isLoadingSpanScoresData:z,onSpanScoresPageChange:T,onScoreSelect:Q,activeTab:I,onTabChange:M}),j&&o.jsx(kTn,{score:j,onClose:G})]})]})}const pSt=["environment","serviceName","source","scope","userId","organizationId","resourceId","runId","sessionId","threadId","requestId","experimentId","spanType","entityName","parentEntityType","parentEntityId","parentEntityName","rootEntityType","rootEntityId","rootEntityName"],ITn={environment:{label:"Environment",group:"Deployment"},serviceName:{label:"Service Name",group:"Deployment"},source:{label:"Source",group:"Deployment"},scope:{label:"Scope",group:"Deployment"},userId:{label:"User ID",group:"Identity"},organizationId:{label:"Organization ID",group:"Identity"},resourceId:{label:"Resource ID",group:"Identity"},runId:{label:"Run ID",group:"Correlation"},sessionId:{label:"Session ID",group:"Correlation"},threadId:{label:"Thread ID",group:"Correlation"},requestId:{label:"Request ID",group:"Correlation"},experimentId:{label:"Experiment ID",group:"Experimentation"},spanType:{label:"Span Type",group:"Span"},entityName:{label:"Entity Name",group:"Entity"},parentEntityType:{label:"Parent Entity Type",group:"Entity"},parentEntityId:{label:"Parent Entity ID",group:"Entity"},parentEntityName:{label:"Parent Entity Name",group:"Entity"},rootEntityType:{label:"Root Entity Type",group:"Entity"},rootEntityId:{label:"Root Entity ID",group:"Entity"},rootEntityName:{label:"Root Entity Name",group:"Entity"}};function RTn({onEntityChange:e,onReset:t,selectedEntity:r,entityOptions:n,onDateChange:s,selectedDateFrom:a,selectedDateTo:i,isLoading:l,groupByThread:c,onGroupByThreadChange:u,searchQuery:d,onSearchChange:f,datePreset:h="all",onDatePresetChange:p,selectedTags:m,availableTags:g,onTagsChange:y,errorOnly:x,onErrorOnlyChange:w,selectedMetadata:O,availableMetadata:k,onMetadataChange:_,contextFilters:E,availableContextValues:T,onContextFiltersChange:j}){const A=b.useMemo(()=>{const B=[];if(w&&B.push({id:"status",label:"Status",values:[{value:"error",label:"Error only"}],mode:"multi"}),n&&B.push({id:"entity-type",label:"Entity Type",values:n.map(D=>({value:D.value,label:D.label})),mode:"single"}),y&&(g??[]).length>0&&B.push({id:"tags",label:"Tags",values:(g??[]).map(D=>({value:D,label:D})),mode:"multi"}),_)for(const D of Object.keys(k??{}).sort()){const F=k?.[D]??[];F.length!==0&&B.push({id:`meta:${D}`,label:D,group:"Metadata",values:F.map(U=>({value:U,label:U})),mode:"single"})}if(j)for(const D of pSt){const F=ITn[D];if(!F)continue;const U=T?.[D]??[];U.length!==0&&B.push({id:`ctx:${D}`,label:F.label,group:F.group,values:U.map(z=>({value:z,label:z})),mode:"single"})}return B},[w,n,y,g,_,k,j,T]),I=b.useMemo(()=>{const B={};if(x&&(B.status=["error"]),r&&r.value!=="all"&&(B["entity-type"]=[r.value]),(m??[]).length>0&&(B.tags=m??[]),O)for(const[D,F]of Object.entries(O))B[`meta:${D}`]=[F];if(E)for(const[D,F]of Object.entries(E))F.trim()&&(B[`ctx:${D}`]=[F]);return B},[x,r,m,O,E]),P=b.useCallback(B=>{const F=(B.status??[]).includes("error");F!==!!x&&w?.(F);const U=(B["entity-type"]??[])[0],z=r?.value??"all";if((U??"all")!==z){const Y=n?.find(q=>q.value===(U??"all"));if(Y)e(Y);else if(!U){const q=n?.find(M=>M.value==="all");q&&e(q)}}const V=B.tags??[];JSON.stringify(V)!==JSON.stringify(m??[])&&y?.(V);const W={};for(const[Y,q]of Object.entries(B))Y.startsWith("meta:")&&q.length>0&&(W[Y.slice(5)]=q[0]);JSON.stringify(W)!==JSON.stringify(O??{})&&_?.(W);const L={};for(const[Y,q]of Object.entries(B))Y.startsWith("ctx:")&&q.length>0&&(L[Y.slice(4)]=q[0]);JSON.stringify(L)!==JSON.stringify(E??{})&&j?.(L)},[x,w,r,n,e,m,y,O,_,E,j]),R=b.useMemo(()=>Object.values(I).some(B=>B.length>0),[I]);return o.jsx("div",{className:Z("grid gap-3"),children:o.jsxs("div",{className:Z("flex items-center gap-3"),children:[f&&o.jsx(Ah,{onSearch:f,size:"md",label:"Search traces",placeholder:"Search name, ID, content..."}),o.jsx(YDr,{preset:h,onPresetChange:p,dateFrom:a,dateTo:i,onDateChange:s,disabled:l}),o.jsx(jct,{categories:A,value:I,onChange:P,align:"end",disabled:l}),u&&o.jsxs("label",{className:Z("flex gap-2 items-center shrink-0 cursor-pointer"),children:[o.jsx(Yl,{checked:c,onCheckedChange:u,disabled:l}),o.jsx("span",{className:Z("text-ui-md text-neutral3"),children:"Group by thread"})]}),t&&(R||h!=="last-24h"||!!d)&&o.jsxs(ve,{disabled:l,size:"md",className:"ml-auto",onClick:()=>t(),children:[o.jsx(vn,{}),"Reset"]})]})})}function PTn(){const[e,t]=vo(),[r,n]=b.useState({value:"all",label:"All",type:"all"}),[s,a]=b.useState(()=>new Date(Date.now()-1440*60*1e3)),[i,l]=b.useState(void 0),[c,u]=b.useState(!1),[d,f]=b.useState(""),[h,p]=b.useState([]),[m,g]=b.useState(!1),[y,x]=b.useState({}),[w,O]=b.useState("last-24h"),[k,_]=b.useState({}),{data:E={},isLoading:T}=Bp(),{data:j,isLoading:A}=Cv(),{data:I=[]}=hTn(),{data:P=[]}=dTn(),{data:R=[]}=fTn(),B=e.get("traceId")||void 0,D=e.get("spanId")||void 0,F=e.get("tab"),U=F==="scoring"?"scoring":F==="details"?"details":void 0,z=e.get("scoreId")||void 0,V=b.useCallback(He=>{const Xe={},St=e.get("entity");St&&(Xe.entity=St),He&&(Xe.traceId=He),t(Xe)},[e,t]),W=b.useCallback(He=>{const Xe=e.get("spanId")||null;if(He===Xe)return;const St={},ze=e.get("entity");ze&&(St.entity=ze);const Be=e.get("traceId");Be&&(St.traceId=Be),He&&(St.spanId=He),t(St,{replace:!0})},[e,t]),L=b.useCallback(()=>{const He={},Xe=e.get("entity");Xe&&(He.entity=Xe);const St=e.get("traceId");St&&(He.traceId=St);const ze=e.get("spanId");ze&&(He.spanId=ze);const Be=e.get("tab");Be&&(He.tab=Be);const Te=e.get("scoreId");return Te&&(He.scoreId=Te),He},[e]),Y=b.useCallback(He=>{const Xe=e.get("tab")||null;if(He===Xe)return;const St=L();He&&He!=="details"?St.tab=He:delete St.tab,delete St.scoreId,t(St,{replace:!0})},[e,t,L]),q=b.useCallback(He=>{const Xe=e.get("scoreId")||null;if(He===Xe)return;const St=L();He?St.scoreId=He:delete St.scoreId,t(St,{replace:!0})},[e,t,L]),M=b.useMemo(()=>{if(Object.keys(y).length!==0)return y},[y]),{data:Q,isLoading:G,isFetchingNextPage:J,hasNextPage:ie,setEndOfListElement:te,error:se,isError:oe}=vTn({filters:{...r?.type!=="all"&&{entityId:r?.value,entityType:r?.type},...s&&{startedAt:{start:s}},...i&&{endedAt:{end:i}},...h.length>0&&{tags:h},...m&&{status:"error"},...M&&{metadata:M},...Object.fromEntries(Object.entries(k).filter(([,He])=>He.trim()))}}),he=b.useMemo(()=>Q?.spans??[],[Q?.spans]),K=Q?.threadTitles??{},re=b.useDeferredValue(d),le=b.useMemo(()=>{if(!re.trim())return he;const He=re.trim().toLowerCase();return he.filter(Xe=>{if(Xe.traceId?.toLowerCase().includes(He)||Xe.name?.toLowerCase().includes(He)||Xe.entityId?.toLowerCase().includes(He)||Xe.entityName?.toLowerCase().includes(He)||Xe.input!=null&&(typeof Xe.input=="string"?Xe.input:JSON.stringify(Xe.input)).toLowerCase().includes(He))return!0;const St=Xe.metadata;if(St&&typeof St=="object"){for(const ze of Object.values(St))if(String(ze).toLowerCase().includes(He))return!0}return!1})},[he,re]),pe=b.useRef({}),ce=b.useRef({}),ue=b.useMemo(()=>{let He=!1;const Xe=pe.current;for(const ze of he){const Be=ze.metadata;if(Be&&typeof Be=="object")for(const[Te,$e]of Object.entries(Be)){if($e==null)continue;Xe[Te]||(Xe[Te]=new Set,He=!0);const Ie=String($e);Xe[Te].has(Ie)||(Xe[Te].add(Ie),He=!0)}}if(!He)return ce.current;const St=Object.fromEntries(Object.entries(Xe).map(([ze,Be])=>[ze,[...Be].sort()]));return ce.current=St,St},[he]),we=b.useRef({}),ke=b.useRef({}),Re=b.useMemo(()=>{let He=!1;const Xe=we.current;for(const ze of he)for(const Be of pSt){const Te=ze[Be];Te!=null&&typeof Te=="string"&&Te.trim()&&(Xe[Be]||(Xe[Be]=new Set,He=!0),Xe[Be].has(Te)||(Xe[Be].add(Te),He=!0))}for(const ze of P)Xe.environment||(Xe.environment=new Set,He=!0),Xe.environment.has(ze)||(Xe.environment.add(ze),He=!0);for(const ze of R)Xe.serviceName||(Xe.serviceName=new Set,He=!0),Xe.serviceName.has(ze)||(Xe.serviceName.add(ze),He=!0);if(!He)return ke.current;const St=Object.fromEntries(Object.entries(Xe).map(([ze,Be])=>[ze,[...Be].sort()]));return ke.current=St,St},[he,P,R]),X=b.useMemo(()=>(Object.entries(E)||[]).map(([He,Xe])=>({value:Xe.id,label:Xe.name,type:kh.AGENT})),[E]),ae=b.useMemo(()=>(Object.entries(j||{})||[]).map(([,He])=>({value:He.name,label:He.name,type:kh.WORKFLOW_RUN})),[j]),be=b.useMemo(()=>[{value:"all",label:"All",type:"all"},...X,...ae],[X,ae]),Ae=e.get("entity"),De=be.find(He=>He.value===Ae);De&&De.value!==r?.value&&n(De);const ye=()=>{t({entity:"all"},{replace:!0}),a(new Date(Date.now()-1440*60*1e3)),l(void 0),u(!1),f(""),p([]),g(!1),x({}),O("last-24h"),_({}),pe.current={},ce.current={},we.current={},ke.current={}},_e=(He,Xe)=>{if(Xe==="from")return a(He);l(He)},ge=He=>{He?.value&&t({entity:He.value})},Ee=oe?s2r(se):void 0;if(se&&As(se))return o.jsx(Vr,{title:"Traces",icon:o.jsx(Wi,{}),children:o.jsx(na,{})});if(se&&Os(se))return o.jsx(Vr,{title:"Traces",icon:o.jsx(Wi,{}),children:o.jsx(Zs,{resource:"traces"})});if(se)return o.jsx(Vr,{title:"Traces",icon:o.jsx(Wi,{}),children:o.jsx(sd,{title:"Failed to load traces",message:Ee?.error??"Unknown error"})});const Fe=r?.value!=="all"||w!=="last-24h"||i||d.trim()||h.length>0||m||Object.keys(y).length>0||Object.values(k).some(He=>He.trim());return o.jsxs(Ft,{width:"wide",height:"full",children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:G,children:[o.jsx(Wi,{})," Traces"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Traces documentation",tooltipContent:"Go to Traces documentation",children:o.jsx(Io,{})})})]}),o.jsx(RTn,{onEntityChange:ge,onReset:ye,selectedEntity:r,entityOptions:be,onDateChange:_e,selectedDateFrom:s,selectedDateTo:i,isLoading:G||T||A,groupByThread:c,onGroupByThreadChange:u,searchQuery:d,onSearchChange:f,selectedTags:h,availableTags:I,onTagsChange:p,errorOnly:m,onErrorOnlyChange:g,selectedMetadata:y,availableMetadata:ue,onMetadataChange:x,datePreset:w,onDatePresetChange:O,contextFilters:k,availableContextValues:Re,onContextFiltersChange:_})]}),o.jsx(ATn,{traces:le,isLoading:G,isFetchingNextPage:J,hasNextPage:ie,setEndOfListElement:te,filtersApplied:!!Fe,selectedTraceId:B,initialSpanId:D,initialSpanTab:U,initialScoreId:z,onTraceClick:V,onSpanChange:W,onSpanTabChange:Y,onScoreChange:q,groupByThread:c,threadTitles:K})]})}function MTn(){const{data:e,isLoading:t,error:r}=Cv(),[n,s]=b.useState("");return r&&As(r)?o.jsx(Vr,{title:"Workflows",icon:o.jsx(Ii,{}),children:o.jsx(na,{})}):r&&Os(r)?o.jsx(Vr,{title:"Workflows",icon:o.jsx(Ii,{}),children:o.jsx(Zs,{resource:"workflows"})}):r?o.jsx(Vr,{title:"Workflows",icon:o.jsx(Ii,{}),children:o.jsx(sd,{title:"Failed to load workflows",message:r.message})}):Object.keys(e||{}).length===0&&!t?o.jsx(Vr,{title:"Workflows",icon:o.jsx(Ii,{}),children:o.jsx(jcn,{})}):o.jsxs(Ft,{children:[o.jsxs(Ft.TopArea,{children:[o.jsxs(Ft.Row,{children:[o.jsx(Ft.Column,{children:o.jsx(Cn,{children:o.jsxs(Cn.Title,{isLoading:t,children:[o.jsx(Ii,{})," Workflows"]})})}),o.jsx(Ft.Column,{className:"flex justify-end gap-2",children:o.jsx(xs,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:o.jsx(Io,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(Ah,{onSearch:s,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),o.jsx(Ccn,{workflows:e||{},isLoading:t,search:n})]})}const E8e=()=>{const{workflowId:e}=ba(),{data:t,isLoading:r,error:n}=mP(e);return n&&As(n)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(na,{})}):n&&Os(n)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Zs,{resource:"workflows"})}):o.jsx(Gbt,{workflowId:e,workflow:t??void 0,isLoading:r})};function DTn(e){if(!e)return null;switch(e.icon||e.provider){case"aws-s3":case"s3":return o.jsx(ult,{className:"h-4 w-4 text-[#FF9900]"});case"google-cloud":case"google-cloud-storage":case"gcs":return o.jsx(clt,{className:"h-4 w-4"});case"azure-blob":case"azure":return o.jsx(dlt,{className:"h-4 w-4 text-[#0078D4]"});case"cloudflare":case"cloudflare-r2":case"r2":return o.jsx(dU,{className:"h-4 w-4 text-[#F38020]"});case"minio":return o.jsx(Kre,{className:"h-4 w-4 text-red-400"});case"database":return o.jsx(Ca,{className:"h-4 w-4 text-emerald-400"});case"local":case"folder":return o.jsx(sc,{className:"h-4 w-4 text-amber-400"});case"hard-drive":return o.jsx(Kre,{className:"h-4 w-4 text-slate-400"});case"cloud":return o.jsx(dU,{className:"h-4 w-4 text-sky-400"});default:return o.jsx(dU,{className:"h-4 w-4 text-neutral4"})}}function mSt(e,t=!1){const{name:r,type:n,mount:s}=e;if(n==="directory")return s?DTn(s):t?o.jsx(pE,{className:"h-4 w-4 text-amber-400"}):o.jsx(sc,{className:"h-4 w-4 text-amber-400"});switch(r.split(".").pop()?.toLowerCase()){case"ts":case"tsx":case"js":case"jsx":return o.jsx(wx,{className:"h-4 w-4 text-blue-400"});case"json":return o.jsx(fR,{className:"h-4 w-4 text-yellow-400"});case"md":case"mdx":return o.jsx(Qi,{className:"h-4 w-4 text-neutral4"});case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return o.jsx(pce,{className:"h-4 w-4 text-purple-400"});default:return o.jsx(fce,{className:"h-4 w-4 text-neutral4"})}}function gSt(e){if(e==null||Number.isNaN(e))return"";if(e<0)return"-"+gSt(-e);if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB","TB"],n=Math.min(Math.floor(Math.log(e)/Math.log(t)),r.length-1);return parseFloat((e/Math.pow(t,n)).toFixed(1))+" "+r[n]}function LTn(e){if("body"in e&&e.body&&typeof e.body=="object"){const n=e.body;if(typeof n.error=="string")return n.error;if(typeof n.message=="string")return n.message}const t=e.message,r=t.lastIndexOf(" - {");if(r!==-1)try{const n=t.slice(r+3),s=JSON.parse(n);if(s.error)return s.error;if(s.message)return s.message}catch{}return t.includes("status: 404")?"Directory not found":t}function ySt(e){return e==="."||e===""}function $Tn({path:e,onNavigate:t}){const n=ySt(e)?[]:e.split("/").filter(Boolean);return o.jsxs("div",{className:"flex items-center gap-1 text-sm overflow-x-auto",children:[o.jsx("button",{onClick:()=>t("."),className:"p-1 rounded hover:bg-surface4 text-neutral5 hover:text-neutral6 transition-colors","aria-label":"Workspace root",children:o.jsx(pE,{className:"h-4 w-4"})}),n.map((s,a)=>{const i=n.slice(0,a+1).join("/");return o.jsxs("div",{className:"flex items-center",children:[o.jsx(Vs,{className:"h-4 w-4 text-neutral3"}),o.jsx("button",{onClick:()=>t(i),className:"px-2 py-1 rounded hover:bg-surface4 text-neutral5 hover:text-neutral6 transition-colors truncate max-w-[150px]",title:s,children:s})]},i)})]})}function FTn({entries:e,currentPath:t,isLoading:r,error:n,onNavigate:s,onFileSelect:a,onRefresh:i,onUpload:l,onCreateDirectory:c,onDelete:u,isCreatingDirectory:d,isDeleting:f}){const[h,p]=b.useState(null),m=[...e].sort((w,O)=>w.type==="directory"&&O.type!=="directory"?-1:w.type!=="directory"&&O.type==="directory"?1:w.name.localeCompare(O.name)),g=ySt(t),y=w=>{const O=g?w.name:`${t}/${w.name}`;w.type==="directory"?s(O):a?.(O)},x=w=>{const O=g?w.name:`${t}/${w.name}`;p(O)};return o.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[o.jsx($Tn,{path:t,onNavigate:s}),o.jsxs("div",{className:"flex items-center gap-1",children:[i&&o.jsx(ve,{variant:"ghost",size:"md",onClick:i,disabled:r,"aria-label":"Refresh files",children:o.jsx(hR,{className:`h-4 w-4 ${r?"animate-spin":""}`})}),c&&o.jsx(ve,{variant:"ghost",size:"md",disabled:d,"aria-label":"Create directory",onClick:()=>{const w=prompt("Directory name:");if(w){const O=g?w:`${t}/${w}`;c(O)}},children:d?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):o.jsx(Q6,{className:"h-4 w-4"})}),l&&o.jsx(ve,{variant:"ghost",size:"md",onClick:l,"aria-label":"Upload files",children:o.jsx(Y6,{className:"h-4 w-4"})})]})]}),o.jsx("div",{className:"max-h-[400px] overflow-auto",children:r?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(Ta,{className:"h-6 w-6 animate-spin text-neutral3"})}):n?o.jsxs("div",{className:"py-12 px-4 text-center",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-red-500/10 mb-4",children:o.jsx(XN,{className:"h-6 w-6 text-red-400"})}),o.jsx("p",{className:"text-sm text-neutral6 font-medium mb-1",children:"Failed to load directory"}),o.jsx("p",{className:"text-xs text-neutral4 max-w-sm mx-auto",children:LTn(n)})]}):m.length===0?o.jsx("div",{className:"py-12 text-center text-neutral4 text-sm",children:g?"Workspace is empty":"Directory is empty"}):o.jsx(nd,{children:o.jsxs("ul",{children:[!g&&o.jsx("li",{children:o.jsxs("button",{onClick:()=>{const w=t.split("/").slice(0,-1).join("/")||".";s(w)},className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-surface4 transition-colors text-left",children:[o.jsx(pE,{className:"h-4 w-4 text-amber-400"}),o.jsx("span",{className:"text-sm text-neutral5",children:".."})]})}),m.map(w=>{const O=w.mount?.displayName||w.mount?.provider,k=w.mount?.status==="error";return o.jsx("li",{className:"group",children:o.jsxs("div",{className:"flex items-center hover:bg-surface4 transition-colors",children:[o.jsxs("button",{onClick:()=>y(w),className:"flex-1 flex items-center gap-3 px-4 py-2 text-left",children:[mSt(w),o.jsx("span",{className:"text-sm text-neutral6 flex-1 truncate",children:w.name}),w.mount&&k&&o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{tabIndex:0,className:"flex items-center",children:o.jsx(XN,{className:"h-4 w-4 text-red-400"})})}),o.jsxs(Wr,{className:"max-w-xs",children:[o.jsx("span",{className:"text-red-400",children:"Error:"})," ",w.mount.error||"Failed to connect to this filesystem"]})]}),w.mount&&O&&(w.mount.description?o.jsxs(Yr,{children:[o.jsx(Xr,{asChild:!0,children:o.jsx("span",{tabIndex:0,className:`text-xs px-1.5 py-0.5 rounded ${k?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:O})}),o.jsx(Wr,{children:w.mount.description})]}):o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${k?"text-red-400 bg-red-400/10":"text-neutral3 bg-surface4"}`,children:O})),w.type==="file"&&w.size!==void 0&&o.jsx("span",{className:"text-xs text-neutral3 tabular-nums",children:gSt(w.size)})]}),u&&!w.mount&&o.jsx("button",{onClick:()=>x(w),"aria-label":`Delete ${w.name}`,className:"p-2 opacity-0 group-hover:opacity-100 hover:text-red-400 text-neutral3 transition-all",children:o.jsx(Ku,{className:"h-3.5 w-3.5"})})]})},w.name)})]})})}),o.jsx($t,{open:!!h,onOpenChange:w=>!f&&!w&&p(null),children:o.jsxs($t.Content,{children:[o.jsxs($t.Header,{children:[o.jsx($t.Title,{children:"Delete Item"}),o.jsxs($t.Description,{children:['Are you sure you want to delete "',h,'"? This action cannot be undone.']})]}),o.jsxs($t.Footer,{children:[o.jsx($t.Cancel,{disabled:f,children:"Cancel"}),o.jsxs($t.Action,{disabled:f,onClick:async()=>{try{h&&u&&await u(h)}finally{p(null)}},children:[f?o.jsx(Ta,{className:"h-4 w-4 animate-spin mr-2"}):null,"Delete"]})]})]})})]})}function zTn(e){return e&&{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",md:"markdown",mdx:"mdx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",css:"css",scss:"scss",less:"less",html:"html",xml:"xml",yaml:"yaml",yml:"yaml",toml:"toml",sh:"bash",bash:"bash",zsh:"bash",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",makefile:"makefile",vue:"vue",svelte:"svelte"}[e.toLowerCase()]||null}function BTn({content:e,language:t}){return o.jsx(Sge,{language:t,style:Oge.coldarkDark,customStyle:{margin:0,padding:"1rem",backgroundColor:"transparent",fontSize:"0.875rem"},codeTagProps:{style:{fontFamily:"var(--geist-mono), ui-monospace, monospace"}},children:e})}function UTn({path:e,content:t,isLoading:r,mimeType:n,onClose:s}){const a=e.split("/").pop()||e,i=a.split(".").pop()?.toLowerCase(),l=n?.startsWith("image/")||["png","jpg","jpeg","gif","svg","webp"].includes(i||""),c=zTn(i);return o.jsxs("div",{className:"rounded-lg border border-border1 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-surface3 border-b border-border1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[mSt({name:a,type:"file"}),o.jsx("span",{className:"text-sm font-medium text-neutral6",children:a})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ya,{content:t,copyMessage:"Copied file content"}),s&&o.jsx(ve,{variant:"ghost",size:"md",onClick:s,children:"Close"})]})]}),o.jsx("div",{className:"max-h-[500px] overflow-auto h-full",style:{backgroundColor:"black"},children:r?o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(Ta,{className:"h-6 w-6 animate-spin text-neutral3"})}):l?o.jsx("div",{className:"p-4 flex items-center justify-center",children:o.jsx("img",{src:`data:${n||"image/png"};base64,${btoa(t)}`,alt:a,className:"max-w-full max-h-[400px] object-contain"})}):c?o.jsx(BTn,{content:t,language:c}):o.jsx("pre",{className:"p-4 text-sm text-neutral5 whitespace-pre-wrap font-mono overflow-x-auto",children:t})})]})}const VTn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(gf,{}),titleSlot:"No Workspaces yet",descriptionSlot:o.jsxs(o.Fragment,{children:["Add a workspace to your Mastra configuration to ",o.jsx("br",{}),"manage files, skills, and enable semantic search."]}),actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(Aa,{})]})})}),qTn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(NBt,{}),titleSlot:"Workspace Not Configured",descriptionSlot:o.jsxs(o.Fragment,{children:["No workspace is configured. Add a workspace to your ",o.jsx("br",{}),"Mastra configuration to manage files, skills, and enable semantic search."]}),actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(Aa,{})]})})}),HTn=()=>o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(li,{iconSlot:o.jsx(XN,{}),titleSlot:"Workspace Not Supported",descriptionSlot:o.jsxs(o.Fragment,{children:["The workspace feature requires a newer version of ",o.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),".",o.jsx("br",{}),"Please upgrade your dependencies to enable workspace functionality."]}),actionSlot:o.jsxs(ve,{variant:"ghost",as:"a",href:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",rel:"noopener noreferrer",children:["Workspaces Documentation ",o.jsx(Aa,{})]})})}),ste={bm25:{label:"Keyword",icon:o.jsx(Qi,{className:"h-3.5 w-3.5"}),color:"bg-blue-500/10 text-blue-400 border-blue-500/30"},vector:{label:"Semantic",icon:o.jsx(a_,{className:"h-3.5 w-3.5"}),color:"bg-purple-500/10 text-purple-400 border-purple-500/30"},hybrid:{label:"Hybrid",icon:o.jsx(gVt,{className:"h-3.5 w-3.5"}),color:"bg-amber-500/10 text-amber-400 border-amber-500/30"}};function QTn({onSearch:e,isSearching:t,searchResults:r,canBM25:n,canVector:s,onViewResult:a}){const[i,l]=b.useState(""),[c,u]=b.useState(5),d=()=>n&&s?"hybrid":n?"bm25":s?"vector":"bm25",[f,h]=b.useState(d()),p=g=>{g.preventDefault(),i.trim()&&e({query:i.trim(),topK:c,mode:f})},m=[...n?["bm25"]:[],...s?["vector"]:[],...n&&s?["hybrid"]:[]];return o.jsxs("div",{className:"rounded-lg bg-surface4",children:[o.jsxs("form",{onSubmit:p,className:"p-4",children:[o.jsxs("div",{className:"flex gap-3 items-center",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(gE,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral3"}),o.jsx(cr,{value:i,onChange:g=>l(g.target.value),placeholder:"Search workspace files...",className:"pl-9 h-10 bg-surface2 border-border1"})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-xs text-neutral4",children:"Top"}),o.jsx(cr,{type:"number",min:1,max:50,value:c,onChange:g=>u(parseInt(g.target.value)||5),className:"w-14 h-10 text-center bg-surface2 border-border1",title:"Number of results"})]}),o.jsx(ve,{type:"submit",disabled:t||!i.trim(),size:"lg",className:"h-10 px-4",children:t?o.jsx(Ta,{className:"h-4 w-4 animate-spin"}):"Search"})]}),m.length>0&&o.jsx("div",{className:"flex gap-2 mt-3",children:m.map(g=>{const y=ste[g],x=f===g;return o.jsxs("button",{type:"button",onClick:()=>h(g),className:`
552
552
  inline-flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium border transition-colors